var R=Object.defineProperty;var D=(t,e,r)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var y=(t,e,r)=>(D(t,typeof e!="symbol"?e+"":e,r),r);import{C as V}from"./Collapsable-bb9a395e.js";import{d as p,t as O,G as h,o,n as u,w as A,j as L,bg as j,bh as I,aN as B,E as F,A as w,e as f,c,F as b,l as g,a as m,_ as S,b as $,N as M,V as x,f as U}from"./index-207e8178.js";import{_ as G}from"./AccreditationChip.vue_vue_type_script_setup_true_lang-c587f4c7.js";import{u as K,m as H}from"./checkTypingFunction-087f80ba.js";import{I as Q}from"./InfoToggle-34b6c15c.js";const T=t=>typeof t=="object"&&t!==null&&"titel"in t&&"uri"in t?!0:Array.isArray(t)&&t.length>0?t.every(e=>T(e)):!1,q=t=>{if(typeof t=="string"||Array.isArray(t)&&t.every(e=>typeof e=="string"))return t};class z{constructor(e,r){y(this,"processedAttributes");y(this,"config");y(this,"attributeRawData");this.processedAttributes=[],this.attributeRawData=e,this.config=r}getProcessedAttributes(){return this.processedAttributes}setConfig(e){this.config=e}setProcessedAttributes(e){this.processedAttributes=e}setRawAttributes(e){this.attributeRawData=e}processAttributes(){this.getAttributesThatAreInTheConfig(),this.sortAttributesByOrder()}getAttributesSplitByColumn(e){return e.map(r=>this.filterSetByColumn(r))}objectToArray(e){return Object.entries(e).map(([r,n])=>({key:r,value:n}))}decorateAttributeValue(e,r){const n=r.decoratorFunction;if(!n)return e;const s=n({value:e,attributes:this.attributeRawData});return s||(Array.isArray(e)?e.map(a=>n({value:a,attributes:this.attributeRawData})):n({value:e,attributes:this.attributeRawData}))}getLinkValue(e,r){return Array.isArray(e)?e.map(n=>({url:n.uri,title:n.titel,isExternal:r})):[{url:e.uri,title:e.titel,isExternal:r}]}processAttribute(e,r){const{key:n,value:s}=e;if(T(s))return{name:n,value:this.getLinkValue(s,r.content.linkIsExternal)};const i=this.decorateAttributeValue(s,r.content);if(i===void 0)return;const l=q(i);if(l!==void 0&&this.passesValidationFunctions(l,r))return{name:n,value:l}}createListOfOnlyValidAttributesWithMatchingConfig(e){const r=e.reduce((n,s)=>{if(!s.value||Array.isArray(s.value)&&s.value.every(i=>!i))return n;const a=this.config.filter(i=>i.name===s.key);return a&&a.forEach(i=>{const l=this.processAttribute(s,i);l&&n.push({attribute:l,attachedConfig:i})}),n},[]);this.setProcessedAttributes(r)}getAttributesThatAreInTheConfig(){const r=this.objectToArray(this.attributeRawData).filter(n=>this.config.some(s=>s.name===n.key));this.createListOfOnlyValidAttributesWithMatchingConfig(r)}filterSetByColumn(e){return this.processedAttributes.filter(r=>r.attachedConfig.config.column===e)}getConfigForAttribute(e){return this.config.find(r=>r.name===e)}passesValidationFunctions(e,r){return r.config.validationFunctions?r.config.validationFunctions.every(n=>n({attributeValue:e,attributeConfig:r,attributes:this.attributeRawData})):!0}attributeIsOnVisibleState(e,r){const n=this.getConfigForAttribute(e);return n?n.config.visibleOnState.includes(r):!1}sortAttributesByOrder(){this.setProcessedAttributes([...this.processedAttributes].sort((e,r)=>{const n=e.attachedConfig,s=r.attachedConfig;return!n||!s?0:n.config.order-s.config.order}))}}var v=(t=>(t.Text="text",t.Link="link",t.Chip="chip",t))(v||{}),k=(t=>(t.Left="left",t.Right="right",t))(k||{}),C=(t=>(t.Collapsed="collapsed",t.Expanded="expanded",t))(C||{});const X=p({__name:"TextAttribute",props:{content:{}},setup(t){return(e,r)=>O(e.content)}}),J=p({__name:"LinkAttribute",props:{content:{}},setup(t){const e=t,r=h(()=>e.content.isExternal?F:"a"),n=h(()=>({...e.content.isExternal?{externalLink:e.content.url,linkText:e.content.title}:{href:e.content.url}}));return(s,a)=>(o(),u(B(r.value),j(I(n.value)),{default:A(()=>[L(O(s.content),1)]),_:1},16))}}),W=p({__name:"ChipAttribute",props:{content:{}},setup(t){const e=t,r=h(()=>typeof e.content=="string"&&e.content in K),n=h(()=>r.value?e.content:null);return(s,a)=>r.value&&n.value?(o(),u(G,{accreditation:n.value,key:n.value,"label-id":`keurmerk-${n.value}`},null,8,["accreditation","label-id"])):w("",!0)}}),_=p({__name:"AttributeVariantRenderer",props:{content:{},type:{}},setup(t){const e=t,r=e.content,n=e.content;return(s,a)=>s.type===f(v).Link?(o(),u(J,{key:0,content:f(r)},null,8,["content"])):s.type===f(v).Chip?(o(),u(W,{key:1,content:f(n)},null,8,["content"])):(o(),u(X,{key:2,content:f(n)},null,8,["content"]))}}),Y={key:0,class:"attribute-list"},Z={key:1,class:"attribute-multi-values"},tt={key:2,class:"attribute-single-value"},et=p({__name:"AttributeValue",props:{value:{},type:{},needsList:{type:Boolean}},setup(t){const e=r=>`item-${r&&typeof r=="object"&&"url"in r?r.url:r}`;return(r,n)=>r.needsList?(o(),c("ul",Y,[(o(!0),c(b,null,g(r.value,s=>(o(),c("li",{key:e(s),class:"attribute-item"},[m(_,{content:s,type:r.type},null,8,["content","type"])]))),128))])):Array.isArray(r.value)?(o(),c("div",Z,[(o(!0),c(b,null,g(r.value,s=>(o(),c("div",{class:"attribute-item",key:e(s)},[m(_,{content:s,type:r.type},null,8,["content","type"])]))),128))])):(o(),c("div",tt,[(o(),u(_,{content:r.value,type:r.type,key:e(r.value)},null,8,["content","type"]))]))}});const rt=S(et,[["__scopeId","data-v-3fc1c25f"]]),nt=["cy-data-attributes"],st={class:"title"},ot={key:1,"aria-live":"polite"},it=p({__name:"AttributeRenderer",props:{attribute:{},tooltip:{},attributeTitle:{},type:{},isList:{type:Boolean}},setup(t){const e=t,r={type:e.type,needsList:e.isList};return(n,s)=>(o(),c("div",{class:"attribute","cy-data-attributes":n.attribute.name},[$("h3",st,[L(O(n.attributeTitle)+" ",1),n.tooltip?(o(),u(Q,{key:0,tooltipText:n.tooltip.text},null,8,["tooltipText"])):w("",!0)]),n.attribute.value?(o(),u(rt,M({key:0,value:n.attribute.value},r,{class:"value"}),null,16,["value"])):(o(),c("p",ot,"Geen waarde bekend"))],8,nt))}});const at=S(it,[["__scopeId","data-v-f6713f77"]]),vt=p({__name:"AttributesColumns",props:{rawAttributes:{type:Object,required:!0},isOpen:{type:Boolean,default:!1},cardIndex:{type:Number,default:0},attributeConfig:{type:Object,required:!0},singleColumn:{type:Boolean,default:!1}},setup(t){const e=t,r=new z(e.rawAttributes,e.attributeConfig);r.processAttributes();const n=h(()=>{r.setRawAttributes(e.rawAttributes),r.processAttributes();const a=r.getAttributesSplitByColumn([k.Left,k.Right]),i=r.getProcessedAttributes();return e.singleColumn?[i]:a}),s=a=>r.attributeIsOnVisibleState(a.name,e.isOpen?C.Expanded:C.Collapsed);return(a,i)=>(o(),u(U,null,{default:A(()=>[(o(!0),c(b,null,g(n.value,(l,E)=>(o(),u(x,{key:E,class:"ga-3"},{default:A(()=>[(o(!0),c(b,null,g(l,d=>(o(),u(V,{key:d.attribute.name,"is-open":s(d.attribute)},{default:A(()=>[m(at,{attribute:d.attribute,attributeTitle:d.attachedConfig.content.title.text,type:d.attachedConfig.config.type,isList:d.attachedConfig.config.isList,tooltip:d.attachedConfig.content.title.tooltip},null,8,["attribute","attributeTitle","type","isList","tooltip"])]),_:2},1032,["is-open"]))),128))]),_:2},1024))),128))]),_:1}))}}),P=3,ct="Meerdere sectoren",ut="Meerdere doelen",kt=({value:t})=>{if(typeof t=="number")return H(t)},lt=({value:t})=>{if(typeof t=="string")return t.charAt(0).toUpperCase()+t.slice(1)},dt=({value:t})=>{if(Array.isArray(t))return t.length>P?ct:t.join(", ")},Ct=({value:t})=>{if(Array.isArray(t))return t.length>P?ut:t.join(", ")},Ot=({value:t})=>{if(typeof t!="object"||!Object.hasOwn(t,"sbi"))return;const{sbi:r}=t;return r.length?dt({value:r}):void 0},Lt=({value:t})=>{if(Array.isArray(t))return t.join(", ")},wt=({attributes:t})=>{const e=t&&Object.hasOwn(t,"scope");if(!t||!e)return;const{scope:r}=t;return r==="Nationaal"?"Overal in Nederland":void 0},St=({value:t})=>{if(Array.isArray(t))return t.includes("Persoon")?t.length===1?"Persoon":"Personen en ondernemingen":"Onderneming"},Tt=({value:t,attributes:e})=>{if(typeof t!="string"||!e)return;const r=e&&Object.hasOwn(e,"overheidserkend"),n=e&&Object.hasOwn(e,"nlqf"),s=lt({value:t});if(!r||!n)return s;const{overheidserkend:a}=e,{nlqf:i}=e;return i!=null&&i.label&&a?`${s} (NLQF ${i.label})`:s},pt=t=>/^[KC]/i.test(t),ft=({attributes:t})=>{const e=t&&Object.hasOwn(t,"erkenningen");if(!t||!e)return!1;const{erkenningen:r}=t;return r.some(n=>n.stelsel.toLowerCase()==="crebo"&&pt(n.code))},N=({attributes:t})=>{const e=t&&Object.hasOwn(t,"overheidserkend");if(!t||!e)return!1;const{overheidserkend:r}=t;return r},Pt=({attributes:t})=>!N({attributes:t}),ht=({attributes:t})=>N({attributes:t})&&!ft({attributes:t}),Nt=({attributes:t})=>!ht({attributes:t}),Et=({attributeValue:t})=>t!==1,Rt=({attributes:t})=>{const r=t.instructietaal;return!r||r.every(n=>!n)?!1:r.length>1||r[0].toLowerCase()!=="Nederlands".toLowerCase()},Dt=({attributes:t})=>{const e=t&&Object.hasOwn(t,"locaties"),r=t&&Object.hasOwn(t,"scope");if(!t||!e||!r)return!1;const{scope:n}=t;return n!=="Europees"};export{v as A,k as C,Dt as I,Tt as T,C as V,vt as _,lt as a,Lt as b,ht as c,Nt as d,Pt as e,Ot as f,wt as g,Rt as h,Et as i,St as j,Ct as k,kt as t};