@beinformed/ui 2.0.0-beta.1 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/{Constants-Cw7d8vue.d.cts → Constants-CYAEbTZ4.d.cts} +13 -1
- package/dist/{Constants-Cw7d8vue.d.ts → Constants-CYAEbTZ4.d.ts} +13 -1
- package/dist/{FormModel-VQaB1SCS.d.ts → FormModel-Cmzm2g7k.d.ts} +1 -1
- package/dist/{FormModel-DnizzHJs.d.cts → FormModel-Qa655sE-.d.cts} +1 -1
- package/dist/chunk-24FITWGX.js +2 -0
- package/dist/{chunk-WVQSFYWD.js.map → chunk-24FITWGX.js.map} +1 -1
- package/dist/chunk-4BYHEGUN.js +2 -0
- package/dist/{chunk-6GV6KLAV.js.map → chunk-4BYHEGUN.js.map} +1 -1
- package/dist/chunk-GDEYM54A.js +2 -0
- package/dist/chunk-GDEYM54A.js.map +1 -0
- package/dist/{chunk-VIKUDFQV.js → chunk-GHQP5QNP.js} +2 -2
- package/dist/{chunk-UE323PGR.js → chunk-NOB2I3DW.js} +2 -2
- package/dist/{chunk-KCZQQTX6.js → chunk-QTZ77JJN.js} +2 -2
- package/dist/{chunk-LCMAAW7B.js → chunk-RI2O4J7J.js} +2 -2
- package/dist/chunk-SFI46XCV.js +2 -0
- package/dist/{chunk-OBB3YOFC.js.map → chunk-SFI46XCV.js.map} +1 -1
- package/dist/chunk-VLKSMXSB.js +2 -0
- package/dist/chunk-VLKSMXSB.js.map +1 -0
- package/dist/{chunk-333J3Q2L.js → chunk-WHWNPOV6.js} +2 -2
- package/dist/{chunk-ZDZHA43Q.js → chunk-XWOLLK42.js} +2 -2
- package/dist/{chunk-YOBCFXEM.js → chunk-Y3XZHSPE.js} +2 -2
- package/dist/constants/index.cjs +1 -1
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +6 -2
- package/dist/constants/index.d.ts +6 -2
- package/dist/constants/index.js +1 -1
- package/dist/exceptions/index.cjs +1 -1
- package/dist/exceptions/index.d.cts +3 -3
- package/dist/exceptions/index.d.ts +3 -3
- package/dist/exceptions/index.js +1 -1
- package/dist/{index-BFD-cKUB.d.cts → index-BxJE8Lob.d.ts} +1 -1
- package/dist/{index-CEg8Nt57.d.ts → index-RuAoNZgc.d.cts} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/layouthints/index.cjs +7 -7
- package/dist/layouthints/index.cjs.map +1 -1
- package/dist/layouthints/index.d.cts +2 -2
- package/dist/layouthints/index.d.ts +2 -2
- package/dist/layouthints/index.js +1 -1
- package/dist/models/index.cjs +4 -4
- package/dist/models/index.cjs.map +1 -1
- package/dist/models/index.d.cts +5 -5
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +1 -1
- package/dist/modularui/index.cjs +6 -6
- package/dist/modularui/index.cjs.map +1 -1
- package/dist/modularui/index.d.cts +35 -8
- package/dist/modularui/index.d.ts +35 -8
- package/dist/modularui/index.js +1 -1
- package/dist/settings/index.cjs +1 -1
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.cts +5 -1
- package/dist/settings/index.d.ts +5 -1
- package/dist/settings/index.js +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/index.cjs +8 -8
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +3 -3
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-5BR5HMNQ.js +0 -2
- package/dist/chunk-5BR5HMNQ.js.map +0 -1
- package/dist/chunk-6GV6KLAV.js +0 -2
- package/dist/chunk-BTDN4ZDB.js +0 -2
- package/dist/chunk-BTDN4ZDB.js.map +0 -1
- package/dist/chunk-OBB3YOFC.js +0 -2
- package/dist/chunk-WVQSFYWD.js +0 -2
- /package/dist/{chunk-VIKUDFQV.js.map → chunk-GHQP5QNP.js.map} +0 -0
- /package/dist/{chunk-UE323PGR.js.map → chunk-NOB2I3DW.js.map} +0 -0
- /package/dist/{chunk-KCZQQTX6.js.map → chunk-QTZ77JJN.js.map} +0 -0
- /package/dist/{chunk-LCMAAW7B.js.map → chunk-RI2O4J7J.js.map} +0 -0
- /package/dist/{chunk-333J3Q2L.js.map → chunk-WHWNPOV6.js.map} +0 -0
- /package/dist/{chunk-ZDZHA43Q.js.map → chunk-XWOLLK42.js.map} +0 -0
- /package/dist/{chunk-YOBCFXEM.js.map → chunk-Y3XZHSPE.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p,f as S,g as W,h as J,i as z,j as ee,k as re,l as y,n as yt,o as bt,p as ie,q as T}from"./chunk-KCZQQTX6.js";import{a as P,b as Ir,c as Rr}from"./chunk-73XVCQCW.js";import{c as Kt,d as Lr,e as Lt,f as Wt,g as Fr,h as wr,i as ut,j as zt,k as $t,l as qt,m as Xt,n as Yt,o as Nr,p as Br,q as Qt,r as gt,s as Zt,t as jr}from"./chunk-CPYNQW3X.js";import{a as lt,b as te}from"./chunk-VIKUDFQV.js";import{a as A}from"./chunk-VGAPPKHA.js";import{a as Vr,e as Jt,h as Q,l as Z,m as Ft,w as N}from"./chunk-OBB3YOFC.js";import{a as Ri,b as Li,e as Fi,f as pr,g as D}from"./chunk-UE323PGR.js";import{a as Gt,b as L,e as mt,g as kr,h as g,i as xr,m as ft,w as dr}from"./chunk-6GV6KLAV.js";var hi=Gt(($d,ci)=>{"use strict";function $i(s,t){for(var e=-1,r=t.length,i=s.length;++e<r;)s[i+e]=t[e];return s}ci.exports=$i});var fi=Gt((qd,mi)=>{"use strict";var di=Li(),qi=Fi(),Xi=Ri(),pi=di?di.isConcatSpreadable:void 0;function Yi(s){return Xi(s)||qi(s)||!!(pi&&s&&s[pi])}mi.exports=Yi});var bi=Gt((Xd,yi)=>{"use strict";var Qi=hi(),Zi=fi();function gi(s,t,e,r,i){var n=-1,o=s.length;for(e||(e=Zi),i||(i=[]);++n<o;){var a=s[n];t>0&&e(a)?t>1?gi(a,t-1,e,r,i):Qi(i,a):r||(i[i.length]=a)}return i}yi.exports=gi});var Ai=Gt((Yd,Ci)=>{"use strict";var Ji=bi(),tn=1/0;function en(s){var t=s==null?0:s.length;return t?Ji(s,tn):[]}Ci.exports=en});var O=class extends p{getInitialChildModelLinks(){let t=[];return this.collection.forEach(e=>{typeof e?.getInitialChildModelLinks=="function"&&t.push(...e.getInitialChildModelLinks())}),t}setChildModels(t,e){this.collection.forEach(r=>{typeof r.setChildModels=="function"&&r.setChildModels(t,e)})}};var b=class extends p{constructor(t=[]){if(super(t),!Array.isArray(t))throw new A(`${t} is not an Array`)}get layouthint(){return this.collection}has(...t){return(t.length>0?[...t]:[]).flat().some(r=>this.layouthint.includes(r)||this.layouthint.some(i=>i.startsWith(r)))}hasExact(...t){return(t.length>0?[...t]:[]).flat().some(r=>this.layouthint.includes(r))}getByLayoutHint(t){let e=null;return typeof t=="function"&&(e=this.layouthint.find(t)),typeof t=="string"&&(e=this.layouthint.find(r=>r.startsWith(t.toString()))),e||null}getLayoutHintValue(t){let e=t.endsWith(":")?t.substr(0,t.length-1):t,r=this.getByLayoutHint(i=>i.startsWith(`${e}=`)||i.startsWith(`${e}:`));return r?r.substr(e.length+1):null}getLayoutHintValues(t){if(!this.has(t))return null;let e=this.getLayoutHintValue(t);return e?e.split(";"):[]}};var k=class s{_configuration;_hasConfiguration=!1;constructor(t){this._hasConfiguration=Array.isArray(t),this._configuration=t??[]}includeLayoutHints(t){let e=this._configuration.filter(r=>{let[i]=Object.keys(r),n=r[i];return n.layouthint?n.layouthint.some(o=>t.includes(o)):!1});return new s(e)}excludeLayoutHints(t){let e=this._configuration.filter(r=>{let[i]=Object.keys(r),n=r[i];return n.layouthint?!n.layouthint.some(o=>t.includes(o)):!0});return new s(e)}get config(){return this._configuration.map(t=>{let[e]=Object.keys(t),r=t[e],i=[];return"labelTypes"in r?i=r.labelTypes:"propertyTypes"in r?i=r.propertyTypes:"sectionReferenceTypes"in r?i=r.sectionReferenceTypes:"textFragmentTypes"in r&&(i=r.textFragmentTypes),{type:e,label:r.label,types:i,layouthint:new b(r.layouthint),icon:"icon"in r?r.icon:""}})}hasConfig(){return this._hasConfiguration}hasContent(){return this.config.some(t=>t.type==="configElement")}hasLayoutHint(t){return this.config.some(e=>e.layouthint.has(t))}byTypes(t=[]){return!t||t.length===0?this.config:this.config.filter(e=>t.includes(e.type))}get labelConfig(){return this.config.filter(t=>t.type==="labelElement")}getAllSectionReferenceTypes(){return this.config.filter(t=>t.type==="contentElement").flatMap(t=>t.types)}getContentElementConfigBySectionReferenceType(t){return this.config.filter(e=>e.type==="contentElement"&&e.types.includes(t))}getContentConfiguredLabel(t,e=""){let r=this.labelConfig.length>0?this.labelConfig[0].types:[];if(t&&r.length>0){let i=t.getLabelElementByIds(r).filter(n=>n.value&&n.value!=="");if(i.length>0){let n=r.filter(o=>(i.some(a=>o===a._id),!1)).map(o=>i.find(l=>l._id===o));if(n.length>0&&n[0]!==void 0)return n[0].value}}return e}get hasContentFromData(){return Z()}};var ne=L(lt(),1);import{immerable as wi}from"immer";import{klona as Ni}from"klona/full";var d=class{static[wi]=!0;_data;_contributions;_layouthint;_modelOptions;constructor(t,e,r={origin:"",contextPath:N()}){typeof t=="object"&&t!=null?this._data=t:this._data={},typeof e=="object"&&e!=null?this._contributions=e:this._contributions={},this._modelOptions=r;let i=this.getContributionAsArray("layouthint",[]);this._layouthint=new b(i)}get data(){return this._data}replaceData(t){this._data=t}get contributions(){return this._contributions}get modelOptions(){return this._modelOptions}get origin(){return this._modelOptions.origin}get contextPath(){return this._modelOptions.contextPath}get layouthint(){return this._layouthint}getData(t,e){return e?(0,ne.get)(this.data,t,e):(0,ne.get)(this.data,t)}getDataAsString(t,e){let r=this.getData(t,e);return typeof r=="string"?r:e}getDataAsNumber(t,e){let r=this.getData(t,e);return typeof r=="number"?r:e}getDataAsBoolean(t,e){let r=this.getData(t,e);return typeof r=="boolean"?r:e}getDataAsArray(t,e){let r=this.getData(t,e);return Array.isArray(r)?r:e}getDataAsObject(t,e){let r=this.getData(t,e);return typeof r=="object"?r:e}getContribution(t,e){return(0,ne.get)(this.contributions,t,e)}getContributionAsArray(t,e){let r=this.getContribution(t,e);return Array.isArray(r)?r:e}getContributionAsObject(t,e){let r=this.getContribution(t,e);return typeof r=="object"?r:e}getContributionAsString(t,e){let r=this.getContribution(t,e);return typeof r=="string"?r:e}getContributionAsBoolean(t,e){let r=this.getContribution(t,e);return typeof r=="boolean"?r:e}getContributionAsNumber(t,e){let r=this.getContribution(t,e);return typeof r=="number"?r:e}hasData(){return Object.keys(this.data).length>0}clone(){return Ni(this)}};var mr=L(pr(),1);import{immerable as Bi}from"immer";var B=class s{[Bi]=!0;_key;_data;_contributions;_locale="en";_parameters;_origin;_contextPath=N();_requestHref;constructor(t,e,r,i){this._key=t??"unknown",this._data=e,this._contributions=r,this._locale=i??"en"}static create(t){let e=new s;if((0,mr.default)(t,"data")&&(0,mr.default)(t,"contributions")){let[r]=Object.keys(t.data),[i]=Object.keys(t.contributions);e.key=t.key??i,e.data=t.data?.[r],e.contributions=t.contributions?.[i],e.origin=t.origin,e.contextPath=t.contextPath}return e}get resourcetype(){let t=this.contributions?.resourcetype;return typeof t=="string"?t:""}get modelOptions(){return{origin:this.origin,contextPath:this.contextPath}}set origin(t){this._origin=t??""}get origin(){return this._origin}set contextPath(t){this._contextPath=t??N()}get contextPath(){return this._contextPath}set locale(t){this._locale=t}get locale(){return this._locale}set key(t){this._key=t}get key(){return this._key}set data(t){this._data=t}get data(){return this._data}set contributions(t){this._contributions=t}get contributions(){return this._contributions}set parameters(t){this._parameters=t}get parameters(){return this._parameters}set requestHref(t){this._requestHref=t}get requestHref(){return this._requestHref}static rehydrate(t){let e=new s;return e.origin=t.origin,e.contextPath=t.contextPath,e.locale=t.locale,e.key=t.key,e.data=t.data,e.contributions=t.contributions,e}};var H=class s extends d{_href;_icon;_targetModel;_isCacheable=!1;_method="GET";constructor(t,e,r){super(t,e,r),this._href=this.createHref()}static create(t,e,r,i){return new s({name:t,href:e.toString()},{name:t,label:r},i)}createHref(){let t=new y(this.getDataAsString("href",""),this.resourcetype,this.modelOptions);return this.handleInitialFilters(t),t}handleInitialFilters(t){if(this.layouthint.has(Qt)){let e={},r=Qt.length;for(let i of this.layouthint.filter(n=>n.startsWith(Qt))){let n=i.substring(r),o=ee.fromString(n);o&&(e[o.name]||(e[o.name]=[]),typeof o.value=="string"&&e[o.name].push(o.value))}Object.keys(e).forEach(i=>{let n=e[i].join(",");t.addParameter(i,n)})}}get key(){return this.getDataAsString("name","")}get label(){return this.getContributionAsString("label",this.key)}get resourcetype(){return this.getContributionAsString("resourcetype","")}get group(){return this.getContributionAsString("group",this.getDataAsString("group",""))}get href(){return this._href}set href(t){this._href=t}get method(){return this._method}set method(t){this._method=t}get links(){return"components"in this.data&&"components"in this.contributions?new C({components:this.data.components},{components:this.contributions.components}):new C}isActive(t){return t.href.startsWith(this.href)}set icon(t){this._icon=t}get icon(){return this._icon}get targetModel(){return this._targetModel}set targetModel(t){this._targetModel=t}get isCacheable(){return this._isCacheable}set isCacheable(t){this._isCacheable=t}get filterName(){let t=this.getDataAsObject("filter");if(t&&"name"in t&&typeof t.name=="string")return t.name}get hasProcessStatusSettings(){return"processStatus"in this.data&&"processStatus"in this.contributions}get processStatus(){if(this.hasProcessStatusSettings)return new Ct(this.data.processStatus,this.contributions.processStatus)}};var Ur=(s,t)=>{if(!s&&!t)return[];let e=[];if(s){let r=s;for(let i of Object.keys(r)){let n=r[i];if(Array.isArray(n))for(let o of n)e.push({data:{group:i,...o},contributions:{name:o.name}});else e.push({data:{name:i,group:i,...n},contributions:{name:i}})}}if(t){let r=t;for(let i of Object.keys(r)){let n=r[i];if(Array.isArray(n))for(let o of n){let a=e.findIndex(l=>l.data?.name===o.name);a>-1&&(e[a]={...e[a],contributions:{...o,group:i}})}else{let o=e.findIndex(a=>a.data?.name===i);o>-1?e[o]={...e[o],contributions:{name:i,...n}}:"href"in n&&e.push({data:{name:i,href:n.href},contributions:{name:i}})}}}return e};var C=class s extends p{constructor(t,e,r){super();let i=Ur(t,e);this.collection=i.filter(n=>!n.contributions.layouthint?.includes(jr)).map(n=>new H(n.data,n.contributions,r))}static create(t,e,r,i){let n="_links"in t?t._links:null,o=typeof e=="object"&&e!==null&&"_links"in e&&typeof e._links=="object"?{...e._links}:{};return new s(Array.isArray(n)?n[0]:n,{self:{resourcetype:r},...o},i)}get links(){return this.collection}set links(t){this.collection=t}getLinkByKey(t){return this.find(e=>e.key===t)}hasLinkByKey(t){return this.all.some(e=>e.key===t)}getLinkByHref(t){return this.find(e=>e.href.equals(t))}getLinksByGroup(...t){let e=t.length>0?[...t]:[],r=this.filter(n=>e.includes(n.group)),i=new s;return i.links=r,i}getLinkByResourceType(t){let e=new s;return e.collection=this.filter(r=>r.resourcetype===t),e}getLinksByLayoutHint(t){let e=new s;return e.collection=this.filter(r=>r.layouthint.has(t)),e}hasLinksByLayoutHint(t){return this.some(e=>e.layouthint.has(t))}toHrefArray(){return this.map(t=>t.href)}hasLink(t){return this.some(e=>e.href.equals(t.href))}update(t){let e=this.links.findIndex(r=>r.key===t.key);return e===-1?(this.collection=[...this.collection,t],this):(this.collection=[...this.links.slice(0,e),t,...this.links.slice(e+1)],this)}get routePath(){if(this.length===0)return"__NON_EXISTING_ROUTE__";let t=this.map(e=>e.href.path).join("|");return this.length>1?`(${t})`:t}};var Ct=class extends d{get concequenceType(){return this.getContributionAsString("consequenceType","").toLowerCase()}get transition(){return this.getContributionAsString("transition","").toLowerCase()}get isApplicable(){return this.getDataAsBoolean("applicable",!1)}get isCompleted(){return this.getDataAsBoolean("completed",!1)}get isNeeded(){let t=this.getDataAsString("needed","unknown");return t==="unknown"?null:t==="true"}get state(){return this.getDataAsString("state","")}get canComplete(){return this.getDataAsBoolean("canComplete",!0)}get links(){return C.create(this.contributions,null,"process-status",this.modelOptions)}get referenceDate(){return S.now()}get conceptLink(){let t=this.links.getLinkByKey("concept");return t&&(t.href=t.href.addParameter(g,this.referenceDate),t.isCacheable=!0),t}};var u=class extends d{_key;_locale;_lastServerUpdate;_links;_childModels=[];_modularuiResponse;_connectKey;constructor(t=new B){super(t.data,t.contributions,t.modelOptions),this._modularuiResponse=t,this._key=t.key,this._locale=t.locale,this._lastServerUpdate=Date.now(),this._links=C.create(this.data,this.contributions,this.resourcetype,this.modelOptions)}get modularuiResponse(){return this._modularuiResponse}set connectKey(t){this._connectKey=t}get connectKey(){return this._connectKey}get lastServerUpdate(){return this._lastServerUpdate}set lastServerUpdate(t){this._lastServerUpdate=t}get locale(){return this._locale}get key(){return this._key}set key(t){this._key=t}get resourcetype(){return this.getContributionAsString("resourcetype","unknown")}get label(){return this.getContributionAsString("label","")}get links(){return this._links}get selflink(){let t=this.links.getLinkByKey("self");if(t==null)throw new D(`Could not find self link for ${this.key===null?"unknown":this.key}`);return t}get selfhref(){return this.selflink?.href}getInitialChildModelLinks(){return[]}get childModels(){return this._childModels}addChildModels(t=[],e=[]){let r=t?.flat(),i=e?.flat();return this._childModels=r,this.setChildModels(r,i),this}setChildModels(t,e){if(!t&&!e)throw new A("No models send to setChildModels")}};var ct=class extends u{get type(){return"ConceptTypeDetail"}get key(){return this.getDataAsString("_id","concepttype")}get label(){return this.getDataAsString("label","")}get isCoreTaxonomy(){return this.getDataAsBoolean("coreTaxonomy",!1)}get icon(){return this.getDataAsString("icon","")}get textColor(){return this.getDataAsString("textColor","#000")}get backgroundColor(){return this.getDataAsString("backgroundColor","#fff")}get borderColor(){return this.getDataAsString("lineColor","#000")}get labelTypes(){return this.getDataAsArray("labelTypes")||[]}get propertyTypes(){return this.getDataAsArray("propertyTypes")||[]}get textFragmentTypes(){return this.getDataAsArray("textFragmentTypes")||[]}get sectionReferenceTypes(){return this.getDataAsArray("sectionReferenceTypes")||[]}isOfConceptType(t){return this.selfhref?.equals(t)}};var At=class extends d{_entryDate;_links;_conceptType;constructor(t,e,r){super(t,{},r),this._entryDate=e,this._links=C.create(t??{},null,"concept",this.modelOptions)}get type(){return"ConceptLinkModel"}getInitialChildModelLinks(){return this.conceptTypeLink?(this.conceptTypeLink.isCacheable=!0,[this.conceptTypeLink]):[]}setChildModels(t,e){if(this.conceptTypeLink){let r=this.conceptTypeLink.href,i=t.find(n=>n instanceof ct?n.selfhref?.equalsWithParameters(r):!1);this.conceptType=i}}get conceptType(){return this._conceptType}set conceptType(t){this._conceptType=t}get key(){return this.getDataAsString("_id","")}get label(){let t=this.getDataAsString("label");return t||this.getDataAsString("conceptLabel","")}get links(){return this._links}get selflink(){let t=this.links.getLinkByKey("self");if(t===null)throw new Error(`Could not find self link for ${this.key===null?"unknown":this.key}`);return t}get selfhref(){return this._entryDate?this.selflink?.href.addParameter(g,this._entryDate):this.selflink?.href}get conceptTypeLink(){return this.links.getLinkByKey("concepttype")}get concepttypeHref(){return this.conceptTypeLink?.href??null}get taxonomyType(){return"default"}get modelCategory(){return this.getDataAsString("modelCategory")}get sectionId(){return this.data.section?._id}get fragment(){return this.data.section?.fragment}asLinkModel(){let t=H.create(this.key,"",this.label,this.modelOptions);return this.selfhref&&(t.href=this.selfhref),t}};var Mt=class extends d{_concept;constructor(t,e,r){super(t,void 0,r),this._concept=new At(t?.concept,e,this.modelOptions)}get selfhref(){throw new Error("Method not implemented.")}getInitialChildModelLinks(){return this.concept.getInitialChildModelLinks()}setChildModels(t,e){this.concept.setChildModels(t,e)}get type(){return this.getDataAsString("relationType","")}get key(){return this.type}get label(){return this.getDataAsString("relationLabel")}get direction(){return this.getDataAsString("relationDirection")}get relationTypeType(){return this.getDataAsString("relationTypeType","None")}get condition(){return this.getDataAsString("relationCondition")}get properties(){return this.getDataAsArray("properties")}get textfragments(){return this.getDataAsArray("textFragments")}get concept(){return this._concept}set concept(t){this._concept=t}};var se=class s extends O{_entryDate;_modelOptions;constructor(t,e,r){super(),this._entryDate=e,this._modelOptions=r||{origin:"",contextPath:N()},t&&this.createCollection(t,e)}createCollection(t,e){Array.isArray(t)?t.forEach(r=>{r instanceof Mt?this.add(r):this.add(new Mt(r,e,this._modelOptions))}):this.add(new Mt(t,e,this._modelOptions))}get types(){return this.collection.filter((t,e,r)=>r.findIndex(i=>i.key===t.key)===e).map(t=>({key:t.key,label:t.label}))}byType(t){return new s(this.filter(e=>e.key===t),this._entryDate,this._modelOptions)}get incoming(){return new s(this.filter(t=>t.direction==="incoming"),this._entryDate,this._modelOptions)}get outgoing(){return new s(this.filter(t=>t.direction==="outgoing"),this._entryDate,this._modelOptions)}hasIncoming(){return this.incoming.length>0}hasOutgoing(){return this.outgoing.length>0}};var $=class extends u{get type(){return"ContentType"}get label(){return this.getDataAsString("label","")}get icon(){return this.iconLarge}get iconSmall(){return this.getDataAsString("iconSmall")}get iconMedium(){return this.getDataAsString("iconMedium")}get iconLarge(){return this.getDataAsString("iconLarge")}get description(){return this.getDataAsString("description")}};var R=class extends d{_links;_entryDate;_contentType;_items;constructor(t,e,r){super(t,{},r),this._entryDate=e,this._links=C.create(this.data,this.contributions,"content",this.modelOptions),this._items=[]}get type(){return"ContentLinkModel"}getInitialChildModelLinks(){return this.contentTypeLink?(this.contentTypeLink.isCacheable=!0,[this.contentTypeLink]):[]}setChildModels(t,e){if(this.contentTypeLink){let r=this.contentTypeLink.href;this.contentType=t.find(i=>i instanceof $?i.selfhref?.equalsWithParameters(r):!1)}}get contentType(){return this._contentType}set contentType(t){this._contentType=t instanceof $?t:void 0}set entryDate(t){this._entryDate=t}get key(){return this.getDataAsString("_id","")}get label(){return this.getDataAsString("label","")}get sourceLabel(){return this.getDataAsString("sourceLabel")}get abbreviation(){return this.getDataAsString("abbreviation")||this.getDataAsString("sourceAbbreviation")}get section(){return this.data.section}get encodedHref(){let t="/content/",e=new y(this.selfhref.path,"",this.modelOptions),r=e.path,i=this.section?r.substring(t.length,r.lastIndexOf("/")):r.substring(t.length);if(this.section!=null){let n=encodeURIComponent(this.section);e.path=`${t}${encodeURIComponent(i)}/${n}`}else e.path=`${t}${encodeURIComponent(i)}`;return this._entryDate!==null&&e.addParameter(g,this._entryDate),e}get links(){return this._links}get selflink(){let t=this.links.getLinkByKey("self");if(Jt("COMPLETE_SOURCE",!1)&&(this.links.hasLinkByKey("content")&&(t=this.links.getLinkByKey("content")),this.section!=null&&t&&!t.href.path.endsWith(encodeURIComponent(this.section))&&(t.href.addParameter("complete","true"),t.href.hash=this.section||"")),!t)throw new Error(`Could not find self link for '${this.key||"unknown"}'`);return t.href.state?t.href.state.fragment=this.fragment:t.href.state={fragment:this.fragment},t}get contentHref(){let t=this.data._links.self.href;if(this.data._links.content)t=this.data._links.content.href;else if(this.section){let e=encodeURIComponent(this.section);t.endsWith(e)&&(t=t.substring(0,t.lastIndexOf("/"+e)))}return new y(t).addParameter("complete","true").addParameter(g,this._entryDate)}get sectionHref(){if(this.section){let e=this.contentHref;return new y(e.path+"/"+encodeURIComponent(this.section)).addParameter(g,this._entryDate)}return null}get selfhref(){return this._entryDate?this.selflink.href.addParameter(g,this._entryDate):this.selflink.href}get subSectionID(){return this.selfhref.hash}get contentTypeLink(){return this.links.getLinkByKey("contenttype")}get contentTypeHref(){return this.contentTypeLink?.href}get fragment(){return this.data.sectionFragment}set items(t){this._items=t}get items(){return this._items}};var wt=class extends d{_entryDate;_links;constructor(t,e,r){super(t,void 0,r),this._links=C.create(this.data,null,"concept",this.modelOptions),this._entryDate=e}get links(){return this._links}get link(){let t=this.selfhref?.path,e=this.links.getLinkByKey("content")?.href.path;if(t&&e)return new R({...this.data,label:this.label,section:this.sectionId,sectionFragment:this.fragment},this._entryDate,this.modelOptions)}get selflink(){return this.links.getLinkByKey("self")}get selfhref(){return this.selflink?.href}get type(){return this.getDataAsString("type","")}get typeLabel(){return this.getDataAsString("typeLabel","")}get label(){return this.getDataAsString("label")}get sourceLabel(){return this.getDataAsString("sourceLabel")}get sourceAbbreviation(){return this.getDataAsString("sourceAbbreviation")}get referenceHash(){if(this.selfhref)return yt(this.selfhref)}get number(){return this.getDataAsString("number")}get sectionId(){return this.getDataAsString("sectionId")}get fragment(){return this.getDataAsObject("sectionFragment")}};var oe=class extends p{constructor(t,e=[],r,i){super(),this.collection=this.createSourceReferences(t||[],r),this.collection=t?t.map(n=>{let o=e.find(a=>a._id===n.type);return new wt({typeLabel:o?.label,...n},r,i)}):[]}createSourceReferences(t,e){return t.map(r=>new wt(r,e))}byTypes(t){return this.filter(e=>t.includes(e.type))}};var tt=class extends u{_conceptType;_relations;_sourceReferences;constructor(t){super(t),this._relations=new se(this.data.relations,this.entryDate,this.modelOptions)}get type(){return"ConceptDetail"}getInitialChildModelLinks(){let t=this.links.getLinkByKey("concepttype"),e=this.relationsCollection.getInitialChildModelLinks();return t?(t.isCacheable=!0,[t,...e]):e}setChildModels(t,e){let r=t.find(i=>i instanceof ct);r instanceof ct&&(this.conceptType=r),this.relationsCollection.setChildModels(t,e)}get key(){return this.getDataAsString("_id","concept")}get selfhref(){let{href:t}=this.selflink;return this.entryDate?t.setParameter(g,this.entryDate):t.removeParameter(g),t}get diagramLinks(){return this.links.getLinksByGroup("diagram")}get conceptType(){return this._conceptType}set conceptType(t){this._conceptType=t}get label(){return this.getDataAsString("conceptLabel","")}get modelCategory(){return this.getDataAsString("modelCategory","")}get taxonomyType(){return this.getDataAsString("taxonomyType")}get relationsCollection(){return this._relations}get formula(){return this.getDataAsString("formula")}get labels(){if(this.conceptType?.labelTypes){let t=this.getDataAsArray("labels",[]);return this.conceptType.labelTypes.map(e=>{let r=t.find(i=>i.type===e._id);return{...e,...r}})}return[]}getLabelElementByIds(t){return this.labels.filter(e=>t.includes(e._id))}get conceptProperties(){if(this.conceptType?.propertyTypes){let t=this.getDataAsArray("properties",[]);return this.conceptType.propertyTypes.map(e=>{let r=t.find(i=>i.type===e._id);return{...e,...r}})}return[]}getConceptPropertiesByIds(t){return this.conceptProperties.filter(e=>t.includes(e._id))}get textfragments(){let t=this.getDataAsArray("textFragments",[]),e=t.map(i=>({...this.conceptType?.textFragmentTypes.find(o=>i.type===o._id),...i})),r=this.conceptType?.textFragmentTypes?this.conceptType.textFragmentTypes.filter(i=>!t.some(n=>n.type===i._id)):[];return[...e,...r]}getTextFragmentByKeys(t){return this.textfragments.filter(e=>"type"in e&&typeof e.type=="string"&&t.includes(e.type))}getSourceReferenceCollection(t=[]){if(!this._sourceReferences){let e=[];this.conceptType&&this.conceptType.sectionReferenceTypes&&(e=this.conceptType.sectionReferenceTypes),this._sourceReferences=new oe(this.getSourceReferencesForCurrentLanguage(t),e,this.entryDate,this.modelOptions)}return this._sourceReferences}getSourceReferencesForCurrentLanguage(t){let e=this.getDataAsArray("sourceReferences",[]);if(e.length===0)return[];let r=3,i=e.map(a=>a.type.substring(a.type.length-r)),n=`_${this.locale}`;if(i.includes(n))return e.filter(a=>a.type.endsWith(n));let o=t.map(a=>`_${a.split("-")[0]}`);return e.filter(a=>{let l=a.type.substring(a.type.length-r);return!o.includes(l)})}get entryDate(){return this.getDataAsString(`filter.${g}.value`)}isOfConceptType(t){return this.conceptType?.isOfConceptType(t)??!1}};import{immerable as ji}from"immer";var Nt=class{[ji]=!0;_id;_defaultMessage;_parameters;_isClientConstraint;_layouthint;constructor(t,e,r,i=!1,n=new b){this._id=t,this._parameters=r,this._defaultMessage=e,this._isClientConstraint=i,this._layouthint=Array.isArray(n)?new b(n):n}get id(){return this._id}get defaultMessage(){return this._defaultMessage}get parameters(){return this._parameters}get isClientConstraint(){return this._isClientConstraint??!1}get layouthint(){return this._layouthint}get isMandatoryConstraint(){return this.id==="Constraint.Mandatory"}getMessage(){return{id:this.id,defaultMessage:this.defaultMessage??"",parameters:this.parameters??{}}}};var ae=(i=>(i[i.FORM=0]="FORM",i[i.FORMOBJECT=1]="FORMOBJECT",i[i.ATTRIBUTE=2]="ATTRIBUTE",i[i.COMPOSITE_CHILDREN=3]="COMPOSITE_CHILDREN",i))(ae||{}),j=class extends p{_type;constructor(t,e){super(),this._type=t,this.collection=[],e&&(this.collection=[...e.collection])}get type(){return this._type}get serverErrors(){return this.collection.filter(t=>!t.isClientConstraint)}findById(t){return this.collection.findIndex(e=>e.id===t)}addError(t,e,r,i){let n=this.findById(t);n>-1&&this.removeByIndex(n),this.add(new Nt(t,e,r,!1,i))}removeError(t){let e=this.findById(t);this.removeByIndex(e)}addServerError(t,e,r,i){r?this.addError(t,e,r,i):this.addError(t,e,void 0,i)}removeServerError(t){this.removeError(t)}removeServerErrors(){this.serverErrors.forEach(t=>{this.removeError(t.id)})}addErrors(t){this.collection=[...this.collection,...t]}addConstraints(t){this.collection=[...this.collection,...t.map(e=>new Nt(e.id,e.defaultMessage,e.parameters,!0))]}hasMandatoryError(){return this.collection.some(t=>t.isMandatoryConstraint)}};var le=class s extends d{_entryDate;_links;constructor(t,e,r){super(t,{},r),this._entryDate=e,this._links=C.create(this.data,this.contributions,"subsection",this.modelOptions)}get referred(){return this.getDataAsBoolean("referred",!1)}get id(){return"id"in this.data?this.getDataAsString("id"):this.getDataAsString("_id")}get key(){return this.id}get body(){return bt(this.data.body)}get number(){return this.getDataAsString("number")}get label(){return this.getDataAsString("label","")}get subSections(){return this.data.subSections?this.data.subSections.map(t=>new s(t,this.entryDate,this.modelOptions)):[]}get links(){return this._links}get selflink(){return this.links.getLinkByKey("self")}get selfhref(){return this.selflink?.href}get entryDate(){return this._entryDate}get relatedConceptsHrefs(){let t=[];return this.relatedConceptsHref&&t.push(this.relatedConceptsHref),this.subSections.forEach(e=>{t.push(...e.relatedConceptsHrefs)}),t}get relatedConceptsHref(){let t=this.links.getLinkByKey("relatedConcepts");if(t){let{href:e}=t;if(e.hash.includes("/relatedConcepts")){let r=e.path.substring(0,e.path.lastIndexOf("/"));e.path=r+"/"+e.hash,e.hash=e.hash.includes("#")?e.hash.substring(e.hash.indexOf("#")):""}return e.addParameter("entryDate",this.entryDate),e.setReferenceHash(this.referenceHash),e}}get referenceHash(){return yt(this.selfhref)}getReferredSections(){let t=[];for(let e of this.subSections){e.referred&&t.push(e);let r=e.getReferredSections();t.push(...r)}return t}};var et=class s extends d{_entryDate;_selflink;_childSections;constructor(t,e,r){super(t,{},r),this._entryDate=e,this._selflink=this.createSelfLink(),this._childSections=this.createChildSections()}get referred(){return this.getDataAsBoolean("referred",!1)}get selflink(){return this._selflink}createSelfLink(){let t=this.getDataAsString("_links.self.href");if(typeof t<"u")return H.create(this.key||"unknown",t,this.label,this.modelOptions)}get selfhref(){return this.selflink?.href}get entryDate(){return this._entryDate}get type(){return this.getDataAsString("type")}get sourceLabel(){return this.getDataAsString("sourceLabel")}get id(){let t=this.getDataAsString("id");return t||this.getDataAsString("_id","unknown")}get key(){return this.id}get label(){return this.getDataAsString("label","")}get number(){return this.getDataAsString("number")}get body(){let t=this.data.body;if(t)return bt(t)}get childSectionLinks(){let t=[];return this.data.childSections?t=this.data.childSections:this.data.sections&&(t=this.data.sections),t.map(e=>{let r=e.id||e._id,i=e._links;return new R({section:r,_id:r,label:e.label,sourceLabel:e.sourceLabel,_links:i},this.entryDate,this.modelOptions)})}get selfContentLink(){let t=this.data._links;return new R({section:this.id,_id:this.id,label:this.label,sourceLabel:this.sourceLabel,_links:t},this.entryDate,this.modelOptions)}createChildSections(){let t=[];return this.data.childSections?t=this.data.childSections:this.data.sections&&(t=this.data.sections),t.filter(e=>"body"in e).map(e=>new s(e,this.entryDate,this.modelOptions))}get childSections(){return this._childSections}set childSections(t){this._childSections=t||[]}get sections(){return this.data.sections?this.data.sections.map(t=>new s(t,this.entryDate,this.modelOptions)):[]}get subSections(){return Array.isArray(this.data.subSections)?this.data.subSections.map(t=>new le(t,this.entryDate,this.modelOptions)):[]}get referenceHash(){return yt(this.selfhref)}getReferredSections(){let t=[];for(let e of this.subSections){e.referred&&t.push(e);let r=e.getReferredSections();t.push(...r)}for(let e of this.childSections){e.referred&&t.push(e);let r=e.getReferredSections();t.push(...r)}return t}};import{immerable as Vi}from"immer";var _t=class s{[Vi]=!0;_content;constructor(t){this._content=t}static create(t){return typeof t=="object"&&t!==null&&"elements"in t&&Array.isArray(t.elements)?new s(t):new s}get fromData(){return Z()}get header(){let t=null,e=null,r=this._content?.header?.label;r&&(t=r);let i=this._content?.header?.description;return i&&(typeof i=="object"&&"message"in i?e=i.message:typeof i=="string"&&(e=i)),{label:t,description:e}}mapToPropertyElement(t){let e=t.propertyElement;return{propertyElement:{label:e.label,layouthint:new b(e.layouthint),properties:"properties"in e?e.properties:[]}}}mapToTextFragmentElement(t){let e=t.textFragmentElement;return{textFragmentElement:{label:e.label,layouthint:new b(e.layouthint),textfragments:"textfragments"in e?e.textfragments.map(r=>typeof r=="object"?{...r,text:bt(r.text)||""}:r):[]}}}mapToContentElement(t){let e=t.contentElement;return{contentElement:{label:e.label,layouthint:new b(e.layouthint),sections:"sections"in e?e.sections.map(r=>new et(r)):[]}}}get elements(){return Array.isArray(this._content?.elements)?this._content.elements.filter(t=>t!=null).map(t=>{switch(Object.keys(t)[0]){case"propertyElement":return this.mapToPropertyElement(t);case"textFragmentElement":return this.mapToTextFragmentElement(t);case"contentElement":return this.mapToContentElement(t);default:return t}}):[]}get label(){return this._content?.label}get properties(){return this.elements.filter(t=>Object.keys(t)[0]==="propertyElement").map(t=>{let{propertyElement:e}=t;return"properties"in e?e.properties:[]}).flat()}getConceptPropertiesByLabels(t){return this.elements.filter(e=>Object.keys(e)[0]==="propertyElement").map(e=>e.propertyElement).filter(e=>Array.isArray(t)?t.includes(e.label):t===e.label).map(e=>"properties"in e?e.properties:[]).flat()}get textfragments(){return this.elements.filter(t=>Object.keys(t)[0]==="textFragmentElement").map(t=>{let{textFragmentElement:e}=t;return"textfragments"in e?e.textfragments:[]}).flat()}getTextFragmentsByLabels(t){return this.elements.filter(e=>Object.keys(e)[0]==="textFragmentElement").map(e=>e.textFragmentElement).filter(e=>Array.isArray(t)?t.includes(e.label):t===e.label).map(e=>"textfragments"in e?e.textfragments:[]).flat()}get sections(){return this.elements.filter(t=>Object.keys(t)[0]==="contentElement").map(t=>t.contentElement.sections).flat()}getSectionsByType(t){return this.sections.filter(e=>{let r=e.type;return r?Array.isArray(t)?t.includes(r):t===r:!1})}getSectionsByLabels(t){return this.elements.filter(e=>Object.keys(e)[0]==="contentElement").map(e=>e.contentElement).filter(e=>Array.isArray(t)?t.includes(e.label):t===e.label).map(e=>e.sections).flat()}getReferredSections(){let t=[];for(let e of this.sections)t.push(...e.getReferredSections());return t}};var ue=class{_id;_validateMethod;_defaultMessage;_parameters;_useClientsideValidation;constructor(t,e,r,i,n=Q("USE_CLIENTSIDE_VALIDATION")){this._id=t,this._validateMethod=e,this._defaultMessage=r,this._parameters=i,this._useClientsideValidation=n}get id(){return this._id}get defaultMessage(){return this._defaultMessage||"Missing default message"}get parameters(){return this._parameters}hasValidation(){return this._validateMethod!=null}validate(t){let e=this._validateMethod;return this._useClientsideValidation&&e?e(t):!0}get isMandatoryConstraint(){return this._id==="mandatory"||this._id==="Constraint.Mandatory"}};var m=class extends p{addConstraint(t,e,r,i={},n=Q("USE_CLIENTSIDE_VALIDATION")){this.add(new ue(t,e,r,i,n))}validate(t){return this.isEmpty()||this.collection.every(e=>e.validate(t))}hasMandatoryConstraint(){return this.collection.some(t=>t.isMandatoryConstraint)}invalidConstraints(t){return t===""&&!this.hasMandatoryConstraint()?[]:this.collection.filter(e=>!e.validate(t))}};var ce=class{get id(){return"Constraint.Mandatory"}hasValidation(){return!0}get defaultMessage(){return"Field is mandatory"}get parameters(){return{}}validate(t){if(t==null)return!1;if(typeof t!="string")throw new TypeError(`isNotEmptyString: Not comparing to string: ${typeof t}`);return t!==""}get isMandatoryConstraint(){return!0}};var he="Constraint.InvalidLengthExact",de="Constraint.InvalidLengthBetween",pe="Constraint.InvalidLengthTooShort",me="Constraint.InvalidLengthTooLong",fe=class{_minLength;_maxLength;constructor(t,e){this._minLength=t,this._maxLength=e}get id(){return this.minLength&&this.maxLength&&this.minLength===this.maxLength?he:this.minLength&&this.maxLength?de:this.minLength?pe:this.maxLength?me:"Constraint.NoLengthConstraint"}get minLength(){return this._minLength}get maxLength(){return this._maxLength}hasValidation(){return!0}isExactLength(t){if(typeof t!="string")throw new TypeError("isExactLength: Not comparing to string");if(this.minLength==null)throw new Error("isExactLength: Min and max length not set");return t.length===this.minLength}isBetween(t){if(typeof t!="string")throw new TypeError("isBetween: Not comparing to string");if(this.minLength==null||this.maxLength==null)throw new Error("isBetween: Min or max length not set");return this.isLongEnough(t)&&this.isSmallEnough(t)}isLongEnough(t){if(typeof t!="string")throw new TypeError("isLongEnough: Not comparing to string");if(!this.minLength)throw new Error("isLongEnough: Min length not set");return t.length>=this.minLength}isSmallEnough(t){if(typeof t!="string")throw new TypeError("isSmallEnough: Not comparing to string");if(!this.maxLength)throw new Error("isSmallEnough: Max length not set");return t.length<=this.maxLength}get defaultMessage(){switch(this.id){case he:return"Length must be precisely ${length} characters";case de:return"Length must be between ${min-length} and ${max-length} characters";case pe:return"The length of the value must be larger than ${min-length}";case me:return"The length of the value must be smaller than ${max-length}";default:return""}}get parameters(){switch(this.id){case he:return{length:this.minLength};case de:return{"min-length":this.minLength,"max-length":this.maxLength};case pe:return{"min-length":this.minLength};case me:return{"max-length":this.maxLength};default:return{}}}validate(t){switch(this.id){case he:return this.isExactLength(t);case de:return this.isBetween(t);case pe:return this.isLongEnough(t);case me:return this.isSmallEnough(t);default:return!0}}get isMandatoryConstraint(){return!1}};var h=class extends d{_label;_links;_parentKey;_hasContentConfiguration=!1;_content;_concept;attributeReferenceDate;_lastModification=0;_initvalue;_value;_inputvalue;_previouslyValidatedValue;attributeErrors;_serverConstraints=new m;_useClientsideValidation=Q("USE_CLIENTSIDE_VALIDATION",!0);_isValid=!0;_mandatory;_readonly=!1;_disabled=!1;_isResult;_isHidden=!1;_isEditable=!1;_layoutHintRules;_placeholder;constructor(t,e,r){super(t,e,r),this.attributeReferenceDate=this.getDataAsString("referenceDate",S.now()),this._links=C.create(this.data,this.contributions,"attribute",this.modelOptions),this._content=this.createAttributeContent(),this._label=this.createLabel(),this._placeholder=this.getContributionAsString("placeholder"),this._initvalue=this.data.value,this._inputvalue=this.getInitialInputValue(this.data.value),this._value=this.data.value,this._isResult=this.getDataAsBoolean("isResult",!1),this._mandatory=this.layouthint.has(Kt)||this.getContributionAsBoolean("mandatory",!1),this._disabled=this.layouthint.has(Lr),this.attributeErrors=this.createErrorCollection(this.data.message)}createLabel(){return this.hasContentFromData()&&this.content?.label&&(this._label=this.content.label),this.getContributionAsString("label","")}createErrorCollection(t){let e=new j(2);return typeof t=="object"&&t!=null&&e.addServerError(t.id,t.message,t.properties,t.layouthint),e}static isApplicableModel(t){throw typeof t!="object"?new A("Given argument for isApplicableModel is not a contributions object"):new Error("isApplicableModel must be implemented on an attribute")}get key(){return this.getDataAsString("key","unknown")}get parentKey(){return this._parentKey||""}set parentKey(t){this._parentKey=t}get name(){return this.key}get label(){return this._label}set label(t){this._label=t}get placeholder(){return this._placeholder}set placeholder(t){this._placeholder=t}get isEditable(){return this._isEditable}set isEditable(t){this._isEditable=t}get isVisible(){return!this._isHidden}get isHidden(){return this._isHidden}set isHidden(t){this._isHidden=t}show(){this.isHidden=!1}hide(){this.isHidden=!0}get links(){return this._links}get downloadLink(){let t=this.links.getLinksByGroup("download").first;if(t&&t.key===this.key)return t}getInitialChildModelLinks(){return!this.hasContentFromData()&&this.hasContentConfiguration()&&this.conceptLink?[this.conceptLink]:[]}setChildModels(t,e){let r=this.conceptLink?.href;if(r){let i=t.find(n=>n instanceof tt?n.selfhref.equalsWithParameters(r):!1);this.concept=i}}get conceptLink(){let t=this.links.getLinkByKey("concept");return t&&(t.href=t.href.addParameter(g,this.referenceDate),t.isCacheable=!0),t}get concept(){return this._concept}set concept(t){this._concept=t}get referenceDate(){return this.attributeReferenceDate}set referenceDate(t){this.attributeReferenceDate=t}hasContentFromData(){return Z()}setHasContentConfiguration(t){this._hasContentConfiguration=t}hasContentConfiguration(){return this._hasContentConfiguration}createAttributeContent(){if("content"in this.data)return new _t(this.data.content)}get content(){return this._content}indicateContentConfiguration(t){if(t){let e=t.questions?.hasConfig(),r=t.isConfiguredEndResultAttribute(this.key),i=t.isConfiguredIntermediateResultAttribute(this.key);this.setHasContentConfiguration(e||r||i)}}getContentConfiguredLabel(t){return this.hasContentFromData()?this.content?.label??this.label:t.getContentConfiguredLabel(this.concept,this.label)}get defaultAlignment(){return"left"}get alignment(){let t=this.layouthint.getByLayoutHint("align-"),e=t?t.substring(6):this.defaultAlignment;return e==="left"||e==="center"||e==="right"?e:this.defaultAlignment}get readonlyWidth(){return"MEDIUM"}get layoutHintRules(){return this._layoutHintRules}set layoutHintRules(t){this._layoutHintRules=t}processLayoutHintRules(t){this.layoutHintRules&&this.layoutHintRules.process(this,t)}get lastModification(){return this._lastModification}set lastModification(t){this._lastModification=t}updateLastModification(){this.lastModification=Date.now()}isChangedSince(t){return this.lastModification>t}getInitialInputValue(t){return t}get initvalue(){return this.getInitValue()}getInitValue(){return this._initvalue}setInitValue(t){this._initvalue=t}hasValue(){return this._value!=null&&this._value!==""}getValue(){return this.hasValue()?this._value:null}setValue(t){this._value=t}get value(){return this.getValue()}set value(t){this.updateLastModification(),this._value=t}getInputValue(){let t=this._inputvalue;return t?t.toString():""}setInputvalue(t){this._inputvalue=t}get inputvalue(){return this.getInputValue()}set inputvalue(t){this._inputvalue=t,this.value=t,this.validate(t)}formatValue(t){return JSON.stringify(t)}get readonlyvalue(){return this.value?this.value.toString():""}get validateValue(){return this.inputvalue}get mandatory(){return this._mandatory||!1}set mandatory(t){t!==this._mandatory&&(this._previouslyValidatedValue=null),this._mandatory=t}get configuredMandatory(){return this.layouthint.has(Kt)??this.getContributionAsBoolean("mandatory")}get readonly(){return this._readonly||this.getContributionAsBoolean("readonly")===!0||this.getDataAsBoolean("static")===!0||this.isResult}set readonly(t){this._readonly=t}get disabled(){return this._disabled}set disabled(t){this._disabled=t}get isResult(){return this._isResult}set isResult(t){this._isResult=t}get format(){return this.getContributionAsString("format")}get formatLabel(){return this.format}get minLength(){return this.getContributionAsNumber("minLength")}get maxLength(){return this.getContributionAsNumber("maxLength")}get operator(){return this.getContributionAsString("operator","")}get assistantMessage(){return this.getContributionAsString("assistant")}get isValid(){return this.validate(this.validateValue)}getIsValid(){return this._isValid}setIsValid(t){this._isValid=t}getServerConstraints(){return this._serverConstraints}get constraintCollection(){let t=new m;return t.add(this._serverConstraints),this.mandatory&&t.add(new ce),(this.minLength||this.maxLength)&&t.add(new fe(this.minLength,this.maxLength)),t.add(this.addConstraints()),t}addConstraints(){return new m}setUseClientsideValidation(t){this._useClientsideValidation=t}useClientsideValidation(){return this._useClientsideValidation??!0}validate(t){return this.useClientsideValidation()?(this.isOptionalAndEmpty(t)?this._isValid=!0:this.getPreviouslyValidatedValue()!==t&&(this._isValid=this.constraintCollection.validate(t)),this.setPreviouslyValidatedValue(t),this._isValid):!0}setPreviouslyValidatedValue(t){this._previouslyValidatedValue=t}getPreviouslyValidatedValue(){return this._previouslyValidatedValue}isOptionalAndEmpty(t){if(t===void 0)throw new A("isOptionalAndEmpty method needs value argument");return!this.mandatory&&t===""}get errorCollection(){let t=new j(2,this.attributeErrors);return t.addConstraints(this.constraintCollection.invalidConstraints(this.validateValue)),t}inError(){return!this._isValid&&this.isChangedSince(0)}resetErrors(){this.attributeErrors.clear()}addServerError(t){this.attributeErrors.addServerError(t.id,t.message,t.properties,t.layouthint)}removeServerError(t){this.attributeErrors.removeServerError(t)}hasServerErrors(){return this.errorCollection.serverErrors.length>0}hasErrors(){return this.errorCollection.hasItems()}addMissingError(t){this.attributeErrors.addServerError("Constraint.Missing")}removeMissingError(){this.removeServerError("Constraint.Missing")}addServerConstraint(t,e,r){this._serverConstraints.addConstraint(t,void 0,e||"",r,this.useClientsideValidation())}formatParameters(t){if(!t)return{};let e={};return Object.keys(t).forEach(r=>{let i=t[r];r.endsWith("-number")||r.endsWith("-date")?e[r]=this.formatValue(i):e[r]=i}),e}get hasDynamicValidationData(){return!0}updateValidations(t){t.some(e=>e.id==="Constraint.Mandatory")||this.layouthint.has(Kt)?this.mandatory=!0:this.hasValue()||(this.mandatory=!1),this._serverConstraints=new m,this.resetErrors(),t.filter(e=>e.id!=="Constraint.Mandatory"||!this.hasValue()).forEach(e=>{this.hasValue()?this.attributeErrors.addServerError(e.id,e.message,this.formatParameters(e.properties),e.layouthint):this.addServerConstraint(e.id,e.message,this.formatParameters(e.properties))})}mergeAttribute(t){this.concept=t.concept,!t.readonly&&t.isValid&&t.inputvalue!==null&&this.update(t.inputvalue)}getFormData(){return this.inError()?null:{[this.name]:this.value}}get formdata(){return this.getFormData()}getEmptyFormData(){return{[this.name]:null}}equals(t){return this.key===t.key&&this.parentKey===t.parentKey}};import{immerable as Ki}from"immer";var Sr=L(lt(),1),$e=L(Vr(),1);var Gr=L(pr(),1);var q=class s extends O{get type(){return"composite-collection"}get selfhref(){}static create(t,e,r){return"children"in t&&"children"in e&&Array.isArray(e.children)&&Array.isArray(t.children)?Array.isArray(t.children[0])?s.createMultiData(t,e,r):s.createStandard(t,e,r):new s}static createStandard(t,e,r){let i=new s;return"children"in e&&"children"in t&&Array.isArray(e.children)&&Array.isArray(t.children)&&(i.collection=e.children.map(n=>{let[o]=Object.keys(n),a=Array.isArray(t.children)?t.children.find(w=>w.key===o):{},l=n[o];"type"in e&&typeof e.type=="string"&&e.type.includes("range")&&!l.type&&(l.type=e.type.replace("range",""));let c=v.createAttribute(o,{...a,dynamicschema:a?.dynamicschema},{...l,readonly:l.readonly??"readonly"in e},r);return c&&"key"in t&&typeof t.key=="string"&&(c.parentKey=t.key),c}).filter(n=>n!==null)),i}static createMultiData(t,e,r){let i=new s;return"children"in t&&Array.isArray(t.children)&&(i.collection=t.children.map(n=>s.create({...t,children:n},e,r))),i}getInputValue(){return this.collection.map(t=>t.inputvalue).join(",")}get inputvalue(){return this.getInputValue()}validate(){return this.collection.every(t=>t.isValid)}get errorCollection(){return new j(3)}hasServerErrors(){return this.errorCollection.serverErrors.length>0||this.collection.some(t=>t.hasServerErrors())}hasErrors(){return this.errorCollection.hasItems()??this.collection.some(t=>t.hasErrors())}isValid(){return!this.hasErrors()}reset(){this.collection.forEach(t=>{t.reset()})}get initvalue(){let t={},e=[];for(let r of this.collection)r instanceof s?e.push(r.initvalue):r.initvalue!==null&&(t[r.key]=r.initvalue);if(!(e.length===0&&Object.keys(t).length===0))return e.length>0?e:t}get value(){if(this.first instanceof s)return this.collection.map(e=>e.value);let t={};if(this.collection.forEach(e=>{if(e instanceof s)return e.value;e.formdata!==null&&!e.readonly&&(t={...t,...e.formdata})}),Object.keys(t).length!==0)return t}get readonlyvalue(){return this.first instanceof s?this.collection.map(t=>t.readonlyvalue).join(" | "):this.collection.filter(t=>t.value!==null).map(t=>t.readonlyvalue).join(", ")}updateValidations(t,e){this.collection.forEach(r=>{if(r instanceof s)r.updateValidations(t,e);else{let i=e.filter(n=>n.anchor?.elementid===`${t}${r.key}`);r.updateValidations(i)}})}setUseClientsideValidation(t){this.collection.forEach(e=>{e.setUseClientsideValidation(t)})}hasValue(){return this.collection.some(t=>t.hasValue())}getChildByAttribute(t){return this.collection.find(e=>e instanceof h&&e.equals(t)?!0:e instanceof M?e.getChildByAttribute(t):!1)}getChildByKey(t){return this.collection.find(e=>e instanceof h&&e.key===t?!0:e instanceof M?e.getChildByKey(t):!1)}};var _=(f=>(f.STRING="string",f.NUMBER="number",f.INTEGER="integer",f.BOOLEAN="boolean",f.MEMO="memo",f.DATE="date",f.DATETIME="datetime",f.TIME="time",f.TIMESTAMP="timestamp",f.ARRAY="array",f.BINARY="binary",f.COMPOSITE="composite",f.CAPTCHA="captcha",f.PASSWORD="password",f.CHOICE="choice",f.LOOKUP="lookup",f.RANGE="range",f.HELPTEXT="helptext",f.LABEL="label",f.MONEY="money",f.XML="xml",f.UPLOAD="upload",f.ASSIGNMENT="assignment",f))(_||{}),Pr=(c=>(c.STRING="string",c.CHOICE="choice",c.DATE="date",c.DATETIME="datetime",c.ASSIGNMENT="assignment",c.DATERANGE="daterange",c.DATETIMERANGE="datetimerange",c.NUMBER="number",c.NUMBERRANGE="numberrange",c))(Pr||{}),Hr=(i=>(i.STATIC="static",i.DYNAMIC="dynamic",i.DYNAMIC_WITH_THRESHOLD="dynamicWithThreshold",i.LOOKUP="lookup",i))(Hr||{});var M=class s extends h{_children;constructor(t,e,r){super(t,e,r),this._children=q.create(t??{},e??{},r),this.setChildrenOptionality()}static isApplicableModel(t){return t.type==="composite"||t.type==="array"&&"children"in t}getInitialChildModelLinks(){return this.children.getInitialChildModelLinks()}setChildModels(t,e){this.children.setChildModels(t,e)}get type(){return"composite"}get children(){return this._children}set children(t){this._children=t}get start(){return this.children.all[0]}get end(){return this.children.all[this.children.size-1]}getInputValue(){return this.children.getInputValue()}hasValue(){return this.children.some(t=>t.hasValue())}get constraintCollection(){let t=new m;return t.add(this.getServerConstraints()),t.add(this.addConstraints()),t}setUseClientsideValidation(t){super.setUseClientsideValidation(t),this.children.all.forEach(e=>e.setUseClientsideValidation(t))}validate(t){if(!this.useClientsideValidation())return!0;let e=this.children.validate();return e&&(e=this.constraintCollection.validate(t)),this.setIsValid(e),this.getIsValid()}get isValid(){return this.validate("")}hasServerErrors(){return this.errorCollection.serverErrors.length>0||this.children.some(t=>t.hasServerErrors())}hasErrors(){return this.errorCollection.hasItems()??this.children.some(t=>t.hasErrors())}reset(){this.children.reset()}getChildByAttribute(t){return this.children.find(e=>e instanceof q?!1:e.equals(t))}getChildByKey(t){return this.children.find(e=>e instanceof h&&e.key===t?!0:e instanceof s||e instanceof q?e.getChildByKey(t)!==void 0:!1)}mergeAttribute(t){this.concept=t.concept,this.children.forEach(e=>{if(t instanceof s&&e instanceof h){let r=t.getChildByKey(e.key);r&&e.mergeAttribute(r)}})}update(t,e){if(!e)throw new A("Composite attribute needs changed attribute on update call");return this.updateLastModification(),this.children.forEach(r=>{r instanceof s?r.update(t,e):r instanceof h&&r.equals(e)&&r.update(t)}),this.setChildrenOptionality(),this.validate(t),this}updateByAttribute(t){t instanceof s?t.children.forEach(e=>{if(!(e instanceof q)){let r=this.getChildByAttribute(e);r&&r.updateByAttribute(e)}}):console.error(`update of composite attribute with ${t.type} not supported`)}setChildrenOptionality(){let t=!this.mandatory&&this.children.every(e=>e.value===null);this.children.forEach(e=>{e instanceof h&&(e.mandatory=t||!e.configuredMandatory?!1:e.configuredMandatory)})}get readonly(){return super.readonly??this.children.every(t=>t instanceof h&&t.readonly)}set readonly(t){super.readonly=t}get readonlyvalue(){return this.children.readonlyvalue}get initvalue(){return this.children.initvalue}getFormData(){return{[this.name]:this.value}}getValue(){return this.children.value}getChildrenIds(){let t=this.data.value;return Array.isArray(t)?t.map(e=>{if(typeof e=="object"&&e!=null&&"_id"in e)return e._id}):t!=null&&typeof t=="object"&&"_id"in t?[t._id]:[]}get isResult(){return this._isResult}set isResult(t){this._isResult=t,this.children.forEach(e=>{e instanceof q||(e.isResult=t)})}indicateContentConfiguration(t){t&&this.children.forEach(e=>{e instanceof q||e.indicateContentConfiguration(t)})}equals(t){return this.key===t.key&&this.parentKey===t.parentKey||this.children.some(e=>e instanceof h&&e.equals(t))}get readonlyWidth(){if(this.type==="composite")return"LARGE";switch(this.start instanceof h?this.start.type:""){case"datetime":return"LARGE";case"timestamp":return"EXTRA_LARGE";default:return"MEDIUM"}}};var E=class extends O{constructor(t={elementid:"none"},e=[],r){super(),e.forEach(i=>{let[n,o]=Object.entries(i)[0],a=v.createAttribute(n,t,o,{origin:r?.origin,contextPath:r?.contextPath});a!==null&&(r?.isReadonly&&!(0,Gr.default)(o,"readonly")&&(a.readonly=!0),this.collection.push(a))}),this.processLayoutHintRules()}get attributes(){return this.processLayoutHintRules(),this.all}set attributes(t){this.collection=t}processLayoutHintRules(){this.all.forEach(t=>{t.processLayoutHintRules(this)})}get visible(){return this.attributes.filter(t=>!t.isHidden)}get questions(){return this.visible.filter(t=>!t.isResult)}get results(){return this.visible.filter(t=>t.isResult)}getAttributeByAttribute(t){return this.find(e=>e.equals(t)?!0:t instanceof M?t.getChildByAttribute(e):!1)}getAttributeByKey(t){return this.find(e=>e.key===t?!0:e instanceof M?e.getChildByKey(t):!1)}hasAttributeByKey(t){return this.getAttributeByKey(t)!=null}getAttributeByLayoutHint(...t){return this.find(e=>e.layouthint.has(...t))}getChoiceAttributeByLayoutHint(t){let e=this.getAttributeByLayoutHint(t);if(e instanceof X)return e}getAttributesByLayoutHint(...t){return this.filter(e=>e.layouthint.has(...t))}replace(t,e){this.replaceByKey(t.key,e)}replaceByKey(t,e){this.forEach((r,i)=>{r.key===t&&(this.collection[i]=e)})}setReferenceDate(t){this.forEach(e=>{e.referenceDate=t})}hasServerErrors(){return this.collection.some(t=>t.hasServerErrors())}addServerError(t){let e=t?.anchor?.elementid;if(e){let r=this.getAttributeByKey(e);if(r)r.addServerError(t);else throw new P(`Could not add error to missing attribute with id ${e}`)}}hasErrors(){return this.visible.some(t=>t.hasErrors())}updateValidations(t){return this.all.filter(e=>e.hasDynamicValidationData).forEach(e=>{let r=t.filter(i=>i.anchor?.elementid===e.key);if(e.updateValidations(r),e instanceof M){let i=t.filter(n=>{let o=n.anchor?.elementid;return o&&o.startsWith(`${e.key}.`)});e.children.updateValidations(`${e.key}.`,i)}}),this}indicateContentConfiguration(t){t&&this.all.forEach(e=>{e.indicateContentConfiguration(t)})}get formdata(){return this.getFormData(!1)}getFormData(t=!1){let e=this.attributes.filter(i=>i.formdata!==null&&!i.readonly&&(!t||i.hasDynamicValidationData)).map(i=>i.isVisible?i.formdata:i.getEmptyFormData()),r={};return e.forEach(i=>{r={...r,...i}}),r}};var G=class s extends d{_code;_isSelected;_concept;_referenceDate;_level;_attributeCollection;_children;_links;_content;_isUser=!1;constructor(t=[],e={},r){super({},e),this._code=this.getContributionAsString("code",this.getContributionAsString("key","")),this._isSelected=t.includes(this.code),this._referenceDate=r?.referenceDate||new Date().toISOString().split("T")[0],this._level=0,this._attributeCollection=this.createAttributeCollection(r),this._children=this.addChildren(t,e,r),this._links=new C(this.contributions._links,{},{origin:r?.origin,contextPath:r?.contextPath}),this._content=this.createContent(),this._isUser="optionType"in e&&e.optionType==="user"}get type(){return"option"}static createFromListItemModel(t){let e=new s;return e.code=t.id?.toString()??"",e}get isChoiceAttributeOptionModel(){return!0}getInitialChildModelLinks(){let t=[];return!this.hasContentFromData()&&this.conceptLink&&t.push(this.conceptLink),this.children&&t.push(...this.children.getInitialChildModelLinks()),t}setChildModels(t,e=[]){let r=this.conceptLink?.href;if(r){let i=t.find(n=>n instanceof tt?n.selfhref.equalsWithParameters(r):!1);this.concept=i}this.children&&this.children.setChildModels(t,e)}get code(){return this._code}set code(t){this._code=t}equals(t){return this.code.toString()===t.code.toString()}createAttributeCollection(t){let e=this.getContributionAsArray("elementsContributions",[]),r=this.getContributionAsObject("elements",{});return new E(r,e,{origin:t?.origin,contextPath:t?.contextPath,isReadonly:!0})}get attributeCollection(){return this._attributeCollection}set attributeCollection(t){this._attributeCollection=t}get label(){let t=this.getContributionAsString("label");if(t)return t;if(this.attributeCollection.hasItems()){let e=this.attributeCollection.getAttributeByLayoutHint(ut);if(e)return e.readonlyvalue;if(this.attributeCollection.first)return this.attributeCollection.first.readonlyvalue}return""}getContentConfiguredLabel(t){if(this.hasContentFromData())return this.content?.label||this.label;if(t)return t.getContentConfiguredLabel(this.concept,this.label)}hasContentFromData(){return Z()}get content(){return this._content}addChildren(t=[],e={},r){if("elements"in e)return new Y;let i="children"in e?e.children:[];return Y.create({value:t},{options:i??[]},r)}get children(){return this._children}createContent(){return _t.create(this.getContributionAsObject("content"))}get selected(){return this._isSelected}set selected(t){this._isSelected=t}get count(){return this.getContributionAsNumber("count")}get links(){return this._links}set links(t){this._links=t}get selfhref(){return this.links.getLinkByKey("self")?.href}get referenceDate(){return this._referenceDate}set referenceDate(t){this._referenceDate=t}get conceptLink(){let t=this.links.getLinkByKey("concept");return t&&(t.href=t.href.addParameter(g,this.referenceDate),t.isCacheable=!0),t}get concept(){return this._concept}set concept(t){this._concept=t}get level(){return this._level}set level(t){this._level=t}get isBooleanType(){return this.getContributionAsBoolean("isBooleanType",!1)}get hasAlternativeLabel(){return this.getContributionAsBoolean("hasAlternativeLabel",!1)}get isUser(){return this._isUser}mergeOption(t){this.concept=t.concept,this.children!=null&&t.children!=null&&this.children.mergeOptions(t.children)}};var Y=class s extends O{_modelOptions;_headers=[];_sortOptions=!1;constructor(t){super(),this._modelOptions=t||{origin:"",contextPath:N(),referenceDate:new Date().toISOString().split("T")[0]}}set sortOptions(t){this._sortOptions=t,this.collection.forEach(e=>{e.children&&(e.children.sortOptions=t)})}get sortOptions(){return this._sortOptions}static create(t={},e={},r){let i=new s(r);if("type"in e&&e.type==="boolean"){let n="value"in t?t.value:void 0;i.addBooleanOptions(n,e)}else"dynamicschema"in t&&t.dynamicschema!=null?i.addDynamicSchema(t,e):"options"in e&&e.options!=null&&i.addOptions(t,e);return"children"in e&&Array.isArray(e.children)&&i.addHeaders(e.children),i}get all(){return this.sortOptions?this.collection.sort((t,e)=>t.label.localeCompare(e.label)):this.collection}getSelectedOptions(t){let e=[];return"options"in t&&Array.isArray(t.options)?e.push(...t.options.filter(r=>r.selected).map(r=>r.key)):"value"in t&&("value"in t&&Array.isArray(t.value)?e.push(...t.value):typeof t.value=="boolean"?e.push(t.value.toString()):e.push(t.value)),e}getOptionCount(t,e){if(Array.isArray(e)){let r=e.find(i=>"key"in i&&i.key===t);if(r)return"count"in r&&typeof r.count=="number"?r.count:void 0}}addOptions(t,e){let r=this.getSelectedOptions(t);if("options"in e&&Array.isArray(e.options)){let i="options"in t&&Array.isArray(t.options)?t.options:[];e.options.forEach(n=>{let o=n.code||n.key,a="optionType"in e?e.optionType:"generic";this.addOption(r,{...n,count:this.getOptionCount(o,i),optionType:a})})}return this}addDynamicSchema(t,e){let r=this.getSelectedOptions(t);if("dynamicschema"in t&&Array.isArray(t.dynamicschema)){let i="options"in t&&Array.isArray(t.options)?t.options:[],n="children"in e?e.children:void 0,o="optionType"in e?e.optionType:"generic";t.dynamicschema.forEach(a=>{this.addOption(r,{...a,count:this.getOptionCount(a.code,i),optionType:o,elementsContributions:n})})}return this}addBooleanOption(t,e,r,i=[]){let n=i.find(a=>"code"in a&&a.code===t),o=n&&"label"in n?n.label:e;this.addOption(r,{code:t,label:o,isBooleanType:!0,hasAlternativeLabel:n!=null})}addBooleanOptions(t,e){let r=t==null?[]:[t.toString()],i="options"in e&&Array.isArray(e.options)?e.options:[];return this.addBooleanOption("true","Yes",r,i),this.addBooleanOption("false","No",r,i),this}addOption(t,e){let r=new G(Array.isArray(t)?t:[t],e,this._modelOptions);return this.add(r),this}getOptionByCode(t){return this.collection.find(e=>e.code===t)}hasOptionByCode(t){return this.collection.some(e=>e.code===t)}get selected(){let t=[];return this.collection.forEach(e=>{e.selected&&e.selected===!0&&t.push(e),e.children&&t.push(...e.children.selected)}),t}deselectAll(){this.collection=this.collection.map(t=>(t.selected=!1,t.children&&t.children.deselectAll(),t))}select(t){this.toggle(t,"select")}deselect(t){this.toggle(t,"deselect")}toggle(t,e){this.collection=this.collection.map(r=>(r.code===t?r.selected=e==="select":r.children&&r.children.toggle(t,e),r))}setReferenceDate(t){return this.collection.map(e=>(e.referenceDate=t,e.children&&(e.children.referenceDate=t),e))}set referenceDate(t){this.collection=this.setReferenceDate(t)}addHeaders(t){this._headers=t.map(e=>new Et(e))}get headers(){return this._headers?this._headers:[]}mergeOptions(t,e=!1,r=!1){let i=[];this.collection.forEach(n=>{let o=t.find(a=>a.code===n.code);o?(n.mergeOption(o),i.push(n)):r||i.push(n)}),e?this.collection=[...i,...t.filter(n=>!this.collection.some(o=>o.code===n.code))]:this.collection=i}some(t,e){return this.collection.some((r,i,n)=>{let o=t(r,i,n);return!o&&r.children?r.children.some(t,e):o})}};var Kr=(l=>(l.CHECKBOX="checkbox",l.RADIOBUTTON="radiobutton",l.COMBOBOX="combobox",l.LIST="list",l.LISTVIEW="listview",l.TABLE="table",l.LONGLIST="longlist",l.TOGGLE="toggle",l))(Kr||{}),X=class s extends h{_options;constructor(t,e,r){super(t,e,r),this.attributeReferenceDate=this.getDataAsString("referenceDate",new Date().toISOString().split("T")[0]),this._options=Y.create(t,e,{...r,referenceDate:this.referenceDate}),this.layouthint.has(wr)&&(this._options.sortOptions=!0)}static isApplicableModel(t){let e="";return"type"in t&&typeof t.type=="string"&&(e=t.type),e==="choice"||e==="array"?!0:e!=="composite"&&e!=="boolean"?"enumerated"in t||"options"in t:!1}get type(){let t=this.getContributionAsString("optionMode",""),e=this.lookupLink||this.lookupListLink;return t==="lookup"||t==="dynamicWithThreshold"&&e?"lookup":"choice"}getInitialChildModelLinks(){let t=[];return this.hasContentConfiguration()&&(!this.hasContentFromData()&&this.conceptLink&&t.push(this.conceptLink),t.push(...this.options.getInitialChildModelLinks())),t}setChildModels(t,e){let r=this.conceptLink?.href;if(r){let i=t.find(n=>n instanceof tt?n.selfhref?.equalsWithParameters(r):!1);this.concept=i}this.options.setChildModels(t,e)}get optionType(){return this.contributions?.optionType??"generic"}get isUser(){return this.optionType==="user"}get lookupLink(){let t=this.links.getLinkByKey("lookupOptions");return t&&this.lookupParameterType==="bodyParameter"&&(t.method="POST"),t}get lookupParameterType(){return this.getContributionAsString("parameterType")==="bodyParameter"?"bodyParameter":"queryParameter"}get lookupListLink(){return this.links.getLinkByKey("lookupList")}get lookupListLabel(){return this.contributions.lookupList?.label??""}get referenceDate(){return this.attributeReferenceDate}set referenceDate(t){this.attributeReferenceDate=t,this.options.referenceDate=t}get options(){return this._options}get selected(){return this.options.selected.map(t=>t.code)}get readonlyvalue(){return this.options.selected.map(t=>t.label).join(", ")}get initvalue(){let t=this.getInitValue();return Array.isArray(t)&&t.length!==0,t}getValue(){return this.options.selected.length>0?this.options.selected.map(t=>t.code).join(","):null}hasValue(){return this.options.selected.length>0}getInputValue(){return this.selected.join(",")}toggleOption(t){this.selected.includes(t)?this.disableOption(t):this.enableOption(t)}enableOption(t){this.isMultiple||this.options.deselectAll(),this.options.select(t),this.inputvalue=this.getInputValue()}disableOption(t){this.options.deselect(t),this.inputvalue=this.getInputValue()}addOption(t){this.isMultiple||this.options.deselectAll();let e="code"in t&&typeof t.code=="string"?t.code:"";this.options.find(r=>r.code===e)===void 0&&this.options.addOption(e,t)}get choicetype(){return["checkbox","radiobutton","combobox","list","listview","table","longlist","toggle"].find(t=>this.layouthint.has(t))??"checkbox"}get isMultiple(){return this.getContributionAsBoolean("multiplechoice")??this.choicetype==="checkbox"}get isTree(){return this.getContributionAsArray("options",[]).some(t=>"children"in t)}reset(){this.options.deselectAll()}mergeAttribute(t,e=!1,r=!1){!this.readonly&&t instanceof s&&(this.concept=t.concept,this.options.mergeOptions(t.options,e??this.type==="lookup",r),this.options.deselectAll(),t.isValid&&t.inputvalue!==null&&this.update(t.inputvalue))}update(t){if(this.readonly)return this;this.updateLastModification();let e;return Array.isArray(t)?e=t:typeof t=="string"&&this.isMultiple?e=t.split(","):e=[t],e.forEach(r=>{r instanceof G?(this.options.some(i=>i.equals(r))||this.options.add(r),this.toggleOption(r.code)):typeof r=="string"&&this.options.some(i=>i.code.toString()===r)&&this.toggleOption(r)}),this}updateByAttribute(t){if(this.reset(),t instanceof s||t instanceof M){let e;t instanceof s?e=t.options.selected:t instanceof M&&(e=t.getChildrenIds()),e!=null&&this.update(e)}else console.error(`update of choice attribute with ${t.type} not supported`)}addMissingError(t){this.isChangedSince(0)&&this.attributeErrors.addServerError("Constraint.Missing"),t instanceof s&&this.mergeAttribute(t,!0,!0)}setHasContentConfiguration(t){super.setHasContentConfiguration(this.contentConfiguration!=null||t)}get contentConfiguration(){if(!this.contributions.content?.optionElements)return;let t=this.contributions.content.optionElements.map(e=>"contentElement"in e?{contentElement:{layouthint:[Zt],...e.contentElement}}:e);return new k(t)}get placeholder(){return this.getContributionAsString("placeholder","")}addServerError(t){let{id:e,message:r,properties:i,layouthint:n}=t,o="answer-option-key";if(i&&o in i){let a=i[o],l=this.options.find(c=>c.code===a);l&&(i[o]=l.getContentConfiguredLabel(this.contentConfiguration??void 0)??"")}this.attributeErrors.addServerError(e,r,i,n)}get readonlyWidth(){return"MEDIUM"}};var ye=class s extends h{_referenceDate;_options;constructor(t,e,r){super(t,e,r),this._referenceDate=this.getDataAsString("referenceDate",S.now()),this._options=Y.create(t,e,{...r,referenceDate:this.referenceDate})}static isApplicableModel(t){return"type"in t&&t.type==="boolean"}get type(){return"boolean"}get referenceDate(){return this._referenceDate}set referenceDate(t){this._referenceDate=t,this.options.referenceDate=t}get choicetype(){return["checkbox","radiobutton","combobox","toggle"].find(t=>this.layouthint.has(t))??"radiobutton"}get isMultiple(){return!1}get isTree(){return!1}setHasContentConfiguration(t){super.setHasContentConfiguration(this.contentConfiguration!==null||t)}get contentConfiguration(){if("content"in this.contributions&&typeof this.contributions.content=="object"&&this.contributions.content!==null&&"optionElements"in this.contributions.content&&Array.isArray(this.contributions.content.optionElements)){let t=this.contributions.content.optionElements.map(e=>"contentElement"in e?{contentElement:{...e.contentElement,layouthint:[Zt]}}:e);return new k(t)}return null}get options(){return this._options}get selected(){return this.options.selected.map(t=>t.code)}get readonlyvalue(){return this.options.selected.map(t=>t.label).join(", ")}get initvalue(){let t=this.getInitValue();return Array.isArray(t)&&t.length!==0,t}getValue(){let t=this.options.selected;return t.length>0?t[0].code:null}hasValue(){return this.options.selected.length>0}getInputValue(){return this.selected.join(",")}toggleOption(t){this.selected.includes(t)?this.disableOption(t):this.enableOption(t)}enableOption(t){this.options.deselectAll(),this.options.select(t),this.inputvalue=this.getInputValue()}disableOption(t){this.options.deselect(t),this.inputvalue=this.getInputValue()}reset(){this.options.deselectAll()}mergeAttribute(t){!this.readonly&&t instanceof s&&(this.concept=t.concept,this.options.deselectAll(),t.isValid&&t.inputvalue!==null&&this.update(t.inputvalue))}update(t){if(this.readonly)return this;this.updateLastModification();let e;return Array.isArray(t)?e=t:typeof t=="string"&&this.isMultiple?e=t.split(","):typeof t=="string"?e=[t==="true"?"true":"false"]:e=[JSON.stringify(t)],e.forEach(r=>{r instanceof G?this.toggleOption(r.code):typeof r=="string"&&this.options.some(i=>i.code.toString()===r)&&this.toggleOption(r)}),this}updateByAttribute(t){this.reset(),t instanceof s?this.update(t.value):console.error(`update of boolean attribute with ${t.type} not supported`)}getFormData(){return this.inError()?null:this.hasValue()?{[this.name]:this.value==="true"}:this.choicetype==="checkbox"||this.choicetype==="toggle"?{[this.name]:!1}:{[this.name]:null}}get readonlyWidth(){return this.options.some(t=>t.hasAlternativeLabel)?"SMALL":"EXTRA_SMALL"}};var be=class extends h{_answer="";static isApplicableModel(t){return t.type==="captcha"}get type(){return"captcha"}update(t){return this.updateLastModification(),this.inputvalue=t,this}updateByAttribute(t){}setAnswer(t){this._answer=t}getAnswer(){return this._answer}get hasDynamicValidationData(){return!1}reset(){this._answer="",this.inputvalue=""}};var fr="Constraint.Date.InexactDate",gr="Constraint.Date.OutOfRange",yr="Constraint.Date.BelowMinimum",br="Constraint.Date.AboveMaximum",Ce=class{_type;_format;_minDate;_maxDate;constructor(t,e=null,r=null,i="yyyy-MM-dd"){this._type=t,this._format=i,this._minDate=e,this._maxDate=r}get type(){return this._type}get id(){return this.minDate!==null&&this.maxDate!==null&&this.minDate===this.maxDate?fr:this.minDate!==null&&this.maxDate!==null?gr:this.minDate!==null?yr:this.maxDate!==null?br:"Constraint.Date.NoBoundaryConstraint"}get format(){return this._format}get minDate(){return this._minDate}get maxDate(){return this._maxDate}get defaultMessage(){switch(this.id){case fr:return"Date must be precisely ${min-date}";case gr:return"Must be between ${min-date} and ${max-date}";case yr:return"Must be on or after ${min-date}";case br:return"Must be on or before ${max-date}";default:return""}}get parameters(){return{"min-date":this.minDate?this.formatUtil.toFormat(this.minDate,this.format):null,"max-date":this.maxDate?this.formatUtil.toFormat(this.maxDate,this.format):null}}hasValidation(){return!0}isExactDate(t){if(this.minDate===null)throw new D("isExactDate: Min and max date not set");return this.formatUtil.isSame(t,this.minDate,this.format)}isBetweenDates(t){if(this.minDate===null||this.maxDate===null)throw new D("isBetweenDate: Min or max date not set");return this.isSameOrAfterMinDate(t)&&this.isSameOrBeforeMaxDate(t)}isSameOrAfterMinDate(t){if(this.minDate==null)throw new D("isSameOrAfterMinDate: Min date not set");return this.formatUtil.isSameOrAfter(t,this.minDate,this.format)}isSameOrBeforeMaxDate(t){if(this.maxDate==null)throw new D("isSameOrBeforeMaxDate: Max date not set");return this.formatUtil.isSameOrBefore(t,this.maxDate,this.format)}get formatUtil(){switch(this.type){case"time":return J;case"timestamp":return z;case"datetime":return W;default:return S}}validate(t){if(typeof t!="string")throw new TypeError("isNotEmptyString: Not comparing to string");switch(this.id){case fr:return this.isExactDate(t);case gr:return this.isBetweenDates(t);case yr:return this.isSameOrAfterMinDate(t);case br:return this.isSameOrBeforeMaxDate(t);default:return!0}}get isMandatoryConstraint(){return!1}};var Ae=class{_format;_formatLabel;constructor(t,e){this._format=t,this._formatLabel=e}get id(){return"Constraint.DateFormat.InvalidFormat"}get format(){return this._format}get formatLabel(){return this._formatLabel}hasValidation(){return!0}get defaultMessage(){return"Date must be entered in the format ${format}"}get parameters(){return{format:this.formatLabel}}validate(t){return t?S.hasFormat(t,this.format):!1}get isMandatoryConstraint(){return!1}};var Me=class{_type;_format;_formatLabel;_formatNoOffset;_id="Constraint.DateTime.MissingValue";constructor(t,e,r){this._type=t,this._format=e,this._formatNoOffset=e.replace(ft,"").trim(),this._formatLabel=r}get type(){return this._type}get id(){return this._id}get format(){return this._format}get formatLabel(){return this._formatLabel}hasValidation(){return!0}get defaultMessage(){return"Date and time should both be entered"}get parameters(){return{format:this.formatLabel}}get formatUtil(){return this.type==="timestamp"?z:W}validate(t){if(!t)return!1;if(this.formatUtil.hasFormat(t,this.format))return!0;if(Ft())if(this.formatUtil.hasFormat(t,this._formatNoOffset)){if(!new RegExp("[+-](0[0-9]|1[0-4]):[0-5][0-9]").test(t))return this._id="Constraint.DateTime.MissingOffset",!1}else return this._id="Constraint.DateTime.MissingValue",!1;return!1}get isMandatoryConstraint(){return!1}};var _e=class{_format;_formatLabel;constructor(t,e){this._format=t,this._formatLabel=e}get id(){return"Constraint.TimeFormat.InvalidFormat"}get format(){return this._format}get formatLabel(){return this._formatLabel}hasValidation(){return!0}get defaultMessage(){return"Time must be entered in the format ${format}"}get parameters(){return{format:this.formatLabel}}validate(t){return t?J.hasFormat(t,this.format):!1}get isMandatoryConstraint(){return!1}};var Ee=class s extends h{_dateInputFormat;constructor(t,e,r){super(t,e,r),this._inputvalue="",this._dateInputFormat="",this.updateInitValue()}get type(){return this.getContributionAsString("type","date")}static isApplicableModel(t){return t.type==="date"||t.type==="time"||t.type==="datetime"||t.type==="timestamp"}get formatUtil(){switch(this.type){case"time":return J;case"timestamp":return z;case"datetime":return W;default:return S}}getInitValue(){let t=this.getDataAsString("value");return t&&(this.type==="time"&&t.length===5&&(t=`${t}:00`),this.type==="datetime"&&t.includes(".")?t=z.toFormat(t,W.getIsoFormat()):t=this.formatUtil.toISO(t),this.hasTime&&(t=this.getTimeValue(t))),t}getTimeValue(t){let e=t;if(this.timeInputFormat.toLowerCase().includes("h")||(e=this.formatUtil.setHour(t,0)),this.timeInputFormat.includes("m")||(e=this.formatUtil.setMinute(t,0)),this.timeInputFormat.includes("s")||(e=this.formatUtil.setSecond(t,0)),this.type==="timestamp"&&!this.timeInputFormat.includes("S")&&(e=this.formatUtil.setMilliseconds(t,0)),Ft()){let r=this.formatUtil.toFormat(t,ft),i=this.formatUtil.toFormat(e,ft);e=e.replace(i,r)}return e}updateInitValue(){let t=this.getInitValue();if(t!=null){this.setInitValue(t);let e=this.getInitialInputValue(t);this._inputvalue=e,this.setValue(t)}}getInitialInputValue(t){if(typeof t!="string")return"";let e=t;return this.type==="time"&&t.length===5&&(e=`${t}:00`),this.formatUtil.toFormat(e,this.inputFormat)}getInputValue(){return this._inputvalue?this._inputvalue.toString():""}get inputvalue(){return this.getInputValue()}set inputvalue(t){this.validate(t),this._inputvalue=t,this.value=t!==null&&t!==""?this.formatUtil.toISO(t,this.inputFormat):null}reset(){this.inputvalue=""}get format(){let t=this.getContributionAsString("format","");return this.formatUtil.convertFormat(t)}get formatLabel(){switch(this.type){case"date":return this.dateInputFormat.toLowerCase();case"time":return this.timeInputFormat.toLowerCase();default:return this.format.toLowerCase()}}get hasDate(){return this.type==="date"||this.type==="datetime"||this.type==="timestamp"}get hasTime(){return this.type==="time"||this.type==="datetime"||this.type==="timestamp"}get inputFormatWithoutOffset(){return this.hasDate&&this.hasTime?`${this.dateInputFormat} ${this.timeInputFormat}`.trim():this.hasDate?this.dateInputFormat:this.hasTime?this.timeInputFormat:""}get inputFormat(){return Ft()&&this.dateInputFormat!==""&&this.timeInputFormat!==""?`${this.inputFormatWithoutOffset} ${ft}`:this.inputFormatWithoutOffset}extractDateInputFormat(){let t=new Set("yMLdQDEewGu"),e=new Set("HhaKmsSZzXxO"),r=this.format,i="",n=!1,o=!1;for(let a=0;a<r.length;a++){let l=a>0?r[a-1]:"",c=a<r.length?r[a+1]:"",w=r[a];w==="'"?n=l==="'"||c==="'"||!n:!n&&t.has(w)?o=!0:!n&&e.has(w)&&(o=!1),o&&(i+=w)}return i.trim()}get dateInputFormat(){return this.hasDate?(this._dateInputFormat||(this._dateInputFormat=this.extractDateInputFormat()),this._dateInputFormat):""}get dateReadonlyFormat(){return this.hasDate?this.hasTime?this.format.replace(this.timeInputFormat,"").trim():this.format:""}get placeholder(){if(super.placeholder)return super.placeholder;let t=this.getContributionAsString("formatlabel");return this.hasDate&&this.hasTime&&t?.includes(" ")?t.split(" ")[0]:t}createTimeInputFormat(){if(!this.hasTime)return"";let t=this.format,e=[];t.includes("H")?e.push("HH"):t.includes("h")&&e.push("hh"),t.includes("m")&&e.push("mm"),t.includes("s")&&e.push("ss");let r=e.join(":");return t.includes("S")&&(r=`${r}.SSS`),t.includes("a")?`${r} a`:r}get timeInputFormat(){return this.createTimeInputFormat()}get timeReadonlyFormat(){return this.createTimeInputFormat()}get dateInputValue(){return typeof this.value=="string"&&this.dateInputFormat!==""?this.formatUtil.toFormat(this.value,this.dateInputFormat):""}get timeInputValue(){return typeof this.value=="string"&&this.timeInputFormat!==""?this.formatUtil.toFormat(this.value,this.timeInputFormat):""}formatValue(t){return typeof t!="string"||t===""?"":(this.type==="datetime"||this.type==="timestamp")&&S.hasFormat(t,xr)?S.toFormat(t,this.dateReadonlyFormat):this.type==="date"?this.formatUtil.toFormat(t,this.dateReadonlyFormat):this.formatUtil.toFormat(t,this.format)}get readonlyvalue(){return typeof this.value=="string"?this.formatValue(this.value):""}get isAmbiguous(){return typeof this.value=="string"?this.formatUtil.isAmbiguous(this.value):!1}get offset(){return typeof this.value=="string"?this.formatUtil.getOffset(this.value):null}get mindate(){return this.getContributionAsString("mindate")}get maxdate(){return this.getContributionAsString("maxdate")}addServerError(t){let{id:e,message:r,properties:i,layouthint:n}=t;i&&"format"in i&&this.formatLabel&&(i.format=this.formatLabel),this.attributeErrors.addServerError(e,r,i,n)}getFormatConstraint(){switch(this.type){case"date":return new Ae(this.dateInputFormat,this.formatLabel);case"time":return new _e(this.timeInputFormat,this.formatLabel);default:return new Me(this.type,this.inputFormat,this.formatLabel)}}addConstraints(){let t=new m;return t.add(this.getFormatConstraint()),(this.mindate||this.maxdate)&&t.add(new Ce(this.type,this.mindate,this.maxdate,this.inputFormat)),t}get readonlyWidth(){return this.type==="date"||this.type==="time"?"SMALL":"MEDIUM"}update(t){return this.inputvalue===t?this:(this.updateLastModification(),this.inputvalue=t,this)}updateByAttribute(t){if(this.reset(),t instanceof s){let e=t.value;if(e!=null){let r=this.formatUtil.toFormat(e,this.inputFormat);this.update(r)}}else console.error(`update of datetime attribute with ${t.type} not supported`)}};var De=class extends h{static isApplicableModel(t){return t.type==="helptext"||"readonly"in t&&"text"in t}get type(){return"helptext"}get text(){let e=this.getData("content")?.text?.message;if(e)return e;let r=this.getContribution("text");return r!=null?typeof r=="string"?r:r.message:null}update(t){return this}updateByAttribute(t){}getFormData(){return null}reset(){}};var ve=class extends h{static isApplicableModel(t){return"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("label"):!1}get type(){return"label"}update(t){return this}updateByAttribute(t){}getFormData(){return null}reset(){}};import{immerable as Ui}from"immer";var Dt=class{[Ui]=!0;static checkHintApplicability=!1;static isApplicableForAttribute(t){return!0}static isApplicableForHint(t){throw new D("Missing isApplicableForHint implementation on layout hint rule")}static initAttribute(t){throw new D("Missing initAttribute implementation on layout hint rule")}static initHint(t){throw new D("Missing initHint implementation on layout hint rule")}};var Wr="equals",zr="includes",$r="notEquals",qr="notIncludes",Xr="notIsEmpty",Yr="isEmpty",Qr="show",Zr="hide",Se=class s extends Dt{_action="";_control="";_operator="";_options=[];static checkHintApplicability=!0;static isApplicableForHint(t){return new RegExp(`^${Wt}\\s?(${Qr}|${Zr})`,"i").test(t)}static getRuleInstance(){return new s}static initHint(t){let e=this.getRuleInstance(),r=`${Wr}|${zr}|${$r}|${qr}|${Xr}|${Yr}`,i=new RegExp(`${Wt}\\s?(\\S*)\\swhen ${Lt}:\\s?(.*?)\\s*(${r})\\s(.*)`,"i"),n=new RegExp(`${Wt}\\s?(\\S*)\\swhen ${Lt}:\\s?(.*?)\\s*(${r})`,"i"),o=t.match(i)?t.match(i):t.match(n);if(o)e.action=o[1],e.control=o[2],e.operator=o[3],e.options=o[4]?o[4]:"";else throw new P(`No dependent information found on layout hint: ${t}`);return e}get action(){return this._action}set action(t){this._action=t}get control(){return this._control}set control(t){this._control=t}get operator(){return this._operator}set operator(t){this._operator=t}get options(){return this._options}set options(t){this._options=t.split("|").map(e=>e.trim())}processEqualsOptions(t){if("selected"in t&&Array.isArray(t.selected)){let e=t.selected;return this.options.every(r=>e.includes(r))}throw new P("Dependent control in combination with equals operator must be a choice, string or number attribute")}processIncludesOptions(t){if(t.type==="choice")return this.options.some(e=>t.selected.includes(e));throw new P("Dependent control in combination with includes operator must be a choice attribute")}handleOperator(t){switch(this.operator){case Wr:return this.processEqualsOptions(t);case zr:return this.processIncludesOptions(t);case $r:return!this.processEqualsOptions(t);case qr:return!this.processIncludesOptions(t);case Xr:return t?.selected.length!==0;case Yr:return t?.selected.length===0;default:throw new P(`Unsupported operator for dependent question: ${this.operator}`)}}getControlAttribute(t){let e=t.getAttributeByLayoutHint(`${Lt}:${this.control}`,`${Lt}: ${this.control}`);return typeof e<"u"&&e!=null&&"selected"in e&&Array.isArray(e.selected)?e:null}process(t,e){let r=this.getControlAttribute(e);if(!r)return;if(r.processLayoutHintRules(e),r.isHidden){t.hide();return}let i=this.handleOperator(r);if(this.action===Qr)t.isHidden=!i;else if(this.action===Zr)t.isHidden=i;else throw new P(`Unsupported action ${this.action} for dependent question on attribute: ${t.label}`)}};var Te=class{_filetypeConstraints;constructor(t){this._filetypeConstraints=t}get id(){return"Constraint.File.InvalidExtension"}get extensions(){return this._filetypeConstraints.map(t=>t.extensions.join(", ")).join(", ")}hasValidation(){return!1}get defaultMessage(){return"Allowed extensions are: ${extensions}"}get parameters(){return{extensions:this.extensions}}validate(){return!0}get isMandatoryConstraint(){return!1}};import Jr from"file-size";var Cr="Constraint.File.MaxTotalFileSize",Ar="Constraint.File.MaxFileSize",Oe=class{_filesizeConstraint;constructor(t){this._filesizeConstraint=t}get id(){return this.filesizeConstraint.isMaxTotal?Cr:this.filesizeConstraint.fileSize!==void 0?Ar:""}get filesizeConstraint(){return this._filesizeConstraint}hasValidation(){return!1}get defaultMessage(){return this.id===Cr?"{filesize-left} van {max-total-filesize} over van totaal toegestaan upload bestandsgrootte":this.id===Ar?"Maximale bestandsgroote is ${max-filesize}":""}get filesize(){return Jr(this.filesizeConstraint.fileSize??0).human("jedec")}get maxTotalFileSize(){if(this.filesizeConstraint.maxTotalFileSize)return Jr(this.filesizeConstraint.maxTotalFileSize).human("jedec")}get parameters(){return this.id===Cr?{"filesize-left":this.filesize,"max-total-filesize":this.maxTotalFileSize}:this.id===Ar?{"max-filesize":this.filesize}:{}}validate(){return!0}get isMandatoryConstraint(){return!1}};var Pi="UNCHANGED",vt=class s extends h{_files;_initialTotalFileSize=0;_maxTotalFileSize;static isApplicableModel(t){return t.type==="binary"}get type(){return"upload"}get multiple(){return this.getContributionAsBoolean("multiple",!1)}get initialTotalFileSize(){return this._initialTotalFileSize??0}set initialTotalFileSize(t){this._initialTotalFileSize=t}get maxTotalFileSize(){return this._maxTotalFileSize}set maxTotalFileSize(t){this._maxTotalFileSize=t}get currentFilesize(){return this.initialTotalFileSize+this.uploadedFileSize}get maxFileSize(){if(this.maxTotalFileSize){let t=this.maxTotalFileSize-this.currentFilesize;return t<0?0:t}return this.getContributionAsNumber("uploadMaxFileSize")}get uploadedFileSize(){if(Object.keys(this.files).length===0)return 0;let t=0;return Object.keys(this.files).forEach(e=>{let r=this.files[e];r.size&&(t+=r.size)}),t}get uploadConstraints(){let t=this.getContributionAsArray("allowedMimeTypes",[]).filter(i=>i!=="[...]");return{fileTypes:this.getContributionAsArray("allowedExtensions",[]).filter(i=>i!=="[...]").map(i=>({extensions:[i],mimeTypes:t})),maxFileSize:{fileSize:this.maxFileSize,maxTotalFileSize:this.maxTotalFileSize,isMaxTotal:this.maxTotalFileSize!==void 0},acceptedFiles:this.acceptedFiles}}get acceptedFiles(){let t=this.getContributionAsArray("allowedMimeTypes",[]).filter(r=>r!=="[...]");return[...this.getContributionAsArray("allowedExtensions",[]).filter(r=>r!=="[...]"),...t]}addConstraints(){let t=new m;return this.uploadConstraints.fileTypes.length>0&&t.add(new Te(this.uploadConstraints.fileTypes)),(this.uploadConstraints.maxFileSize.isMaxTotal||this.uploadConstraints.maxFileSize.fileSize!==void 0)&&t.add(new Oe(this.uploadConstraints.maxFileSize)),t}get files(){return this._files??{}}set files(t){this._files=t}getFilesTypeFromValue(t){if(typeof t=="object")return t;if(typeof t=="string")try{return JSON.parse(t)}catch{console.warn(`Can't parse upload value: ${t}`)}return null}update(t){if(!t)return this;let e=this.getFilesTypeFromValue(t);return e==null?this.inputvalue=t:(this.files=e,this.inputvalue=Object.keys(e).map(r=>e[r].token).join(",")),this.updateLastModification(),this}updateByAttribute(t){}get readonlyvalue(){return this.initvalue?this.initvalue.toString():""}getValue(){return this.hasValue()?this.initvalue===this.inputvalue?Pi:super.getValue():null}mergeAttribute(t){t instanceof s&&t.isValid&&t.inputvalue!==null&&this.update(JSON.stringify(t.files))}reset(){this._files={}}};var ke=class s extends Dt{static isApplicableForAttribute(t){return t.type==="upload"}static initAttribute(){return new s}processUploadInformation(t,e){let r=e.getAttributesByLayoutHint(Xt),i=e.getAttributesByLayoutHint(Yt);if(r.length>0&&i.length>0){let n=r[0].value,o=i[0].value;t.initialTotalFileSize=Number(n),t.maxTotalFileSize=Number(o)}}process(t,e){t instanceof vt&&this.processUploadInformation(t,e)}};var Bt=[Se,ke],kl=s=>{Bt.push(s)},xl=s=>{let t=s(Bt);if(Array.isArray(t))Bt=t;else throw new Ir("Result of updater of updateLayoutHintRules is not an array")},xe=class s extends p{get allRules(){return Bt}static setLayoutHintRules(t){let e=new s;return Bt.forEach(r=>{r.isApplicableForAttribute(t)&&(r.checkHintApplicability?t.layouthint.forEach(i=>{r.isApplicableForHint(i)&&e.add(r.initHint(i))}):e.add(r.initAttribute(t)))}),t.layoutHintRules=e,t}process(t,e){this.all.forEach(r=>{r.process(t,e)})}};var Ie=class{get id(){return"Constraint.BSN.InvalidFormat"}hasValidation(){return!0}get defaultMessage(){return"Must be a valid BSN"}get parameters(){return{}}isValidBSN(t){if(t.replace(/[^\d]/gu,"").length!==t.length)return!1;let e=t.replace(/\D/gu,""),r=e.length;if(r<8||r>9||Number.isNaN(e))return!1;let o=0,a=0;for(let l=r;l>0;l--){let c=parseInt(e.charAt(o),10);a+=l===1?c*-1:c*l,o+=1}return a%11===0}validate(t){return this.isValidBSN(t)}get isMandatoryConstraint(){return!1}};import Hi from"iban";var Re=class{get id(){return"Constraint.IBAN.InvalidFormat"}hasValidation(){return!0}get defaultMessage(){return"Must be a valid IBAN number"}get parameters(){return{}}validate(t){return Hi.isValid(t)}get isMandatoryConstraint(){return!1}};var rt=class{_regexConstraint;constructor(t){this._regexConstraint=t}get id(){return this.regexConstraint.messageKey}get regexConstraint(){return this._regexConstraint}hasValidation(){return!0}get defaultMessage(){return this.regexConstraint.defaultMessage||this.regexConstraint.messageKey}get parameters(){return{regex:this.regexConstraint.regex}}validate(t){return this.regexConstraint.regex instanceof RegExp?this.regexConstraint.regex.test(t):new RegExp(this.regexConstraint.regex).test(t)}get isMandatoryConstraint(){return!1}};var K=class s extends h{get type(){return"string"}static isApplicableModel(t){return"type"in t&&t.type==="string"?!0:"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("string"):!1}getInitialInputValue(t){return this.formatValue(t)}get regexp(){return this.getContributionAsString("regexp")}get regexpvalidationmessage(){return this.getContributionAsString("regexpValidationMessage")}get postfix(){return this.getContributionAsString("postfix","")}get prefix(){return this.getContributionAsString("prefix","")}isBSN(){return this.layouthint.has("bsn")}isIBAN(){return this.layouthint.has("iban")}isZipcode(){return this.layouthint.has("zipcode")}isEmail(){return this.layouthint.has("email")}addConstraints(){let t=new m;return this.isBSN()?t.add(new Ie):this.isIBAN()&&t.add(new Re),this.isZipcode()?t.add(new rt({messageKey:"Constraint.ZipCode.InvalidFormat",defaultMessage:"Must be a valid Dutch ZIP code, e.g. 1234 AB",regex:new RegExp("^[1-9][0-9]{3} ?[a-zA-Z]{2}$","gi")})):this.isEmail()&&this.regexp?t.add(new rt({messageKey:"Constraint.Email.InvalidFormat",defaultMessage:"Must be a valid e-mail address",regex:new RegExp(this.regexp,"gi")})):this.regexp&&t.add(new rt({messageKey:"Constraint.String.InvalidRegex",defaultMessage:this.regexpvalidationmessage,regex:this.regexp})),t}reset(){this.inputvalue=""}formatIBAN(t){let r=this.removeFormat(t).replace(/\s/g,"").match(/.{1,4}/g);return r==null?"":r.join(" ")}formatZipcode(t){let e=this.removeFormat(t);return e.length===6?e.substring(0,4)+" "+e.substring(4).toUpperCase():e}formatBSN(t){return this.removeFormat(t)}formatValue(t){return t==null||t.toString()===""?"":typeof t=="string"?this.isIBAN()?this.formatIBAN(t):this.isZipcode()?this.formatZipcode(t):this.isBSN()?this.formatBSN(t):t.replace(/ {2}/gi," \xA0"):JSON.stringify(t)}removeFormat(t){return t==null||t.toString()===""?"":typeof t=="string"?this.isIBAN()||this.isZipcode()||this.isBSN()?t.replace(/[^a-z0-9,]/gi,""):t:JSON.stringify(t)}get validateValue(){return this.removeFormat(this.inputvalue)}get inputvalue(){return this.getInputValue()}set inputvalue(t){this.setInputvalue(t),t==null?this.value=t:this.value=this.removeFormat(t),this.validate(this.validateValue)}get readonlyvalue(){return typeof this.value=="string"?this.formatValue(this.value).replace(/ {2}/gi," \xA0"):this.value==null?"":JSON.stringify(this.value)}update(t){return this.inputvalue===t?this:(this.updateLastModification(),this.inputvalue=t,this)}updateByAttribute(t){this.reset(),t instanceof s?this.update(t.value):console.error(`update of string attribute with ${t.type} not supported`)}get readonlyWidth(){return this.isZipcode()||this.isBSN()?"SMALL":this.isIBAN()?"LARGE":"MEDIUM"}};var Le=class extends K{static isApplicableModel(t){return"type"in t&&typeof t.type=="string"&&t.type==="memo"?!0:"rows"in t&&typeof t.rows=="number"?t.rows>1:!1}get type(){return"memo"}get rows(){return this.getContributionAsNumber("rows",10)}get formatted(){return this.getContributionAsBoolean("formatted",!1)}get readonlyWidth(){return"LARGE"}};var ti=L(Vr(),1);var Mr="Constraint.Number.InexactNumber",_r="Constraint.Number.OutOfRange",Er="Constraint.Number.BelowMinimum",Dr="Constraint.Number.AboveMaximum",Fe=class{_minNumber;_maxNumber;_groupingSeparator=",";_decimalSeparator=".";_format="";constructor(t=null,e=null,r=",",i=".",n){this._format=n??"",this._groupingSeparator=r,this._decimalSeparator=i,this._minNumber=t,this._maxNumber=e}get id(){return this.minNumber!==null&&this.maxNumber!==null&&this.minNumber===this.maxNumber?Mr:this.minNumber!==null&&this.maxNumber!==null?_r:this.minNumber!==null?Er:this.maxNumber!==null?Dr:"Constraint.Number.NoBoundaryConstraint"}get minNumber(){return this._minNumber}get maxNumber(){return this._maxNumber}get format(){return this._format}get groupingSeparator(){return this._groupingSeparator}get decimalSeparator(){return this._decimalSeparator}hasValidation(){return!0}get defaultMessage(){switch(this.id){case Mr:return"Number must be precisely ${min-number}";case _r:return"Must be between ${min-number} and ${max-number}";case Er:return"The number must be larger than ${min-number}";case Dr:return"The number must be smaller than ${max-number}";default:return""}}get parameters(){return{"min-number":this.minNumber===null?null:T.formatNumber(this.minNumber,this.format,this.groupingSeparator,this.decimalSeparator),"max-number":this.maxNumber===null?null:T.formatNumber(this.maxNumber,this.format,this.groupingSeparator,this.decimalSeparator)}}isExactNumber(t){return T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator)===this.minNumber}isSameOrAboveMinNumber(t){let e=T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator);return isNaN(e)||e==null?!1:this.minNumber!=null&&e>=this.minNumber}isSameOrBelowMaxNumber(t){let e=T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator);return isNaN(e)||e==null?!1:this.maxNumber!=null&&e<=this.maxNumber}isBetweenNumbers(t){return this.isSameOrAboveMinNumber(t)&&this.isSameOrBelowMaxNumber(t)}validate(t){switch(this.id){case Mr:return this.isExactNumber(t);case _r:return this.isBetweenNumbers(t);case Er:return this.isSameOrAboveMinNumber(t);case Dr:return this.isSameOrBelowMaxNumber(t);default:return!0}}get isMandatoryConstraint(){return!1}};var vr="Constraint.Number.InvalidInteger",we=class{_decimalSeparator=",";_groupingSeparator=".";_format="0";constructor(t=",",e=".",r="0"){this._decimalSeparator=e,this._groupingSeparator=t,this._format=r??"0"}get id(){return this.maxDigits===0?vr:"Constraint.Number.InvalidDecimal"}get decimalSeparator(){return this._decimalSeparator}get groupingSeparator(){return this._groupingSeparator}get format(){return this._format}get maxDigits(){return this.format?new ie(this.format).maxFrac:0}hasValidation(){return!0}get defaultMessage(){return this.id===vr?"Must be a whole number":"The value is not correct numeric format"}get parameters(){return{"max-digits":this.maxDigits}}isInteger(t){return Number.isInteger(t)}getNumberOfDigits(t){return Math.floor(t)===t?0:T.parseNumberToString(t).split(".")[1].length}isValidDecimal(t){if(isNaN(t))return!1;let e=this.getNumberOfDigits(t);return!isNaN(parseFloat(String(t)))&&isFinite(t)&&e<=this.maxDigits}validate(t){if(this.maxDigits===0&&this.decimalSeparator!==""&&t.toString().includes(this.decimalSeparator))return!1;let e=T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator);return this.id===vr?this.isInteger(e):this.isValidDecimal(e)}get isMandatoryConstraint(){return!1}};var Gi=3,Ne=class{_decimalSeparator;_groupingSeparator;_format;constructor(t=",",e=".",r="0"){this._decimalSeparator=e,this._groupingSeparator=t,this._format=r??"0"}get id(){return"Constraint.Number.GroupingSeparator"}get decimalSeparator(){return this._decimalSeparator}get groupingSeparator(){return this._groupingSeparator}get format(){return this._format}get groupSize(){if(this.format){let t=new ie(this.format).comma;if(t>0)return t}return Gi}hasValidation(){return!0}get defaultMessage(){return"Group divider '${group-divider}' must be correctly placed"}get parameters(){return{"group-divider":this.groupingSeparator}}hasCorrectGrouping(t){let e=t.replace("-","").replace("+","");if(!e.includes(this.groupingSeparator))return!0;let r=e;if(this.decimalSeparator!==""&&e.includes(this.decimalSeparator)){if(e.indexOf(this.decimalSeparator)<e.indexOf(this.groupingSeparator))return!1;r=e.substring(0,e.indexOf(this.decimalSeparator))}let i=r.split(this.groupingSeparator);return i[0].length<this.groupSize&&(i=i.slice(1)),i.every(n=>n.length===this.groupSize)}validate(t){return this.groupingSeparator===""||typeof t!="string"||!t.includes(this.groupingSeparator)||this.hasCorrectGrouping(t)}get isMandatoryConstraint(){return!1}};var St=class s extends h{static isApplicableModel(t){return"type"in t&&typeof t.type=="string"?t.type==="number"||t.type==="integer":!1}get type(){return"number"}getInitialInputValue(t){return t==null?"":this.formatValue(t)}get groupingSeparator(){return this.getContributionAsString("groupingSeparator","")}get decimalSeparator(){return this.getContributionAsString("decimalSeparator","")}get minNumber(){return this.getContributionAsNumber("minimum")}get maxNumber(){return this.getContributionAsNumber("maximum")}get maxDigits(){let t=this.format;return t!=null&&t.includes(".")?t.split(".")[1].length:0}get unit(){return this.getContributionAsString("unit","")}addConstraints(){let t=new m;return t.add(new we(this.groupingSeparator,this.decimalSeparator,this.format)),t.add(new Ne(this.groupingSeparator,this.decimalSeparator,this.format??void 0)),t.add(new Fe(this.minNumber,this.maxNumber,this.groupingSeparator,this.decimalSeparator,this.format??void 0)),t}reset(){this.inputvalue=""}get format(){return this.getContributionAsString("format","0")}formatValue(t){return typeof t=="string"||typeof t=="number"?T.formatNumber(t,this.format,this.groupingSeparator,this.decimalSeparator):""}get readonlyvalue(){return(0,ti.default)(this.value)?JSON.stringify(this.value):this.formatValue(this.value)}get inputvalue(){return this.getInputValue()}set inputvalue(t){this.setInputvalue(t),this.validate(t);let e=T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator);this.value=isNaN(e)?null:T.parseNumberToString(e)}getValue(){let t=super.getValue();return t==null||t===""?null:Number(t)}update(t){return t===this.inputvalue?this:(this.updateLastModification(),this.inputvalue=t,this)}updateByAttribute(t){this.reset(),t instanceof s?this.update(t.value):console.error(`update of number attribute with ${t.type} not supported`)}get isHidden(){return super.isHidden||this.layouthint.has(Xt,Yt,gt)}set isHidden(t){super.isHidden=t}get readonlyWidth(){return"SMALL"}};var Be=class extends St{static isApplicableModel(t){return"type"in t&&typeof t.type=="string"&&t.type==="money"?!0:"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("money"):!1}get type(){return"money"}get currencySymbol(){return this.getContributionAsString("currencySymbol","")}get prefix(){return this.currencySymbol}get readonlyWidth(){return"SMALL"}};var jt=class{_otherPasswordLabel;_otherPasswordValue;constructor(t,e){this._otherPasswordLabel=e,this._otherPasswordValue=t}get id(){return"Constraint.Password.ConfirmMismatch"}get otherPasswordLabel(){return this._otherPasswordLabel}get otherPasswordValue(){return this._otherPasswordValue}hasValidation(){return!0}get defaultMessage(){return"Must match ${other} field"}get parameters(){return{other:this.otherPasswordLabel}}validate(t){return t===this.otherPasswordValue}get isMandatoryConstraint(){return!1}};var je=class{get id(){return"Constraint.Password.LowerAndUpperCaseMandatory"}hasValidation(){return!0}get defaultMessage(){return"Must contain both upper and lowercase characters"}get parameters(){return{}}validate(t){return/[a-z]/u.test(t)&&/[A-Z]/u.test(t)}get isMandatoryConstraint(){return!1}};var Ve=class{_minNumeric;constructor(t){this._minNumeric=t}get id(){return"Constraint.Password.MinNumericCharactersMandatory"}get minNumeric(){return this._minNumeric}hasValidation(){return!0}get defaultMessage(){return"Must contain ${min-numeric} or more numerical characters"}get parameters(){return{"min-numeric":this.minNumeric}}validate(t){return t.replace(/\D/gu,"").length>=this.minNumeric}get isMandatoryConstraint(){return!1}};var Ue=class{_minSpecial;constructor(t){this._minSpecial=t}get id(){return"Constraint.Password.MinSpecialCharactersMandatory"}get minSpecial(){return this._minSpecial}hasValidation(){return!0}get defaultMessage(){return"Must contain ${min-special} or more special characters"}get parameters(){return{"min-special":this.minSpecial}}validate(t){return t.replace(/[\da-z]/giu,"").length>=this.minSpecial}get isMandatoryConstraint(){return!1}};var Pe=class{_maxSequence;constructor(t=2){this._maxSequence=t}get id(){return"Constraint.Password.ThreeConsecutiveCharactersNotAllowed"}get maxSequence(){return this._maxSequence}hasValidation(){return!0}get defaultMessage(){return"Must not contain any character more than twice consecutively"}get parameters(){return{"max-sequence":this.maxSequence}}hasNoSequenceOfIdenticalCharacters(t){return!t.split("").filter((e,r)=>t.indexOf(e)===r).some(e=>{let r=e.repeat(this.maxSequence+1);return t.includes(r)})}validate(t){return this.hasNoSequenceOfIdenticalCharacters(t)}get isMandatoryConstraint(){return!1}};var He=class extends K{_confirmValue;_isConfirmPassword=!1;_otherLabel="";static isApplicableModel(t){return t.type==="password"?!0:"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("password"):!1}get type(){return"password"}update(t){return this.updateLastModification(),this.inputvalue=t,this}get constraints(){return this.getContributionAsObject("constraints",{})}get upperAndLowerCaseMandatory(){return this.constraints.upperAndLowerCaseMandatory}get maxSequenceOfIdenticalCharacters(){return this.constraints.maxSequenceOfIdenticalCharacters}get maxSequenceOfUsernameCharacters(){return this.constraints.maxSequenceOfUsernameCharacters}get minNumberOfNumericCharacters(){return this.constraints.minNumberOfNumericCharacters}get minNumberOfSpecialCharacters(){return this.constraints.minNumberOfSpecialCharacters}get regexConstraint(){return this.constraints.regexConstraint}addConstraints(){return this.isConfirmPassword?this.getConfirmPasswordConstraints():this.getStandardPasswordConstraints()}getConfirmPasswordConstraints(){let t=new m;return t.add(new jt(this.confirmValue,this.otherLabel)),t}getStandardPasswordConstraints(){let t=new m;return this.upperAndLowerCaseMandatory&&t.add(new je),this.maxSequenceOfIdenticalCharacters&&t.add(new Pe(this.maxSequenceOfIdenticalCharacters)),this.minNumberOfNumericCharacters&&t.add(new Ve(this.minNumberOfNumericCharacters)),this.minNumberOfSpecialCharacters&&t.add(new Ue(this.minNumberOfSpecialCharacters)),this.regexConstraint&&this.regexConstraint.length>0&&this.regexConstraint.forEach(e=>{t.add(new rt(e))}),this.layouthint.has(Fr)&&this.isConfirmPassword==null&&t.add(new jt(this.confirmValue,this.otherLabel)),t}get constraintCollection(){return this.isConfirmPassword?this.getConfirmPasswordConstraints():super.constraintCollection}get isConfirmPassword(){return this._isConfirmPassword}set isConfirmPassword(t){this._isConfirmPassword=t}get confirmValue(){return this._confirmValue??""}set confirmValue(t){this._confirmValue=t,this.validate(this.inputvalue)}get otherLabel(){return this._otherLabel}set otherLabel(t){this._otherLabel=t}validate(t){return this.useClientsideValidation()?(this.isOptionalAndEmpty(t)?this.setIsValid(!0):this.getPreviouslyValidatedValue()!==`${this.confirmValue}-${t}`&&this.setIsValid(this.constraintCollection.validate(t)),this.setPreviouslyValidatedValue(`${this.confirmValue}-${t}`),this.getIsValid()):!0}getFormData(){return this.isConfirmPassword||this.inError()?null:{[this.name]:this.value}}};var Ge=class{_type;_start;_end;constructor(t,e,r){this._type=t,this._start=e,this._end=r}get type(){return this._type}get id(){switch(this.type){case"date":return"Constraint.DateRange.Mandatory";case"time":return"Constraint.TimeRange.Mandatory";case"datetime":return"Constraint.DateTimeRange.Mandatory";case"timestamp":return"Constraint.TimeStampRange.Mandatory";default:return"Constraint.Range.Mandatory"}}hasValidation(){return!0}get defaultMessage(){return"Field is mandatory: must contain at least a start or end value"}get parameters(){return{}}validate(){return this._start.hasErrors()||(this._end?.hasErrors()??!1)?!0:this._start.hasValue()||(this._end?.hasValue()??!1)}get isMandatoryConstraint(){return!0}};var Ke=class{_start;_end;constructor(t,e){this._start=t,this._end=e}get id(){let t=this.hasInclusiveBounds?"InvalidRangeInclusive":"InvalidRange";switch(this.rangeType){case"time":return`Constraint.TimeRange.${t}`;case"date":return`Constraint.DateRange.${t}`;case"datetime":return`Constraint.DateTimeRange.${t}`;case"timestamp":return`Constraint.TimeStampRange.${t}`;default:return`Constraint.NumberRange.${t}`}}get defaultMessage(){let t=this.hasInclusiveBounds?" or equal to the":"";switch(this.rangeType){case"time":return`Start time must be before${t} end time`;case"date":return`Start date must be before${t} end date`;case"datetime":return`Start value must be before${t} end value`;case"timestamp":return`Start value must be before${t} end value`;default:return`Start value must be less than${t} the end value`}}hasValidation(){return!0}get parameters(){return{}}get start(){return this._start}get end(){return this._end}get rangeType(){return this.start.type}get hasInclusiveBounds(){return this.start.operator==="greaterThanOrEqualTo"&&this.end.operator==="lessThanOrEqualTo"}getDateTimeUtil(){switch(this.rangeType){case"time":return J;case"date":return S;case"timestamp":return z;default:return W}}doValidate(t,e){return typeof t=="number"&&typeof e=="number"?this.hasInclusiveBounds?T.isSameOrBefore(t,e):T.isBefore(t,e):typeof t=="string"&&typeof e=="string"?this.hasInclusiveBounds?this.getDateTimeUtil().isSameOrBefore(t,e):this.getDateTimeUtil().isBefore(t,e):!1}validate(){return this.start.inError()||this.end.inError()?!0:this.doValidate(this.start.value,this.end.value)}get isMandatoryConstraint(){return!1}};var it=class s extends h{_startAttribute;_endAttribute;constructor(t,e,r){if(super(t,e,r),!Array.isArray(e?.children))throw new Error(`Problem reading contributions of range attribute: ${this.key}, the children property must be an array.`);this._startAttribute=this.createChild(0),this._endAttribute=this.createChild(1),this.setChildrenOptionality()}get start(){return this._startAttribute}get end(){return this._endAttribute}get type(){return"range"}static isApplicableModel(t){return t.type.includes("range")}getInitialChildModelLinks(){return[...this.start.getInitialChildModelLinks(),...this.end.getInitialChildModelLinks()]}setChildModels(t,e){this.start.setChildModels(t,e),this.end.setChildModels(t,e)}getInputValue(){return[this.start.getInputValue(),this.end.getInputValue()].join(",")}hasValue(){return this.start.hasValue()||this.end.hasValue()}get constraintCollection(){let t=new m;return t.add(this.getServerConstraints()),t.add(this.addConstraints()),t}setUseClientsideValidation(t){super.setUseClientsideValidation(t),this.start.setUseClientsideValidation(t),this.end.setUseClientsideValidation(t)}validate(t){if(!this.useClientsideValidation())return!0;let e=this.start.isValid&&this.end.isValid;return e&&(e=this.constraintCollection.validate(t)),this.setIsValid(e),this.getIsValid()}addConstraints(){let t=new m;return this.start.hasValue()&&this.end.hasValue()&&t.add(new Ke(this.start,this.end)),this.mandatory&&!this.start.mandatory&&!this.end.mandatory&&t.add(new Ge(this.start.type,this.start,this.end)),t}get isValid(){return this.validate("")}hasServerErrors(){return this.errorCollection.serverErrors.length>0||this.start.hasServerErrors()||this.end.hasServerErrors()}hasErrors(){return this.errorCollection.hasItems()||this.start.hasErrors()||this.end.hasErrors()}reset(){this.start.reset(),this.end.reset()}mergeAttribute(t){this.concept=t.concept,t instanceof s&&(this.start.mergeAttribute(t.start),this.end.mergeAttribute(t.end))}update(t,e){if(!e)throw new A("Range attribute needs changed attribute on update call");return this.updateLastModification(),this.start.equals(e)&&this.start.update(t),this.end.equals(e)&&this.end.update(t),this.setChildrenOptionality(),this.validate(t),this}updateByAttribute(t){t instanceof s?(this.start.updateByAttribute(t.start),this.end.updateByAttribute(t.end)):console.error(`update of range attribute with ${t.type} not supported`)}get readonly(){return super.readonly??(this.start.readonly&&this.end.readonly)}set readonly(t){super.readonly=t}get readonlyvalue(){let t=[];return this.start.value!==null&&t.push(this.start.value),this.end.value!==null&&t.push(this.end.value),t.join(", ")}get initvalue(){return{[this.start.key]:this.start.initvalue,[this.end.key]:this.end.initvalue}}getFormData(){return{[this.name]:this.value}}getValue(){return{...this.start.formdata,...this.end.formdata}}get isResult(){return this._isResult}set isResult(t){this._isResult=t,this.start.isResult=t,this.end.isResult=t}indicateContentConfiguration(t){t&&(this.start.indicateContentConfiguration(t),this.end.indicateContentConfiguration(t))}equals(t){return this.key===t.key&&this.parentKey===t.parentKey||this.start.equals(t)||this.end.equals(t)}get readonlyWidth(){switch(this.start.type){case"datetime":return"LARGE";case"timestamp":return"EXTRA_LARGE";default:return"MEDIUM"}}createChild(t){let e=this.data.children?.[t];Array.isArray(e)&&(e=void 0);let r=this.contributions.children[t],[i]=Object.keys(r),n=r[i],o=v.createAttribute(i,e??{},n,this.modelOptions);return o&&e&&"key"in e&&(o.parentKey=e.key),o}setChildrenOptionality(){let t=!this.mandatory&&this.start.value===null&&this.end.value===null;this.start&&(this.start.mandatory=t||this.start.configuredMandatory?!1:this.start.configuredMandatory),this.end&&(this.end.mandatory=t||this.end.configuredMandatory?!1:this.end.configuredMandatory)}};var We=class{get id(){return"Constraint.XML.InvalidFormat"}hasValidation(){return!0}get defaultMessage(){return"Must be well-formed XML"}get parameters(){return{}}isValidXML(t){let e=new DOMParser;try{if(e.parseFromString(t,"text/xml").querySelectorAll("parsererror").length>0)return!1}catch{return!1}return!0}validate(t){return this.isValidXML(t)}get isMandatoryConstraint(){return!1}};var ze=class extends K{static isApplicableModel(t){return"type"in t&&typeof t.type=="string"&&t.type==="xml"?!0:"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("xml"):!1}get type(){return"xml"}get rows(){return 10}addConstraints(){let t=new m;return t.add(new We),t}get readonlyWidth(){return"EXTRA_LARGE"}};var v=class{static get ATTRIBUTE_MODELS(){return[X,ye,De,ve,ze,Le,K,Ee,Be,St,He,vt,M,it,be]}static createAttribute(t,e,r,i){let n=this.getAttributeModel(r);if(!n)throw new Error("Could not find model for contributions: "+r);let o=r.children,a=new qe(t,e,Array.isArray(o)?qe.getChildrenKeys(o):[]).getData(),l=new n(a,r,i);return xe.setLayoutHintRules(l),l}static getAttributeModel(t){return this.ATTRIBUTE_MODELS.find(e=>e.isApplicableModel(t))}},qe=class s{_key;_data;_value;_links;_children;constructor(t,e,r){this._key=t,this._data=this.getAttributeData(t,e),this._value=this.getValue(),this._links=this.getLinks(),this._children=this.createChildren(e,r)}get key(){return this._key}get data(){return this._data}get value(){return this._value}get links(){return this._links}get children(){return this._children}getAttributeData(t,e){return Array.isArray(e)?e.find(r=>"elementid"in r&&r.elementid===t||"name"in r&&r.name===t||"param"in r&&r.param===t)||{}:e}getValue(){let t;return this.key in this.data?t=this.data[this.key]:"values"in this.data?t=this.data.values:"value"in this.data?t=this.data.value:"suggestions"in this.data?t=this.data.suggestions:"suggestion"in this.data?t=this.data.suggestion:"options"in this.data&&Array.isArray(this.data.options)&&(t=this.data.options.filter(e=>e.selected).map(e=>e.code||e.key)),t}getDynamicschemaFromData(){if("dynamicschema"in this.data){let{dynamicschema:t}=this.data;return Array.isArray(t),t}return null}getDynamicSchema(){let t=this.getDynamicschemaFromData();if(!t)return;if(Array.isArray(t))return t;let e=this.getDynamicSchemaId();if(typeof e=="string"&&e in t&&Array.isArray(t[e]))return t[e].map(r=>"elements"in r?{...r,elements:{...r.elements,dynamicschema:t}}:r)}getDynamicSchemaId(){return typeof this.data.dynamicschemaId=="string"||typeof this.data.dynamicschemaId=="number"?this.data.dynamicschemaId:this.key}getStatic(){return typeof this.data.static=="boolean"?this.data.static:!1}getLinks(){return(0,Sr.pick)(this.data._links,["concept","download","lookupOptions","lookupList"])}getOptions(){return this.data.options}getMessage(){return this.data.message}isResult(){return typeof this.data.isResult=="boolean"?this.data.isResult:!1}getReferenceDate(){if(typeof this.data.referenceDate=="string")return this.data.referenceDate}getContent(){if("content"in this.data){let t=(0,Sr.pick)(this.data.content,["header","label","elements","layouthint","text"]);if(Object.keys(t).length>0)return t}return null}getData(){return{key:this.key,value:this.value,static:this.getStatic(),_links:this.links,dynamicschema:this.getDynamicSchema(),dynamicschemaId:this.getDynamicSchemaId(),options:this.getOptions(),message:this.getMessage(),isResult:this.isResult(),referenceDate:this.getReferenceDate(),content:this.getContent(),children:this.children}}static getChildrenKeys(t){return t.map(e=>{let[r]=Object.keys(e),i=e[r].type==="range"||e[r].type==="composite",n=e[r].dynamicschemaId,o=i?e[r]?.children:[];return{key:r,dynamicschemaId:n,children:this.getChildrenKeys(o)}})}createChildren(t,e){if(this.value===null)return e.map(n=>this.createChild(t,{[n.key]:null},n));let i=this.value;return Array.isArray(i)?i.map(n=>e.map(o=>{let a=this.childData(n,this.key,o.key);return this.createChild(t,a,o)})):e.map(n=>{let o=this.childData(t,this.key,n.key);return this.createChild(t,o,n)})}getDataContent(t,e){if(t&&e in t)return t[e]}childData(t,e,r){if(Array.isArray(t)){if(Array.isArray(this.data.elements))return this.data.elements.find(i=>i.elementid===r)}else if(e in t&&(0,$e.default)(t[e])){let i=t[e],n=this.getDataContent(t.content,r);return{...i,content:n}}else if(r in t&&(0,$e.default)(t[r]))return t[r];return(0,$e.default)(t)?t:{}}createChild(t,e,r){let i="dynamicschema"in t?t.dynamicschema:void 0,n=null;return r.dynamicschemaId?n=r.dynamicschemaId:r.key&&typeof t=="object"&&"key"in t&&typeof t.key=="string"&&(n=`${t.key}.${r.key}`),new s(r.key,{...e,dynamicschema:i,dynamicschemaId:n},r.children).getData()}};var Et=class{[Ki]=!0;_key;_header;_sortOption;_readonlyWidth;constructor(t,e){let[r]=Object.keys(t),i=v.createAttribute(r,{elementid:r},t[r]);this._readonlyWidth=i.readonlyWidth,this._key=r,this._header=t[r],this._sortOption=e?.find(n=>n.key===r)}get key(){return this._key}get label(){return this._header.label}get type(){return this._header.type}get layouthint(){return new b(this._header.layouthint)}get alignment(){let t=this.layouthint.getByLayoutHint("align-");return t===null?"left":t.substring(6)}get readonlyWidth(){return this._readonlyWidth??"MEDIUM"}equals(t){return t.key===this.key}get sortOption(){return this._sortOption}hasSorting(){return this.sortOption!=null}};var ei=L(pr(),1);var Xe=class s extends d{_fieldCollection;_selfhref;_icon;constructor(t,e,r){super(t,e,r),this._fieldCollection=this.createFieldCollection(r)}static create(t,e,r,i="form",n,o){let a={name:t,href:e},l={name:t,label:r??t,type:i};return new s(a,l,{origin:n,contextPath:o})}createFieldCollection(t){let e={},r=[];return"fields"in this.data&&typeof this.data.fields=="object"&&this.data.fields!=null&&(e=this.data.fields),"fields"in this.contributions&&Array.isArray(this.contributions.fields)&&(r=this.contributions.fields),new E(e,r,{...t,isReadonly:!0})}get isDisabled(){return!this.data.href}get selfhref(){return this._selfhref??new y(`${this.data.href}?${this.querystring}`,"Form",this.modelOptions)}set selfhref(t){this._selfhref=t}get method(){let t=this.getDataAsString("method","POST");return mt[t]}get type(){return this.layouthint.has(qt)?"create":this.layouthint.has($t)?"update":this.layouthint.has(zt)?"delete":this.getContributionAsString("type","general")}get name(){return this.getDataAsString("name","unknown")}get fields(){return this._fieldCollection.all}get fieldCollection(){return this._fieldCollection}set fieldCollection(t){this._fieldCollection=t}get querystring(){return this.fields.filter(t=>t.value!=null&&t.value!=="").map(t=>{let{value:e}=t;return e!==null?`${t.name}=${e}`:t.name}).join("&")}getFieldByKey(t){return this._fieldCollection.getAttributeByKey(t)}hasFieldByKey(t){return this.getFieldByKey(t)!=null}get key(){return this.getDataAsString("name")}get label(){return this.getContributionAsString("label",this.key)}get isProcessTask(){return(0,ei.default)(this.contributions,"processTask")}get processStatus(){if(this.isProcessTask){let t=this.data.processStatus||{},e=this.contributions.processTask||{};return new Ct(t,e,this.modelOptions)}}get icon(){return this._icon}set icon(t){this._icon=t}};var F=class s extends p{constructor(t,e,r){super(),this.collection=this.createCollection(t,e,r)}createCollection(t,e,r){let i=[];if(t&&e&&Array.isArray(t)&&Array.isArray(e))for(let n of t){let o=e.find(a=>{if(typeof a=="object"&&a!==null&&"name"in a&&"type"in a&&"name"in n)return a.name===n.name&&a.type!=="service-operation"});o&&i.push(new Xe(n,o,r))}return i}getActionByKey(t){let e=new s;return e.collection=this.filter(r=>r.key===t),e.first}getActionsByType(t){let e=new s;return e.collection=this.filter(r=>Array.isArray(t)?t.includes(r.type):r.type===t),e}getActionsByLayoutHint(...t){let e=new s;return e.collection=this.filter(r=>r.layouthint.has(...t)),e}hasActionsByLayoutHint(...t){return this.getActionsByLayoutHint(...t).length>0}get routePath(){let t=this.collection.filter(r=>!r.isDisabled);if(t.length===0)return"__NON_EXISTING_ROUTE__";let e=t.map(r=>r.selfhref.path).join("|");return this.length>1?`(${e})`:e}};var ht=class extends u{get type(){return"User"}get username(){return this.getDataAsString("Username","Guest")}get fullname(){return this.getDataAsString("Fullname","Guest")}};var Ye=class extends u{_user;_mustChangePassword=!1;get type(){return"UserServices"}getInitialChildModelLinks(){let t=this.userLink;return t?[t]:[]}setChildModels(t,e){this.user=t.find(r=>r instanceof ht)}get userLink(){return this.links.getLinkByKey("Userdata")}get user(){return this._user}set user(t){this._user=t}get changePassword(){return this.links.getLinkByKey("ChangePassword")?.href}get isLoggedIn(){let t=this.user instanceof ht;return this.links.length>3||t||te.getItem("basic-ok")===!0}set mustChangePassword(t){this._mustChangePassword=t}get mustChangePassword(){return this._mustChangePassword}};var ri=class extends u{_userServices;constructor(t){super(t),te.setItem("primaryAuthenticationType",this.primaryAuthenticationType)}get type(){return"Application"}get tabs(){return this.links.getLinksByGroup("tab")}get modelcatalog(){return H.create("modelcatalog","/modelcatalog","Model catalog",this.modelOptions)}get userServices(){return this._userServices}set userServices(t){this._userServices=t}get user(){return this.userServices?.user}get userHref(){return this.userServices?.userLink?.href}getInitialChildModelLinks(){let t=this.links.getLinkByKey("UserServices");if(t&&t.href.path==="/login")throw new Rr("The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.");return t?[t]:[]}setChildModels(t,e){this.userServices=t.find(r=>r instanceof Ye)}get isLoggedIn(){return this.userServices?.isLoggedIn??!1}get userMustChangePassword(){return this.userServices?.mustChangePassword??!1}get authenticationTypes(){let t=this.getContributionAsArray("security",[dr]);return t?t?.sort((e,r)=>e.isPrimary===r.isPrimary?0:e.isPrimary?-1:1):[dr]}get primaryAuthenticationType(){return this.authenticationTypes[0]}};var ii=L(lt(),1);var dt=class s extends d{_key;_attributeCollection;constructor(t="",e,r,i){super(e,r,i);let n=this.contributions.attributes?this.contributions.attributes.filter(o=>{let[a]=Object.keys(o);return(0,ii.has)(this.data,a)}):[];this._attributeCollection=new E(this.data,n,{...i,isReadonly:!0}),this._key=t}get key(){return this._key}set key(t){this._key=t}get label(){return this.contributions.label}get attributeCollection(){return this._attributeCollection}set attributeCollection(t){this._attributeCollection=t}createChildAttributeSetModel(t,e,r){let i=this.contributions.objects;return new s(r?`${t}-${r+1}`:t,{...e,dynamicschema:this.data.dynamicschema},i?.[t],this.modelOptions)}getChildAttributeSets(){if(!this.contributions.objects)return[];let t=[];for(let e of Object.keys(this.contributions.objects))if(e in this.data){let r=this.data[e];if(Array.isArray(r))for(let[i,n]of r.entries())t.push(this.createChildAttributeSetModel(e,n,i));else t.push(this.createChildAttributeSetModel(e,r))}return t}};var nt=class s extends u{_attributeCollection;_metadataCollection;_actionCollection;constructor(t){super(t),this._attributeCollection=this.createAttributeCollection(),this._metadataCollection=this.createMetadataCollection(),this._actionCollection=this.createActionCollection()}get type(){return"Detail"}getInitialChildModelLinks(){return this._attributeCollection.getInitialChildModelLinks()}setChildModels(t,e){this._attributeCollection.setChildModels(t,e)}get id(){let t=this.getDataAsNumber("_id");return t||this.getDataAsString("_id",this.key)}get label(){return this.getContributionAsString("label","")}createAttributeCollection(){let t=this.getContributionAsArray("attributes",[]).filter(e=>{let[r]=Object.keys(e);return r in this.data});return new E(this.data,t,{...this.modelOptions,isReadonly:!0})}get attributeCollection(){return this._attributeCollection}set attributeCollection(t){this._attributeCollection=t}get attributes(){return this.attributeCollection.all.filter(t=>!t.layouthint.has(ut)&&!t.isHidden)}getAttributeByKey(t){return this._attributeCollection.getAttributeByKey(t)}createMetadataCollection(){let t=this.getContributionAsObject("metadata",{}),e=Object.entries(t).map(([r,i])=>({[r]:i}));return new E(this.data,e,{...this.modelOptions,isReadonly:!0})}get metadataCollection(){return this._metadataCollection}set metadataCollection(t){this._metadataCollection=t}createActionCollection(){let t=this.getDataAsArray("actions",[]),e=this.getContributionAsArray("actions",[]);return new F(t,e)}get actionCollection(){return this._actionCollection}set actionCollection(t){this._actionCollection=t}get isCase(){return this.getContributionAsString("resourcetype")==="CaseView"}get titleAttribute(){return this._attributeCollection.getAttributeByLayoutHint(ut)}update(t){if(t instanceof s){let e=new s(t.modularuiResponse);return e.attributeCollection=t.attributeCollection,e.metadataCollection=t.metadataCollection,e.actionCollection=t.actionCollection,e}return this}equals(t){return this.id?.toString()===t.id?.toString()}};var st=class extends p{hasTasks(){return this.collection.some(t=>t.hasTasks())}};var U=class s extends u{_actionCollection;constructor(t){super(t);let e=this.data.actions&&Array.isArray(this.data.actions)?this.data.actions:[],r=this.contributions.actions&&Array.isArray(this.contributions.actions)?this.contributions.actions:[];this._actionCollection=new F(e,r);try{let i=this.selflink.href.href;i&&(this.key=i.substring(i.lastIndexOf("/")+1))}catch{this.key=this.getDataAsString("name","unknown")}}static create(t,e,r,i){let n=new B;return n.key=t,n.data=e,n.contributions=r,n.origin=i?.origin,n.contextPath=i?.contextPath,new s(n)}get type(){return"TaskGroup"}hasTasks(){return this.actionCollection.length>0}get actionCollection(){return this._actionCollection}};var ni=class extends nt{_taskGroupCollection;constructor(t){super(t),this._taskGroupCollection=this.createTaskGroupCollection()}get type(){return"CaseView"}getInitialChildModelLinks(){return this.links.getLinksByGroup("taskgroup").all}get panelLinks(){return this.links.getLinksByGroup("panel")}setChildModels(t,e){super.setChildModels(t,e);let r=t.filter(i=>i instanceof U);this.taskGroupCollection.add(r)}get casename(){return this.attributeCollection.getAttributeByLayoutHint(ut)}get label(){return this.casename?.readonlyvalue||""}get viewLabel(){return this.getContributionAsString("label","")}hasIntroText(){return this.introtext!==""}get introtext(){let t=this.data._content;if(t&&"text"in t&&typeof t.text=="object"&&t.text!=null&&"message"in t.text)return t.text.message;let e=this.contributions;return e.text?typeof e.text=="object"&&"message"in e.text&&typeof e.text.message=="string"?e.text.message:e.text:Array.isArray(e.texts)?e.texts[0].text:""}get selfhref(){let t=this.links.getLinkByKey("self");if(t==null)throw new D("No self href available");return t.href}createTaskGroupCollection(){let t=this.getDataAsArray("taskgroups",[]),e=this.getContributionAsArray("taskgroups",[]),r=[];for(let i of t){let n=i.name,o=e.find(a=>a.name===n);if(o){let a=U.create(n,i,o,this.modelOptions);r.push(a)}}return new st(r)}set taskGroupCollection(t){this._taskGroupCollection=t}get taskGroupCollection(){return this._taskGroupCollection}hasTaskGroups(){return this.taskGroupCollection&&this.taskGroupCollection.hasItems()}};var Tt=class extends d{_context;_listKey;constructor(t,e,r){super(t,e,r),this._listKey=this.getContributionAsString("listKey")}get key(){return this.getDataAsString("name","")}get type(){return this.getContributionAsString("type","string").replace("filter","")}get parameterType(){return this.getContributionAsString("parameterType")==="bodyParameter"?"bodyParameter":"queryParameter"}get name(){return this.listkey?this.listkey+kr+this.param:this.param}get param(){return this.getDataAsString("param")??this.getDataAsString("name","")}get isMultiple(){return this.getContributionAsBoolean("multiplechoice",!1)}get context(){return this._context}set context(t){this._context=t}setContext(t){this._context=t}get contextid(){return this.getContributionAsString("contextid","")}get contextLabel(){return this.context?.label??""}get listkey(){return this._listKey}set listkey(t){this._listKey=t}get label(){return this.getContributionAsString("label","")}isQuickSearch(){return this.getContributionAsBoolean("quicksearch",!1)}get assistantMessage(){return this.getContributionAsString("assistant")}};var x=class extends Tt{_attribute;constructor(t,e,r){super(t,e,r),this._attribute=this.createAttribute(this.type,this.param||"",this.data,this.contributions)}get attribute(){return this._attribute}get params(){return this.param?[{name:this.param,value:this.attribute?.value}]:[]}get value(){return this.attribute?.value}get inputvalue(){return this.attribute?.inputvalue??""}hasValue(){return this.value!==null&&this.value!==""}getAttributeType(t){switch(t){case"choice":return"choice";case"date":return"date";case"datetime":return"datetime";case"daterange":case"datetimerange":return"range";case"number":case"numberrange":return"range";default:return"string"}}getChildType(t){switch(t){case"daterange":return"date";case"datetimerange":return"datetime";case"numberrange":return"number";default:return"string"}}createAttribute(t,e,r,i){if(t==="assignment")return;let n=this.getAttributeType(t),o={...i,type:n};if(n==="range"&&"children"in o&&Array.isArray(o.children)){let a=this.getChildType(t);o.children=o.children.map(l=>{let c=Object.keys(l)[0];return{[c]:{...l[c],type:a}}})}return v.createAttribute(e,r,o,this.modelOptions)}reset(){return this.attribute?.reset(),this}update(t,e){this.attribute?.update(e)}isActive(){return this.attribute?.initvalue!=null}get isValid(){return this.attribute?.isValid??!1}get readonlyvalue(){return this.attribute?.readonlyvalue??""}get formdata(){return this.attribute?.formdata??null}};var ot=class extends x{constructor(t,e,r){if(super(t,e,r),t&&"options"in t&&t.options&&Array.isArray(t.options)){let i=t.options.filter(n=>n.selected).map(n=>n.key);t.options.forEach(n=>{this.attribute?.options.addOption(i,{code:n.key,label:n.key})})}}};var Ot=class extends Tt{_assignmenttype;_user;constructor(t,e,r){super(t,e,r),this._assignmenttype=this.createAssignmentTypeModel(),this._user=this.createUserModel()}createAssignmentTypeModel(){let t=`${this.contextid}ASSIGNMENTTYPE`,e=this.data[t];if(typeof e>"u")throw new D(`Missing assignment type data for ${t}`);let r=this.data.dynamicschema;r&&(e.dynamicschema={[t]:r[t]});let n={...this.contributions[t],enumerated:!0,optionMode:e._links?"lookup":"static",type:"choice"},o=e.name||e.param;return v.createAttribute(o,e,n,this.modelOptions)}createUserModel(){let t=`${this.contextid}USERKEY`,e=this.data[t],r=this.data.dynamicschema;r&&r[t]&&(e.dynamicschema={[t]:r[t]});let n={...this.contributions[t],optionMode:e._links?"lookup":"static",type:"choice"},o=e.name||e.param;return v.createAttribute(o,e,n,this.modelOptions)}get assignmenttype(){return this._assignmenttype}get user(){return this._user}get params(){return this.assignmenttype&&this.user?[{name:this.assignmenttype.name,value:this.assignmenttype.value},{name:this.user.name,value:this.user.value}]:[]}get value(){return{[this.assignmenttype.name]:this.assignmenttype.value,[this.user.name]:this.user.value}}get inputvalue(){return{[this.assignmenttype.name]:this.assignmenttype.inputvalue,[this.user.name]:this.user.inputvalue}}hasValue(){return this.assignmenttype.value!==null&&this.assignmenttype.value!==""||this.user.value!==null&&this.user.value!==""}reset(){return this.assignmenttype&&this.assignmenttype.reset(),this.user&&this.user.reset(),this}update(t,e){this.user!=null&&this.user.key===t.key?this.user.update(e):this.assignmenttype!=null&&this.assignmenttype.key===t.key&&this.assignmenttype.update(e)}isActive(){return this.assignmenttype!=null&&this.assignmenttype.initvalue!==null||this.user!=null&&this.user.initvalue!==null}get isValid(){return this.assignmenttype!=null&&this.assignmenttype.isValid&&this.user!=null&&this.user.isValid}get readonlyvalue(){return{[this.assignmenttype.name]:this.assignmenttype.readonlyvalue,[this.user.name]:this.user.readonlyvalue}}get formdata(){return this.value}};var kt=class extends x{update(t,e){this.attribute instanceof it?this.attribute.update(e,t):super.update(t,e)}get params(){return this.attribute?[{name:this.attribute.start.name,value:this.attribute.start.value},{name:this.attribute.end.name,value:this.attribute.end.value}]:[]}};var Qe=class extends x{_isValid=!0;_value;_inputvalue;constructor(t,e,r){if(super(t,e,r),this.attribute){let i=this.getDataAsString("value","");this.update(this.attribute,i)}this._inputvalue=this._value??""}get params(){return this.param?[{name:this.param,value:this.removeFormat(this.value??"")}]:[]}get value(){return this._value}get inputvalue(){return this._inputvalue}reset(){return this._inputvalue="",this._value=void 0,this}get isValid(){return this._isValid}update(t,e){if(this._isValid=!0,this._inputvalue=typeof e!="string"?String(e):e,this.shouldHandleFormat()){let r=this.isMultiple?this._inputvalue.split(",").map(n=>n.trim()):[this._inputvalue.trim()],i=[];for(let n of r){let o=this.formatValue(n);o!==""&&(i.push(o),this.attribute?.validate(o)||(this._isValid=!1))}this._value=i.join(",")}else this._value=e}get operator(){return this.getContributionAsString("operator","")}formatValue(t){return this.shouldHandleFormat()?this.attribute?.formatValue(t)||"":t}isBSN(){return this.layouthint.has("bsn")}isIBAN(){return this.layouthint.has("iban")}isZipcode(){return this.layouthint.has("zipcode")}removeFormat(t){return t==null||t.toString()===""?"":typeof t=="string"&&this.shouldHandleFormat()?t.replace(/[^a-z0-9,]/gi,""):t}shouldHandleFormat(){return(this.operator==="exactly"||this.operator==="isNot")&&(this.isIBAN()||this.isZipcode()||this.isBSN())}get formdata(){return{[this.param]:this.value}}};var xt=class{static createFilter(t,e,r,i){let n=r.type??"stringfilter";return n==="choicefilter"&&t==="index"?new ot(e,r,i):n.includes("rangefilter")?new kt(e,r,i):n==="assignmentfilter"?new Ot(e,r,i):n==="stringfilter"?new Qe(e,r,i):new x(e,r,i)}static setListKey(t,e){"listkey"in e&&typeof e.listkey=="string"&&(t.listkey=e.listkey)}static setFilterContext(t,e,r){if(r.contexts){let i=r.contexts.find(n=>n.id===e);i&&(t.context=i)}}};var I=class extends p{constructor(t={},e,r){super(),this.collection=this.createCollection(t,e,r)}createCollection(t,e,r){let i=[];if(e&&"filter"in e&&Array.isArray(e.filter))for(let n of e.filter){let[o]=Object.keys(n),a=t[o],l=n[o],c=xt.createFilter(o,a,l,{origin:r?.origin,contextPath:r?.contextPath});xt.setListKey(c,e),l.contextid&&xt.setFilterContext(c,l.contextid,e),i.push(c)}return i}reset(){return this.collection=this.collection.map(t=>t.reset()),this}checkRangeFilterByAttributeKey(t,e){let r=t.attribute;if(r instanceof it){let i=r.start,n=r.end;return r.key===e||i?.name===e||n?.name===e}return!1}checkAssignmentFilterByAttributeKey(t,e){return t.key===e||t.user?.key===e||t.assignmenttype?.key===e}getFilterByName(t){return this.find(e=>e.name===t)||null}getFilterByAttributeKey(t){return this.find(e=>e instanceof kt?this.checkRangeFilterByAttributeKey(e,t):e instanceof Ot?this.checkAssignmentFilterByAttributeKey(e,t):e instanceof x?e.attribute?.key===t:!1)}update(t,e){let r=t.parentKey?this.getFilterByAttributeKey(t.parentKey):this.getFilterByAttributeKey(t.key);if(!r)throw new Error(`Can not find filter by attribute key: ${t.key}`);r.update(t,e),this.collection=this.collection.map(i=>i.name===r.name?r:i)}get isValid(){return this.collection.every(t=>t.isValid)}hasActiveFilters(){return this.collection.some(t=>t.isActive())}getActiveFilters(){return this.collection.filter(t=>t.isActive())}get formdata(){let t=this.filter(e=>e.parameterType==="bodyParameter"&&e.hasValue()&&e.formdata);return t.length===0?null:t.reduce((e,r)=>Object.assign(e,r.formdata),{})}};var Ze=class extends O{};var si=class extends u{_filterCollection;_concepts;constructor(t){super(t),this._filterCollection=new I(this.data.filter,{filter:this.contributions.filter,dynamicschema:this.data.dynamicschema},this.modelOptions),this._concepts=new Ze,this._concepts.collection=this.data._embedded?this.data._embedded.results.map(e=>new At(e.concept,this.entryDate,this.modelOptions)):[]}get type(){return this.resourcetype.toLowerCase()==="relatedconcepts"?"RelatedConcepts":"ConceptIndex"}getInitialChildModelLinks(){return this.items.getInitialChildModelLinks()}setChildModels(t,e){this.items.setChildModels(t,e)}get selfhref(){let{href:t}=this.selflink;return this.filterCollection.hasItems()&&this.filterCollection.forEach(e=>{e.params.forEach(r=>{r.value?t.setParameter(r.name,r.value):t.removeParameter(r.name)})}),t}get label(){return this.getContributionAsString("label","")}get filterCollection(){return this._filterCollection}get indexfilter(){let t=this.filterCollection.getFilterByAttributeKey("index");if(t instanceof ot)return t}get entryDate(){let e=this.filterCollection.getFilterByAttributeKey(g)?.value;if(typeof e=="string")return e}get searchtermfilter(){let t=this.filterCollection.getFilterByAttributeKey("label");return t instanceof x?t:null}get modelCategoryFilter(){let t=this.filterCollection.getFilterByAttributeKey("modelCategory");return t instanceof x?t:null}get items(){return this._concepts}set items(t){this._concepts=t}};var Je=class extends O{};var oi=class extends u{_filterCollection;_content;constructor(t){super(t),this._filterCollection=new I(this.data.filter,{filter:this.contributions.filter,dynamicschema:this.data.dynamicschema},this.modelOptions),this._content=new Je,this._content.collection=this.data._embedded?this.data._embedded.results.map(e=>new R(e.content,void 0,this.modelOptions)):[]}get type(){return"ContentIndex"}getInitialChildModelLinks(){return this.items.getInitialChildModelLinks()}setChildModels(t,e){this.items.setChildModels(t,e)}get selfhref(){let t=this.selflink.href;return this.filterCollection.forEach(e=>{e.params.forEach(r=>{r.value?t.setParameter(r.name,r.value):t.removeParameter(r.name)})}),t}get label(){return this.getContributionAsString("label","unknown")}get filterCollection(){return this._filterCollection}get indexfilter(){let t=this._filterCollection.getFilterByAttributeKey("index");return t instanceof ot?t:null}get items(){return this._content}hasIndexFilter(){let t=this.indexfilter?.attribute;return t instanceof X&&t.options.length>0}hasFiltersSet(){return this.filterCollection.some(t=>t.isActive())}hasNoFiltersSet(){return!this.hasFiltersSet()}getFirstCharHref(){let t=this.indexfilter?.attribute,e="#";return t instanceof X&&(e=t.options.filter(r=>r.code!=="0")[0].code),new y(this.selfhref).addParameter("index",e)}};var ai=class extends u{_section;_contentType;_filterCollection;constructor(t){super(t),this._filterCollection=new I(this.data.filter,{filter:this.contributions.filter},this.modelOptions),this._section=new et(this.data,this.entryDate,this.modelOptions)}get type(){return"Content"}getInitialChildModelLinks(){let t=this.links.getLinkByKey("contenttype");return t?[t]:[]}setChildModels(t,e){this.contentType=t.find(r=>r instanceof $)}get section(){return this._section}get id(){return this.data._id}get filterCollection(){return this._filterCollection}get entryDate(){let e=this.filterCollection?.getFilterByAttributeKey(g)?.value;if(typeof e=="string")return e}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get label(){return this.section.label}get number(){return this.section.number}get body(){return this.section.body}get childSectionLinks(){return this.section.childSectionLinks}get selfContentLink(){return this.section.selfContentLink}get childSections(){return this.section.childSections}set childSections(t){this.section.childSections=t||[]}get subSections(){return this.section.subSections}get relatedConceptsHrefs(){let t=[];return this.relatedConceptsHref&&t.push(this.relatedConceptsHref),this.subSections.forEach(e=>{t.push(...e.relatedConceptsHrefs)}),t}get relatedConceptsHref(){let t=this.links.getLinkByKey("relatedConcepts");if(t){let{href:e}=t;return e.addParameter("entryDate",this.entryDate),e.setReferenceHash(this.referenceHash),e}return null}get referenceHash(){return this.section.referenceHash}};var li=class extends u{_contentType;_filterCollection;constructor(t){super(t),this._filterCollection=new I(this.data.filter,{filter:this.contributions.filter},this.modelOptions)}get type(){return"ContentTOC"}getInitialChildModelLinks(){let t=this.links.getLinkByKey("contenttype");return t?[t]:[]}setChildModels(t,e){this.contentType=t.find(r=>r instanceof $)}get label(){return this.getDataAsString("label","")}get abbreviation(){return this.getDataAsString("abbreviation")}get selfhref(){let t=new y(this.selflink.href);return this.filterCollection.forEach(e=>{e.params.forEach(r=>{r.value?t.setParameter(r.name,r.value):t.removeParameter(r.name)})}),t}get relatedConceptsHref(){let t=this.links.getLinkByKey("relatedConcepts");if(t){let{href:e}=t;return e.addParameter("entryDate",this.entryDate),e}}get selfContentLink(){return new R(this.data,this.entryDate,this.modelOptions)}getItems(t){return t.map(e=>{let r=new R(e,this.entryDate,this.modelOptions);return typeof e.items<"u"&&(r.items=this.getItems(e.items)),r})}getSectionItems(t){return t.map(e=>{let r=new R(e,this.entryDate,this.modelOptions);return typeof e.sections<"u"&&(r.items=this.getItems(e.sections)),r})}get items(){return Array.isArray(this.data.items)?this.getItems(this.data.items):Array.isArray(this.data.sections)?this.getSectionItems(this.data.sections):[]}get sections(){return this.data.sections?this.data.sections.map(e=>new et(e,this.entryDate,this.modelOptions)):[]}get categories(){return Array.isArray(this.data.categories)?this.data.categories.map(t=>new R(t,void 0,this.modelOptions)):[]}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get filterCollection(){return this._filterCollection}get entryDate(){let e=this.filterCollection.getFilterByAttributeKey(g)?.value;if(typeof e=="string")return e}get isCompleteSource(){return this.filterCollection.getFilterByAttributeKey("complete")?.value==="true"}};var It=class{_configuration;_layouthint;_calculatedResults;_positiveResults;_negativeResults;_results;constructor(t){this._configuration=t||null,this._layouthint=new b(t?.layouthint),this._calculatedResults=new k(t?.calculatedResultElements),this._positiveResults=new k(t?.positiveResultElements),this._negativeResults=new k(t?.negativeResultElements),this._results=new k(t?.resultElements)}get label(){return this._configuration?.label}get description(){let t=this._configuration?.description;return typeof t=="object"&&"message"in t?t.message:t}get layouthint(){return this._layouthint}get attributes(){return this._configuration===null?[]:[...this._configuration.attributes,...this.layouthint.all.filter(t=>t.includes("attribute:")).map(t=>t.substring(10))]}get calculatedResultElements(){return this._calculatedResults}get positiveResultElements(){return this._positiveResults}get negativeResultElements(){return this._negativeResults}get resultElements(){return this._results}};var tr=class{_configuration;constructor(t){this._configuration=t||[]}get config(){return this._configuration.filter(t=>{let[e]=Object.keys(t);return e==="decisionResult"||e==="classificationResult"||e==="calculatorResult"}).map(t=>{let[e]=Object.keys(t);return new It(t[e])})}};var er=class{_question;_options;_answers;constructor(t){this._question=new k(t.questionElements),this._options=new k(t.optionElements),this._answers=new k(t.givenAnswerElements)}hasConfig(){return this._question.hasConfig()||this._options.hasConfig()||this._answers.hasConfig()}get question(){return this._question}get options(){return this._options}get answers(){return this._answers}};import{immerable as Wi}from"immer";var Rt=class{[Wi]=!0;_questions;_intermediateResults;_endResults;constructor(t){this._questions=this.createQuestionConfiguration(t),this._intermediateResults=this.createIntermedidateResultsConfiguration(t),this._endResults=this.createEndResultsConfiguration(t)}createQuestionConfiguration(t){if(t&&"questions"in t&&typeof t.questions=="object")return new er(t.questions)}createIntermedidateResultsConfiguration(t){if(t&&"intermediateResults"in t&&typeof t.intermediateResults=="object")return new It(t.intermediateResults)}createEndResultsConfiguration(t){if(t&&"results"in t&&typeof t.results=="object")return new tr(t.results)}get questions(){return this._questions}isConfiguredIntermediateResultAttribute(t){return this.intermediateResults?.attributes.includes(t)??!1}get intermediateResults(){return this._intermediateResults}isConfiguredEndResultAttribute(t){return this.endResults?this.endResults?.config.some(e=>e.attributes.includes(t)):!1}get endResults(){return this._endResults}};import{immerable as zi}from"immer";var ui=class{[zi]=!0;_originalError;_connectKey;_modelOptions;constructor(t,e,r){this._originalError=t,this._connectKey=e,this._modelOptions=r}set connectKey(t){this._connectKey=t}get connectKey(){return this._connectKey}get origin(){return this._modelOptions?.origin||""}get contextPath(){return this._modelOptions?.contextPath||N()}get error(){return this._originalError}get status(){let r=this.error;return"status"in r?parseInt(r.status,10):0}get id(){return this.isResourceNotFound&&"id"in this.error&&this.error.id!=="Error.NotAuthorized"?"Error.ResourceNotFound":"id"in this.error&&typeof this.error.id=="string"?this.error.id:this.error.name||"Error.GeneralError"}get message(){let t=this.error;return"message"in t?t.message:this.id}get responseMessage(){return this.response&&"message"in this.response?this.response.message:""}get title(){return this.response&&"title"in this.response?this.response.title:{id:""}}get titleMessage(){if("title"in this.error)return this.error.title?.message}get titleId(){return this.response?.title?.id}get titleProperties(){return this.response?.title?.properties}get redirect(){return this.response?.redirect}get redirectText(){if(this.redirect&&"text"in this.redirect)return this.redirect?.text}get redirectTextID(){return this.redirectText?.id}get redirectTextProperties(){return this.redirectText?.properties}get redirectMessage(){return this.redirectText?.message}get redirectHref(){if(this.redirect&&"href"in this.redirect){let t=this.redirect?.href;if(t)return new y(t)}}get layouthint(){return this.response&&Array.isArray(this.response.layouthint)?new b(this.response.layouthint):new b}get response(){let t=this.error;if("response"in t&&typeof t.response=="object")return t.response}get properties(){let t=this.error;if("properties"in t)return t.properties}get parameters(){let t=this.error;if("parameters"in t)return t.parameters}get isResourceNotFound(){return this.status===404}get isResourceNotFoundAfterReload(){let t=this.error;return"isReload"in t&&typeof t.isReload=="boolean"?this.isResourceNotFound&&t.isReload:!1}get isUnauthorized(){let e=this.status===401,r=this.id==="Error.NotAuthorized"||this.id==="Error.Authentication.Required"||this.id==="Error.Authentication.InvalidCredentials",i=this.error,n="action"in i&&typeof i.action=="object"&&i.action!==null&&"name"in i.action&&i.action.name==="login";return e||r||n}get isChangePassword(){return this.id==="Error.ChangePasswordRequired"}get isConcurrentUser(){return this.id==="Error.Authentication.ConcurrentUser"}get isConcurrentError(){return this.id==="Error.Case.ConcurrentModification"||this.id==="Error.DataStore.ConcurrentModification"||this.id==="Error.DataStore.RecordAlreadyExists"||this.id==="Error.DataStore.RowCannotBeLocked"}get isBlocked(){return this.id==="Error.Authentication.BlockedUser"}get isInvalidCredentials(){return this.id==="Error.Authentication.InvalidCredentials"}get isInvalidUsername(){return this.id==="Error.Authentication.InvalidUsername"}get isTimeoutError(){return this.id==="Error.CodemapLookup.InvalidToken"}get isRemoteServiceException(){return this.id==="Error.RemoteServiceException"}get changePasswordHref(){let t=this.properties;if(t&&"redirect"in t)return new y(t.redirect)}get isBasicAuthentication(){let e=this.error;return"error"in e?this.isUnauthorized&&this.status===401&&e.error==="No responseText":!1}get loginFailed(){return this.id==="Error.Authentication.Required"||this.id==="Error.Authentication.InvalidCredentials"}get shouldThrowOnServer(){return!this.isChangePassword&&!this.isBlocked&&!this.isConcurrentUser}};var Tr=L(lt(),1);var pt=class s extends d{_attributeCollection;_contentConfiguration;_errorCollection;_repeatIndex;_dynamicValidationsLoaded=!1;constructor(t,e,r){super(t,e,r),t&&this.getElements().length>0?this._attributeCollection=new E(this.getElements(),this.getApplicableAttributeContributions(),{...r,isReadonly:!1}):this._attributeCollection=new E,this._contentConfiguration=new Rt(e?e.content:{}),this._errorCollection=new j("formobject");let i=this.getDataAsString("referenceDate");i&&this.attributeCollection.setReferenceDate(i),this.attributeCollection.indicateContentConfiguration(this.contentConfiguration)}static createEmpty(t){if(!t)throw new A("createEmpty method needs a FormObjectModel as input argument to create a new version of the object");return new s(t.data,t.contributions,t.modelOptions)}equals(t,e=!0){if(!t||this.key!==t.key)return!1;let r=this.attributeCollection.all.filter(n=>!n.isResult).some(n=>t&&t.attributeCollection.hasAttributeByKey(n.key));return(e?this.repeatIndex===t.repeatIndex:!0)&&r}getAttributeByAttribute(t){return this.attributeCollection.getAttributeByAttribute(t)}getAttributeByKey(t){return this.attributeCollection.getAttributeByKey(t)}hasAttributeByKey(t){return this.attributeCollection.hasAttributeByKey(t)}getElements(){let t=[];if(Array.isArray(this.data.elements)&&t.push(...this.data.elements),Array.isArray(this.data.results)){let e=this.data.results.map(r=>({...r,isResult:!0}));t.push(...e)}return this.data.elementid&&t.push({...this.data}),t}getApplicableAttributeContributions(){if(this.data&&this.contributions){let t=this.getElements().map(r=>r.elementid),e=this.getAttributesInData(t,this.contributions.attributes);return this.isDynamic?e.map(r=>{let[i]=Object.keys(r);return{[i]:{...r[i],mandatory:!0}}}):e}return[]}getAttributesInData(t,e=[]){return e.filter(r=>{let[i]=Object.keys(r);return t.some(n=>n.split(".")[0]===i)})}getInitialChildModelLinks(){return this._attributeCollection.getInitialChildModelLinks()}setChildModels(t,e){this._attributeCollection.setChildModels(t,e)}get key(){return this.data.objectid||"unknown"}get contentConfiguration(){return this._contentConfiguration}get hasEndResultConfiguration(){return this.contributions.content?.results!=null}get isDynamic(){return this.getContributionAsBoolean("dynamicObject",!1)}get hasDynamicValidations(){return this.getContributionAsBoolean("dynamicValidations",!1)}get isRepeatable(){return this.getContributionAsBoolean("repeatable",!1)}get repeatIndex(){return this._repeatIndex??this.data.index??1}set repeatIndex(t){this._repeatIndex=t}get maxRepeats(){return this.isRepeatable?this.getDataAsNumber("numberofrepeats",-1):1}get hasFixedNrOfRepeats(){return this.maxRepeats>-1}get isRepeatWithUnknownTotal(){return this.isRepeatable&&this.maxRepeats===-1}get isLastRepeat(){return this.isRepeatable?this.getDataAsBoolean("last",!1):!0}get repeatIndexLabel(){return this.getDataAsString("index-identifier")}get label(){return this.getContributionAsString("label")}get introText(){if(typeof this.data.content=="object"&&this.data.content!=null&&"text"in this.data.content){let{message:t}=this.data.content.text;return t}return this.contributions.text?.message?this.contributions.text.message:this.contributions.introText}get assistent(){return this.contributions.assistent}get buttonLabels(){return this.getContributionAsObject("buttonLabels",{})}get attributeCollection(){return this._attributeCollection}set attributeCollection(t){this._attributeCollection=t}mergeObject(t){this.attributeCollection.forEach(e=>{let r=t.getAttributeByAttribute(e);r&&e.mergeAttribute(r)}),this.repeatIndex=t.repeatIndex}updateAttribute(t,e){let r=this.attributeCollection.getAttributeByAttribute(t);if(r==null)throw new Error(`Attribute with name: ${t.name} not found.`);return r instanceof M?r.update(e,t):r.update(e),r}isChangedSince(t){return this.attributeCollection.find(e=>e.isChangedSince(t))!=null}resetErrors(){this._errorCollection.clear(),this.attributeCollection.forEach(t=>t.resetErrors())}get errorCollection(){return this._errorCollection}addServerError(t){t.anchor?.elementid!=null?this.attributeCollection.addServerError(t):this._errorCollection.addServerError(t.id,t.message,t.properties,t.layouthint)}hasServerErrors(){return this.errorCollection.hasItems()||this.attributeCollection.hasServerErrors()}hasErrors(){return this.errorCollection.hasItems()||this.attributeCollection.hasErrors()}get isValid(){return this.attributeCollection.visible.every(t=>t.isValid)&&!this.errorCollection.hasItems()}get dynamicValidationsLoaded(){return this._dynamicValidationsLoaded}set dynamicValidationsLoaded(t){this._dynamicValidationsLoaded=t}handleErrorValidations(t){let e=[];t.filter(r=>r.anchor?.objectid===this.key).forEach(r=>{(0,Tr.has)(r.anchor,"elementid")?e.push(r):this.errorCollection.addServerError(r.id,r.message,r.properties,new b(r.layouthint))}),this.attributeCollection.updateValidations(e)}handleMissingValidations(t,e){let r=[];for(let i of t.anchors)if(!i.objectid||i.objectid===this.key)if(Array.isArray(i.elements))for(let n of i.elements)r.push({anchor:{objectid:n.objectid||"",elementid:n.elementid},id:"Constraint.Mandatory"});else r.push({anchor:{...i,objectid:i.objectid||""},id:"Constraint.Mandatory"});Array.isArray(e)&&e.filter(i=>i.id==="Constraint.Mandatory"&&i.anchor?.objectid===this.key&&(0,Tr.has)(i.anchor,"elementid")).forEach(i=>{r.push(i)}),this.attributeCollection.updateValidations(r)}updateValidations(t){return this.resetErrors(),Array.isArray(t.errors)&&this.handleErrorValidations(t.errors),Array.isArray(t.missing?.anchors)&&this.handleMissingValidations(t.missing,t.errors),this.dynamicValidationsLoaded=!0,this}get formdata(){return this.attributeCollection.formdata}getFormData(t=!1){return this.attributeCollection.getFormData(t)}};var Vt=L(lt(),1),_i=L(Ai(),1);import rn from"deepmerge";var Mi=class s extends u{_lastUpdate;_completedFormObjects=[];_currentFormObject=null;_previouslyEnteredFormObjects=[];_mergePreviouslyEnteredObjects=!0;_endResultFormObjects=[];_previousEndResultKeys=[];_useClientsideValidation=Q("USE_CLIENTSIDE_VALIDATION");_errorCollection=new j(0);_redirectLocation;_commit=!1;_isFinished=!1;_isComplete=!1;_success;_parameters=new re;_tokens=[];constructor(t){super(t),this._lastUpdate=0,this.currentFormObject=this.createFormObject(),this.endResultFormObjects=this.setEndResultFormObjects(),this.parameters=this.setParameters(t?.parameters),this.isComplete=this.getDataAsBoolean("complete",!1),Array.isArray(this.data.errors)&&this.handleRootErrors(this.data.errors),this.createSuccess(),this.setTokens()}get type(){return"Form"}get actiontype(){return this.layouthint.has(qt)?"create":this.layouthint.has($t)?"update":this.layouthint.has(zt)?"delete":this.getContributionAsString("actiontype","form")}getInitialChildModelLinks(){let t=(0,_i.default)(this.endResultFormObjects.map(e=>e.getInitialChildModelLinks()));return this.currentFormObject==null?t:[...this.currentFormObject.getInitialChildModelLinks(),...t]}setChildModels(t,e){this.currentFormObject&&this.currentFormObject.setChildModels(t,e),this.endResultFormObjects.forEach(r=>{r.setChildModels(t,e)})}get label(){return this.getContributionAsString("label","")}get buttonLabels(){return this.getContributionAsObject("buttonLabels",{})}getButtonLabel(t){if(t==="cancel"&&"cancel"in this.buttonLabels)return this.buttonLabels.cancel;let e=this.currentFormObject?.buttonLabels;if(e&&t in e)return e[t]}get allObjects(){return this.currentFormObject==null?this.completedFormObjects:[...this.completedFormObjects,this.currentFormObject]}get objectKeys(){let t=this.getContributionAsObject("objects",{});return Object.keys(t)}get numberOfExpectedQuestions(){return this.objectKeys.length}get hasNoQuestionsConfigured(){return this.isComplete&&(this.objectKeys.length===0||!("missing"in this.data)&&!("results"in this.data)&&!("errors"in this.data))}addDynamicSchemaToElements(t,e){return t?.map(r=>({...r,dynamicschema:r.dynamicschema?r.dynamicschema.map(i=>{let n="elements"in i?i.elements:[];return n.length?{...i,elements:{...n,dynamicschema:e}}:i}):void 0}))}getMissingAnchors(){return(this.data.missing?.anchors??[]).map(e=>{if(this.data.results){let r=this.data.results.find(i=>i.objectid===e.objectid&&"elements"in i);r&&(e.results=r.elements)}return e.elements&&this.data.dynamicschema?{...e,elements:this.addDynamicSchemaToElements(e.elements,this.data.dynamicschema)}:e})}createFormObject(){if(this.data&&this.contributions.objects){let t=this.getMissingAnchors();if(t.length){let e=t[0],r=t[0].objectid;if(r){let i=this.contributions.objects[r];if(i)return new pt(e,i)}}}return null}addEmptyFormObject(t=this.currentFormObject){if(t){let e=pt.createEmpty(t);e.repeatIndex=this.getHighestRepeatIndex(t)+1,this.addFormObject(e)}}getHighestRepeatIndex(t){return Math.max(...this.allObjects.filter(e=>e.equals(t,!1)).map(e=>e.repeatIndex))}addFormObject(t){if(!t)throw new A("Missing form object to add");this.completedFormObjects=[...this.allObjects],this.currentFormObject=t}getFormObjectByKey(t){return this.allObjects.find(e=>e.key===t)}getFormObjectByLayoutHint(t){return this.allObjects.find(e=>e.layouthint.has(t))}removeFormObject(t){if(!t)throw new A("Missing form object to remove");if(this.currentFormObject&&this.currentFormObject.equals(t))throw new A("Can not remove the current form object");this.completedFormObjects=this.completedFormObjects.filter(e=>!e.equals(t))}get currentFormObject(){return this._currentFormObject}set currentFormObject(t){this._currentFormObject=t}get completedFormObjects(){return this._completedFormObjects}set completedFormObjects(t){this._completedFormObjects=t}get previouslyEnteredFormObjects(){return this._previouslyEnteredFormObjects}set previouslyEnteredFormObjects(t){this._previouslyEnteredFormObjects=t}setEndResultFormObjects(){if(this.data&&this.data.results&&Array.isArray(this.data.results)){let e=(Array.isArray(this.data.missing?.anchors)?this.data.missing?.anchors:[]).map(i=>i.objectid),r=this.data.results.filter(i=>!e.includes(i.objectid)).map(i=>{let{elements:n,...o}=i;return{...o,results:n}});if(r.length>0)return r.map(i=>{let n=this.contributions.objects?.[i.objectid];return n?new pt(i,n):null}).filter(i=>i!=null)}return[]}get expectsEndResultFormObjects(){let t=this.endResultFormObjects.map(e=>e.key);return this.objectKeys.some(e=>this.contributions.objects?.[e]?.content?.results&&!t.includes(e))}get endResultFormObjects(){return this._endResultFormObjects}set endResultFormObjects(t){this.previousEndResultKeys=this.endResultFormObjects.map(e=>e.key),this._endResultFormObjects=t}getEndResultFormObjects(){return this.endResultFormObjects.filter(t=>!this.previousEndResultKeys.includes(t.key))}get previousEndResultKeys(){return this._previousEndResultKeys}set previousEndResultKeys(t){this._previousEndResultKeys=t}get isValid(){return this.currentFormObject?this.currentFormObject.isRepeatable&&(!this.currentFormObject.hasFixedNrOfRepeats||this.allObjects.filter(e=>this.currentFormObject!=null&&e.equals(this.currentFormObject,!1)).find(e=>e.isValid))?!0:this.currentFormObject?.isValid??!0:!0}hasServerErrors(){return this.errorCollection.hasItems()?!0:this.currentFormObject?this.currentFormObject.hasServerErrors():!1}hasErrors(){return this.errorCollection.hasItems()?!0:this.currentFormObject?this.currentFormObject.hasErrors():!1}addServerError(t){this.errorCollection.addServerError(t.id,t.message,t.properties,t.layouthint)}resetErrors(){this._errorCollection.clear(),this.currentFormObject&&this.currentFormObject.resetErrors()}get errorCollection(){return this._errorCollection}set errorCollection(t){this._errorCollection=t}get commit(){return this._commit||!1}set commit(t){this._commit=t}get isFinished(){return this._isFinished||this.success!=null}set isFinished(t){this._isFinished=t}get isComplete(){return this._isComplete}set isComplete(t){this._isComplete=t}get successRedirect(){return this.isFinished&&this.success?.redirect?new y(this.success.redirect):void 0}get redirectLocation(){return this._redirectLocation||this.successRedirect}getSuccessData(){return this.success?.data}getResultData(){let t={};if(this.contributions.resultdata){let e=this.contributions.resultdata,r=Object.keys(e),i=this.getSuccessData();for(let n of r){let o=i?.[n]||{},a=n in e?e[n]:{};t[n]=new dt(n,o,a)}}return t}get resultData(){return this.getSuccessData()}setParameters(t){let e=t?t.map(r=>new ee(r.prefix,r.name,r.value)):[];return new re(e)}get parameters(){return this._parameters}set parameters(t){this._parameters=t}selfhrefNoCommitParam(){let t=this.parameters.filter(r=>r.name!=="commit"),e=this.selflink?.href;return e?(e.method="POST",e.parameters=new re(t),e):new y}selfhrefWithCommitParam(){let t=this.selfhrefNoCommitParam();return this.expectsEndResultFormObjects&&!this.isComplete&&!this.commit&&t.addParameter("commit","false"),t}get selfhref(){if(!this.selflink)throw new Error("No self link found for form");return Jt("ALWAYS_COMMIT_FORM")?this.selfhrefNoCommitParam():this.selfhrefWithCommitParam()}get tokens(){if(!this._tokens){let t=this.data?.tokens;this._tokens=Array.isArray(t)?t:[]}return this._tokens}set tokens(t){this._tokens=t}removeTokens(){this._tokens=[]}setTokens(){let t=this.data?.tokens;this._tokens=Array.isArray(t)?t:[]}isChanged(){return this.currentFormObject!==null&&this.currentFormObject.isChangedSince(this.lastUpdate)}get lastUpdate(){return this._lastUpdate}set lastUpdate(t){this._lastUpdate=t}getFormDataObjects(t=!0,e=!1){let r=this.allObjects.filter(n=>n.isRepeatable&&!n.hasFixedNrOfRepeats&&!n.attributeCollection.some(a=>a.value!==null)?!1:n.isValid||!t),i=[];return r.forEach(n=>{let o=n.getFormData(e);if(!o)return;let a=o&&Object.values(o).some(c=>c!==null);if(n.isDynamic?a:!0){let c=i.findIndex(w=>w.key===n.key&&w.repeatIndex===n.repeatIndex);c>-1?i[c].formdata=rn(i[c].formdata,o):i.push({key:n.key,repeatIndex:n.repeatIndex,formdata:o})}}),i.map(n=>({[n.key]:n.formdata}))}getFormData(t=!0,e=!0,r=!1){return e&&this.tokens.length>0?JSON.stringify({objects:this.getFormDataObjects(t,r),tokens:this.tokens}):JSON.stringify({objects:this.getFormDataObjects(t,r)})}setUseClientsideValidation(t){this._useClientsideValidation=t,this.allObjects.forEach(e=>{e.attributeCollection.all.forEach(r=>r.setUseClientsideValidation(t))})}useClientsideValidation(){return this._useClientsideValidation??!0}get formdata(){return this.getFormData(this.useClientsideValidation())}get validationData(){return this.getFormData(!1,!1,!0)}get hasPreviousStep(){let t=this.currentFormObject!=null?this.currentFormObject.key:"";return this.completedFormObjects.filter(e=>!e.isRepeatWithUnknownTotal||e.key!==t).length>0}setPreviousObject(){this.isComplete=!1,this.isFinished=!1,this.success=void 0;let t=this.currentFormObject;this.currentFormObject!=null&&(this.previouslyEnteredFormObjects=[this.currentFormObject,...this.previouslyEnteredFormObjects]),this.currentFormObject=this.completedFormObjects[this.completedFormObjects.length-1],this.completedFormObjects=this.completedFormObjects.slice(0,-1);let e=this.completedFormObjects.map(r=>r.key).filter(r=>r!==this.currentFormObject?.key);this.endResultFormObjects=this._endResultFormObjects.filter(r=>e.includes(r.key)),this.previousEndResultKeys=this.endResultFormObjects.map(r=>r.key),this.currentFormObject&&this.currentFormObject.equals(t,this.currentFormObject.hasFixedNrOfRepeats)&&this.setPreviousObject()}get hasNextStep(){if(this.isComplete||this.isFinished||this.hasNoQuestionsConfigured||!this.contributions.objects)return!1;if(this.currentFormObject&&this.currentFormObject.isDynamic||this.expectsEndResultFormObjects)return!0;let t=this.objectKeys.findIndex(r=>r===this.currentFormObject?.key),e=this.objectKeys.length-1===t;return e&&this.currentFormObject&&this.currentFormObject.isRepeatable&&!this.currentFormObject.isLastRepeat?!0:!e}update(t){if(t instanceof s){this.resetErrors(),this.lastUpdate=Date.now(),this.lastServerUpdate=t.lastServerUpdate,this.tokens=t.tokens,this.isComplete=t.isComplete,this.isFinished=t.isFinished,this.success=t.success;let e=t.data??{},r=(0,Vt.has)(e,"missing"),i=(0,Vt.has)(e,"errors");!r&&!i&&this.handleFinished(t),i&&this.handleErrors(t),r&&this.handleMissing(t)}return this}updateCurrentFormObject(t){if(t instanceof s){let e=t.data??{},r=(0,Vt.has)(e,"missing");(0,Vt.has)(e,"errors")&&this.handleErrors(t),r&&this.handleMissing(t)}}updateValidations(t){return this.currentFormObject&&this.currentFormObject.updateValidations(t),this}get success(){return this._success}set success(t){this._success=t}createSuccess(){this._success=this.data.success}handleFinished(t){this.currentFormObject&&(this.completedFormObjects=[...this.completedFormObjects,this.currentFormObject]),this.currentFormObject=t.currentFormObject,this.endResultFormObjects=t.endResultFormObjects,this.replaceData({...this.data,...t.data})}handleRootErrors(t){t.filter(e=>!e.anchor).forEach(e=>{this.errorCollection.addServerError(e.id,e.message,e.properties,e.layouthint)})}handleErrors(t){let e=Array.isArray(t.data.errors)?t.data.errors:[];e&&e.forEach(r=>{r.anchor&&this.currentFormObject&&this.currentFormObject.key===r.anchor.objectid?this.currentFormObject.addServerError(r):this.errorCollection.addServerError(r.id,r.message,r.properties,r.layouthint)})}handleMissing(t){this.currentFormObject&&this.currentFormObject.equals(t.currentFormObject)?this.handleMissingErrors(t):this.handleNewFormObject(t)}processMissingErrors(t){return this.currentFormObject===null?null:(this.currentFormObject.attributeCollection.map(e=>{let r=t.currentFormObject?.getAttributeByKey(e.key);return r?e.addMissingError(r):e.removeMissingError(),e}),this.currentFormObject)}handleMissingErrors(t){this.currentFormObject=this.processMissingErrors(t)}handleNewFormObject(t){this.endResultFormObjects=t.endResultFormObjects;let e=t.currentFormObject;e===null?(this.completedFormObjects=[...this.allObjects],this.currentFormObject=null):(this.currentFormObject?.isRepeatable?this.completedFormObjects=[...this.completedFormObjects,this.currentFormObject]:this.currentFormObject&&(this.completedFormObjects=[...this.allObjects]),this.currentFormObject=e)}get mergePreviouslyEnteredObjects(){return this._mergePreviouslyEnteredObjects}set mergePreviouslyEnteredObjects(t){this._mergePreviouslyEnteredObjects=t}handlePreviouslyEnteredFormObjects(t,e){e.forEach(r=>{let i=this.mergePreviouslyEnteredObjects?this.mergeObjects(t,r):t;this.addFormObject(i)}),this.previouslyEnteredFormObjects=this.previouslyEnteredFormObjects.filter(r=>!e.find(n=>r.equals(n)))}mergeObjects(t,e){let r=pt.createEmpty(t);return r.mergeObject(e),r}findAttribute(t){return this.allObjects.flatMap(e=>e.attributeCollection.all).find(e=>t(e))}};var rr=L(lt(),1);var Ut=class extends nt{_contentConfiguration;_listitem;_givenAnswers;_results;_eventdata;constructor(t){super(t),this._contentConfiguration=new Rt(this.contributions?this.contributions.content:{}),this.setResultSection(),this._eventdata=this.setEventData()}getInitialChildModelLinks(){let t=this.listitem?this.listitem.links.getLinksByGroup("panel").all:[],e=[...super.getInitialChildModelLinks(),...t];return this.hasResults&&(this.results&&e.push(...this.results.getInitialChildModelLinks()),this.givenAnswers&&e.push(...this.givenAnswers.getInitialChildModelLinks())),e}setChildModels(t,e){this.attributeCollection.setChildModels(t,e),this.results&&this.results.setChildModels(t,e),this.givenAnswers&&this.givenAnswers.setChildModels(t,e)}get type(){return"ListDetail"}set listitem(t){this._listitem=t,t&&(this.actionCollection=t.actionCollection)}get listitem(){return this._listitem}get panelLinks(){return this.listitem?.links.getLinksByGroup("panel")}get contentConfiguration(){return this._contentConfiguration}set contentConfiguration(t){this._contentConfiguration=t}get introtext(){return this.data._content?this.data._content.text.message:this.contributions.text?this.contributions.text.message??this.contributions.text:Array.isArray(this.contributions.texts)?this.contributions.texts[0].text:""}setResultSection(){let t=this.contributions.resultSection,e=this.data.resultSection;e&&t&&(this.setResults(e.results,t.results),this.setGivenAnswers(e.givenAnswers,t.givenAnswers))}setResults(t,e){if(t&&e){e.type==="composite"&&(e.children=e.children.filter(i=>Object.keys(i)[0]in t));let r=v.createAttribute("results",{key:"results",dynamicschema:this.data.dynamicschema,content:this.data.content?.results,...this.data.resultSection},e,this.modelOptions);r instanceof M&&(r.isResult=!0,r.indicateContentConfiguration(this.contentConfiguration),this._results=r)}}setGivenAnswers(t,e){if(t&&e){let r=e.children?{...e,children:e.children.filter(n=>Object.keys(n)[0]in t)}:e,i=v.createAttribute("givenAnswers",{key:"givenAnswers",dynamicschema:this.data.dynamicschema,content:this.data.content?.givenAnswers,...this.data.resultSection},r,this.modelOptions);i instanceof M&&(i.isResult=!0,this._givenAnswers=i)}}get givenAnswers(){return this._givenAnswers}get hasResults(){return(0,rr.has)(this.contributions,"resultSection")}get results(){return this._results}get hasEventData(){return(0,rr.has)(this.contributions,"eventdata")&&(0,rr.has)(this.data,"eventdata")&&this.data.eventdata!=null&&this.contributions.eventdata!=null}setEventData(){if(!this.data.eventdata||!this.contributions.eventdata)return[];let t=[],{eventdata:e,dynamicschema:r}=this.data;return this.contributions.eventdata.forEach(n=>{for(let o of Object.keys(n)){let a=n[o],l=e[o];l&&(Array.isArray(l)?l.forEach((c,w)=>{let Ii=`${o}-${w+1}`;t.push(new dt(Ii,{...c,dynamicschema:r},a,this.modelOptions))}):t.push(new dt(o,{...l,dynamicschema:r},a,this.modelOptions)))}}),t}get eventdata(){return this._eventdata}};import{immerable as nn}from"immer";var Or=class{_group;_context;_attributeCollection;_grouping;constructor(t,e,r,i){this._group=t,this._context=e,this._attributeCollection=new E(t,e?.attributes,{...i,isReadonly:!0}),t.grouping&&(this._grouping=new Pt({...t.grouping,dynamicschema:t.dynamicschema},r,i))}get type(){return this._group.type}get id(){return this._group._id||"unknown"}get label(){return this._context?.label}get attributeCollection(){return this._attributeCollection}get grouping(){return this._grouping}get reference(){return this._group.reference||[]}hasAttributeByKey(t){return this.attributeCollection.hasAttributeByKey(t)?!0:this.grouping?this.grouping.hasAttributeByKey(t):!1}getAttributeByKey(t){let e=this.attributeCollection.getAttributeByKey(t);if(e)return e;if(this.grouping)return this.grouping.getAttributeByKey(t)}},Pt=class{[nn]=!0;_prefix;_groups=[];constructor(t,e,r){this._prefix=t?.prefix,t?.group&&(this._groups=this.createGroup(t,e,r))}createGroup(t,e,r){if(!t.group)return[];let i=this.getContextFromContributionsByPrefix(e,this._prefix);return t.group.map(n=>{let o=this.getDynamicSchema(n.type,t.dynamicschema),a={...n,dynamicschema:o};return new Or(a,i,e,r)})}getDynamicSchema(t,e){if(e)return this._prefix&&e[t]&&!e[this._prefix+t]&&(e[this._prefix+t]=e[t]),e}get groups(){return this._groups}hasGroups(){return this._groups.length>0}getContextFromContributionsByPrefix(t,e){if(t&&e)return t.find(r=>r.prefix===e)}hasAttributeByKey(t){return this.groups.some(e=>e.hasAttributeByKey(t))}getAttributeByKey(t){let e=this.groups.find(r=>r.hasAttributeByKey(t));if(e)return e.getAttributeByKey(t)}getGroupByAttributeKey(t){return this.groups.find(e=>e.hasAttributeByKey(t))}};var at=class s extends y{_isPrefixed;_prefix;_pagingName;_pagesizeName;_sortingName;_lookupToken;constructor(t,e,r=!0){super(t,void 0),this._isPrefixed=r,e?this.setParametersFromListModel(e):t!=null&&t instanceof s&&this.setParameterNamesFromHref(t)}setParameterNamesFromHref(t){this._prefix=this._isPrefixed?t.prefix:void 0,this._pagingName=t.pagingName,this._pagesizeName=t.pagesizeName,this._sortingName=t.sortingName}setParametersFromListModel(t){this._prefix=this._isPrefixed?t.key:void 0,this._pagingName=t.paging?.name||"",this._pagesizeName=t.paging?.pagesize?.name||"",this._sortingName=t.sorting?.name||"",this.page=t.paging?.page,this.pagesize=t.paging&&t.paging.pagesize.options.length>0?t.paging.pagesize.value:void 0,this.sort=t.sorting?.param,this.filterCollection=t.filterCollection,this.formdata=t.formdata,this.lookupToken=t.lookupToken}get prefix(){return this._prefix}get pagingName(){return this._pagingName}get pagesizeName(){return this._pagesizeName}get sortingName(){return this._sortingName}set page(t){this.pagingName&&this.setParameter(this.pagingName,t?.toString(),this.prefix)}get page(){return this.pagingName?this.getParameter(this.pagingName,this.prefix):void 0}set sort(t){this.sortingName&&this.setParameter(this.sortingName,t,this.prefix)}set pagesize(t){this.pagesizeName&&this.setParameter(this.pagesizeName,t?.toString(),this.prefix)}set lookupToken(t){this.setParameter("lookupToken",t,this.prefix)}set filterCollection(t){t&&t.filter(e=>e.parameterType==="queryParameter").forEach(e=>{e.params.forEach(r=>{r.value==null?this.removeParameter(r.name,this.prefix):this.setParameter(r.name,r.value,this.prefix)})})}};var ir=class s extends nt{static createFromListResult(t,e,r,i){let n=new B;return n.key=t,n.data=e,n.contributions=r,n.origin=i?.origin,n.contextPath=i?.contextPath,new s(n)}static createFromChoiceAttributeOption(t){let e=new B;e.key=t.code;let r=new s(e);return r.attributeCollection=t.attributeCollection,r}get selfhref(){let t=this.links.getLinkByKey("self");return t?t.href:new y("#")}get caseviewHref(){let t=this.attributeCollection.getAttributeByLayoutHint(gt);if(t){let e=t.name,r=this.links.getLinkByKey(e);if(r)return r.href}return this.selfhref}get panelLinks(){return this.links.getLinksByGroup("panel")}hasPanelLinks(){return this.panelLinks.length>-1}getActionsByType(t){return this.actionCollection.getActionsByType(t)}get additionalDetailRoutePath(){let t=this.panelLinks;return t.length===0?"__NON_EXISTING_ROUTE__":t.map(e=>e.href.path).join("|")}};var nr=class s extends p{static createFromList(t){let e=t.data._embedded;if(e){if(Array.isArray(e))throw new P(`One record panel with multiple tables is not supported, place all types in one panel for the panel with key ${t.key}`);let r=t.data.dynamicschema,i=e.results.map(n=>{let[o]=Object.keys(n),a=n[o];a.dynamicschema=r;let l=t.contributions.results[o];return ir.createFromListResult(o,a,l,t.modelOptions)});return new s(i)}return new s}get additionalDetailRoutePath(){if(this.isEmpty())return"__NON_EXISTING_ROUTE__";let t=this.all.map(e=>e.additionalDetailRoutePath).join("|");return t.includes("|")?`(${t})`:t}get actionCollection(){let t=new F;return this.all.forEach(e=>{t.collection.push(...e.actionCollection.all)}),t}};import{immerable as sn}from"immer";var sr=class{[sn]=!0;_pagesize;_options;constructor(t,e){this._pagesize=t,this._options=e?.options||[]}get name(){return"pagesize"}get value(){return this._pagesize}set value(t){this._pagesize=t}get options(){return this._options}get querystring(){return`${this.name}=${this.value}`}};import{immerable as on}from"immer";var or=class{[on]=!0;_data;_contributions;_page;_pagesize;constructor(t,e){this._data=t,this._contributions=e,this._page=this._data?.page,this._pagesize=new sr(this._data?.pagesize,this._contributions?.pagesize)}get isEnabled(){return typeof this.page<"u"}get name(){return"page"}get value(){return this.page}get maxpages(){return this._data?.maxpages}get page(){return this._page}set page(t){this._page=t}get totalResults(){return this._data?.totalresults||-1}get pagesize(){return this._pagesize}get querystring(){let t=[];return this.pagesize&&t.push(this.pagesize.querystring),t.push(`${this.name}=${this.page}`),t.join("&")}};import{immerable as an}from"immer";var Ei=(e=>(e.ASC="asc",e.DESC="desc",e))(Ei||{}),Ht=class{[an]=!0;_key;_label;_group;_sortorder="desc";_selected=!1;constructor(t,e,r){this._key=t,this._group=r,this._label=this.setLabel(t,e,r)}setLabel(t,e,r){if(e)this._label=e;else if(r){let i=r.getAttributeByKey(t);i&&(this._label=i.label)}return""}reset(){this.selected=!1,this.sortorder="desc"}get selected(){return this._selected}set selected(t){this._selected=t}get key(){return this._key}get value(){return`${this.key} ${this.sortorder}`}get oppositeDirection(){return this.sortorder==="desc"?"asc":"desc"}get oppositeValue(){return`${this.key} ${this.oppositeDirection}`}get label(){return this._label}get sortorder(){return this._sortorder}set sortorder(t){this._sortorder=t}get group(){return this._group}getHref(t){let e=new at(t);return(e.prefix?e.hasParameter("page",e.prefix):e.hasParameter("page"))&&(e.page=1),e.sort=this.oppositeValue,e}};var ar=class extends p{constructor(t,e,r,i){super();let n=t?.sorting?.attributes;n&&(this.collection=n.map(o=>{let a=e[o],l=r&&r.getGroupByAttributeKey(o);return new Ht(o,a,l)}),this.setSelected(i))}get name(){return"sort"}get value(){return this.filter(t=>t.selected).map(t=>t.value).join(",")}set value(t){this.reset(),this.setSelected(t)}get param(){return this.value}get options(){return this.collection}reset(){this.collection.forEach(t=>t.reset())}setSelected(t=""){t.split(",").forEach(e=>{let[r,i]=e.split(" ");this.collection.forEach(n=>{n.key===r&&(n.selected=!0,i==="asc"?n.sortorder="asc":i==="desc"&&(n.sortorder="desc"))})})}getUpdateQuerystring(t){if(!t)throw new A("Missing option key as input argument");return this.filter(e=>e.key===t).map(e=>e.key===t?e.oppositeValue:e.value).join(",")}getUpdateQuerystringBySortOption(t){if(!(t instanceof Ht))throw new A("Missing SortOptionModel as input argument");return this.getUpdateQuerystring(t.key)}createListHref(t,e){let r=new at(t);return(r.prefix?r.hasParameter("page",r.prefix):r.hasParameter("page"))&&(r.page=1),r.sort=this.getUpdateQuerystringBySortOption(e),r}};var lr=class extends u{_detail;_headers;_paging;_filterCollection;_sorting;_actionCollection;_listItemCollection;_grouping;_lookupToken;constructor(t){super(t),this._headers=this.setHeaders(),this._paging=this.setPaging(),this._filterCollection=this.setFilters(),this._sorting=this.setSorting(),this._actionCollection=this.setActionCollection(),this._grouping=this.setGrouping(),this._lookupToken=this.setLookupToken(),this._listItemCollection=this._listItemCollection=nr.createFromList(this)}get type(){return"List"}getInitialChildModelLinks(){return this.layouthint.has(Nr)&&this.listItemCollection.length===1?this.listItemCollection.map(t=>{let e=t.selflink;return e.targetModel=Ut,e}):[]}setChildModels(t,e){this.detail=t.find(r=>r instanceof Ut)}get requestMethod(){return this.filterCollection.some(e=>e.parameterType==="bodyParameter"&&e.hasValue())?"POST":"GET"}get label(){return this.contributions.label}get lookupToken(){return this._lookupToken}set lookupToken(t){this._lookupToken=t}get introtext(){return this.data.content?this.data.content.text.message:this.contributions.text?this.contributions.text.message??this.contributions.text:Array.isArray(this.contributions.texts)?this.contributions.texts[0].text:""}get listItemCollection(){return this._listItemCollection}set listItemCollection(t){this._listItemCollection=t}get detail(){return this._detail}set detail(t){let e=this.listItemCollection.find(r=>r.selfhref.equals(t?.selfhref));e&&t&&(t.listitem=e),this._detail=t}get grouping(){return this._grouping}setGrouping(){return new Pt({...this.data.grouping,dynamicschema:this.data.dynamicschema},this.contributions.contexts,this.modelOptions)}hasGrouping(){return this.grouping.hasGroups()}hasResults(){return this.listItemCollection.hasItems}isEmpty(){return!this.hasResults()}get shouldHide(){return this.layouthint.has(Br)&&this.isEmpty()&&this.actionCollection.isEmpty()&&!this.filterCollection.hasActiveFilters()}getListItemById(t){let e=decodeURIComponent(t.toString());return this.listItemCollection.find(r=>r.id.toString()===e)}getListItemByHref(t){return this.listItemCollection.find(e=>e.selfhref.equals(t))}get paging(){return this._paging}setPaging(){return new or(this.data.paging,this.contributions.paging)}get sorting(){return this._sorting}setSorting(){return new ar(this.contributions,this.getSortingLabels(),this.grouping,this.data.sorting)}get filterCollection(){return this._filterCollection}set filterCollection(t){Array.isArray(t)?this._filterCollection.collection=t:this._filterCollection=t}setFilters(){return new I(this.data.filter,{listkey:this.key,filter:this.contributions.filter||{},contexts:this.contributions.contexts,dynamicschema:this.data.dynamicschema},this.modelOptions)}isFiltered(){return this.filterCollection.hasActiveFilters()}get actionCollection(){return this._actionCollection}setActionCollection(){return new F(this.data.actions,this.contributions.actions,this.modelOptions)}hasList(){return this.key!=null}getSelfHref(){let t=this.links.getLinkByKey("self");return new at(t?.href,this)}setLookupToken(){return this.modularuiResponse.parameters?.find(t=>t.name==="lookupToken")?.value}get selfhref(){return this.getSelfHref()}get headers(){return this._headers}setHeaders(){let t=[];if(this.contributions.results){let{results:e}=this.contributions;Object.keys(e).forEach(r=>{e[r].attributes.forEach(i=>{let n=new Et(i,this.sorting);!t.some(a=>a.equals(n))&&!n.layouthint.has(gt)&&t.push(n)})})}return t}getSortingLabels(){let t={};return this.contributions.results&&Object.values(this.contributions.results).forEach(e=>{e.attributes.forEach(r=>{let i=Object.keys(r)[0],n=r[i].label;t[i]=n})}),t}getActionsByType(t){return this.actionCollection.getActionsByType(t)}getAdditionalDetailLabel(t){let e=Object.keys(this.contributions.results);for(let r of e){let i=this.contributions.results[r]._links?.panel?.find(n=>n.resourcetype===t);if(i)return i.label}}get formdata(){let{formdata:t}=this.filterCollection;return t!=null?JSON.stringify(t):null}};var ur=class s extends O{static create(t,e,r){let i=new s;return t.options&&e.options&&t.options.forEach(n=>{i.add(new G([],{...n,optionType:this.getOptionType(n,e),elementsContributions:e.options[0].elements},{...r,referenceDate:new Date().toISOString().split("T")[0]}))}),i}static getOptionType(t,e){return e.optionType?e.optionType:t._links?.download?.[0].name==="avatar"?"user":"generic"}};var Di=class extends u{_options;_filterCollection;constructor(t){super(t),this._options=ur.create(this.data,this.contributions,this.modelOptions),this._filterCollection=this.createFilterCollection(this.data.filter,this.contributions.filter)}get type(){return"LookupOptions"}get options(){return this._options}createFilterCollection(t,e){return t&&e?new I({[t.name]:t},{filter:e},this.modelOptions):new I}get filterCollection(){return this._filterCollection}};var cr=class{_modelCategory;constructor(t){this._modelCategory=t}get key(){return this._modelCategory._id}get label(){return this._modelCategory.label}get description(){return this._modelCategory.description}get iconSmall(){return this._modelCategory.iconSmall}get iconMedium(){return this._modelCategory.iconMedium}get iconLarge(){return this._modelCategory.iconLarge}};var hr=class extends p{constructor(t=[]){super(),this.collection=t?t.map(e=>new cr(e)):[]}};var vi=class extends u{get type(){return"ModelCatalog"}get label(){return this.locale==="nl"?"Model catalogus":"Model catalog"}get conceptIndexLink(){let t=this.links.getLinkByKey("concepts");if(!t)throw new D("Missing concepts index link in model catalog");return t}get contentIndexLink(){let t=this.links.getLinkByKey("content");if(!t)throw new D("Missing content index link in model catalog");return t}get modelcategories(){return new hr(this.data.modelcategories)}};var Si=class extends u{_taskGroupCollection;constructor(t){super(t),this._taskGroupCollection=this.createTaskGroupCollection()}get type(){return"GroupingPanel"}get label(){return this.contributions.label}getInitialChildModelLinks(){return this.links.getLinksByGroup("taskgroup").all}get panelLinks(){return this.links.getLinksByGroup("panel")}setChildModels(t,e){let r=t.filter(i=>i instanceof U);this.taskGroupCollection.add(r)}hasIntroText(){return this.introtext!==""}get introtext(){return this.data._content?this.data._content.text.message:this.contributions.text?this.contributions.text.message??this.contributions.text:Array.isArray(this.contributions.texts)?this.contributions.texts[0].text:""}createTaskGroupCollection(){let t=this.getDataAsArray("taskgroups",[]),e=this.getContributionAsArray("taskgroups",[]),r=[];for(let i of t){let n=i.name,o=e.find(a=>a.name===n);if(o){let a=U.create(n,i,o,this.modelOptions);r.push(a)}}return new st(r)}set taskGroupCollection(t){this._taskGroupCollection=t}get taskGroupCollection(){return this._taskGroupCollection}hasTaskGroups(){return this.taskGroupCollection&&this.taskGroupCollection.hasItems()}hasTasks(){return this.taskGroupCollection.hasTasks()}};var Ti=class extends lr{get type(){return"CaseSearch"}getQuickSearchFilters(){return this.filterCollection?this.filterCollection.filter(t=>t.isQuickSearch()):[]}hasQuickSearchFilters(){return this.getQuickSearchFilters().length>0}};var Oi=class extends u{_actionCollection;_taskGroupCollection;constructor(t){super(t),this._taskGroupCollection=this.createTaskGroupCollection(),this._actionCollection=new F(this.data.actions,this.contributions.actions,this.modelOptions)}get type(){return"Tab"}getInitialChildModelLinks(){return this.links.getLinksByGroup("taskgroup","actions").all}setChildModels(t,e){let r=t.filter(i=>i instanceof U);this.taskGroupCollection.add(r)}get searchLink(){return this.links.getLinksByGroup("search").first}createTaskGroupCollection(){let t=this.getDataAsArray("taskgroups",[]),e=this.getContributionAsArray("taskgroups",[]),r=[];for(let i of t){let n=i.name,o=e.find(a=>a.name===n);if(o){let a=U.create(n,i,o,this.modelOptions);r.push(a)}}return new st(r)}get taskGroupCollection(){return this._taskGroupCollection}set taskGroupCollection(t){this._taskGroupCollection=t}get label(){return this.getContributionAsString("label","")}get components(){return this.links.getLinksByGroup("component","search")}get actionCollection(){return this._actionCollection}hasComponents(){return this.components.size>0}hasTaskGroups(){return this.taskGroupCollection&&this.taskGroupCollection?.hasItems()}hasActions(){return this.actionCollection&&this.actionCollection.hasItems()}};var xi=L(lt(),1);var ki=class extends ht{_attributeCollection;constructor(t=new B){super(t);let e=this.contributions;if(e&&e.attributes&&Array.isArray(e.attributes)){let r=e.attributes.filter(i=>{let[n]=Object.keys(i);return n!=="sessiondata"&&(0,xi.has)(this.data,n)});this._attributeCollection=new E(this.data,r,{...this.modelOptions,isReadonly:!0})}else this._attributeCollection=new E(this.data,[],{...this.modelOptions,isReadonly:!0})}get type(){return"UserProfile"}get attributeCollection(){return this._attributeCollection}};export{O as a,b,k as c,d,B as e,Ct as f,H as g,Ur as h,C as i,u as j,ct as k,At as l,Mt as m,se as n,$ as o,R as p,wt as q,oe as r,tt as s,Nt as t,ae as u,j as v,le as w,et as x,_t as y,ue as z,m as A,ce as B,fe as C,h as D,Et as E,G as F,Y as G,q as H,_ as I,Pr as J,Hr as K,M as L,Kr as M,X as N,ye as O,be as P,Ce as Q,Ae as R,Me as S,_e as T,Ee as U,De as V,ve as W,Dt as X,Se as Y,Te as Z,Oe as _,vt as $,ke as aa,kl as ba,xl as ca,xe as da,Ie as ea,Re as fa,rt as ga,K as ha,Le as ia,Fe as ja,we as ka,Ne as la,St as ma,Be as na,jt as oa,je as pa,Ve as qa,Ue as ra,Pe as sa,He as ta,Ge as ua,Ke as va,it as wa,We as xa,ze as ya,v as za,qe as Aa,E as Ba,Xe as Ca,F as Da,ht as Ea,Ye as Fa,ri as Ga,dt as Ha,nt as Ia,st as Ja,U as Ka,ni as La,x as Ma,ot as Na,Ot as Oa,kt as Pa,Qe as Qa,xt as Ra,I as Sa,Ze as Ta,si as Ua,Je as Va,oi as Wa,ai as Xa,li as Ya,It as Za,tr as _a,er as $a,Rt as ab,ui as bb,pt as cb,Mi as db,Ut as eb,Or as fb,Pt as gb,at as hb,ir as ib,nr as jb,sr as kb,or as lb,Ei as mb,Ht as nb,ar as ob,lr as pb,ur as qb,Di as rb,cr as sb,hr as tb,vi as ub,Si as vb,Ti as wb,Oi as xb,ki as yb};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p,f as S,g as W,h as J,i as z,j as ee,k as re,l as y,n as yt,o as bt,p as ie,q as T}from"./chunk-QTZ77JJN.js";import{a as P,b as Ir,c as Rr}from"./chunk-73XVCQCW.js";import{c as Kt,d as Lr,e as Lt,f as Wt,g as Fr,h as wr,i as ut,j as zt,k as $t,l as qt,m as Xt,n as Yt,o as Nr,p as Br,q as Qt,r as gt,s as Zt,t as jr}from"./chunk-CPYNQW3X.js";import{a as lt,b as te}from"./chunk-GHQP5QNP.js";import{a as A}from"./chunk-VGAPPKHA.js";import{a as Vr,e as Jt,h as Q,l as Z,m as Ft,x as N}from"./chunk-SFI46XCV.js";import{a as Ri,b as Li,e as Fi,f as pr,g as D}from"./chunk-NOB2I3DW.js";import{a as Gt,b as L,e as mt,g as kr,h as g,i as xr,m as ft,w as dr}from"./chunk-4BYHEGUN.js";var hi=Gt(($d,ci)=>{"use strict";function $i(s,t){for(var e=-1,r=t.length,i=s.length;++e<r;)s[i+e]=t[e];return s}ci.exports=$i});var fi=Gt((qd,mi)=>{"use strict";var di=Li(),qi=Fi(),Xi=Ri(),pi=di?di.isConcatSpreadable:void 0;function Yi(s){return Xi(s)||qi(s)||!!(pi&&s&&s[pi])}mi.exports=Yi});var bi=Gt((Xd,yi)=>{"use strict";var Qi=hi(),Zi=fi();function gi(s,t,e,r,i){var n=-1,o=s.length;for(e||(e=Zi),i||(i=[]);++n<o;){var a=s[n];t>0&&e(a)?t>1?gi(a,t-1,e,r,i):Qi(i,a):r||(i[i.length]=a)}return i}yi.exports=gi});var Ai=Gt((Yd,Ci)=>{"use strict";var Ji=bi(),tn=1/0;function en(s){var t=s==null?0:s.length;return t?Ji(s,tn):[]}Ci.exports=en});var O=class extends p{getInitialChildModelLinks(){let t=[];return this.collection.forEach(e=>{typeof e?.getInitialChildModelLinks=="function"&&t.push(...e.getInitialChildModelLinks())}),t}setChildModels(t,e){this.collection.forEach(r=>{typeof r.setChildModels=="function"&&r.setChildModels(t,e)})}};var b=class extends p{constructor(t=[]){if(super(t),!Array.isArray(t))throw new A(`${t} is not an Array`)}get layouthint(){return this.collection}has(...t){return(t.length>0?[...t]:[]).flat().some(r=>this.layouthint.includes(r)||this.layouthint.some(i=>i.startsWith(r)))}hasExact(...t){return(t.length>0?[...t]:[]).flat().some(r=>this.layouthint.includes(r))}getByLayoutHint(t){let e=null;return typeof t=="function"&&(e=this.layouthint.find(t)),typeof t=="string"&&(e=this.layouthint.find(r=>r.startsWith(t.toString()))),e||null}getLayoutHintValue(t){let e=t.endsWith(":")?t.substr(0,t.length-1):t,r=this.getByLayoutHint(i=>i.startsWith(`${e}=`)||i.startsWith(`${e}:`));return r?r.substr(e.length+1):null}getLayoutHintValues(t){if(!this.has(t))return null;let e=this.getLayoutHintValue(t);return e?e.split(";"):[]}};var k=class s{_configuration;_hasConfiguration=!1;constructor(t){this._hasConfiguration=Array.isArray(t),this._configuration=t??[]}includeLayoutHints(t){let e=this._configuration.filter(r=>{let[i]=Object.keys(r),n=r[i];return n.layouthint?n.layouthint.some(o=>t.includes(o)):!1});return new s(e)}excludeLayoutHints(t){let e=this._configuration.filter(r=>{let[i]=Object.keys(r),n=r[i];return n.layouthint?!n.layouthint.some(o=>t.includes(o)):!0});return new s(e)}get config(){return this._configuration.map(t=>{let[e]=Object.keys(t),r=t[e],i=[];return"labelTypes"in r?i=r.labelTypes:"propertyTypes"in r?i=r.propertyTypes:"sectionReferenceTypes"in r?i=r.sectionReferenceTypes:"textFragmentTypes"in r&&(i=r.textFragmentTypes),{type:e,label:r.label,types:i,layouthint:new b(r.layouthint),icon:"icon"in r?r.icon:""}})}hasConfig(){return this._hasConfiguration}hasContent(){return this.config.some(t=>t.type==="configElement")}hasLayoutHint(t){return this.config.some(e=>e.layouthint.has(t))}byTypes(t=[]){return!t||t.length===0?this.config:this.config.filter(e=>t.includes(e.type))}get labelConfig(){return this.config.filter(t=>t.type==="labelElement")}getAllSectionReferenceTypes(){return this.config.filter(t=>t.type==="contentElement").flatMap(t=>t.types)}getContentElementConfigBySectionReferenceType(t){return this.config.filter(e=>e.type==="contentElement"&&e.types.includes(t))}getContentConfiguredLabel(t,e=""){let r=this.labelConfig.length>0?this.labelConfig[0].types:[];if(t&&r.length>0){let i=t.getLabelElementByIds(r).filter(n=>n.value&&n.value!=="");if(i.length>0){let n=r.filter(o=>(i.some(a=>o===a._id),!1)).map(o=>i.find(l=>l._id===o));if(n.length>0&&n[0]!==void 0)return n[0].value}}return e}get hasContentFromData(){return Z()}};var ne=L(lt(),1);import{immerable as wi}from"immer";import{klona as Ni}from"klona/full";var d=class{static[wi]=!0;_data;_contributions;_layouthint;_modelOptions;constructor(t,e,r={origin:"",contextPath:N()}){typeof t=="object"&&t!=null?this._data=t:this._data={},typeof e=="object"&&e!=null?this._contributions=e:this._contributions={},this._modelOptions=r;let i=this.getContributionAsArray("layouthint",[]);this._layouthint=new b(i)}get data(){return this._data}replaceData(t){this._data=t}get contributions(){return this._contributions}get modelOptions(){return this._modelOptions}get origin(){return this._modelOptions.origin}get contextPath(){return this._modelOptions.contextPath}get layouthint(){return this._layouthint}getData(t,e){return e?(0,ne.get)(this.data,t,e):(0,ne.get)(this.data,t)}getDataAsString(t,e){let r=this.getData(t,e);return typeof r=="string"?r:e}getDataAsNumber(t,e){let r=this.getData(t,e);return typeof r=="number"?r:e}getDataAsBoolean(t,e){let r=this.getData(t,e);return typeof r=="boolean"?r:e}getDataAsArray(t,e){let r=this.getData(t,e);return Array.isArray(r)?r:e}getDataAsObject(t,e){let r=this.getData(t,e);return typeof r=="object"?r:e}getContribution(t,e){return(0,ne.get)(this.contributions,t,e)}getContributionAsArray(t,e){let r=this.getContribution(t,e);return Array.isArray(r)?r:e}getContributionAsObject(t,e){let r=this.getContribution(t,e);return typeof r=="object"?r:e}getContributionAsString(t,e){let r=this.getContribution(t,e);return typeof r=="string"?r:e}getContributionAsBoolean(t,e){let r=this.getContribution(t,e);return typeof r=="boolean"?r:e}getContributionAsNumber(t,e){let r=this.getContribution(t,e);return typeof r=="number"?r:e}hasData(){return Object.keys(this.data).length>0}clone(){return Ni(this)}};var mr=L(pr(),1);import{immerable as Bi}from"immer";var B=class s{[Bi]=!0;_key;_data;_contributions;_locale="en";_parameters;_origin;_contextPath=N();_requestHref;constructor(t,e,r,i){this._key=t??"unknown",this._data=e,this._contributions=r,this._locale=i??"en"}static create(t){let e=new s;if((0,mr.default)(t,"data")&&(0,mr.default)(t,"contributions")){let[r]=Object.keys(t.data),[i]=Object.keys(t.contributions);e.key=t.key??i,e.data=t.data?.[r],e.contributions=t.contributions?.[i],e.origin=t.origin,e.contextPath=t.contextPath}return e}get resourcetype(){let t=this.contributions?.resourcetype;return typeof t=="string"?t:""}get modelOptions(){return{origin:this.origin,contextPath:this.contextPath}}set origin(t){this._origin=t??""}get origin(){return this._origin}set contextPath(t){this._contextPath=t??N()}get contextPath(){return this._contextPath}set locale(t){this._locale=t}get locale(){return this._locale}set key(t){this._key=t}get key(){return this._key}set data(t){this._data=t}get data(){return this._data}set contributions(t){this._contributions=t}get contributions(){return this._contributions}set parameters(t){this._parameters=t}get parameters(){return this._parameters}set requestHref(t){this._requestHref=t}get requestHref(){return this._requestHref}static rehydrate(t){let e=new s;return e.origin=t.origin,e.contextPath=t.contextPath,e.locale=t.locale,e.key=t.key,e.data=t.data,e.contributions=t.contributions,e}};var H=class s extends d{_href;_icon;_targetModel;_isCacheable=!1;_method="GET";constructor(t,e,r){super(t,e,r),this._href=this.createHref()}static create(t,e,r,i){return new s({name:t,href:e.toString()},{name:t,label:r},i)}createHref(){let t=new y(this.getDataAsString("href",""),this.resourcetype,this.modelOptions);return this.handleInitialFilters(t),t}handleInitialFilters(t){if(this.layouthint.has(Qt)){let e={},r=Qt.length;for(let i of this.layouthint.filter(n=>n.startsWith(Qt))){let n=i.substring(r),o=ee.fromString(n);o&&(e[o.name]||(e[o.name]=[]),typeof o.value=="string"&&e[o.name].push(o.value))}Object.keys(e).forEach(i=>{let n=e[i].join(",");t.addParameter(i,n)})}}get key(){return this.getDataAsString("name","")}get label(){return this.getContributionAsString("label",this.key)}get resourcetype(){return this.getContributionAsString("resourcetype","")}get group(){return this.getContributionAsString("group",this.getDataAsString("group",""))}get href(){return this._href}set href(t){this._href=t}get method(){return this._method}set method(t){this._method=t}get links(){return"components"in this.data&&"components"in this.contributions?new C({components:this.data.components},{components:this.contributions.components}):new C}isActive(t){return t.href.startsWith(this.href)}set icon(t){this._icon=t}get icon(){return this._icon}get targetModel(){return this._targetModel}set targetModel(t){this._targetModel=t}get isCacheable(){return this._isCacheable}set isCacheable(t){this._isCacheable=t}get filterName(){let t=this.getDataAsObject("filter");if(t&&"name"in t&&typeof t.name=="string")return t.name}get hasProcessStatusSettings(){return"processStatus"in this.data&&"processStatus"in this.contributions}get processStatus(){if(this.hasProcessStatusSettings)return new Ct(this.data.processStatus,this.contributions.processStatus)}};var Ur=(s,t)=>{if(!s&&!t)return[];let e=[];if(s){let r=s;for(let i of Object.keys(r)){let n=r[i];if(Array.isArray(n))for(let o of n)e.push({data:{group:i,...o},contributions:{name:o.name}});else e.push({data:{name:i,group:i,...n},contributions:{name:i}})}}if(t){let r=t;for(let i of Object.keys(r)){let n=r[i];if(Array.isArray(n))for(let o of n){let a=e.findIndex(l=>l.data?.name===o.name);a>-1&&(e[a]={...e[a],contributions:{...o,group:i}})}else{let o=e.findIndex(a=>a.data?.name===i);o>-1?e[o]={...e[o],contributions:{name:i,...n}}:"href"in n&&e.push({data:{name:i,href:n.href},contributions:{name:i}})}}}return e};var C=class s extends p{constructor(t,e,r){super();let i=Ur(t,e);this.collection=i.filter(n=>!n.contributions.layouthint?.includes(jr)).map(n=>new H(n.data,n.contributions,r))}static create(t,e,r,i){let n="_links"in t?t._links:null,o=typeof e=="object"&&e!==null&&"_links"in e&&typeof e._links=="object"?{...e._links}:{};return new s(Array.isArray(n)?n[0]:n,{self:{resourcetype:r},...o},i)}get links(){return this.collection}set links(t){this.collection=t}getLinkByKey(t){return this.find(e=>e.key===t)}hasLinkByKey(t){return this.all.some(e=>e.key===t)}getLinkByHref(t){return this.find(e=>e.href.equals(t))}getLinksByGroup(...t){let e=t.length>0?[...t]:[],r=this.filter(n=>e.includes(n.group)),i=new s;return i.links=r,i}getLinkByResourceType(t){let e=new s;return e.collection=this.filter(r=>r.resourcetype===t),e}getLinksByLayoutHint(t){let e=new s;return e.collection=this.filter(r=>r.layouthint.has(t)),e}hasLinksByLayoutHint(t){return this.some(e=>e.layouthint.has(t))}toHrefArray(){return this.map(t=>t.href)}hasLink(t){return this.some(e=>e.href.equals(t.href))}update(t){let e=this.links.findIndex(r=>r.key===t.key);return e===-1?(this.collection=[...this.collection,t],this):(this.collection=[...this.links.slice(0,e),t,...this.links.slice(e+1)],this)}get routePath(){if(this.length===0)return"__NON_EXISTING_ROUTE__";let t=this.map(e=>e.href.path).join("|");return this.length>1?`(${t})`:t}};var Ct=class extends d{get concequenceType(){return this.getContributionAsString("consequenceType","").toLowerCase()}get transition(){return this.getContributionAsString("transition","").toLowerCase()}get isApplicable(){return this.getDataAsBoolean("applicable",!1)}get isCompleted(){return this.getDataAsBoolean("completed",!1)}get isNeeded(){let t=this.getDataAsString("needed","unknown");return t==="unknown"?null:t==="true"}get state(){return this.getDataAsString("state","")}get canComplete(){return this.getDataAsBoolean("canComplete",!0)}get links(){return C.create(this.contributions,null,"process-status",this.modelOptions)}get referenceDate(){return S.now()}get conceptLink(){let t=this.links.getLinkByKey("concept");return t&&(t.href=t.href.addParameter(g,this.referenceDate),t.isCacheable=!0),t}};var u=class extends d{_key;_locale;_lastServerUpdate;_links;_childModels=[];_modularuiResponse;_connectKey;constructor(t=new B){super(t.data,t.contributions,t.modelOptions),this._modularuiResponse=t,this._key=t.key,this._locale=t.locale,this._lastServerUpdate=Date.now(),this._links=C.create(this.data,this.contributions,this.resourcetype,this.modelOptions)}get modularuiResponse(){return this._modularuiResponse}set connectKey(t){this._connectKey=t}get connectKey(){return this._connectKey}get lastServerUpdate(){return this._lastServerUpdate}set lastServerUpdate(t){this._lastServerUpdate=t}get locale(){return this._locale}get key(){return this._key}set key(t){this._key=t}get resourcetype(){return this.getContributionAsString("resourcetype","unknown")}get label(){return this.getContributionAsString("label","")}get links(){return this._links}get selflink(){let t=this.links.getLinkByKey("self");if(t==null)throw new D(`Could not find self link for ${this.key===null?"unknown":this.key}`);return t}get selfhref(){return this.selflink?.href}getInitialChildModelLinks(){return[]}get childModels(){return this._childModels}addChildModels(t=[],e=[]){let r=t?.flat(),i=e?.flat();return this._childModels=r,this.setChildModels(r,i),this}setChildModels(t,e){if(!t&&!e)throw new A("No models send to setChildModels")}};var ct=class extends u{get type(){return"ConceptTypeDetail"}get key(){return this.getDataAsString("_id","concepttype")}get label(){return this.getDataAsString("label","")}get isCoreTaxonomy(){return this.getDataAsBoolean("coreTaxonomy",!1)}get icon(){return this.getDataAsString("icon","")}get textColor(){return this.getDataAsString("textColor","#000")}get backgroundColor(){return this.getDataAsString("backgroundColor","#fff")}get borderColor(){return this.getDataAsString("lineColor","#000")}get labelTypes(){return this.getDataAsArray("labelTypes")||[]}get propertyTypes(){return this.getDataAsArray("propertyTypes")||[]}get textFragmentTypes(){return this.getDataAsArray("textFragmentTypes")||[]}get sectionReferenceTypes(){return this.getDataAsArray("sectionReferenceTypes")||[]}isOfConceptType(t){return this.selfhref?.equals(t)}};var At=class extends d{_entryDate;_links;_conceptType;constructor(t,e,r){super(t,{},r),this._entryDate=e,this._links=C.create(t??{},null,"concept",this.modelOptions)}get type(){return"ConceptLinkModel"}getInitialChildModelLinks(){return this.conceptTypeLink?(this.conceptTypeLink.isCacheable=!0,[this.conceptTypeLink]):[]}setChildModels(t,e){if(this.conceptTypeLink){let r=this.conceptTypeLink.href,i=t.find(n=>n instanceof ct?n.selfhref?.equalsWithParameters(r):!1);this.conceptType=i}}get conceptType(){return this._conceptType}set conceptType(t){this._conceptType=t}get key(){return this.getDataAsString("_id","")}get label(){let t=this.getDataAsString("label");return t||this.getDataAsString("conceptLabel","")}get links(){return this._links}get selflink(){let t=this.links.getLinkByKey("self");if(t===null)throw new Error(`Could not find self link for ${this.key===null?"unknown":this.key}`);return t}get selfhref(){return this._entryDate?this.selflink?.href.addParameter(g,this._entryDate):this.selflink?.href}get conceptTypeLink(){return this.links.getLinkByKey("concepttype")}get concepttypeHref(){return this.conceptTypeLink?.href??null}get taxonomyType(){return"default"}get modelCategory(){return this.getDataAsString("modelCategory")}get sectionId(){return this.data.section?._id}get fragment(){return this.data.section?.fragment}asLinkModel(){let t=H.create(this.key,"",this.label,this.modelOptions);return this.selfhref&&(t.href=this.selfhref),t}};var Mt=class extends d{_concept;constructor(t,e,r){super(t,void 0,r),this._concept=new At(t?.concept,e,this.modelOptions)}get selfhref(){throw new Error("Method not implemented.")}getInitialChildModelLinks(){return this.concept.getInitialChildModelLinks()}setChildModels(t,e){this.concept.setChildModels(t,e)}get type(){return this.getDataAsString("relationType","")}get key(){return this.type}get label(){return this.getDataAsString("relationLabel")}get direction(){return this.getDataAsString("relationDirection")}get relationTypeType(){return this.getDataAsString("relationTypeType","None")}get condition(){return this.getDataAsString("relationCondition")}get properties(){return this.getDataAsArray("properties")}get textfragments(){return this.getDataAsArray("textFragments")}get concept(){return this._concept}set concept(t){this._concept=t}};var se=class s extends O{_entryDate;_modelOptions;constructor(t,e,r){super(),this._entryDate=e,this._modelOptions=r||{origin:"",contextPath:N()},t&&this.createCollection(t,e)}createCollection(t,e){Array.isArray(t)?t.forEach(r=>{r instanceof Mt?this.add(r):this.add(new Mt(r,e,this._modelOptions))}):this.add(new Mt(t,e,this._modelOptions))}get types(){return this.collection.filter((t,e,r)=>r.findIndex(i=>i.key===t.key)===e).map(t=>({key:t.key,label:t.label}))}byType(t){return new s(this.filter(e=>e.key===t),this._entryDate,this._modelOptions)}get incoming(){return new s(this.filter(t=>t.direction==="incoming"),this._entryDate,this._modelOptions)}get outgoing(){return new s(this.filter(t=>t.direction==="outgoing"),this._entryDate,this._modelOptions)}hasIncoming(){return this.incoming.length>0}hasOutgoing(){return this.outgoing.length>0}};var $=class extends u{get type(){return"ContentType"}get label(){return this.getDataAsString("label","")}get icon(){return this.iconLarge}get iconSmall(){return this.getDataAsString("iconSmall")}get iconMedium(){return this.getDataAsString("iconMedium")}get iconLarge(){return this.getDataAsString("iconLarge")}get description(){return this.getDataAsString("description")}};var R=class extends d{_links;_entryDate;_contentType;_items;constructor(t,e,r){super(t,{},r),this._entryDate=e,this._links=C.create(this.data,this.contributions,"content",this.modelOptions),this._items=[]}get type(){return"ContentLinkModel"}getInitialChildModelLinks(){return this.contentTypeLink?(this.contentTypeLink.isCacheable=!0,[this.contentTypeLink]):[]}setChildModels(t,e){if(this.contentTypeLink){let r=this.contentTypeLink.href;this.contentType=t.find(i=>i instanceof $?i.selfhref?.equalsWithParameters(r):!1)}}get contentType(){return this._contentType}set contentType(t){this._contentType=t instanceof $?t:void 0}set entryDate(t){this._entryDate=t}get key(){return this.getDataAsString("_id","")}get label(){return this.getDataAsString("label","")}get sourceLabel(){return this.getDataAsString("sourceLabel")}get abbreviation(){return this.getDataAsString("abbreviation")||this.getDataAsString("sourceAbbreviation")}get section(){return this.data.section}get encodedHref(){let t="/content/",e=new y(this.selfhref.path,"",this.modelOptions),r=e.path,i=this.section?r.substring(t.length,r.lastIndexOf("/")):r.substring(t.length);if(this.section!=null){let n=encodeURIComponent(this.section);e.path=`${t}${encodeURIComponent(i)}/${n}`}else e.path=`${t}${encodeURIComponent(i)}`;return this._entryDate!==null&&e.addParameter(g,this._entryDate),e}get links(){return this._links}get selflink(){let t=this.links.getLinkByKey("self");if(Jt("COMPLETE_SOURCE",!1)&&(this.links.hasLinkByKey("content")&&(t=this.links.getLinkByKey("content")),this.section!=null&&t&&!t.href.path.endsWith(encodeURIComponent(this.section))&&(t.href.addParameter("complete","true"),t.href.hash=this.section||"")),!t)throw new Error(`Could not find self link for '${this.key||"unknown"}'`);return t.href.state?t.href.state.fragment=this.fragment:t.href.state={fragment:this.fragment},t}get contentHref(){let t=this.data._links.self.href;if(this.data._links.content)t=this.data._links.content.href;else if(this.section){let e=encodeURIComponent(this.section);t.endsWith(e)&&(t=t.substring(0,t.lastIndexOf("/"+e)))}return new y(t).addParameter("complete","true").addParameter(g,this._entryDate)}get sectionHref(){if(this.section){let e=this.contentHref;return new y(e.path+"/"+encodeURIComponent(this.section)).addParameter(g,this._entryDate)}return null}get selfhref(){return this._entryDate?this.selflink.href.addParameter(g,this._entryDate):this.selflink.href}get subSectionID(){return this.selfhref.hash}get contentTypeLink(){return this.links.getLinkByKey("contenttype")}get contentTypeHref(){return this.contentTypeLink?.href}get fragment(){return this.data.sectionFragment}set items(t){this._items=t}get items(){return this._items}};var wt=class extends d{_entryDate;_links;constructor(t,e,r){super(t,void 0,r),this._links=C.create(this.data,null,"concept",this.modelOptions),this._entryDate=e}get links(){return this._links}get link(){let t=this.selfhref?.path,e=this.links.getLinkByKey("content")?.href.path;if(t&&e)return new R({...this.data,label:this.label,section:this.sectionId,sectionFragment:this.fragment},this._entryDate,this.modelOptions)}get selflink(){return this.links.getLinkByKey("self")}get selfhref(){return this.selflink?.href}get type(){return this.getDataAsString("type","")}get typeLabel(){return this.getDataAsString("typeLabel","")}get label(){return this.getDataAsString("label")}get sourceLabel(){return this.getDataAsString("sourceLabel")}get sourceAbbreviation(){return this.getDataAsString("sourceAbbreviation")}get referenceHash(){if(this.selfhref)return yt(this.selfhref)}get number(){return this.getDataAsString("number")}get sectionId(){return this.getDataAsString("sectionId")}get fragment(){return this.getDataAsObject("sectionFragment")}};var oe=class extends p{constructor(t,e=[],r,i){super(),this.collection=this.createSourceReferences(t||[],r),this.collection=t?t.map(n=>{let o=e.find(a=>a._id===n.type);return new wt({typeLabel:o?.label,...n},r,i)}):[]}createSourceReferences(t,e){return t.map(r=>new wt(r,e))}byTypes(t){return this.filter(e=>t.includes(e.type))}};var tt=class extends u{_conceptType;_relations;_sourceReferences;constructor(t){super(t),this._relations=new se(this.data.relations,this.entryDate,this.modelOptions)}get type(){return"ConceptDetail"}getInitialChildModelLinks(){let t=this.links.getLinkByKey("concepttype"),e=this.relationsCollection.getInitialChildModelLinks();return t?(t.isCacheable=!0,[t,...e]):e}setChildModels(t,e){let r=t.find(i=>i instanceof ct);r instanceof ct&&(this.conceptType=r),this.relationsCollection.setChildModels(t,e)}get key(){return this.getDataAsString("_id","concept")}get selfhref(){let{href:t}=this.selflink;return this.entryDate?t.setParameter(g,this.entryDate):t.removeParameter(g),t}get diagramLinks(){return this.links.getLinksByGroup("diagram")}get conceptType(){return this._conceptType}set conceptType(t){this._conceptType=t}get label(){return this.getDataAsString("conceptLabel","")}get modelCategory(){return this.getDataAsString("modelCategory","")}get taxonomyType(){return this.getDataAsString("taxonomyType")}get relationsCollection(){return this._relations}get formula(){return this.getDataAsString("formula")}get labels(){if(this.conceptType?.labelTypes){let t=this.getDataAsArray("labels",[]);return this.conceptType.labelTypes.map(e=>{let r=t.find(i=>i.type===e._id);return{...e,...r}})}return[]}getLabelElementByIds(t){return this.labels.filter(e=>t.includes(e._id))}get conceptProperties(){if(this.conceptType?.propertyTypes){let t=this.getDataAsArray("properties",[]);return this.conceptType.propertyTypes.map(e=>{let r=t.find(i=>i.type===e._id);return{...e,...r}})}return[]}getConceptPropertiesByIds(t){return this.conceptProperties.filter(e=>t.includes(e._id))}get textfragments(){let t=this.getDataAsArray("textFragments",[]),e=t.map(i=>({...this.conceptType?.textFragmentTypes.find(o=>i.type===o._id),...i})),r=this.conceptType?.textFragmentTypes?this.conceptType.textFragmentTypes.filter(i=>!t.some(n=>n.type===i._id)):[];return[...e,...r]}getTextFragmentByKeys(t){return this.textfragments.filter(e=>"type"in e&&typeof e.type=="string"&&t.includes(e.type))}getSourceReferenceCollection(t=[]){if(!this._sourceReferences){let e=[];this.conceptType&&this.conceptType.sectionReferenceTypes&&(e=this.conceptType.sectionReferenceTypes),this._sourceReferences=new oe(this.getSourceReferencesForCurrentLanguage(t),e,this.entryDate,this.modelOptions)}return this._sourceReferences}getSourceReferencesForCurrentLanguage(t){let e=this.getDataAsArray("sourceReferences",[]);if(e.length===0)return[];let r=3,i=e.map(a=>a.type.substring(a.type.length-r)),n=`_${this.locale}`;if(i.includes(n))return e.filter(a=>a.type.endsWith(n));let o=t.map(a=>`_${a.split("-")[0]}`);return e.filter(a=>{let l=a.type.substring(a.type.length-r);return!o.includes(l)})}get entryDate(){return this.getDataAsString(`filter.${g}.value`)}isOfConceptType(t){return this.conceptType?.isOfConceptType(t)??!1}};import{immerable as ji}from"immer";var Nt=class{[ji]=!0;_id;_defaultMessage;_parameters;_isClientConstraint;_layouthint;constructor(t,e,r,i=!1,n=new b){this._id=t,this._parameters=r,this._defaultMessage=e,this._isClientConstraint=i,this._layouthint=Array.isArray(n)?new b(n):n}get id(){return this._id}get defaultMessage(){return this._defaultMessage}get parameters(){return this._parameters}get isClientConstraint(){return this._isClientConstraint??!1}get layouthint(){return this._layouthint}get isMandatoryConstraint(){return this.id==="Constraint.Mandatory"}getMessage(){return{id:this.id,defaultMessage:this.defaultMessage??"",parameters:this.parameters??{}}}};var ae=(i=>(i[i.FORM=0]="FORM",i[i.FORMOBJECT=1]="FORMOBJECT",i[i.ATTRIBUTE=2]="ATTRIBUTE",i[i.COMPOSITE_CHILDREN=3]="COMPOSITE_CHILDREN",i))(ae||{}),j=class extends p{_type;constructor(t,e){super(),this._type=t,this.collection=[],e&&(this.collection=[...e.collection])}get type(){return this._type}get serverErrors(){return this.collection.filter(t=>!t.isClientConstraint)}findById(t){return this.collection.findIndex(e=>e.id===t)}addError(t,e,r,i){let n=this.findById(t);n>-1&&this.removeByIndex(n),this.add(new Nt(t,e,r,!1,i))}removeError(t){let e=this.findById(t);this.removeByIndex(e)}addServerError(t,e,r,i){r?this.addError(t,e,r,i):this.addError(t,e,void 0,i)}removeServerError(t){this.removeError(t)}removeServerErrors(){this.serverErrors.forEach(t=>{this.removeError(t.id)})}addErrors(t){this.collection=[...this.collection,...t]}addConstraints(t){this.collection=[...this.collection,...t.map(e=>new Nt(e.id,e.defaultMessage,e.parameters,!0))]}hasMandatoryError(){return this.collection.some(t=>t.isMandatoryConstraint)}};var le=class s extends d{_entryDate;_links;constructor(t,e,r){super(t,{},r),this._entryDate=e,this._links=C.create(this.data,this.contributions,"subsection",this.modelOptions)}get referred(){return this.getDataAsBoolean("referred",!1)}get id(){return"id"in this.data?this.getDataAsString("id"):this.getDataAsString("_id")}get key(){return this.id}get body(){return bt(this.data.body)}get number(){return this.getDataAsString("number")}get label(){return this.getDataAsString("label","")}get subSections(){return this.data.subSections?this.data.subSections.map(t=>new s(t,this.entryDate,this.modelOptions)):[]}get links(){return this._links}get selflink(){return this.links.getLinkByKey("self")}get selfhref(){return this.selflink?.href}get entryDate(){return this._entryDate}get relatedConceptsHrefs(){let t=[];return this.relatedConceptsHref&&t.push(this.relatedConceptsHref),this.subSections.forEach(e=>{t.push(...e.relatedConceptsHrefs)}),t}get relatedConceptsHref(){let t=this.links.getLinkByKey("relatedConcepts");if(t){let{href:e}=t;if(e.hash.includes("/relatedConcepts")){let r=e.path.substring(0,e.path.lastIndexOf("/"));e.path=r+"/"+e.hash,e.hash=e.hash.includes("#")?e.hash.substring(e.hash.indexOf("#")):""}return e.addParameter("entryDate",this.entryDate),e.setReferenceHash(this.referenceHash),e}}get referenceHash(){return yt(this.selfhref)}getReferredSections(){let t=[];for(let e of this.subSections){e.referred&&t.push(e);let r=e.getReferredSections();t.push(...r)}return t}};var et=class s extends d{_entryDate;_selflink;_childSections;constructor(t,e,r){super(t,{},r),this._entryDate=e,this._selflink=this.createSelfLink(),this._childSections=this.createChildSections()}get referred(){return this.getDataAsBoolean("referred",!1)}get selflink(){return this._selflink}createSelfLink(){let t=this.getDataAsString("_links.self.href");if(typeof t<"u")return H.create(this.key||"unknown",t,this.label,this.modelOptions)}get selfhref(){return this.selflink?.href}get entryDate(){return this._entryDate}get type(){return this.getDataAsString("type")}get sourceLabel(){return this.getDataAsString("sourceLabel")}get id(){let t=this.getDataAsString("id");return t||this.getDataAsString("_id","unknown")}get key(){return this.id}get label(){return this.getDataAsString("label","")}get number(){return this.getDataAsString("number")}get body(){let t=this.data.body;if(t)return bt(t)}get childSectionLinks(){let t=[];return this.data.childSections?t=this.data.childSections:this.data.sections&&(t=this.data.sections),t.map(e=>{let r=e.id||e._id,i=e._links;return new R({section:r,_id:r,label:e.label,sourceLabel:e.sourceLabel,_links:i},this.entryDate,this.modelOptions)})}get selfContentLink(){let t=this.data._links;return new R({section:this.id,_id:this.id,label:this.label,sourceLabel:this.sourceLabel,_links:t},this.entryDate,this.modelOptions)}createChildSections(){let t=[];return this.data.childSections?t=this.data.childSections:this.data.sections&&(t=this.data.sections),t.filter(e=>"body"in e).map(e=>new s(e,this.entryDate,this.modelOptions))}get childSections(){return this._childSections}set childSections(t){this._childSections=t||[]}get sections(){return this.data.sections?this.data.sections.map(t=>new s(t,this.entryDate,this.modelOptions)):[]}get subSections(){return Array.isArray(this.data.subSections)?this.data.subSections.map(t=>new le(t,this.entryDate,this.modelOptions)):[]}get referenceHash(){return yt(this.selfhref)}getReferredSections(){let t=[];for(let e of this.subSections){e.referred&&t.push(e);let r=e.getReferredSections();t.push(...r)}for(let e of this.childSections){e.referred&&t.push(e);let r=e.getReferredSections();t.push(...r)}return t}};import{immerable as Vi}from"immer";var _t=class s{[Vi]=!0;_content;constructor(t){this._content=t}static create(t){return typeof t=="object"&&t!==null&&"elements"in t&&Array.isArray(t.elements)?new s(t):new s}get fromData(){return Z()}get header(){let t=null,e=null,r=this._content?.header?.label;r&&(t=r);let i=this._content?.header?.description;return i&&(typeof i=="object"&&"message"in i?e=i.message:typeof i=="string"&&(e=i)),{label:t,description:e}}mapToPropertyElement(t){let e=t.propertyElement;return{propertyElement:{label:e.label,layouthint:new b(e.layouthint),properties:"properties"in e?e.properties:[]}}}mapToTextFragmentElement(t){let e=t.textFragmentElement;return{textFragmentElement:{label:e.label,layouthint:new b(e.layouthint),textfragments:"textfragments"in e?e.textfragments.map(r=>typeof r=="object"?{...r,text:bt(r.text)||""}:r):[]}}}mapToContentElement(t){let e=t.contentElement;return{contentElement:{label:e.label,layouthint:new b(e.layouthint),sections:"sections"in e?e.sections.map(r=>new et(r)):[]}}}get elements(){return Array.isArray(this._content?.elements)?this._content.elements.filter(t=>t!=null).map(t=>{switch(Object.keys(t)[0]){case"propertyElement":return this.mapToPropertyElement(t);case"textFragmentElement":return this.mapToTextFragmentElement(t);case"contentElement":return this.mapToContentElement(t);default:return t}}):[]}get label(){return this._content?.label}get properties(){return this.elements.filter(t=>Object.keys(t)[0]==="propertyElement").map(t=>{let{propertyElement:e}=t;return"properties"in e?e.properties:[]}).flat()}getConceptPropertiesByLabels(t){return this.elements.filter(e=>Object.keys(e)[0]==="propertyElement").map(e=>e.propertyElement).filter(e=>Array.isArray(t)?t.includes(e.label):t===e.label).map(e=>"properties"in e?e.properties:[]).flat()}get textfragments(){return this.elements.filter(t=>Object.keys(t)[0]==="textFragmentElement").map(t=>{let{textFragmentElement:e}=t;return"textfragments"in e?e.textfragments:[]}).flat()}getTextFragmentsByLabels(t){return this.elements.filter(e=>Object.keys(e)[0]==="textFragmentElement").map(e=>e.textFragmentElement).filter(e=>Array.isArray(t)?t.includes(e.label):t===e.label).map(e=>"textfragments"in e?e.textfragments:[]).flat()}get sections(){return this.elements.filter(t=>Object.keys(t)[0]==="contentElement").map(t=>t.contentElement.sections).flat()}getSectionsByType(t){return this.sections.filter(e=>{let r=e.type;return r?Array.isArray(t)?t.includes(r):t===r:!1})}getSectionsByLabels(t){return this.elements.filter(e=>Object.keys(e)[0]==="contentElement").map(e=>e.contentElement).filter(e=>Array.isArray(t)?t.includes(e.label):t===e.label).map(e=>e.sections).flat()}getReferredSections(){let t=[];for(let e of this.sections)t.push(...e.getReferredSections());return t}};var ue=class{_id;_validateMethod;_defaultMessage;_parameters;_useClientsideValidation;constructor(t,e,r,i,n=Q("USE_CLIENTSIDE_VALIDATION")){this._id=t,this._validateMethod=e,this._defaultMessage=r,this._parameters=i,this._useClientsideValidation=n}get id(){return this._id}get defaultMessage(){return this._defaultMessage||"Missing default message"}get parameters(){return this._parameters}hasValidation(){return this._validateMethod!=null}validate(t){let e=this._validateMethod;return this._useClientsideValidation&&e?e(t):!0}get isMandatoryConstraint(){return this._id==="mandatory"||this._id==="Constraint.Mandatory"}};var m=class extends p{addConstraint(t,e,r,i={},n=Q("USE_CLIENTSIDE_VALIDATION")){this.add(new ue(t,e,r,i,n))}validate(t){return this.isEmpty()||this.collection.every(e=>e.validate(t))}hasMandatoryConstraint(){return this.collection.some(t=>t.isMandatoryConstraint)}invalidConstraints(t){return t===""&&!this.hasMandatoryConstraint()?[]:this.collection.filter(e=>!e.validate(t))}};var ce=class{get id(){return"Constraint.Mandatory"}hasValidation(){return!0}get defaultMessage(){return"Field is mandatory"}get parameters(){return{}}validate(t){if(t==null)return!1;if(typeof t!="string")throw new TypeError(`isNotEmptyString: Not comparing to string: ${typeof t}`);return t!==""}get isMandatoryConstraint(){return!0}};var he="Constraint.InvalidLengthExact",de="Constraint.InvalidLengthBetween",pe="Constraint.InvalidLengthTooShort",me="Constraint.InvalidLengthTooLong",fe=class{_minLength;_maxLength;constructor(t,e){this._minLength=t,this._maxLength=e}get id(){return this.minLength&&this.maxLength&&this.minLength===this.maxLength?he:this.minLength&&this.maxLength?de:this.minLength?pe:this.maxLength?me:"Constraint.NoLengthConstraint"}get minLength(){return this._minLength}get maxLength(){return this._maxLength}hasValidation(){return!0}isExactLength(t){if(typeof t!="string")throw new TypeError("isExactLength: Not comparing to string");if(this.minLength==null)throw new Error("isExactLength: Min and max length not set");return t.length===this.minLength}isBetween(t){if(typeof t!="string")throw new TypeError("isBetween: Not comparing to string");if(this.minLength==null||this.maxLength==null)throw new Error("isBetween: Min or max length not set");return this.isLongEnough(t)&&this.isSmallEnough(t)}isLongEnough(t){if(typeof t!="string")throw new TypeError("isLongEnough: Not comparing to string");if(!this.minLength)throw new Error("isLongEnough: Min length not set");return t.length>=this.minLength}isSmallEnough(t){if(typeof t!="string")throw new TypeError("isSmallEnough: Not comparing to string");if(!this.maxLength)throw new Error("isSmallEnough: Max length not set");return t.length<=this.maxLength}get defaultMessage(){switch(this.id){case he:return"Length must be precisely ${length} characters";case de:return"Length must be between ${min-length} and ${max-length} characters";case pe:return"The length of the value must be larger than ${min-length}";case me:return"The length of the value must be smaller than ${max-length}";default:return""}}get parameters(){switch(this.id){case he:return{length:this.minLength};case de:return{"min-length":this.minLength,"max-length":this.maxLength};case pe:return{"min-length":this.minLength};case me:return{"max-length":this.maxLength};default:return{}}}validate(t){switch(this.id){case he:return this.isExactLength(t);case de:return this.isBetween(t);case pe:return this.isLongEnough(t);case me:return this.isSmallEnough(t);default:return!0}}get isMandatoryConstraint(){return!1}};var h=class extends d{_label;_links;_parentKey;_hasContentConfiguration=!1;_content;_concept;attributeReferenceDate;_lastModification=0;_initvalue;_value;_inputvalue;_previouslyValidatedValue;attributeErrors;_serverConstraints=new m;_useClientsideValidation=Q("USE_CLIENTSIDE_VALIDATION",!0);_isValid=!0;_mandatory;_readonly=!1;_disabled=!1;_isResult;_isHidden=!1;_isEditable=!1;_layoutHintRules;_placeholder;constructor(t,e,r){super(t,e,r),this.attributeReferenceDate=this.getDataAsString("referenceDate",S.now()),this._links=C.create(this.data,this.contributions,"attribute",this.modelOptions),this._content=this.createAttributeContent(),this._label=this.createLabel(),this._placeholder=this.getContributionAsString("placeholder"),this._initvalue=this.data.value,this._inputvalue=this.getInitialInputValue(this.data.value),this._value=this.data.value,this._isResult=this.getDataAsBoolean("isResult",!1),this._mandatory=this.layouthint.has(Kt)||this.getContributionAsBoolean("mandatory",!1),this._disabled=this.layouthint.has(Lr),this.attributeErrors=this.createErrorCollection(this.data.message)}createLabel(){return this.hasContentFromData()&&this.content?.label&&(this._label=this.content.label),this.getContributionAsString("label","")}createErrorCollection(t){let e=new j(2);return typeof t=="object"&&t!=null&&e.addServerError(t.id,t.message,t.properties,t.layouthint),e}static isApplicableModel(t){throw typeof t!="object"?new A("Given argument for isApplicableModel is not a contributions object"):new Error("isApplicableModel must be implemented on an attribute")}get key(){return this.getDataAsString("key","unknown")}get parentKey(){return this._parentKey||""}set parentKey(t){this._parentKey=t}get name(){return this.key}get label(){return this._label}set label(t){this._label=t}get placeholder(){return this._placeholder}set placeholder(t){this._placeholder=t}get isEditable(){return this._isEditable}set isEditable(t){this._isEditable=t}get isVisible(){return!this._isHidden}get isHidden(){return this._isHidden}set isHidden(t){this._isHidden=t}show(){this.isHidden=!1}hide(){this.isHidden=!0}get links(){return this._links}get downloadLink(){let t=this.links.getLinksByGroup("download").first;if(t&&t.key===this.key)return t}getInitialChildModelLinks(){return!this.hasContentFromData()&&this.hasContentConfiguration()&&this.conceptLink?[this.conceptLink]:[]}setChildModels(t,e){let r=this.conceptLink?.href;if(r){let i=t.find(n=>n instanceof tt?n.selfhref.equalsWithParameters(r):!1);this.concept=i}}get conceptLink(){let t=this.links.getLinkByKey("concept");return t&&(t.href=t.href.addParameter(g,this.referenceDate),t.isCacheable=!0),t}get concept(){return this._concept}set concept(t){this._concept=t}get referenceDate(){return this.attributeReferenceDate}set referenceDate(t){this.attributeReferenceDate=t}hasContentFromData(){return Z()}setHasContentConfiguration(t){this._hasContentConfiguration=t}hasContentConfiguration(){return this._hasContentConfiguration}createAttributeContent(){if("content"in this.data)return new _t(this.data.content)}get content(){return this._content}indicateContentConfiguration(t){if(t){let e=t.questions?.hasConfig(),r=t.isConfiguredEndResultAttribute(this.key),i=t.isConfiguredIntermediateResultAttribute(this.key);this.setHasContentConfiguration(e||r||i)}}getContentConfiguredLabel(t){return this.hasContentFromData()?this.content?.label??this.label:t.getContentConfiguredLabel(this.concept,this.label)}get defaultAlignment(){return"left"}get alignment(){let t=this.layouthint.getByLayoutHint("align-"),e=t?t.substring(6):this.defaultAlignment;return e==="left"||e==="center"||e==="right"?e:this.defaultAlignment}get readonlyWidth(){return"MEDIUM"}get layoutHintRules(){return this._layoutHintRules}set layoutHintRules(t){this._layoutHintRules=t}processLayoutHintRules(t){this.layoutHintRules&&this.layoutHintRules.process(this,t)}get lastModification(){return this._lastModification}set lastModification(t){this._lastModification=t}updateLastModification(){this.lastModification=Date.now()}isChangedSince(t){return this.lastModification>t}getInitialInputValue(t){return t}get initvalue(){return this.getInitValue()}getInitValue(){return this._initvalue}setInitValue(t){this._initvalue=t}hasValue(){return this._value!=null&&this._value!==""}getValue(){return this.hasValue()?this._value:null}setValue(t){this._value=t}get value(){return this.getValue()}set value(t){this.updateLastModification(),this._value=t}getInputValue(){let t=this._inputvalue;return t?t.toString():""}setInputvalue(t){this._inputvalue=t}get inputvalue(){return this.getInputValue()}set inputvalue(t){this._inputvalue=t,this.value=t,this.validate(t)}formatValue(t){return JSON.stringify(t)}get readonlyvalue(){return this.value?this.value.toString():""}get validateValue(){return this.inputvalue}get mandatory(){return this._mandatory||!1}set mandatory(t){t!==this._mandatory&&(this._previouslyValidatedValue=null),this._mandatory=t}get configuredMandatory(){return this.layouthint.has(Kt)??this.getContributionAsBoolean("mandatory")}get readonly(){return this._readonly||this.getContributionAsBoolean("readonly")===!0||this.getDataAsBoolean("static")===!0||this.isResult}set readonly(t){this._readonly=t}get disabled(){return this._disabled}set disabled(t){this._disabled=t}get isResult(){return this._isResult}set isResult(t){this._isResult=t}get format(){return this.getContributionAsString("format")}get formatLabel(){return this.format}get minLength(){return this.getContributionAsNumber("minLength")}get maxLength(){return this.getContributionAsNumber("maxLength")}get operator(){return this.getContributionAsString("operator","")}get assistantMessage(){return this.getContributionAsString("assistant")}get isValid(){return this.validate(this.validateValue)}getIsValid(){return this._isValid}setIsValid(t){this._isValid=t}getServerConstraints(){return this._serverConstraints}get constraintCollection(){let t=new m;return t.add(this._serverConstraints),this.mandatory&&t.add(new ce),(this.minLength||this.maxLength)&&t.add(new fe(this.minLength,this.maxLength)),t.add(this.addConstraints()),t}addConstraints(){return new m}setUseClientsideValidation(t){this._useClientsideValidation=t}useClientsideValidation(){return this._useClientsideValidation??!0}validate(t){return this.useClientsideValidation()?(this.isOptionalAndEmpty(t)?this._isValid=!0:this.getPreviouslyValidatedValue()!==t&&(this._isValid=this.constraintCollection.validate(t)),this.setPreviouslyValidatedValue(t),this._isValid):!0}setPreviouslyValidatedValue(t){this._previouslyValidatedValue=t}getPreviouslyValidatedValue(){return this._previouslyValidatedValue}isOptionalAndEmpty(t){if(t===void 0)throw new A("isOptionalAndEmpty method needs value argument");return!this.mandatory&&t===""}get errorCollection(){let t=new j(2,this.attributeErrors);return t.addConstraints(this.constraintCollection.invalidConstraints(this.validateValue)),t}inError(){return!this._isValid&&this.isChangedSince(0)}resetErrors(){this.attributeErrors.clear()}addServerError(t){this.attributeErrors.addServerError(t.id,t.message,t.properties,t.layouthint)}removeServerError(t){this.attributeErrors.removeServerError(t)}hasServerErrors(){return this.errorCollection.serverErrors.length>0}hasErrors(){return this.errorCollection.hasItems()}addMissingError(t){this.attributeErrors.addServerError("Constraint.Missing")}removeMissingError(){this.removeServerError("Constraint.Missing")}addServerConstraint(t,e,r){this._serverConstraints.addConstraint(t,void 0,e||"",r,this.useClientsideValidation())}formatParameters(t){if(!t)return{};let e={};return Object.keys(t).forEach(r=>{let i=t[r];r.endsWith("-number")||r.endsWith("-date")?e[r]=this.formatValue(i):e[r]=i}),e}get hasDynamicValidationData(){return!0}updateValidations(t){t.some(e=>e.id==="Constraint.Mandatory")||this.layouthint.has(Kt)?this.mandatory=!0:this.hasValue()||(this.mandatory=!1),this._serverConstraints=new m,this.resetErrors(),t.filter(e=>e.id!=="Constraint.Mandatory"||!this.hasValue()).forEach(e=>{this.hasValue()?this.attributeErrors.addServerError(e.id,e.message,this.formatParameters(e.properties),e.layouthint):this.addServerConstraint(e.id,e.message,this.formatParameters(e.properties))})}mergeAttribute(t){this.concept=t.concept,!t.readonly&&t.isValid&&t.inputvalue!==null&&this.update(t.inputvalue)}getFormData(){return this.inError()?null:{[this.name]:this.value}}get formdata(){return this.getFormData()}getEmptyFormData(){return{[this.name]:null}}equals(t){return this.key===t.key&&this.parentKey===t.parentKey}};import{immerable as Ki}from"immer";var Sr=L(lt(),1),$e=L(Vr(),1);var Gr=L(pr(),1);var q=class s extends O{get type(){return"composite-collection"}get selfhref(){}static create(t,e,r){return"children"in t&&"children"in e&&Array.isArray(e.children)&&Array.isArray(t.children)?Array.isArray(t.children[0])?s.createMultiData(t,e,r):s.createStandard(t,e,r):new s}static createStandard(t,e,r){let i=new s;return"children"in e&&"children"in t&&Array.isArray(e.children)&&Array.isArray(t.children)&&(i.collection=e.children.map(n=>{let[o]=Object.keys(n),a=Array.isArray(t.children)?t.children.find(w=>w.key===o):{},l=n[o];"type"in e&&typeof e.type=="string"&&e.type.includes("range")&&!l.type&&(l.type=e.type.replace("range",""));let c=v.createAttribute(o,{...a,dynamicschema:a?.dynamicschema},{...l,readonly:l.readonly??"readonly"in e},r);return c&&"key"in t&&typeof t.key=="string"&&(c.parentKey=t.key),c}).filter(n=>n!==null)),i}static createMultiData(t,e,r){let i=new s;return"children"in t&&Array.isArray(t.children)&&(i.collection=t.children.map(n=>s.create({...t,children:n},e,r))),i}getInputValue(){return this.collection.map(t=>t.inputvalue).join(",")}get inputvalue(){return this.getInputValue()}validate(){return this.collection.every(t=>t.isValid)}get errorCollection(){return new j(3)}hasServerErrors(){return this.errorCollection.serverErrors.length>0||this.collection.some(t=>t.hasServerErrors())}hasErrors(){return this.errorCollection.hasItems()??this.collection.some(t=>t.hasErrors())}isValid(){return!this.hasErrors()}reset(){this.collection.forEach(t=>{t.reset()})}get initvalue(){let t={},e=[];for(let r of this.collection)r instanceof s?e.push(r.initvalue):r.initvalue!==null&&(t[r.key]=r.initvalue);if(!(e.length===0&&Object.keys(t).length===0))return e.length>0?e:t}get value(){if(this.first instanceof s)return this.collection.map(e=>e.value);let t={};if(this.collection.forEach(e=>{if(e instanceof s)return e.value;e.formdata!==null&&!e.readonly&&(t={...t,...e.formdata})}),Object.keys(t).length!==0)return t}get readonlyvalue(){return this.first instanceof s?this.collection.map(t=>t.readonlyvalue).join(" | "):this.collection.filter(t=>t.value!==null).map(t=>t.readonlyvalue).join(", ")}updateValidations(t,e){this.collection.forEach(r=>{if(r instanceof s)r.updateValidations(t,e);else{let i=e.filter(n=>n.anchor?.elementid===`${t}${r.key}`);r.updateValidations(i)}})}setUseClientsideValidation(t){this.collection.forEach(e=>{e.setUseClientsideValidation(t)})}hasValue(){return this.collection.some(t=>t.hasValue())}getChildByAttribute(t){return this.collection.find(e=>e instanceof h&&e.equals(t)?!0:e instanceof M?e.getChildByAttribute(t):!1)}getChildByKey(t){return this.collection.find(e=>e instanceof h&&e.key===t?!0:e instanceof M?e.getChildByKey(t):!1)}};var _=(f=>(f.STRING="string",f.NUMBER="number",f.INTEGER="integer",f.BOOLEAN="boolean",f.MEMO="memo",f.DATE="date",f.DATETIME="datetime",f.TIME="time",f.TIMESTAMP="timestamp",f.ARRAY="array",f.BINARY="binary",f.COMPOSITE="composite",f.CAPTCHA="captcha",f.PASSWORD="password",f.CHOICE="choice",f.LOOKUP="lookup",f.RANGE="range",f.HELPTEXT="helptext",f.LABEL="label",f.MONEY="money",f.XML="xml",f.UPLOAD="upload",f.ASSIGNMENT="assignment",f))(_||{}),Pr=(c=>(c.STRING="string",c.CHOICE="choice",c.DATE="date",c.DATETIME="datetime",c.ASSIGNMENT="assignment",c.DATERANGE="daterange",c.DATETIMERANGE="datetimerange",c.NUMBER="number",c.NUMBERRANGE="numberrange",c))(Pr||{}),Hr=(i=>(i.STATIC="static",i.DYNAMIC="dynamic",i.DYNAMIC_WITH_THRESHOLD="dynamicWithThreshold",i.LOOKUP="lookup",i))(Hr||{});var M=class s extends h{_children;constructor(t,e,r){super(t,e,r),this._children=q.create(t??{},e??{},r),this.setChildrenOptionality()}static isApplicableModel(t){return t.type==="composite"||t.type==="array"&&"children"in t}getInitialChildModelLinks(){return this.children.getInitialChildModelLinks()}setChildModels(t,e){this.children.setChildModels(t,e)}get type(){return"composite"}get children(){return this._children}set children(t){this._children=t}get start(){return this.children.all[0]}get end(){return this.children.all[this.children.size-1]}getInputValue(){return this.children.getInputValue()}hasValue(){return this.children.some(t=>t.hasValue())}get constraintCollection(){let t=new m;return t.add(this.getServerConstraints()),t.add(this.addConstraints()),t}setUseClientsideValidation(t){super.setUseClientsideValidation(t),this.children.all.forEach(e=>e.setUseClientsideValidation(t))}validate(t){if(!this.useClientsideValidation())return!0;let e=this.children.validate();return e&&(e=this.constraintCollection.validate(t)),this.setIsValid(e),this.getIsValid()}get isValid(){return this.validate("")}hasServerErrors(){return this.errorCollection.serverErrors.length>0||this.children.some(t=>t.hasServerErrors())}hasErrors(){return this.errorCollection.hasItems()??this.children.some(t=>t.hasErrors())}reset(){this.children.reset()}getChildByAttribute(t){return this.children.find(e=>e instanceof q?!1:e.equals(t))}getChildByKey(t){return this.children.find(e=>e instanceof h&&e.key===t?!0:e instanceof s||e instanceof q?e.getChildByKey(t)!==void 0:!1)}mergeAttribute(t){this.concept=t.concept,this.children.forEach(e=>{if(t instanceof s&&e instanceof h){let r=t.getChildByKey(e.key);r&&e.mergeAttribute(r)}})}update(t,e){if(!e)throw new A("Composite attribute needs changed attribute on update call");return this.updateLastModification(),this.children.forEach(r=>{r instanceof s?r.update(t,e):r instanceof h&&r.equals(e)&&r.update(t)}),this.setChildrenOptionality(),this.validate(t),this}updateByAttribute(t){t instanceof s?t.children.forEach(e=>{if(!(e instanceof q)){let r=this.getChildByAttribute(e);r&&r.updateByAttribute(e)}}):console.error(`update of composite attribute with ${t.type} not supported`)}setChildrenOptionality(){let t=!this.mandatory&&this.children.every(e=>e.value===null);this.children.forEach(e=>{e instanceof h&&(e.mandatory=t||!e.configuredMandatory?!1:e.configuredMandatory)})}get readonly(){return super.readonly??this.children.every(t=>t instanceof h&&t.readonly)}set readonly(t){super.readonly=t}get readonlyvalue(){return this.children.readonlyvalue}get initvalue(){return this.children.initvalue}getFormData(){return{[this.name]:this.value}}getValue(){return this.children.value}getChildrenIds(){let t=this.data.value;return Array.isArray(t)?t.map(e=>{if(typeof e=="object"&&e!=null&&"_id"in e)return e._id}):t!=null&&typeof t=="object"&&"_id"in t?[t._id]:[]}get isResult(){return this._isResult}set isResult(t){this._isResult=t,this.children.forEach(e=>{e instanceof q||(e.isResult=t)})}indicateContentConfiguration(t){t&&this.children.forEach(e=>{e instanceof q||e.indicateContentConfiguration(t)})}equals(t){return this.key===t.key&&this.parentKey===t.parentKey||this.children.some(e=>e instanceof h&&e.equals(t))}get readonlyWidth(){if(this.type==="composite")return"LARGE";switch(this.start instanceof h?this.start.type:""){case"datetime":return"LARGE";case"timestamp":return"EXTRA_LARGE";default:return"MEDIUM"}}};var E=class extends O{constructor(t={elementid:"none"},e=[],r){super(),e.forEach(i=>{let[n,o]=Object.entries(i)[0],a=v.createAttribute(n,t,o,{origin:r?.origin,contextPath:r?.contextPath});a!==null&&(r?.isReadonly&&!(0,Gr.default)(o,"readonly")&&(a.readonly=!0),this.collection.push(a))}),this.processLayoutHintRules()}get attributes(){return this.processLayoutHintRules(),this.all}set attributes(t){this.collection=t}processLayoutHintRules(){this.all.forEach(t=>{t.processLayoutHintRules(this)})}get visible(){return this.attributes.filter(t=>!t.isHidden)}get questions(){return this.visible.filter(t=>!t.isResult)}get results(){return this.visible.filter(t=>t.isResult)}getAttributeByAttribute(t){return this.find(e=>e.equals(t)?!0:t instanceof M?t.getChildByAttribute(e):!1)}getAttributeByKey(t){return this.find(e=>e.key===t?!0:e instanceof M?e.getChildByKey(t):!1)}hasAttributeByKey(t){return this.getAttributeByKey(t)!=null}getAttributeByLayoutHint(...t){return this.find(e=>e.layouthint.has(...t))}getChoiceAttributeByLayoutHint(t){let e=this.getAttributeByLayoutHint(t);if(e instanceof X)return e}getAttributesByLayoutHint(...t){return this.filter(e=>e.layouthint.has(...t))}replace(t,e){this.replaceByKey(t.key,e)}replaceByKey(t,e){this.forEach((r,i)=>{r.key===t&&(this.collection[i]=e)})}setReferenceDate(t){this.forEach(e=>{e.referenceDate=t})}hasServerErrors(){return this.collection.some(t=>t.hasServerErrors())}addServerError(t){let e=t?.anchor?.elementid;if(e){let r=this.getAttributeByKey(e);if(r)r.addServerError(t);else throw new P(`Could not add error to missing attribute with id ${e}`)}}hasErrors(){return this.visible.some(t=>t.hasErrors())}updateValidations(t){return this.all.filter(e=>e.hasDynamicValidationData).forEach(e=>{let r=t.filter(i=>i.anchor?.elementid===e.key);if(e.updateValidations(r),e instanceof M){let i=t.filter(n=>{let o=n.anchor?.elementid;return o&&o.startsWith(`${e.key}.`)});e.children.updateValidations(`${e.key}.`,i)}}),this}indicateContentConfiguration(t){t&&this.all.forEach(e=>{e.indicateContentConfiguration(t)})}get formdata(){return this.getFormData(!1)}getFormData(t=!1){let e=this.attributes.filter(i=>i.formdata!==null&&!i.readonly&&(!t||i.hasDynamicValidationData)).map(i=>i.isVisible?i.formdata:i.getEmptyFormData()),r={};return e.forEach(i=>{r={...r,...i}}),r}};var G=class s extends d{_code;_isSelected;_concept;_referenceDate;_level;_attributeCollection;_children;_links;_content;_isUser=!1;constructor(t=[],e={},r){super({},e),this._code=this.getContributionAsString("code",this.getContributionAsString("key","")),this._isSelected=t.includes(this.code),this._referenceDate=r?.referenceDate||new Date().toISOString().split("T")[0],this._level=0,this._attributeCollection=this.createAttributeCollection(r),this._children=this.addChildren(t,e,r),this._links=new C(this.contributions._links,{},{origin:r?.origin,contextPath:r?.contextPath}),this._content=this.createContent(),this._isUser="optionType"in e&&e.optionType==="user"}get type(){return"option"}static createFromListItemModel(t){let e=new s;return e.code=t.id?.toString()??"",e}get isChoiceAttributeOptionModel(){return!0}getInitialChildModelLinks(){let t=[];return!this.hasContentFromData()&&this.conceptLink&&t.push(this.conceptLink),this.children&&t.push(...this.children.getInitialChildModelLinks()),t}setChildModels(t,e=[]){let r=this.conceptLink?.href;if(r){let i=t.find(n=>n instanceof tt?n.selfhref.equalsWithParameters(r):!1);this.concept=i}this.children&&this.children.setChildModels(t,e)}get code(){return this._code}set code(t){this._code=t}equals(t){return this.code.toString()===t.code.toString()}createAttributeCollection(t){let e=this.getContributionAsArray("elementsContributions",[]),r=this.getContributionAsObject("elements",{});return new E(r,e,{origin:t?.origin,contextPath:t?.contextPath,isReadonly:!0})}get attributeCollection(){return this._attributeCollection}set attributeCollection(t){this._attributeCollection=t}get label(){let t=this.getContributionAsString("label");if(t)return t;if(this.attributeCollection.hasItems()){let e=this.attributeCollection.getAttributeByLayoutHint(ut);if(e)return e.readonlyvalue;if(this.attributeCollection.first)return this.attributeCollection.first.readonlyvalue}return""}getContentConfiguredLabel(t){if(this.hasContentFromData())return this.content?.label||this.label;if(t)return t.getContentConfiguredLabel(this.concept,this.label)}hasContentFromData(){return Z()}get content(){return this._content}addChildren(t=[],e={},r){if("elements"in e)return new Y;let i="children"in e?e.children:[];return Y.create({value:t},{options:i??[]},r)}get children(){return this._children}createContent(){return _t.create(this.getContributionAsObject("content"))}get selected(){return this._isSelected}set selected(t){this._isSelected=t}get count(){return this.getContributionAsNumber("count")}get links(){return this._links}set links(t){this._links=t}get selfhref(){return this.links.getLinkByKey("self")?.href}get referenceDate(){return this._referenceDate}set referenceDate(t){this._referenceDate=t}get conceptLink(){let t=this.links.getLinkByKey("concept");return t&&(t.href=t.href.addParameter(g,this.referenceDate),t.isCacheable=!0),t}get concept(){return this._concept}set concept(t){this._concept=t}get level(){return this._level}set level(t){this._level=t}get isBooleanType(){return this.getContributionAsBoolean("isBooleanType",!1)}get hasAlternativeLabel(){return this.getContributionAsBoolean("hasAlternativeLabel",!1)}get isUser(){return this._isUser}mergeOption(t){this.concept=t.concept,this.children!=null&&t.children!=null&&this.children.mergeOptions(t.children)}};var Y=class s extends O{_modelOptions;_headers=[];_sortOptions=!1;constructor(t){super(),this._modelOptions=t||{origin:"",contextPath:N(),referenceDate:new Date().toISOString().split("T")[0]}}set sortOptions(t){this._sortOptions=t,this.collection.forEach(e=>{e.children&&(e.children.sortOptions=t)})}get sortOptions(){return this._sortOptions}static create(t={},e={},r){let i=new s(r);if("type"in e&&e.type==="boolean"){let n="value"in t?t.value:void 0;i.addBooleanOptions(n,e)}else"dynamicschema"in t&&t.dynamicschema!=null?i.addDynamicSchema(t,e):"options"in e&&e.options!=null&&i.addOptions(t,e);return"children"in e&&Array.isArray(e.children)&&i.addHeaders(e.children),i}get all(){return this.sortOptions?this.collection.sort((t,e)=>t.label.localeCompare(e.label)):this.collection}getSelectedOptions(t){let e=[];return"options"in t&&Array.isArray(t.options)?e.push(...t.options.filter(r=>r.selected).map(r=>r.key)):"value"in t&&("value"in t&&Array.isArray(t.value)?e.push(...t.value):typeof t.value=="boolean"?e.push(t.value.toString()):e.push(t.value)),e}getOptionCount(t,e){if(Array.isArray(e)){let r=e.find(i=>"key"in i&&i.key===t);if(r)return"count"in r&&typeof r.count=="number"?r.count:void 0}}addOptions(t,e){let r=this.getSelectedOptions(t);if("options"in e&&Array.isArray(e.options)){let i="options"in t&&Array.isArray(t.options)?t.options:[];e.options.forEach(n=>{let o=n.code||n.key,a="optionType"in e?e.optionType:"generic";this.addOption(r,{...n,count:this.getOptionCount(o,i),optionType:a})})}return this}addDynamicSchema(t,e){let r=this.getSelectedOptions(t);if("dynamicschema"in t&&Array.isArray(t.dynamicschema)){let i="options"in t&&Array.isArray(t.options)?t.options:[],n="children"in e?e.children:void 0,o="optionType"in e?e.optionType:"generic";t.dynamicschema.forEach(a=>{this.addOption(r,{...a,count:this.getOptionCount(a.code,i),optionType:o,elementsContributions:n})})}return this}addBooleanOption(t,e,r,i=[]){let n=i.find(a=>"code"in a&&a.code===t),o=n&&"label"in n?n.label:e;this.addOption(r,{code:t,label:o,isBooleanType:!0,hasAlternativeLabel:n!=null})}addBooleanOptions(t,e){let r=t==null?[]:[t.toString()],i="options"in e&&Array.isArray(e.options)?e.options:[];return this.addBooleanOption("true","Yes",r,i),this.addBooleanOption("false","No",r,i),this}addOption(t,e){let r=new G(Array.isArray(t)?t:[t],e,this._modelOptions);return this.add(r),this}getOptionByCode(t){return this.collection.find(e=>e.code===t)}hasOptionByCode(t){return this.collection.some(e=>e.code===t)}get selected(){let t=[];return this.collection.forEach(e=>{e.selected&&e.selected===!0&&t.push(e),e.children&&t.push(...e.children.selected)}),t}deselectAll(){this.collection=this.collection.map(t=>(t.selected=!1,t.children&&t.children.deselectAll(),t))}select(t){this.toggle(t,"select")}deselect(t){this.toggle(t,"deselect")}toggle(t,e){this.collection=this.collection.map(r=>(r.code===t?r.selected=e==="select":r.children&&r.children.toggle(t,e),r))}setReferenceDate(t){return this.collection.map(e=>(e.referenceDate=t,e.children&&(e.children.referenceDate=t),e))}set referenceDate(t){this.collection=this.setReferenceDate(t)}addHeaders(t){this._headers=t.map(e=>new Et(e))}get headers(){return this._headers?this._headers:[]}mergeOptions(t,e=!1,r=!1){let i=[];this.collection.forEach(n=>{let o=t.find(a=>a.code===n.code);o?(n.mergeOption(o),i.push(n)):r||i.push(n)}),e?this.collection=[...i,...t.filter(n=>!this.collection.some(o=>o.code===n.code))]:this.collection=i}some(t,e){return this.collection.some((r,i,n)=>{let o=t(r,i,n);return!o&&r.children?r.children.some(t,e):o})}};var Kr=(l=>(l.CHECKBOX="checkbox",l.RADIOBUTTON="radiobutton",l.COMBOBOX="combobox",l.LIST="list",l.LISTVIEW="listview",l.TABLE="table",l.LONGLIST="longlist",l.TOGGLE="toggle",l))(Kr||{}),X=class s extends h{_options;constructor(t,e,r){super(t,e,r),this.attributeReferenceDate=this.getDataAsString("referenceDate",new Date().toISOString().split("T")[0]),this._options=Y.create(t,e,{...r,referenceDate:this.referenceDate}),this.layouthint.has(wr)&&(this._options.sortOptions=!0)}static isApplicableModel(t){let e="";return"type"in t&&typeof t.type=="string"&&(e=t.type),e==="choice"||e==="array"?!0:e!=="composite"&&e!=="boolean"?"enumerated"in t||"options"in t:!1}get type(){let t=this.getContributionAsString("optionMode",""),e=this.lookupLink||this.lookupListLink;return t==="lookup"||t==="dynamicWithThreshold"&&e?"lookup":"choice"}getInitialChildModelLinks(){let t=[];return this.hasContentConfiguration()&&(!this.hasContentFromData()&&this.conceptLink&&t.push(this.conceptLink),t.push(...this.options.getInitialChildModelLinks())),t}setChildModels(t,e){let r=this.conceptLink?.href;if(r){let i=t.find(n=>n instanceof tt?n.selfhref?.equalsWithParameters(r):!1);this.concept=i}this.options.setChildModels(t,e)}get optionType(){return this.contributions?.optionType??"generic"}get isUser(){return this.optionType==="user"}get lookupLink(){let t=this.links.getLinkByKey("lookupOptions");return t&&this.lookupParameterType==="bodyParameter"&&(t.method="POST"),t}get lookupParameterType(){return this.getContributionAsString("parameterType")==="bodyParameter"?"bodyParameter":"queryParameter"}get lookupListLink(){return this.links.getLinkByKey("lookupList")}get lookupListLabel(){return this.contributions.lookupList?.label??""}get referenceDate(){return this.attributeReferenceDate}set referenceDate(t){this.attributeReferenceDate=t,this.options.referenceDate=t}get options(){return this._options}get selected(){return this.options.selected.map(t=>t.code)}get readonlyvalue(){return this.options.selected.map(t=>t.label).join(", ")}get initvalue(){let t=this.getInitValue();return Array.isArray(t)&&t.length!==0,t}getValue(){return this.options.selected.length>0?this.options.selected.map(t=>t.code).join(","):null}hasValue(){return this.options.selected.length>0}getInputValue(){return this.selected.join(",")}toggleOption(t){this.selected.includes(t)?this.disableOption(t):this.enableOption(t)}enableOption(t){this.isMultiple||this.options.deselectAll(),this.options.select(t),this.inputvalue=this.getInputValue()}disableOption(t){this.options.deselect(t),this.inputvalue=this.getInputValue()}addOption(t){this.isMultiple||this.options.deselectAll();let e="code"in t&&typeof t.code=="string"?t.code:"";this.options.find(r=>r.code===e)===void 0&&this.options.addOption(e,t)}get choicetype(){return["checkbox","radiobutton","combobox","list","listview","table","longlist","toggle"].find(t=>this.layouthint.has(t))??"checkbox"}get isMultiple(){return this.getContributionAsBoolean("multiplechoice")??this.choicetype==="checkbox"}get isTree(){return this.getContributionAsArray("options",[]).some(t=>"children"in t)}reset(){this.options.deselectAll()}mergeAttribute(t,e=!1,r=!1){!this.readonly&&t instanceof s&&(this.concept=t.concept,this.options.mergeOptions(t.options,e??this.type==="lookup",r),this.options.deselectAll(),t.isValid&&t.inputvalue!==null&&this.update(t.inputvalue))}update(t){if(this.readonly)return this;this.updateLastModification();let e;return Array.isArray(t)?e=t:typeof t=="string"&&this.isMultiple?e=t.split(","):e=[t],e.forEach(r=>{r instanceof G?(this.options.some(i=>i.equals(r))||this.options.add(r),this.toggleOption(r.code)):typeof r=="string"&&this.options.some(i=>i.code.toString()===r)&&this.toggleOption(r)}),this}updateByAttribute(t){if(this.reset(),t instanceof s||t instanceof M){let e;t instanceof s?e=t.options.selected:t instanceof M&&(e=t.getChildrenIds()),e!=null&&this.update(e)}else console.error(`update of choice attribute with ${t.type} not supported`)}addMissingError(t){this.isChangedSince(0)&&this.attributeErrors.addServerError("Constraint.Missing"),t instanceof s&&this.mergeAttribute(t,!0,!0)}setHasContentConfiguration(t){super.setHasContentConfiguration(this.contentConfiguration!=null||t)}get contentConfiguration(){if(!this.contributions.content?.optionElements)return;let t=this.contributions.content.optionElements.map(e=>"contentElement"in e?{contentElement:{layouthint:[Zt],...e.contentElement}}:e);return new k(t)}get placeholder(){return this.getContributionAsString("placeholder","")}addServerError(t){let{id:e,message:r,properties:i,layouthint:n}=t,o="answer-option-key";if(i&&o in i){let a=i[o],l=this.options.find(c=>c.code===a);l&&(i[o]=l.getContentConfiguredLabel(this.contentConfiguration??void 0)??"")}this.attributeErrors.addServerError(e,r,i,n)}get readonlyWidth(){return"MEDIUM"}};var ye=class s extends h{_referenceDate;_options;constructor(t,e,r){super(t,e,r),this._referenceDate=this.getDataAsString("referenceDate",S.now()),this._options=Y.create(t,e,{...r,referenceDate:this.referenceDate})}static isApplicableModel(t){return"type"in t&&t.type==="boolean"}get type(){return"boolean"}get referenceDate(){return this._referenceDate}set referenceDate(t){this._referenceDate=t,this.options.referenceDate=t}get choicetype(){return["checkbox","radiobutton","combobox","toggle"].find(t=>this.layouthint.has(t))??"radiobutton"}get isMultiple(){return!1}get isTree(){return!1}setHasContentConfiguration(t){super.setHasContentConfiguration(this.contentConfiguration!==null||t)}get contentConfiguration(){if("content"in this.contributions&&typeof this.contributions.content=="object"&&this.contributions.content!==null&&"optionElements"in this.contributions.content&&Array.isArray(this.contributions.content.optionElements)){let t=this.contributions.content.optionElements.map(e=>"contentElement"in e?{contentElement:{...e.contentElement,layouthint:[Zt]}}:e);return new k(t)}return null}get options(){return this._options}get selected(){return this.options.selected.map(t=>t.code)}get readonlyvalue(){return this.options.selected.map(t=>t.label).join(", ")}get initvalue(){let t=this.getInitValue();return Array.isArray(t)&&t.length!==0,t}getValue(){let t=this.options.selected;return t.length>0?t[0].code:null}hasValue(){return this.options.selected.length>0}getInputValue(){return this.selected.join(",")}toggleOption(t){this.selected.includes(t)?this.disableOption(t):this.enableOption(t)}enableOption(t){this.options.deselectAll(),this.options.select(t),this.inputvalue=this.getInputValue()}disableOption(t){this.options.deselect(t),this.inputvalue=this.getInputValue()}reset(){this.options.deselectAll()}mergeAttribute(t){!this.readonly&&t instanceof s&&(this.concept=t.concept,this.options.deselectAll(),t.isValid&&t.inputvalue!==null&&this.update(t.inputvalue))}update(t){if(this.readonly)return this;this.updateLastModification();let e;return Array.isArray(t)?e=t:typeof t=="string"&&this.isMultiple?e=t.split(","):typeof t=="string"?e=[t==="true"?"true":"false"]:e=[JSON.stringify(t)],e.forEach(r=>{r instanceof G?this.toggleOption(r.code):typeof r=="string"&&this.options.some(i=>i.code.toString()===r)&&this.toggleOption(r)}),this}updateByAttribute(t){this.reset(),t instanceof s?this.update(t.value):console.error(`update of boolean attribute with ${t.type} not supported`)}getFormData(){return this.inError()?null:this.hasValue()?{[this.name]:this.value==="true"}:this.choicetype==="checkbox"||this.choicetype==="toggle"?{[this.name]:!1}:{[this.name]:null}}get readonlyWidth(){return this.options.some(t=>t.hasAlternativeLabel)?"SMALL":"EXTRA_SMALL"}};var be=class extends h{_answer="";static isApplicableModel(t){return t.type==="captcha"}get type(){return"captcha"}update(t){return this.updateLastModification(),this.inputvalue=t,this}updateByAttribute(t){}setAnswer(t){this._answer=t}getAnswer(){return this._answer}get hasDynamicValidationData(){return!1}reset(){this._answer="",this.inputvalue=""}};var fr="Constraint.Date.InexactDate",gr="Constraint.Date.OutOfRange",yr="Constraint.Date.BelowMinimum",br="Constraint.Date.AboveMaximum",Ce=class{_type;_format;_minDate;_maxDate;constructor(t,e=null,r=null,i="yyyy-MM-dd"){this._type=t,this._format=i,this._minDate=e,this._maxDate=r}get type(){return this._type}get id(){return this.minDate!==null&&this.maxDate!==null&&this.minDate===this.maxDate?fr:this.minDate!==null&&this.maxDate!==null?gr:this.minDate!==null?yr:this.maxDate!==null?br:"Constraint.Date.NoBoundaryConstraint"}get format(){return this._format}get minDate(){return this._minDate}get maxDate(){return this._maxDate}get defaultMessage(){switch(this.id){case fr:return"Date must be precisely ${min-date}";case gr:return"Must be between ${min-date} and ${max-date}";case yr:return"Must be on or after ${min-date}";case br:return"Must be on or before ${max-date}";default:return""}}get parameters(){return{"min-date":this.minDate?this.formatUtil.toFormat(this.minDate,this.format):null,"max-date":this.maxDate?this.formatUtil.toFormat(this.maxDate,this.format):null}}hasValidation(){return!0}isExactDate(t){if(this.minDate===null)throw new D("isExactDate: Min and max date not set");return this.formatUtil.isSame(t,this.minDate,this.format)}isBetweenDates(t){if(this.minDate===null||this.maxDate===null)throw new D("isBetweenDate: Min or max date not set");return this.isSameOrAfterMinDate(t)&&this.isSameOrBeforeMaxDate(t)}isSameOrAfterMinDate(t){if(this.minDate==null)throw new D("isSameOrAfterMinDate: Min date not set");return this.formatUtil.isSameOrAfter(t,this.minDate,this.format)}isSameOrBeforeMaxDate(t){if(this.maxDate==null)throw new D("isSameOrBeforeMaxDate: Max date not set");return this.formatUtil.isSameOrBefore(t,this.maxDate,this.format)}get formatUtil(){switch(this.type){case"time":return J;case"timestamp":return z;case"datetime":return W;default:return S}}validate(t){if(typeof t!="string")throw new TypeError("isNotEmptyString: Not comparing to string");switch(this.id){case fr:return this.isExactDate(t);case gr:return this.isBetweenDates(t);case yr:return this.isSameOrAfterMinDate(t);case br:return this.isSameOrBeforeMaxDate(t);default:return!0}}get isMandatoryConstraint(){return!1}};var Ae=class{_format;_formatLabel;constructor(t,e){this._format=t,this._formatLabel=e}get id(){return"Constraint.DateFormat.InvalidFormat"}get format(){return this._format}get formatLabel(){return this._formatLabel}hasValidation(){return!0}get defaultMessage(){return"Date must be entered in the format ${format}"}get parameters(){return{format:this.formatLabel}}validate(t){return t?S.hasFormat(t,this.format):!1}get isMandatoryConstraint(){return!1}};var Me=class{_type;_format;_formatLabel;_formatNoOffset;_id="Constraint.DateTime.MissingValue";constructor(t,e,r){this._type=t,this._format=e,this._formatNoOffset=e.replace(ft,"").trim(),this._formatLabel=r}get type(){return this._type}get id(){return this._id}get format(){return this._format}get formatLabel(){return this._formatLabel}hasValidation(){return!0}get defaultMessage(){return"Date and time should both be entered"}get parameters(){return{format:this.formatLabel}}get formatUtil(){return this.type==="timestamp"?z:W}validate(t){if(!t)return!1;if(this.formatUtil.hasFormat(t,this.format))return!0;if(Ft())if(this.formatUtil.hasFormat(t,this._formatNoOffset)){if(!new RegExp("[+-](0[0-9]|1[0-4]):[0-5][0-9]").test(t))return this._id="Constraint.DateTime.MissingOffset",!1}else return this._id="Constraint.DateTime.MissingValue",!1;return!1}get isMandatoryConstraint(){return!1}};var _e=class{_format;_formatLabel;constructor(t,e){this._format=t,this._formatLabel=e}get id(){return"Constraint.TimeFormat.InvalidFormat"}get format(){return this._format}get formatLabel(){return this._formatLabel}hasValidation(){return!0}get defaultMessage(){return"Time must be entered in the format ${format}"}get parameters(){return{format:this.formatLabel}}validate(t){return t?J.hasFormat(t,this.format):!1}get isMandatoryConstraint(){return!1}};var Ee=class s extends h{_dateInputFormat;constructor(t,e,r){super(t,e,r),this._inputvalue="",this._dateInputFormat="",this.updateInitValue()}get type(){return this.getContributionAsString("type","date")}static isApplicableModel(t){return t.type==="date"||t.type==="time"||t.type==="datetime"||t.type==="timestamp"}get formatUtil(){switch(this.type){case"time":return J;case"timestamp":return z;case"datetime":return W;default:return S}}getInitValue(){let t=this.getDataAsString("value");return t&&(this.type==="time"&&t.length===5&&(t=`${t}:00`),this.type==="datetime"&&t.includes(".")?t=z.toFormat(t,W.getIsoFormat()):t=this.formatUtil.toISO(t),this.hasTime&&(t=this.getTimeValue(t))),t}getTimeValue(t){let e=t;if(this.timeInputFormat.toLowerCase().includes("h")||(e=this.formatUtil.setHour(t,0)),this.timeInputFormat.includes("m")||(e=this.formatUtil.setMinute(t,0)),this.timeInputFormat.includes("s")||(e=this.formatUtil.setSecond(t,0)),this.type==="timestamp"&&!this.timeInputFormat.includes("S")&&(e=this.formatUtil.setMilliseconds(t,0)),Ft()){let r=this.formatUtil.toFormat(t,ft),i=this.formatUtil.toFormat(e,ft);e=e.replace(i,r)}return e}updateInitValue(){let t=this.getInitValue();if(t!=null){this.setInitValue(t);let e=this.getInitialInputValue(t);this._inputvalue=e,this.setValue(t)}}getInitialInputValue(t){if(typeof t!="string")return"";let e=t;return this.type==="time"&&t.length===5&&(e=`${t}:00`),this.formatUtil.toFormat(e,this.inputFormat)}getInputValue(){return this._inputvalue?this._inputvalue.toString():""}get inputvalue(){return this.getInputValue()}set inputvalue(t){this.validate(t),this._inputvalue=t,this.value=t!==null&&t!==""?this.formatUtil.toISO(t,this.inputFormat):null}reset(){this.inputvalue=""}get format(){let t=this.getContributionAsString("format","");return this.formatUtil.convertFormat(t)}get formatLabel(){switch(this.type){case"date":return this.dateInputFormat.toLowerCase();case"time":return this.timeInputFormat.toLowerCase();default:return this.format.toLowerCase()}}get hasDate(){return this.type==="date"||this.type==="datetime"||this.type==="timestamp"}get hasTime(){return this.type==="time"||this.type==="datetime"||this.type==="timestamp"}get inputFormatWithoutOffset(){return this.hasDate&&this.hasTime?`${this.dateInputFormat} ${this.timeInputFormat}`.trim():this.hasDate?this.dateInputFormat:this.hasTime?this.timeInputFormat:""}get inputFormat(){return Ft()&&this.dateInputFormat!==""&&this.timeInputFormat!==""?`${this.inputFormatWithoutOffset} ${ft}`:this.inputFormatWithoutOffset}extractDateInputFormat(){let t=new Set("yMLdQDEewGu"),e=new Set("HhaKmsSZzXxO"),r=this.format,i="",n=!1,o=!1;for(let a=0;a<r.length;a++){let l=a>0?r[a-1]:"",c=a<r.length?r[a+1]:"",w=r[a];w==="'"?n=l==="'"||c==="'"||!n:!n&&t.has(w)?o=!0:!n&&e.has(w)&&(o=!1),o&&(i+=w)}return i.trim()}get dateInputFormat(){return this.hasDate?(this._dateInputFormat||(this._dateInputFormat=this.extractDateInputFormat()),this._dateInputFormat):""}get dateReadonlyFormat(){return this.hasDate?this.hasTime?this.format.replace(this.timeInputFormat,"").trim():this.format:""}get placeholder(){if(super.placeholder)return super.placeholder;let t=this.getContributionAsString("formatlabel");return this.hasDate&&this.hasTime&&t?.includes(" ")?t.split(" ")[0]:t}createTimeInputFormat(){if(!this.hasTime)return"";let t=this.format,e=[];t.includes("H")?e.push("HH"):t.includes("h")&&e.push("hh"),t.includes("m")&&e.push("mm"),t.includes("s")&&e.push("ss");let r=e.join(":");return t.includes("S")&&(r=`${r}.SSS`),t.includes("a")?`${r} a`:r}get timeInputFormat(){return this.createTimeInputFormat()}get timeReadonlyFormat(){return this.createTimeInputFormat()}get dateInputValue(){return typeof this.value=="string"&&this.dateInputFormat!==""?this.formatUtil.toFormat(this.value,this.dateInputFormat):""}get timeInputValue(){return typeof this.value=="string"&&this.timeInputFormat!==""?this.formatUtil.toFormat(this.value,this.timeInputFormat):""}formatValue(t){return typeof t!="string"||t===""?"":(this.type==="datetime"||this.type==="timestamp")&&S.hasFormat(t,xr)?S.toFormat(t,this.dateReadonlyFormat):this.type==="date"?this.formatUtil.toFormat(t,this.dateReadonlyFormat):this.formatUtil.toFormat(t,this.format)}get readonlyvalue(){return typeof this.value=="string"?this.formatValue(this.value):""}get isAmbiguous(){return typeof this.value=="string"?this.formatUtil.isAmbiguous(this.value):!1}get offset(){return typeof this.value=="string"?this.formatUtil.getOffset(this.value):null}get mindate(){return this.getContributionAsString("mindate")}get maxdate(){return this.getContributionAsString("maxdate")}addServerError(t){let{id:e,message:r,properties:i,layouthint:n}=t;i&&"format"in i&&this.formatLabel&&(i.format=this.formatLabel),this.attributeErrors.addServerError(e,r,i,n)}getFormatConstraint(){switch(this.type){case"date":return new Ae(this.dateInputFormat,this.formatLabel);case"time":return new _e(this.timeInputFormat,this.formatLabel);default:return new Me(this.type,this.inputFormat,this.formatLabel)}}addConstraints(){let t=new m;return t.add(this.getFormatConstraint()),(this.mindate||this.maxdate)&&t.add(new Ce(this.type,this.mindate,this.maxdate,this.inputFormat)),t}get readonlyWidth(){return this.type==="date"||this.type==="time"?"SMALL":"MEDIUM"}update(t){return this.inputvalue===t?this:(this.updateLastModification(),this.inputvalue=t,this)}updateByAttribute(t){if(this.reset(),t instanceof s){let e=t.value;if(e!=null){let r=this.formatUtil.toFormat(e,this.inputFormat);this.update(r)}}else console.error(`update of datetime attribute with ${t.type} not supported`)}};var De=class extends h{static isApplicableModel(t){return t.type==="helptext"||"readonly"in t&&"text"in t}get type(){return"helptext"}get text(){let e=this.getData("content")?.text?.message;if(e)return e;let r=this.getContribution("text");return r!=null?typeof r=="string"?r:r.message:null}update(t){return this}updateByAttribute(t){}getFormData(){return null}reset(){}};var ve=class extends h{static isApplicableModel(t){return"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("label"):!1}get type(){return"label"}update(t){return this}updateByAttribute(t){}getFormData(){return null}reset(){}};import{immerable as Ui}from"immer";var Dt=class{[Ui]=!0;static checkHintApplicability=!1;static isApplicableForAttribute(t){return!0}static isApplicableForHint(t){throw new D("Missing isApplicableForHint implementation on layout hint rule")}static initAttribute(t){throw new D("Missing initAttribute implementation on layout hint rule")}static initHint(t){throw new D("Missing initHint implementation on layout hint rule")}};var Wr="equals",zr="includes",$r="notEquals",qr="notIncludes",Xr="notIsEmpty",Yr="isEmpty",Qr="show",Zr="hide",Se=class s extends Dt{_action="";_control="";_operator="";_options=[];static checkHintApplicability=!0;static isApplicableForHint(t){return new RegExp(`^${Wt}\\s?(${Qr}|${Zr})`,"i").test(t)}static getRuleInstance(){return new s}static initHint(t){let e=this.getRuleInstance(),r=`${Wr}|${zr}|${$r}|${qr}|${Xr}|${Yr}`,i=new RegExp(`${Wt}\\s?(\\S*)\\swhen ${Lt}:\\s?(.*?)\\s*(${r})\\s(.*)`,"i"),n=new RegExp(`${Wt}\\s?(\\S*)\\swhen ${Lt}:\\s?(.*?)\\s*(${r})`,"i"),o=t.match(i)?t.match(i):t.match(n);if(o)e.action=o[1],e.control=o[2],e.operator=o[3],e.options=o[4]?o[4]:"";else throw new P(`No dependent information found on layout hint: ${t}`);return e}get action(){return this._action}set action(t){this._action=t}get control(){return this._control}set control(t){this._control=t}get operator(){return this._operator}set operator(t){this._operator=t}get options(){return this._options}set options(t){this._options=t.split("|").map(e=>e.trim())}processEqualsOptions(t){if("selected"in t&&Array.isArray(t.selected)){let e=t.selected;return this.options.every(r=>e.includes(r))}throw new P("Dependent control in combination with equals operator must be a choice, string or number attribute")}processIncludesOptions(t){if(t.type==="choice")return this.options.some(e=>t.selected.includes(e));throw new P("Dependent control in combination with includes operator must be a choice attribute")}handleOperator(t){switch(this.operator){case Wr:return this.processEqualsOptions(t);case zr:return this.processIncludesOptions(t);case $r:return!this.processEqualsOptions(t);case qr:return!this.processIncludesOptions(t);case Xr:return t?.selected.length!==0;case Yr:return t?.selected.length===0;default:throw new P(`Unsupported operator for dependent question: ${this.operator}`)}}getControlAttribute(t){let e=t.getAttributeByLayoutHint(`${Lt}:${this.control}`,`${Lt}: ${this.control}`);return typeof e<"u"&&e!=null&&"selected"in e&&Array.isArray(e.selected)?e:null}process(t,e){let r=this.getControlAttribute(e);if(!r)return;if(r.processLayoutHintRules(e),r.isHidden){t.hide();return}let i=this.handleOperator(r);if(this.action===Qr)t.isHidden=!i;else if(this.action===Zr)t.isHidden=i;else throw new P(`Unsupported action ${this.action} for dependent question on attribute: ${t.label}`)}};var Te=class{_filetypeConstraints;constructor(t){this._filetypeConstraints=t}get id(){return"Constraint.File.InvalidExtension"}get extensions(){return this._filetypeConstraints.map(t=>t.extensions.join(", ")).join(", ")}hasValidation(){return!1}get defaultMessage(){return"Allowed extensions are: ${extensions}"}get parameters(){return{extensions:this.extensions}}validate(){return!0}get isMandatoryConstraint(){return!1}};import Jr from"file-size";var Cr="Constraint.File.MaxTotalFileSize",Ar="Constraint.File.MaxFileSize",Oe=class{_filesizeConstraint;constructor(t){this._filesizeConstraint=t}get id(){return this.filesizeConstraint.isMaxTotal?Cr:this.filesizeConstraint.fileSize!==void 0?Ar:""}get filesizeConstraint(){return this._filesizeConstraint}hasValidation(){return!1}get defaultMessage(){return this.id===Cr?"{filesize-left} van {max-total-filesize} over van totaal toegestaan upload bestandsgrootte":this.id===Ar?"Maximale bestandsgroote is ${max-filesize}":""}get filesize(){return Jr(this.filesizeConstraint.fileSize??0).human("jedec")}get maxTotalFileSize(){if(this.filesizeConstraint.maxTotalFileSize)return Jr(this.filesizeConstraint.maxTotalFileSize).human("jedec")}get parameters(){return this.id===Cr?{"filesize-left":this.filesize,"max-total-filesize":this.maxTotalFileSize}:this.id===Ar?{"max-filesize":this.filesize}:{}}validate(){return!0}get isMandatoryConstraint(){return!1}};var Pi="UNCHANGED",vt=class s extends h{_files;_initialTotalFileSize=0;_maxTotalFileSize;static isApplicableModel(t){return t.type==="binary"}get type(){return"upload"}get multiple(){return this.getContributionAsBoolean("multiple",!1)}get initialTotalFileSize(){return this._initialTotalFileSize??0}set initialTotalFileSize(t){this._initialTotalFileSize=t}get maxTotalFileSize(){return this._maxTotalFileSize}set maxTotalFileSize(t){this._maxTotalFileSize=t}get currentFilesize(){return this.initialTotalFileSize+this.uploadedFileSize}get maxFileSize(){if(this.maxTotalFileSize){let t=this.maxTotalFileSize-this.currentFilesize;return t<0?0:t}return this.getContributionAsNumber("uploadMaxFileSize")}get uploadedFileSize(){if(Object.keys(this.files).length===0)return 0;let t=0;return Object.keys(this.files).forEach(e=>{let r=this.files[e];r.size&&(t+=r.size)}),t}get uploadConstraints(){let t=this.getContributionAsArray("allowedMimeTypes",[]).filter(i=>i!=="[...]");return{fileTypes:this.getContributionAsArray("allowedExtensions",[]).filter(i=>i!=="[...]").map(i=>({extensions:[i],mimeTypes:t})),maxFileSize:{fileSize:this.maxFileSize,maxTotalFileSize:this.maxTotalFileSize,isMaxTotal:this.maxTotalFileSize!==void 0},acceptedFiles:this.acceptedFiles}}get acceptedFiles(){let t=this.getContributionAsArray("allowedMimeTypes",[]).filter(r=>r!=="[...]");return[...this.getContributionAsArray("allowedExtensions",[]).filter(r=>r!=="[...]"),...t]}addConstraints(){let t=new m;return this.uploadConstraints.fileTypes.length>0&&t.add(new Te(this.uploadConstraints.fileTypes)),(this.uploadConstraints.maxFileSize.isMaxTotal||this.uploadConstraints.maxFileSize.fileSize!==void 0)&&t.add(new Oe(this.uploadConstraints.maxFileSize)),t}get files(){return this._files??{}}set files(t){this._files=t}getFilesTypeFromValue(t){if(typeof t=="object")return t;if(typeof t=="string")try{return JSON.parse(t)}catch{console.warn(`Can't parse upload value: ${t}`)}return null}update(t){if(!t)return this;let e=this.getFilesTypeFromValue(t);return e==null?this.inputvalue=t:(this.files=e,this.inputvalue=Object.keys(e).map(r=>e[r].token).join(",")),this.updateLastModification(),this}updateByAttribute(t){}get readonlyvalue(){return this.initvalue?this.initvalue.toString():""}getValue(){return this.hasValue()?this.initvalue===this.inputvalue?Pi:super.getValue():null}mergeAttribute(t){t instanceof s&&t.isValid&&t.inputvalue!==null&&this.update(JSON.stringify(t.files))}reset(){this._files={}}};var ke=class s extends Dt{static isApplicableForAttribute(t){return t.type==="upload"}static initAttribute(){return new s}processUploadInformation(t,e){let r=e.getAttributesByLayoutHint(Xt),i=e.getAttributesByLayoutHint(Yt);if(r.length>0&&i.length>0){let n=r[0].value,o=i[0].value;t.initialTotalFileSize=Number(n),t.maxTotalFileSize=Number(o)}}process(t,e){t instanceof vt&&this.processUploadInformation(t,e)}};var Bt=[Se,ke],kl=s=>{Bt.push(s)},xl=s=>{let t=s(Bt);if(Array.isArray(t))Bt=t;else throw new Ir("Result of updater of updateLayoutHintRules is not an array")},xe=class s extends p{get allRules(){return Bt}static setLayoutHintRules(t){let e=new s;return Bt.forEach(r=>{r.isApplicableForAttribute(t)&&(r.checkHintApplicability?t.layouthint.forEach(i=>{r.isApplicableForHint(i)&&e.add(r.initHint(i))}):e.add(r.initAttribute(t)))}),t.layoutHintRules=e,t}process(t,e){this.all.forEach(r=>{r.process(t,e)})}};var Ie=class{get id(){return"Constraint.BSN.InvalidFormat"}hasValidation(){return!0}get defaultMessage(){return"Must be a valid BSN"}get parameters(){return{}}isValidBSN(t){if(t.replace(/[^\d]/gu,"").length!==t.length)return!1;let e=t.replace(/\D/gu,""),r=e.length;if(r<8||r>9||Number.isNaN(e))return!1;let o=0,a=0;for(let l=r;l>0;l--){let c=parseInt(e.charAt(o),10);a+=l===1?c*-1:c*l,o+=1}return a%11===0}validate(t){return this.isValidBSN(t)}get isMandatoryConstraint(){return!1}};import Hi from"iban";var Re=class{get id(){return"Constraint.IBAN.InvalidFormat"}hasValidation(){return!0}get defaultMessage(){return"Must be a valid IBAN number"}get parameters(){return{}}validate(t){return Hi.isValid(t)}get isMandatoryConstraint(){return!1}};var rt=class{_regexConstraint;constructor(t){this._regexConstraint=t}get id(){return this.regexConstraint.messageKey}get regexConstraint(){return this._regexConstraint}hasValidation(){return!0}get defaultMessage(){return this.regexConstraint.defaultMessage||this.regexConstraint.messageKey}get parameters(){return{regex:this.regexConstraint.regex}}validate(t){return this.regexConstraint.regex instanceof RegExp?this.regexConstraint.regex.test(t):new RegExp(this.regexConstraint.regex).test(t)}get isMandatoryConstraint(){return!1}};var K=class s extends h{get type(){return"string"}static isApplicableModel(t){return"type"in t&&t.type==="string"?!0:"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("string"):!1}getInitialInputValue(t){return this.formatValue(t)}get regexp(){return this.getContributionAsString("regexp")}get regexpvalidationmessage(){return this.getContributionAsString("regexpValidationMessage")}get postfix(){return this.getContributionAsString("postfix","")}get prefix(){return this.getContributionAsString("prefix","")}isBSN(){return this.layouthint.has("bsn")}isIBAN(){return this.layouthint.has("iban")}isZipcode(){return this.layouthint.has("zipcode")}isEmail(){return this.layouthint.has("email")}addConstraints(){let t=new m;return this.isBSN()?t.add(new Ie):this.isIBAN()&&t.add(new Re),this.isZipcode()?t.add(new rt({messageKey:"Constraint.ZipCode.InvalidFormat",defaultMessage:"Must be a valid Dutch ZIP code, e.g. 1234 AB",regex:new RegExp("^[1-9][0-9]{3} ?[a-zA-Z]{2}$","gi")})):this.isEmail()&&this.regexp?t.add(new rt({messageKey:"Constraint.Email.InvalidFormat",defaultMessage:"Must be a valid e-mail address",regex:new RegExp(this.regexp,"gi")})):this.regexp&&t.add(new rt({messageKey:"Constraint.String.InvalidRegex",defaultMessage:this.regexpvalidationmessage,regex:this.regexp})),t}reset(){this.inputvalue=""}formatIBAN(t){let r=this.removeFormat(t).replace(/\s/g,"").match(/.{1,4}/g);return r==null?"":r.join(" ")}formatZipcode(t){let e=this.removeFormat(t);return e.length===6?e.substring(0,4)+" "+e.substring(4).toUpperCase():e}formatBSN(t){return this.removeFormat(t)}formatValue(t){return t==null||t.toString()===""?"":typeof t=="string"?this.isIBAN()?this.formatIBAN(t):this.isZipcode()?this.formatZipcode(t):this.isBSN()?this.formatBSN(t):t.replace(/ {2}/gi," \xA0"):JSON.stringify(t)}removeFormat(t){return t==null||t.toString()===""?"":typeof t=="string"?this.isIBAN()||this.isZipcode()||this.isBSN()?t.replace(/[^a-z0-9,]/gi,""):t:JSON.stringify(t)}get validateValue(){return this.removeFormat(this.inputvalue)}get inputvalue(){return this.getInputValue()}set inputvalue(t){this.setInputvalue(t),t==null?this.value=t:this.value=this.removeFormat(t),this.validate(this.validateValue)}get readonlyvalue(){return typeof this.value=="string"?this.formatValue(this.value).replace(/ {2}/gi," \xA0"):this.value==null?"":JSON.stringify(this.value)}update(t){return this.inputvalue===t?this:(this.updateLastModification(),this.inputvalue=t,this)}updateByAttribute(t){this.reset(),t instanceof s?this.update(t.value):console.error(`update of string attribute with ${t.type} not supported`)}get readonlyWidth(){return this.isZipcode()||this.isBSN()?"SMALL":this.isIBAN()?"LARGE":"MEDIUM"}};var Le=class extends K{static isApplicableModel(t){return"type"in t&&typeof t.type=="string"&&t.type==="memo"?!0:"rows"in t&&typeof t.rows=="number"?t.rows>1:!1}get type(){return"memo"}get rows(){return this.getContributionAsNumber("rows",10)}get formatted(){return this.getContributionAsBoolean("formatted",!1)}get readonlyWidth(){return"LARGE"}};var ti=L(Vr(),1);var Mr="Constraint.Number.InexactNumber",_r="Constraint.Number.OutOfRange",Er="Constraint.Number.BelowMinimum",Dr="Constraint.Number.AboveMaximum",Fe=class{_minNumber;_maxNumber;_groupingSeparator=",";_decimalSeparator=".";_format="";constructor(t=null,e=null,r=",",i=".",n){this._format=n??"",this._groupingSeparator=r,this._decimalSeparator=i,this._minNumber=t,this._maxNumber=e}get id(){return this.minNumber!==null&&this.maxNumber!==null&&this.minNumber===this.maxNumber?Mr:this.minNumber!==null&&this.maxNumber!==null?_r:this.minNumber!==null?Er:this.maxNumber!==null?Dr:"Constraint.Number.NoBoundaryConstraint"}get minNumber(){return this._minNumber}get maxNumber(){return this._maxNumber}get format(){return this._format}get groupingSeparator(){return this._groupingSeparator}get decimalSeparator(){return this._decimalSeparator}hasValidation(){return!0}get defaultMessage(){switch(this.id){case Mr:return"Number must be precisely ${min-number}";case _r:return"Must be between ${min-number} and ${max-number}";case Er:return"The number must be larger than ${min-number}";case Dr:return"The number must be smaller than ${max-number}";default:return""}}get parameters(){return{"min-number":this.minNumber===null?null:T.formatNumber(this.minNumber,this.format,this.groupingSeparator,this.decimalSeparator),"max-number":this.maxNumber===null?null:T.formatNumber(this.maxNumber,this.format,this.groupingSeparator,this.decimalSeparator)}}isExactNumber(t){return T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator)===this.minNumber}isSameOrAboveMinNumber(t){let e=T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator);return isNaN(e)||e==null?!1:this.minNumber!=null&&e>=this.minNumber}isSameOrBelowMaxNumber(t){let e=T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator);return isNaN(e)||e==null?!1:this.maxNumber!=null&&e<=this.maxNumber}isBetweenNumbers(t){return this.isSameOrAboveMinNumber(t)&&this.isSameOrBelowMaxNumber(t)}validate(t){switch(this.id){case Mr:return this.isExactNumber(t);case _r:return this.isBetweenNumbers(t);case Er:return this.isSameOrAboveMinNumber(t);case Dr:return this.isSameOrBelowMaxNumber(t);default:return!0}}get isMandatoryConstraint(){return!1}};var vr="Constraint.Number.InvalidInteger",we=class{_decimalSeparator=",";_groupingSeparator=".";_format="0";constructor(t=",",e=".",r="0"){this._decimalSeparator=e,this._groupingSeparator=t,this._format=r??"0"}get id(){return this.maxDigits===0?vr:"Constraint.Number.InvalidDecimal"}get decimalSeparator(){return this._decimalSeparator}get groupingSeparator(){return this._groupingSeparator}get format(){return this._format}get maxDigits(){return this.format?new ie(this.format).maxFrac:0}hasValidation(){return!0}get defaultMessage(){return this.id===vr?"Must be a whole number":"The value is not correct numeric format"}get parameters(){return{"max-digits":this.maxDigits}}isInteger(t){return Number.isInteger(t)}getNumberOfDigits(t){return Math.floor(t)===t?0:T.parseNumberToString(t).split(".")[1].length}isValidDecimal(t){if(isNaN(t))return!1;let e=this.getNumberOfDigits(t);return!isNaN(parseFloat(String(t)))&&isFinite(t)&&e<=this.maxDigits}validate(t){if(this.maxDigits===0&&this.decimalSeparator!==""&&t.toString().includes(this.decimalSeparator))return!1;let e=T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator);return this.id===vr?this.isInteger(e):this.isValidDecimal(e)}get isMandatoryConstraint(){return!1}};var Gi=3,Ne=class{_decimalSeparator;_groupingSeparator;_format;constructor(t=",",e=".",r="0"){this._decimalSeparator=e,this._groupingSeparator=t,this._format=r??"0"}get id(){return"Constraint.Number.GroupingSeparator"}get decimalSeparator(){return this._decimalSeparator}get groupingSeparator(){return this._groupingSeparator}get format(){return this._format}get groupSize(){if(this.format){let t=new ie(this.format).comma;if(t>0)return t}return Gi}hasValidation(){return!0}get defaultMessage(){return"Group divider '${group-divider}' must be correctly placed"}get parameters(){return{"group-divider":this.groupingSeparator}}hasCorrectGrouping(t){let e=t.replace("-","").replace("+","");if(!e.includes(this.groupingSeparator))return!0;let r=e;if(this.decimalSeparator!==""&&e.includes(this.decimalSeparator)){if(e.indexOf(this.decimalSeparator)<e.indexOf(this.groupingSeparator))return!1;r=e.substring(0,e.indexOf(this.decimalSeparator))}let i=r.split(this.groupingSeparator);return i[0].length<this.groupSize&&(i=i.slice(1)),i.every(n=>n.length===this.groupSize)}validate(t){return this.groupingSeparator===""||typeof t!="string"||!t.includes(this.groupingSeparator)||this.hasCorrectGrouping(t)}get isMandatoryConstraint(){return!1}};var St=class s extends h{static isApplicableModel(t){return"type"in t&&typeof t.type=="string"?t.type==="number"||t.type==="integer":!1}get type(){return"number"}getInitialInputValue(t){return t==null?"":this.formatValue(t)}get groupingSeparator(){return this.getContributionAsString("groupingSeparator","")}get decimalSeparator(){return this.getContributionAsString("decimalSeparator","")}get minNumber(){return this.getContributionAsNumber("minimum")}get maxNumber(){return this.getContributionAsNumber("maximum")}get maxDigits(){let t=this.format;return t!=null&&t.includes(".")?t.split(".")[1].length:0}get unit(){return this.getContributionAsString("unit","")}addConstraints(){let t=new m;return t.add(new we(this.groupingSeparator,this.decimalSeparator,this.format)),t.add(new Ne(this.groupingSeparator,this.decimalSeparator,this.format??void 0)),t.add(new Fe(this.minNumber,this.maxNumber,this.groupingSeparator,this.decimalSeparator,this.format??void 0)),t}reset(){this.inputvalue=""}get format(){return this.getContributionAsString("format","0")}formatValue(t){return typeof t=="string"||typeof t=="number"?T.formatNumber(t,this.format,this.groupingSeparator,this.decimalSeparator):""}get readonlyvalue(){return(0,ti.default)(this.value)?JSON.stringify(this.value):this.formatValue(this.value)}get inputvalue(){return this.getInputValue()}set inputvalue(t){this.setInputvalue(t),this.validate(t);let e=T.parseToNumber(t,this.groupingSeparator,this.decimalSeparator);this.value=isNaN(e)?null:T.parseNumberToString(e)}getValue(){let t=super.getValue();return t==null||t===""?null:Number(t)}update(t){return t===this.inputvalue?this:(this.updateLastModification(),this.inputvalue=t,this)}updateByAttribute(t){this.reset(),t instanceof s?this.update(t.value):console.error(`update of number attribute with ${t.type} not supported`)}get isHidden(){return super.isHidden||this.layouthint.has(Xt,Yt,gt)}set isHidden(t){super.isHidden=t}get readonlyWidth(){return"SMALL"}};var Be=class extends St{static isApplicableModel(t){return"type"in t&&typeof t.type=="string"&&t.type==="money"?!0:"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("money"):!1}get type(){return"money"}get currencySymbol(){return this.getContributionAsString("currencySymbol","")}get prefix(){return this.currencySymbol}get readonlyWidth(){return"SMALL"}};var jt=class{_otherPasswordLabel;_otherPasswordValue;constructor(t,e){this._otherPasswordLabel=e,this._otherPasswordValue=t}get id(){return"Constraint.Password.ConfirmMismatch"}get otherPasswordLabel(){return this._otherPasswordLabel}get otherPasswordValue(){return this._otherPasswordValue}hasValidation(){return!0}get defaultMessage(){return"Must match ${other} field"}get parameters(){return{other:this.otherPasswordLabel}}validate(t){return t===this.otherPasswordValue}get isMandatoryConstraint(){return!1}};var je=class{get id(){return"Constraint.Password.LowerAndUpperCaseMandatory"}hasValidation(){return!0}get defaultMessage(){return"Must contain both upper and lowercase characters"}get parameters(){return{}}validate(t){return/[a-z]/u.test(t)&&/[A-Z]/u.test(t)}get isMandatoryConstraint(){return!1}};var Ve=class{_minNumeric;constructor(t){this._minNumeric=t}get id(){return"Constraint.Password.MinNumericCharactersMandatory"}get minNumeric(){return this._minNumeric}hasValidation(){return!0}get defaultMessage(){return"Must contain ${min-numeric} or more numerical characters"}get parameters(){return{"min-numeric":this.minNumeric}}validate(t){return t.replace(/\D/gu,"").length>=this.minNumeric}get isMandatoryConstraint(){return!1}};var Ue=class{_minSpecial;constructor(t){this._minSpecial=t}get id(){return"Constraint.Password.MinSpecialCharactersMandatory"}get minSpecial(){return this._minSpecial}hasValidation(){return!0}get defaultMessage(){return"Must contain ${min-special} or more special characters"}get parameters(){return{"min-special":this.minSpecial}}validate(t){return t.replace(/[\da-z]/giu,"").length>=this.minSpecial}get isMandatoryConstraint(){return!1}};var Pe=class{_maxSequence;constructor(t=2){this._maxSequence=t}get id(){return"Constraint.Password.ThreeConsecutiveCharactersNotAllowed"}get maxSequence(){return this._maxSequence}hasValidation(){return!0}get defaultMessage(){return"Must not contain any character more than twice consecutively"}get parameters(){return{"max-sequence":this.maxSequence}}hasNoSequenceOfIdenticalCharacters(t){return!t.split("").filter((e,r)=>t.indexOf(e)===r).some(e=>{let r=e.repeat(this.maxSequence+1);return t.includes(r)})}validate(t){return this.hasNoSequenceOfIdenticalCharacters(t)}get isMandatoryConstraint(){return!1}};var He=class extends K{_confirmValue;_isConfirmPassword=!1;_otherLabel="";static isApplicableModel(t){return t.type==="password"?!0:"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("password"):!1}get type(){return"password"}update(t){return this.updateLastModification(),this.inputvalue=t,this}get constraints(){return this.getContributionAsObject("constraints",{})}get upperAndLowerCaseMandatory(){return this.constraints.upperAndLowerCaseMandatory}get maxSequenceOfIdenticalCharacters(){return this.constraints.maxSequenceOfIdenticalCharacters}get maxSequenceOfUsernameCharacters(){return this.constraints.maxSequenceOfUsernameCharacters}get minNumberOfNumericCharacters(){return this.constraints.minNumberOfNumericCharacters}get minNumberOfSpecialCharacters(){return this.constraints.minNumberOfSpecialCharacters}get regexConstraint(){return this.constraints.regexConstraint}addConstraints(){return this.isConfirmPassword?this.getConfirmPasswordConstraints():this.getStandardPasswordConstraints()}getConfirmPasswordConstraints(){let t=new m;return t.add(new jt(this.confirmValue,this.otherLabel)),t}getStandardPasswordConstraints(){let t=new m;return this.upperAndLowerCaseMandatory&&t.add(new je),this.maxSequenceOfIdenticalCharacters&&t.add(new Pe(this.maxSequenceOfIdenticalCharacters)),this.minNumberOfNumericCharacters&&t.add(new Ve(this.minNumberOfNumericCharacters)),this.minNumberOfSpecialCharacters&&t.add(new Ue(this.minNumberOfSpecialCharacters)),this.regexConstraint&&this.regexConstraint.length>0&&this.regexConstraint.forEach(e=>{t.add(new rt(e))}),this.layouthint.has(Fr)&&this.isConfirmPassword==null&&t.add(new jt(this.confirmValue,this.otherLabel)),t}get constraintCollection(){return this.isConfirmPassword?this.getConfirmPasswordConstraints():super.constraintCollection}get isConfirmPassword(){return this._isConfirmPassword}set isConfirmPassword(t){this._isConfirmPassword=t}get confirmValue(){return this._confirmValue??""}set confirmValue(t){this._confirmValue=t,this.validate(this.inputvalue)}get otherLabel(){return this._otherLabel}set otherLabel(t){this._otherLabel=t}validate(t){return this.useClientsideValidation()?(this.isOptionalAndEmpty(t)?this.setIsValid(!0):this.getPreviouslyValidatedValue()!==`${this.confirmValue}-${t}`&&this.setIsValid(this.constraintCollection.validate(t)),this.setPreviouslyValidatedValue(`${this.confirmValue}-${t}`),this.getIsValid()):!0}getFormData(){return this.isConfirmPassword||this.inError()?null:{[this.name]:this.value}}};var Ge=class{_type;_start;_end;constructor(t,e,r){this._type=t,this._start=e,this._end=r}get type(){return this._type}get id(){switch(this.type){case"date":return"Constraint.DateRange.Mandatory";case"time":return"Constraint.TimeRange.Mandatory";case"datetime":return"Constraint.DateTimeRange.Mandatory";case"timestamp":return"Constraint.TimeStampRange.Mandatory";default:return"Constraint.Range.Mandatory"}}hasValidation(){return!0}get defaultMessage(){return"Field is mandatory: must contain at least a start or end value"}get parameters(){return{}}validate(){return this._start.hasErrors()||(this._end?.hasErrors()??!1)?!0:this._start.hasValue()||(this._end?.hasValue()??!1)}get isMandatoryConstraint(){return!0}};var Ke=class{_start;_end;constructor(t,e){this._start=t,this._end=e}get id(){let t=this.hasInclusiveBounds?"InvalidRangeInclusive":"InvalidRange";switch(this.rangeType){case"time":return`Constraint.TimeRange.${t}`;case"date":return`Constraint.DateRange.${t}`;case"datetime":return`Constraint.DateTimeRange.${t}`;case"timestamp":return`Constraint.TimeStampRange.${t}`;default:return`Constraint.NumberRange.${t}`}}get defaultMessage(){let t=this.hasInclusiveBounds?" or equal to the":"";switch(this.rangeType){case"time":return`Start time must be before${t} end time`;case"date":return`Start date must be before${t} end date`;case"datetime":return`Start value must be before${t} end value`;case"timestamp":return`Start value must be before${t} end value`;default:return`Start value must be less than${t} the end value`}}hasValidation(){return!0}get parameters(){return{}}get start(){return this._start}get end(){return this._end}get rangeType(){return this.start.type}get hasInclusiveBounds(){return this.start.operator==="greaterThanOrEqualTo"&&this.end.operator==="lessThanOrEqualTo"}getDateTimeUtil(){switch(this.rangeType){case"time":return J;case"date":return S;case"timestamp":return z;default:return W}}doValidate(t,e){return typeof t=="number"&&typeof e=="number"?this.hasInclusiveBounds?T.isSameOrBefore(t,e):T.isBefore(t,e):typeof t=="string"&&typeof e=="string"?this.hasInclusiveBounds?this.getDateTimeUtil().isSameOrBefore(t,e):this.getDateTimeUtil().isBefore(t,e):!1}validate(){return this.start.inError()||this.end.inError()?!0:this.doValidate(this.start.value,this.end.value)}get isMandatoryConstraint(){return!1}};var it=class s extends h{_startAttribute;_endAttribute;constructor(t,e,r){if(super(t,e,r),!Array.isArray(e?.children))throw new Error(`Problem reading contributions of range attribute: ${this.key}, the children property must be an array.`);this._startAttribute=this.createChild(0),this._endAttribute=this.createChild(1),this.setChildrenOptionality()}get start(){return this._startAttribute}get end(){return this._endAttribute}get type(){return"range"}static isApplicableModel(t){return t.type.includes("range")}getInitialChildModelLinks(){return[...this.start.getInitialChildModelLinks(),...this.end.getInitialChildModelLinks()]}setChildModels(t,e){this.start.setChildModels(t,e),this.end.setChildModels(t,e)}getInputValue(){return[this.start.getInputValue(),this.end.getInputValue()].join(",")}hasValue(){return this.start.hasValue()||this.end.hasValue()}get constraintCollection(){let t=new m;return t.add(this.getServerConstraints()),t.add(this.addConstraints()),t}setUseClientsideValidation(t){super.setUseClientsideValidation(t),this.start.setUseClientsideValidation(t),this.end.setUseClientsideValidation(t)}validate(t){if(!this.useClientsideValidation())return!0;let e=this.start.isValid&&this.end.isValid;return e&&(e=this.constraintCollection.validate(t)),this.setIsValid(e),this.getIsValid()}addConstraints(){let t=new m;return this.start.hasValue()&&this.end.hasValue()&&t.add(new Ke(this.start,this.end)),this.mandatory&&!this.start.mandatory&&!this.end.mandatory&&t.add(new Ge(this.start.type,this.start,this.end)),t}get isValid(){return this.validate("")}hasServerErrors(){return this.errorCollection.serverErrors.length>0||this.start.hasServerErrors()||this.end.hasServerErrors()}hasErrors(){return this.errorCollection.hasItems()||this.start.hasErrors()||this.end.hasErrors()}reset(){this.start.reset(),this.end.reset()}mergeAttribute(t){this.concept=t.concept,t instanceof s&&(this.start.mergeAttribute(t.start),this.end.mergeAttribute(t.end))}update(t,e){if(!e)throw new A("Range attribute needs changed attribute on update call");return this.updateLastModification(),this.start.equals(e)&&this.start.update(t),this.end.equals(e)&&this.end.update(t),this.setChildrenOptionality(),this.validate(t),this}updateByAttribute(t){t instanceof s?(this.start.updateByAttribute(t.start),this.end.updateByAttribute(t.end)):console.error(`update of range attribute with ${t.type} not supported`)}get readonly(){return super.readonly??(this.start.readonly&&this.end.readonly)}set readonly(t){super.readonly=t}get readonlyvalue(){let t=[];return this.start.value!==null&&t.push(this.start.value),this.end.value!==null&&t.push(this.end.value),t.join(", ")}get initvalue(){return{[this.start.key]:this.start.initvalue,[this.end.key]:this.end.initvalue}}getFormData(){return{[this.name]:this.value}}getValue(){return{...this.start.formdata,...this.end.formdata}}get isResult(){return this._isResult}set isResult(t){this._isResult=t,this.start.isResult=t,this.end.isResult=t}indicateContentConfiguration(t){t&&(this.start.indicateContentConfiguration(t),this.end.indicateContentConfiguration(t))}equals(t){return this.key===t.key&&this.parentKey===t.parentKey||this.start.equals(t)||this.end.equals(t)}get readonlyWidth(){switch(this.start.type){case"datetime":return"LARGE";case"timestamp":return"EXTRA_LARGE";default:return"MEDIUM"}}createChild(t){let e=this.data.children?.[t];Array.isArray(e)&&(e=void 0);let r=this.contributions.children[t],[i]=Object.keys(r),n=r[i],o=v.createAttribute(i,e??{},n,this.modelOptions);return o&&e&&"key"in e&&(o.parentKey=e.key),o}setChildrenOptionality(){let t=!this.mandatory&&this.start.value===null&&this.end.value===null;this.start&&(this.start.mandatory=t||this.start.configuredMandatory?!1:this.start.configuredMandatory),this.end&&(this.end.mandatory=t||this.end.configuredMandatory?!1:this.end.configuredMandatory)}};var We=class{get id(){return"Constraint.XML.InvalidFormat"}hasValidation(){return!0}get defaultMessage(){return"Must be well-formed XML"}get parameters(){return{}}isValidXML(t){let e=new DOMParser;try{if(e.parseFromString(t,"text/xml").querySelectorAll("parsererror").length>0)return!1}catch{return!1}return!0}validate(t){return this.isValidXML(t)}get isMandatoryConstraint(){return!1}};var ze=class extends K{static isApplicableModel(t){return"type"in t&&typeof t.type=="string"&&t.type==="xml"?!0:"layouthint"in t&&Array.isArray(t.layouthint)?t.layouthint.includes("xml"):!1}get type(){return"xml"}get rows(){return 10}addConstraints(){let t=new m;return t.add(new We),t}get readonlyWidth(){return"EXTRA_LARGE"}};var v=class{static get ATTRIBUTE_MODELS(){return[X,ye,De,ve,ze,Le,K,Ee,Be,St,He,vt,M,it,be]}static createAttribute(t,e,r,i){let n=this.getAttributeModel(r);if(!n)throw new Error("Could not find model for contributions: "+r);let o=r.children,a=new qe(t,e,Array.isArray(o)?qe.getChildrenKeys(o):[]).getData(),l=new n(a,r,i);return xe.setLayoutHintRules(l),l}static getAttributeModel(t){return this.ATTRIBUTE_MODELS.find(e=>e.isApplicableModel(t))}},qe=class s{_key;_data;_value;_links;_children;constructor(t,e,r){this._key=t,this._data=this.getAttributeData(t,e),this._value=this.getValue(),this._links=this.getLinks(),this._children=this.createChildren(e,r)}get key(){return this._key}get data(){return this._data}get value(){return this._value}get links(){return this._links}get children(){return this._children}getAttributeData(t,e){return Array.isArray(e)?e.find(r=>"elementid"in r&&r.elementid===t||"name"in r&&r.name===t||"param"in r&&r.param===t)||{}:e}getValue(){let t;return this.key in this.data?t=this.data[this.key]:"values"in this.data?t=this.data.values:"value"in this.data?t=this.data.value:"suggestions"in this.data?t=this.data.suggestions:"suggestion"in this.data?t=this.data.suggestion:"options"in this.data&&Array.isArray(this.data.options)&&(t=this.data.options.filter(e=>e.selected).map(e=>e.code||e.key)),t}getDynamicschemaFromData(){if("dynamicschema"in this.data){let{dynamicschema:t}=this.data;return Array.isArray(t),t}return null}getDynamicSchema(){let t=this.getDynamicschemaFromData();if(!t)return;if(Array.isArray(t))return t;let e=this.getDynamicSchemaId();if(typeof e=="string"&&e in t&&Array.isArray(t[e]))return t[e].map(r=>"elements"in r?{...r,elements:{...r.elements,dynamicschema:t}}:r)}getDynamicSchemaId(){return typeof this.data.dynamicschemaId=="string"||typeof this.data.dynamicschemaId=="number"?this.data.dynamicschemaId:this.key}getStatic(){return typeof this.data.static=="boolean"?this.data.static:!1}getLinks(){return(0,Sr.pick)(this.data._links,["concept","download","lookupOptions","lookupList"])}getOptions(){return this.data.options}getMessage(){return this.data.message}isResult(){return typeof this.data.isResult=="boolean"?this.data.isResult:!1}getReferenceDate(){if(typeof this.data.referenceDate=="string")return this.data.referenceDate}getContent(){if("content"in this.data){let t=(0,Sr.pick)(this.data.content,["header","label","elements","layouthint","text"]);if(Object.keys(t).length>0)return t}return null}getData(){return{key:this.key,value:this.value,static:this.getStatic(),_links:this.links,dynamicschema:this.getDynamicSchema(),dynamicschemaId:this.getDynamicSchemaId(),options:this.getOptions(),message:this.getMessage(),isResult:this.isResult(),referenceDate:this.getReferenceDate(),content:this.getContent(),children:this.children}}static getChildrenKeys(t){return t.map(e=>{let[r]=Object.keys(e),i=e[r].type==="range"||e[r].type==="composite",n=e[r].dynamicschemaId,o=i?e[r]?.children:[];return{key:r,dynamicschemaId:n,children:this.getChildrenKeys(o)}})}createChildren(t,e){if(this.value===null)return e.map(n=>this.createChild(t,{[n.key]:null},n));let i=this.value;return Array.isArray(i)?i.map(n=>e.map(o=>{let a=this.childData(n,this.key,o.key);return this.createChild(t,a,o)})):e.map(n=>{let o=this.childData(t,this.key,n.key);return this.createChild(t,o,n)})}getDataContent(t,e){if(t&&e in t)return t[e]}childData(t,e,r){if(Array.isArray(t)){if(Array.isArray(this.data.elements))return this.data.elements.find(i=>i.elementid===r)}else if(e in t&&(0,$e.default)(t[e])){let i=t[e],n=this.getDataContent(t.content,r);return{...i,content:n}}else if(r in t&&(0,$e.default)(t[r]))return t[r];return(0,$e.default)(t)?t:{}}createChild(t,e,r){let i="dynamicschema"in t?t.dynamicschema:void 0,n=null;return r.dynamicschemaId?n=r.dynamicschemaId:r.key&&typeof t=="object"&&"key"in t&&typeof t.key=="string"&&(n=`${t.key}.${r.key}`),new s(r.key,{...e,dynamicschema:i,dynamicschemaId:n},r.children).getData()}};var Et=class{[Ki]=!0;_key;_header;_sortOption;_readonlyWidth;constructor(t,e){let[r]=Object.keys(t),i=v.createAttribute(r,{elementid:r},t[r]);this._readonlyWidth=i.readonlyWidth,this._key=r,this._header=t[r],this._sortOption=e?.find(n=>n.key===r)}get key(){return this._key}get label(){return this._header.label}get type(){return this._header.type}get layouthint(){return new b(this._header.layouthint)}get alignment(){let t=this.layouthint.getByLayoutHint("align-");return t===null?"left":t.substring(6)}get readonlyWidth(){return this._readonlyWidth??"MEDIUM"}equals(t){return t.key===this.key}get sortOption(){return this._sortOption}hasSorting(){return this.sortOption!=null}};var ei=L(pr(),1);var Xe=class s extends d{_fieldCollection;_selfhref;_icon;constructor(t,e,r){super(t,e,r),this._fieldCollection=this.createFieldCollection(r)}static create(t,e,r,i="form",n,o){let a={name:t,href:e},l={name:t,label:r??t,type:i};return new s(a,l,{origin:n,contextPath:o})}createFieldCollection(t){let e={},r=[];return"fields"in this.data&&typeof this.data.fields=="object"&&this.data.fields!=null&&(e=this.data.fields),"fields"in this.contributions&&Array.isArray(this.contributions.fields)&&(r=this.contributions.fields),new E(e,r,{...t,isReadonly:!0})}get isDisabled(){return!this.data.href}get selfhref(){return this._selfhref??new y(`${this.data.href}?${this.querystring}`,"Form",this.modelOptions)}set selfhref(t){this._selfhref=t}get method(){let t=this.getDataAsString("method","POST");return mt[t]}get type(){return this.layouthint.has(qt)?"create":this.layouthint.has($t)?"update":this.layouthint.has(zt)?"delete":this.getContributionAsString("type","general")}get name(){return this.getDataAsString("name","unknown")}get fields(){return this._fieldCollection.all}get fieldCollection(){return this._fieldCollection}set fieldCollection(t){this._fieldCollection=t}get querystring(){return this.fields.filter(t=>t.value!=null&&t.value!=="").map(t=>{let{value:e}=t;return e!==null?`${t.name}=${e}`:t.name}).join("&")}getFieldByKey(t){return this._fieldCollection.getAttributeByKey(t)}hasFieldByKey(t){return this.getFieldByKey(t)!=null}get key(){return this.getDataAsString("name")}get label(){return this.getContributionAsString("label",this.key)}get isProcessTask(){return(0,ei.default)(this.contributions,"processTask")}get processStatus(){if(this.isProcessTask){let t=this.data.processStatus||{},e=this.contributions.processTask||{};return new Ct(t,e,this.modelOptions)}}get icon(){return this._icon}set icon(t){this._icon=t}};var F=class s extends p{constructor(t,e,r){super(),this.collection=this.createCollection(t,e,r)}createCollection(t,e,r){let i=[];if(t&&e&&Array.isArray(t)&&Array.isArray(e))for(let n of t){let o=e.find(a=>{if(typeof a=="object"&&a!==null&&"name"in a&&"type"in a&&"name"in n)return a.name===n.name&&a.type!=="service-operation"});o&&i.push(new Xe(n,o,r))}return i}getActionByKey(t){let e=new s;return e.collection=this.filter(r=>r.key===t),e.first}getActionsByType(t){let e=new s;return e.collection=this.filter(r=>Array.isArray(t)?t.includes(r.type):r.type===t),e}getActionsByLayoutHint(...t){let e=new s;return e.collection=this.filter(r=>r.layouthint.has(...t)),e}hasActionsByLayoutHint(...t){return this.getActionsByLayoutHint(...t).length>0}get routePath(){let t=this.collection.filter(r=>!r.isDisabled);if(t.length===0)return"__NON_EXISTING_ROUTE__";let e=t.map(r=>r.selfhref.path).join("|");return this.length>1?`(${e})`:e}};var ht=class extends u{get type(){return"User"}get username(){return this.getDataAsString("Username","Guest")}get fullname(){return this.getDataAsString("Fullname","Guest")}};var Ye=class extends u{_user;_mustChangePassword=!1;get type(){return"UserServices"}getInitialChildModelLinks(){let t=this.userLink;return t?[t]:[]}setChildModels(t,e){this.user=t.find(r=>r instanceof ht)}get userLink(){return this.links.getLinkByKey("Userdata")}get user(){return this._user}set user(t){this._user=t}get changePassword(){return this.links.getLinkByKey("ChangePassword")?.href}get isLoggedIn(){let t=this.user instanceof ht;return this.links.length>3||t||te.getItem("basic-ok")===!0}set mustChangePassword(t){this._mustChangePassword=t}get mustChangePassword(){return this._mustChangePassword}};var ri=class extends u{_userServices;constructor(t){super(t),te.setItem("primaryAuthenticationType",this.primaryAuthenticationType)}get type(){return"Application"}get tabs(){return this.links.getLinksByGroup("tab")}get modelcatalog(){return H.create("modelcatalog","/modelcatalog","Model catalog",this.modelOptions)}get userServices(){return this._userServices}set userServices(t){this._userServices=t}get user(){return this.userServices?.user}get userHref(){return this.userServices?.userLink?.href}getInitialChildModelLinks(){let t=this.links.getLinkByKey("UserServices");if(t&&t.href.path==="/login")throw new Rr("The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.");return t?[t]:[]}setChildModels(t,e){this.userServices=t.find(r=>r instanceof Ye)}get isLoggedIn(){return this.userServices?.isLoggedIn??!1}get userMustChangePassword(){return this.userServices?.mustChangePassword??!1}get authenticationTypes(){let t=this.getContributionAsArray("security",[dr]);return t?t?.sort((e,r)=>e.isPrimary===r.isPrimary?0:e.isPrimary?-1:1):[dr]}get primaryAuthenticationType(){return this.authenticationTypes[0]}};var ii=L(lt(),1);var dt=class s extends d{_key;_attributeCollection;constructor(t="",e,r,i){super(e,r,i);let n=this.contributions.attributes?this.contributions.attributes.filter(o=>{let[a]=Object.keys(o);return(0,ii.has)(this.data,a)}):[];this._attributeCollection=new E(this.data,n,{...i,isReadonly:!0}),this._key=t}get key(){return this._key}set key(t){this._key=t}get label(){return this.contributions.label}get attributeCollection(){return this._attributeCollection}set attributeCollection(t){this._attributeCollection=t}createChildAttributeSetModel(t,e,r){let i=this.contributions.objects;return new s(r?`${t}-${r+1}`:t,{...e,dynamicschema:this.data.dynamicschema},i?.[t],this.modelOptions)}getChildAttributeSets(){if(!this.contributions.objects)return[];let t=[];for(let e of Object.keys(this.contributions.objects))if(e in this.data){let r=this.data[e];if(Array.isArray(r))for(let[i,n]of r.entries())t.push(this.createChildAttributeSetModel(e,n,i));else t.push(this.createChildAttributeSetModel(e,r))}return t}};var nt=class s extends u{_attributeCollection;_metadataCollection;_actionCollection;constructor(t){super(t),this._attributeCollection=this.createAttributeCollection(),this._metadataCollection=this.createMetadataCollection(),this._actionCollection=this.createActionCollection()}get type(){return"Detail"}getInitialChildModelLinks(){return this._attributeCollection.getInitialChildModelLinks()}setChildModels(t,e){this._attributeCollection.setChildModels(t,e)}get id(){let t=this.getDataAsNumber("_id");return t||this.getDataAsString("_id",this.key)}get label(){return this.getContributionAsString("label","")}createAttributeCollection(){let t=this.getContributionAsArray("attributes",[]).filter(e=>{let[r]=Object.keys(e);return r in this.data});return new E(this.data,t,{...this.modelOptions,isReadonly:!0})}get attributeCollection(){return this._attributeCollection}set attributeCollection(t){this._attributeCollection=t}get attributes(){return this.attributeCollection.all.filter(t=>!t.layouthint.has(ut)&&!t.isHidden)}getAttributeByKey(t){return this._attributeCollection.getAttributeByKey(t)}createMetadataCollection(){let t=this.getContributionAsObject("metadata",{}),e=Object.entries(t).map(([r,i])=>({[r]:i}));return new E(this.data,e,{...this.modelOptions,isReadonly:!0})}get metadataCollection(){return this._metadataCollection}set metadataCollection(t){this._metadataCollection=t}createActionCollection(){let t=this.getDataAsArray("actions",[]),e=this.getContributionAsArray("actions",[]);return new F(t,e)}get actionCollection(){return this._actionCollection}set actionCollection(t){this._actionCollection=t}get isCase(){return this.getContributionAsString("resourcetype")==="CaseView"}get titleAttribute(){return this._attributeCollection.getAttributeByLayoutHint(ut)}update(t){if(t instanceof s){let e=new s(t.modularuiResponse);return e.attributeCollection=t.attributeCollection,e.metadataCollection=t.metadataCollection,e.actionCollection=t.actionCollection,e}return this}equals(t){return this.id?.toString()===t.id?.toString()}};var st=class extends p{hasTasks(){return this.collection.some(t=>t.hasTasks())}};var U=class s extends u{_actionCollection;constructor(t){super(t);let e=this.data.actions&&Array.isArray(this.data.actions)?this.data.actions:[],r=this.contributions.actions&&Array.isArray(this.contributions.actions)?this.contributions.actions:[];this._actionCollection=new F(e,r);try{let i=this.selflink.href.href;i&&(this.key=i.substring(i.lastIndexOf("/")+1))}catch{this.key=this.getDataAsString("name","unknown")}}static create(t,e,r,i){let n=new B;return n.key=t,n.data=e,n.contributions=r,n.origin=i?.origin,n.contextPath=i?.contextPath,new s(n)}get type(){return"TaskGroup"}hasTasks(){return this.actionCollection.length>0}get actionCollection(){return this._actionCollection}};var ni=class extends nt{_taskGroupCollection;constructor(t){super(t),this._taskGroupCollection=this.createTaskGroupCollection()}get type(){return"CaseView"}getInitialChildModelLinks(){return this.links.getLinksByGroup("taskgroup").all}get panelLinks(){return this.links.getLinksByGroup("panel")}setChildModels(t,e){super.setChildModels(t,e);let r=t.filter(i=>i instanceof U);this.taskGroupCollection.add(r)}get casename(){return this.attributeCollection.getAttributeByLayoutHint(ut)}get label(){return this.casename?.readonlyvalue||""}get viewLabel(){return this.getContributionAsString("label","")}hasIntroText(){return this.introtext!==""}get introtext(){let t=this.data._content;if(t&&"text"in t&&typeof t.text=="object"&&t.text!=null&&"message"in t.text)return t.text.message;let e=this.contributions;return e.text?typeof e.text=="object"&&"message"in e.text&&typeof e.text.message=="string"?e.text.message:e.text:Array.isArray(e.texts)?e.texts[0].text:""}get selfhref(){let t=this.links.getLinkByKey("self");if(t==null)throw new D("No self href available");return t.href}createTaskGroupCollection(){let t=this.getDataAsArray("taskgroups",[]),e=this.getContributionAsArray("taskgroups",[]),r=[];for(let i of t){let n=i.name,o=e.find(a=>a.name===n);if(o){let a=U.create(n,i,o,this.modelOptions);r.push(a)}}return new st(r)}set taskGroupCollection(t){this._taskGroupCollection=t}get taskGroupCollection(){return this._taskGroupCollection}hasTaskGroups(){return this.taskGroupCollection&&this.taskGroupCollection.hasItems()}};var Tt=class extends d{_context;_listKey;constructor(t,e,r){super(t,e,r),this._listKey=this.getContributionAsString("listKey")}get key(){return this.getDataAsString("name","")}get type(){return this.getContributionAsString("type","string").replace("filter","")}get parameterType(){return this.getContributionAsString("parameterType")==="bodyParameter"?"bodyParameter":"queryParameter"}get name(){return this.listkey?this.listkey+kr+this.param:this.param}get param(){return this.getDataAsString("param")??this.getDataAsString("name","")}get isMultiple(){return this.getContributionAsBoolean("multiplechoice",!1)}get context(){return this._context}set context(t){this._context=t}setContext(t){this._context=t}get contextid(){return this.getContributionAsString("contextid","")}get contextLabel(){return this.context?.label??""}get listkey(){return this._listKey}set listkey(t){this._listKey=t}get label(){return this.getContributionAsString("label","")}isQuickSearch(){return this.getContributionAsBoolean("quicksearch",!1)}get assistantMessage(){return this.getContributionAsString("assistant")}};var x=class extends Tt{_attribute;constructor(t,e,r){super(t,e,r),this._attribute=this.createAttribute(this.type,this.param||"",this.data,this.contributions)}get attribute(){return this._attribute}get params(){return this.param?[{name:this.param,value:this.attribute?.value}]:[]}get value(){return this.attribute?.value}get inputvalue(){return this.attribute?.inputvalue??""}hasValue(){return this.value!==null&&this.value!==""}getAttributeType(t){switch(t){case"choice":return"choice";case"date":return"date";case"datetime":return"datetime";case"daterange":case"datetimerange":return"range";case"number":case"numberrange":return"range";default:return"string"}}getChildType(t){switch(t){case"daterange":return"date";case"datetimerange":return"datetime";case"numberrange":return"number";default:return"string"}}createAttribute(t,e,r,i){if(t==="assignment")return;let n=this.getAttributeType(t),o={...i,type:n};if(n==="range"&&"children"in o&&Array.isArray(o.children)){let a=this.getChildType(t);o.children=o.children.map(l=>{let c=Object.keys(l)[0];return{[c]:{...l[c],type:a}}})}return v.createAttribute(e,r,o,this.modelOptions)}reset(){return this.attribute?.reset(),this}update(t,e){this.attribute?.update(e)}isActive(){return this.attribute?.initvalue!=null}get isValid(){return this.attribute?.isValid??!1}get readonlyvalue(){return this.attribute?.readonlyvalue??""}get formdata(){return this.attribute?.formdata??null}};var ot=class extends x{constructor(t,e,r){if(super(t,e,r),t&&"options"in t&&t.options&&Array.isArray(t.options)){let i=t.options.filter(n=>n.selected).map(n=>n.key);t.options.forEach(n=>{this.attribute?.options.addOption(i,{code:n.key,label:n.key})})}}};var Ot=class extends Tt{_assignmenttype;_user;constructor(t,e,r){super(t,e,r),this._assignmenttype=this.createAssignmentTypeModel(),this._user=this.createUserModel()}createAssignmentTypeModel(){let t=`${this.contextid}ASSIGNMENTTYPE`,e=this.data[t];if(typeof e>"u")throw new D(`Missing assignment type data for ${t}`);let r=this.data.dynamicschema;r&&(e.dynamicschema={[t]:r[t]});let n={...this.contributions[t],enumerated:!0,optionMode:e._links?"lookup":"static",type:"choice"},o=e.name||e.param;return v.createAttribute(o,e,n,this.modelOptions)}createUserModel(){let t=`${this.contextid}USERKEY`,e=this.data[t],r=this.data.dynamicschema;r&&r[t]&&(e.dynamicschema={[t]:r[t]});let n={...this.contributions[t],optionMode:e._links?"lookup":"static",type:"choice"},o=e.name||e.param;return v.createAttribute(o,e,n,this.modelOptions)}get assignmenttype(){return this._assignmenttype}get user(){return this._user}get params(){return this.assignmenttype&&this.user?[{name:this.assignmenttype.name,value:this.assignmenttype.value},{name:this.user.name,value:this.user.value}]:[]}get value(){return{[this.assignmenttype.name]:this.assignmenttype.value,[this.user.name]:this.user.value}}get inputvalue(){return{[this.assignmenttype.name]:this.assignmenttype.inputvalue,[this.user.name]:this.user.inputvalue}}hasValue(){return this.assignmenttype.value!==null&&this.assignmenttype.value!==""||this.user.value!==null&&this.user.value!==""}reset(){return this.assignmenttype&&this.assignmenttype.reset(),this.user&&this.user.reset(),this}update(t,e){this.user!=null&&this.user.key===t.key?this.user.update(e):this.assignmenttype!=null&&this.assignmenttype.key===t.key&&this.assignmenttype.update(e)}isActive(){return this.assignmenttype!=null&&this.assignmenttype.initvalue!==null||this.user!=null&&this.user.initvalue!==null}get isValid(){return this.assignmenttype!=null&&this.assignmenttype.isValid&&this.user!=null&&this.user.isValid}get readonlyvalue(){return{[this.assignmenttype.name]:this.assignmenttype.readonlyvalue,[this.user.name]:this.user.readonlyvalue}}get formdata(){return this.value}};var kt=class extends x{update(t,e){this.attribute instanceof it?this.attribute.update(e,t):super.update(t,e)}get params(){return this.attribute?[{name:this.attribute.start.name,value:this.attribute.start.value},{name:this.attribute.end.name,value:this.attribute.end.value}]:[]}};var Qe=class extends x{_isValid=!0;_value;_inputvalue;constructor(t,e,r){if(super(t,e,r),this.attribute){let i=this.getDataAsString("value","");this.update(this.attribute,i)}this._inputvalue=this._value??""}get params(){return this.param?[{name:this.param,value:this.removeFormat(this.value??"")}]:[]}get value(){return this._value}get inputvalue(){return this._inputvalue}reset(){return this._inputvalue="",this._value=void 0,this}get isValid(){return this._isValid}update(t,e){if(this._isValid=!0,this._inputvalue=typeof e!="string"?String(e):e,this.shouldHandleFormat()){let r=this.isMultiple?this._inputvalue.split(",").map(n=>n.trim()):[this._inputvalue.trim()],i=[];for(let n of r){let o=this.formatValue(n);o!==""&&(i.push(o),this.attribute?.validate(o)||(this._isValid=!1))}this._value=i.join(",")}else this._value=e}get operator(){return this.getContributionAsString("operator","")}formatValue(t){return this.shouldHandleFormat()?this.attribute?.formatValue(t)||"":t}isBSN(){return this.layouthint.has("bsn")}isIBAN(){return this.layouthint.has("iban")}isZipcode(){return this.layouthint.has("zipcode")}removeFormat(t){return t==null||t.toString()===""?"":typeof t=="string"&&this.shouldHandleFormat()?t.replace(/[^a-z0-9,]/gi,""):t}shouldHandleFormat(){return(this.operator==="exactly"||this.operator==="isNot")&&(this.isIBAN()||this.isZipcode()||this.isBSN())}get formdata(){return{[this.param]:this.value}}};var xt=class{static createFilter(t,e,r,i){let n=r.type??"stringfilter";return n==="choicefilter"&&t==="index"?new ot(e,r,i):n.includes("rangefilter")?new kt(e,r,i):n==="assignmentfilter"?new Ot(e,r,i):n==="stringfilter"?new Qe(e,r,i):new x(e,r,i)}static setListKey(t,e){"listkey"in e&&typeof e.listkey=="string"&&(t.listkey=e.listkey)}static setFilterContext(t,e,r){if(r.contexts){let i=r.contexts.find(n=>n.id===e);i&&(t.context=i)}}};var I=class extends p{constructor(t={},e,r){super(),this.collection=this.createCollection(t,e,r)}createCollection(t,e,r){let i=[];if(e&&"filter"in e&&Array.isArray(e.filter))for(let n of e.filter){let[o]=Object.keys(n),a=t[o],l=n[o],c=xt.createFilter(o,a,l,{origin:r?.origin,contextPath:r?.contextPath});xt.setListKey(c,e),l.contextid&&xt.setFilterContext(c,l.contextid,e),i.push(c)}return i}reset(){return this.collection=this.collection.map(t=>t.reset()),this}checkRangeFilterByAttributeKey(t,e){let r=t.attribute;if(r instanceof it){let i=r.start,n=r.end;return r.key===e||i?.name===e||n?.name===e}return!1}checkAssignmentFilterByAttributeKey(t,e){return t.key===e||t.user?.key===e||t.assignmenttype?.key===e}getFilterByName(t){return this.find(e=>e.name===t)||null}getFilterByAttributeKey(t){return this.find(e=>e instanceof kt?this.checkRangeFilterByAttributeKey(e,t):e instanceof Ot?this.checkAssignmentFilterByAttributeKey(e,t):e instanceof x?e.attribute?.key===t:!1)}update(t,e){let r=t.parentKey?this.getFilterByAttributeKey(t.parentKey):this.getFilterByAttributeKey(t.key);if(!r)throw new Error(`Can not find filter by attribute key: ${t.key}`);r.update(t,e),this.collection=this.collection.map(i=>i.name===r.name?r:i)}get isValid(){return this.collection.every(t=>t.isValid)}hasActiveFilters(){return this.collection.some(t=>t.isActive())}getActiveFilters(){return this.collection.filter(t=>t.isActive())}get formdata(){let t=this.filter(e=>e.parameterType==="bodyParameter"&&e.hasValue()&&e.formdata);return t.length===0?null:t.reduce((e,r)=>Object.assign(e,r.formdata),{})}};var Ze=class extends O{};var si=class extends u{_filterCollection;_concepts;constructor(t){super(t),this._filterCollection=new I(this.data.filter,{filter:this.contributions.filter,dynamicschema:this.data.dynamicschema},this.modelOptions),this._concepts=new Ze,this._concepts.collection=this.data._embedded?this.data._embedded.results.map(e=>new At(e.concept,this.entryDate,this.modelOptions)):[]}get type(){return this.resourcetype.toLowerCase()==="relatedconcepts"?"RelatedConcepts":"ConceptIndex"}getInitialChildModelLinks(){return this.items.getInitialChildModelLinks()}setChildModels(t,e){this.items.setChildModels(t,e)}get selfhref(){let{href:t}=this.selflink;return this.filterCollection.hasItems()&&this.filterCollection.forEach(e=>{e.params.forEach(r=>{r.value?t.setParameter(r.name,r.value):t.removeParameter(r.name)})}),t}get label(){return this.getContributionAsString("label","")}get filterCollection(){return this._filterCollection}get indexfilter(){let t=this.filterCollection.getFilterByAttributeKey("index");if(t instanceof ot)return t}get entryDate(){let e=this.filterCollection.getFilterByAttributeKey(g)?.value;if(typeof e=="string")return e}get searchtermfilter(){let t=this.filterCollection.getFilterByAttributeKey("label");return t instanceof x?t:null}get modelCategoryFilter(){let t=this.filterCollection.getFilterByAttributeKey("modelCategory");return t instanceof x?t:null}get items(){return this._concepts}set items(t){this._concepts=t}};var Je=class extends O{};var oi=class extends u{_filterCollection;_content;constructor(t){super(t),this._filterCollection=new I(this.data.filter,{filter:this.contributions.filter,dynamicschema:this.data.dynamicschema},this.modelOptions),this._content=new Je,this._content.collection=this.data._embedded?this.data._embedded.results.map(e=>new R(e.content,void 0,this.modelOptions)):[]}get type(){return"ContentIndex"}getInitialChildModelLinks(){return this.items.getInitialChildModelLinks()}setChildModels(t,e){this.items.setChildModels(t,e)}get selfhref(){let t=this.selflink.href;return this.filterCollection.forEach(e=>{e.params.forEach(r=>{r.value?t.setParameter(r.name,r.value):t.removeParameter(r.name)})}),t}get label(){return this.getContributionAsString("label","unknown")}get filterCollection(){return this._filterCollection}get indexfilter(){let t=this._filterCollection.getFilterByAttributeKey("index");return t instanceof ot?t:null}get items(){return this._content}hasIndexFilter(){let t=this.indexfilter?.attribute;return t instanceof X&&t.options.length>0}hasFiltersSet(){return this.filterCollection.some(t=>t.isActive())}hasNoFiltersSet(){return!this.hasFiltersSet()}getFirstCharHref(){let t=this.indexfilter?.attribute,e="#";return t instanceof X&&(e=t.options.filter(r=>r.code!=="0")[0].code),new y(this.selfhref).addParameter("index",e)}};var ai=class extends u{_section;_contentType;_filterCollection;constructor(t){super(t),this._filterCollection=new I(this.data.filter,{filter:this.contributions.filter},this.modelOptions),this._section=new et(this.data,this.entryDate,this.modelOptions)}get type(){return"Content"}getInitialChildModelLinks(){let t=this.links.getLinkByKey("contenttype");return t?[t]:[]}setChildModels(t,e){this.contentType=t.find(r=>r instanceof $)}get section(){return this._section}get id(){return this.data._id}get filterCollection(){return this._filterCollection}get entryDate(){let e=this.filterCollection?.getFilterByAttributeKey(g)?.value;if(typeof e=="string")return e}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get label(){return this.section.label}get number(){return this.section.number}get body(){return this.section.body}get childSectionLinks(){return this.section.childSectionLinks}get selfContentLink(){return this.section.selfContentLink}get childSections(){return this.section.childSections}set childSections(t){this.section.childSections=t||[]}get subSections(){return this.section.subSections}get relatedConceptsHrefs(){let t=[];return this.relatedConceptsHref&&t.push(this.relatedConceptsHref),this.subSections.forEach(e=>{t.push(...e.relatedConceptsHrefs)}),t}get relatedConceptsHref(){let t=this.links.getLinkByKey("relatedConcepts");if(t){let{href:e}=t;return e.addParameter("entryDate",this.entryDate),e.setReferenceHash(this.referenceHash),e}return null}get referenceHash(){return this.section.referenceHash}};var li=class extends u{_contentType;_filterCollection;constructor(t){super(t),this._filterCollection=new I(this.data.filter,{filter:this.contributions.filter},this.modelOptions)}get type(){return"ContentTOC"}getInitialChildModelLinks(){let t=this.links.getLinkByKey("contenttype");return t?[t]:[]}setChildModels(t,e){this.contentType=t.find(r=>r instanceof $)}get label(){return this.getDataAsString("label","")}get abbreviation(){return this.getDataAsString("abbreviation")}get selfhref(){let t=new y(this.selflink.href);return this.filterCollection.forEach(e=>{e.params.forEach(r=>{r.value?t.setParameter(r.name,r.value):t.removeParameter(r.name)})}),t}get relatedConceptsHref(){let t=this.links.getLinkByKey("relatedConcepts");if(t){let{href:e}=t;return e.addParameter("entryDate",this.entryDate),e}}get selfContentLink(){return new R(this.data,this.entryDate,this.modelOptions)}getItems(t){return t.map(e=>{let r=new R(e,this.entryDate,this.modelOptions);return typeof e.items<"u"&&(r.items=this.getItems(e.items)),r})}getSectionItems(t){return t.map(e=>{let r=new R(e,this.entryDate,this.modelOptions);return typeof e.sections<"u"&&(r.items=this.getItems(e.sections)),r})}get items(){return Array.isArray(this.data.items)?this.getItems(this.data.items):Array.isArray(this.data.sections)?this.getSectionItems(this.data.sections):[]}get sections(){return this.data.sections?this.data.sections.map(e=>new et(e,this.entryDate,this.modelOptions)):[]}get categories(){return Array.isArray(this.data.categories)?this.data.categories.map(t=>new R(t,void 0,this.modelOptions)):[]}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get filterCollection(){return this._filterCollection}get entryDate(){let e=this.filterCollection.getFilterByAttributeKey(g)?.value;if(typeof e=="string")return e}get isCompleteSource(){return this.filterCollection.getFilterByAttributeKey("complete")?.value==="true"}};var It=class{_configuration;_layouthint;_calculatedResults;_positiveResults;_negativeResults;_results;constructor(t){this._configuration=t||null,this._layouthint=new b(t?.layouthint),this._calculatedResults=new k(t?.calculatedResultElements),this._positiveResults=new k(t?.positiveResultElements),this._negativeResults=new k(t?.negativeResultElements),this._results=new k(t?.resultElements)}get label(){return this._configuration?.label}get description(){let t=this._configuration?.description;return typeof t=="object"&&"message"in t?t.message:t}get layouthint(){return this._layouthint}get attributes(){return this._configuration===null?[]:[...this._configuration.attributes,...this.layouthint.all.filter(t=>t.includes("attribute:")).map(t=>t.substring(10))]}get calculatedResultElements(){return this._calculatedResults}get positiveResultElements(){return this._positiveResults}get negativeResultElements(){return this._negativeResults}get resultElements(){return this._results}};var tr=class{_configuration;constructor(t){this._configuration=t||[]}get config(){return this._configuration.filter(t=>{let[e]=Object.keys(t);return e==="decisionResult"||e==="classificationResult"||e==="calculatorResult"}).map(t=>{let[e]=Object.keys(t);return new It(t[e])})}};var er=class{_question;_options;_answers;constructor(t){this._question=new k(t.questionElements),this._options=new k(t.optionElements),this._answers=new k(t.givenAnswerElements)}hasConfig(){return this._question.hasConfig()||this._options.hasConfig()||this._answers.hasConfig()}get question(){return this._question}get options(){return this._options}get answers(){return this._answers}};import{immerable as Wi}from"immer";var Rt=class{[Wi]=!0;_questions;_intermediateResults;_endResults;constructor(t){this._questions=this.createQuestionConfiguration(t),this._intermediateResults=this.createIntermedidateResultsConfiguration(t),this._endResults=this.createEndResultsConfiguration(t)}createQuestionConfiguration(t){if(t&&"questions"in t&&typeof t.questions=="object")return new er(t.questions)}createIntermedidateResultsConfiguration(t){if(t&&"intermediateResults"in t&&typeof t.intermediateResults=="object")return new It(t.intermediateResults)}createEndResultsConfiguration(t){if(t&&"results"in t&&typeof t.results=="object")return new tr(t.results)}get questions(){return this._questions}isConfiguredIntermediateResultAttribute(t){return this.intermediateResults?.attributes.includes(t)??!1}get intermediateResults(){return this._intermediateResults}isConfiguredEndResultAttribute(t){return this.endResults?this.endResults?.config.some(e=>e.attributes.includes(t)):!1}get endResults(){return this._endResults}};import{immerable as zi}from"immer";var ui=class{[zi]=!0;_originalError;_connectKey;_modelOptions;constructor(t,e,r){this._originalError=t,this._connectKey=e,this._modelOptions=r}set connectKey(t){this._connectKey=t}get connectKey(){return this._connectKey}get origin(){return this._modelOptions?.origin||""}get contextPath(){return this._modelOptions?.contextPath||N()}get error(){return this._originalError}get status(){let r=this.error;return"status"in r?parseInt(r.status,10):0}get id(){return this.isResourceNotFound&&"id"in this.error&&this.error.id!=="Error.NotAuthorized"?"Error.ResourceNotFound":"id"in this.error&&typeof this.error.id=="string"?this.error.id:this.error.name||"Error.GeneralError"}get message(){let t=this.error;return"message"in t?t.message:this.id}get responseMessage(){return this.response&&"message"in this.response?this.response.message:""}get title(){return this.response&&"title"in this.response?this.response.title:{id:""}}get titleMessage(){if("title"in this.error)return this.error.title?.message}get titleId(){return this.response?.title?.id}get titleProperties(){return this.response?.title?.properties}get redirect(){return this.response?.redirect}get redirectText(){if(this.redirect&&"text"in this.redirect)return this.redirect?.text}get redirectTextID(){return this.redirectText?.id}get redirectTextProperties(){return this.redirectText?.properties}get redirectMessage(){return this.redirectText?.message}get redirectHref(){if(this.redirect&&"href"in this.redirect){let t=this.redirect?.href;if(t)return new y(t)}}get layouthint(){return this.response&&Array.isArray(this.response.layouthint)?new b(this.response.layouthint):new b}get response(){let t=this.error;if("response"in t&&typeof t.response=="object")return t.response}get properties(){let t=this.error;if("properties"in t)return t.properties}get parameters(){let t=this.error;if("parameters"in t)return t.parameters}get isResourceNotFound(){return this.status===404}get isResourceNotFoundAfterReload(){let t=this.error;return"isReload"in t&&typeof t.isReload=="boolean"?this.isResourceNotFound&&t.isReload:!1}get isUnauthorized(){let e=this.status===401,r=this.id==="Error.NotAuthorized"||this.id==="Error.Authentication.Required"||this.id==="Error.Authentication.InvalidCredentials",i=this.error,n="action"in i&&typeof i.action=="object"&&i.action!==null&&"name"in i.action&&i.action.name==="login";return e||r||n}get isChangePassword(){return this.id==="Error.ChangePasswordRequired"}get isConcurrentUser(){return this.id==="Error.Authentication.ConcurrentUser"}get isConcurrentError(){return this.id==="Error.Case.ConcurrentModification"||this.id==="Error.DataStore.ConcurrentModification"||this.id==="Error.DataStore.RecordAlreadyExists"||this.id==="Error.DataStore.RowCannotBeLocked"}get isBlocked(){return this.id==="Error.Authentication.BlockedUser"}get isInvalidCredentials(){return this.id==="Error.Authentication.InvalidCredentials"}get isInvalidUsername(){return this.id==="Error.Authentication.InvalidUsername"}get isTimeoutError(){return this.id==="Error.CodemapLookup.InvalidToken"}get isRemoteServiceException(){return this.id==="Error.RemoteServiceException"}get changePasswordHref(){let t=this.properties;if(t&&"redirect"in t)return new y(t.redirect)}get isBasicAuthentication(){let e=this.error;return"error"in e?this.isUnauthorized&&this.status===401&&e.error==="No responseText":!1}get loginFailed(){return this.id==="Error.Authentication.Required"||this.id==="Error.Authentication.InvalidCredentials"}get shouldThrowOnServer(){return!this.isChangePassword&&!this.isBlocked&&!this.isConcurrentUser}};var Tr=L(lt(),1);var pt=class s extends d{_attributeCollection;_contentConfiguration;_errorCollection;_repeatIndex;_dynamicValidationsLoaded=!1;constructor(t,e,r){super(t,e,r),t&&this.getElements().length>0?this._attributeCollection=new E(this.getElements(),this.getApplicableAttributeContributions(),{...r,isReadonly:!1}):this._attributeCollection=new E,this._contentConfiguration=new Rt(e?e.content:{}),this._errorCollection=new j("formobject");let i=this.getDataAsString("referenceDate");i&&this.attributeCollection.setReferenceDate(i),this.attributeCollection.indicateContentConfiguration(this.contentConfiguration)}static createEmpty(t){if(!t)throw new A("createEmpty method needs a FormObjectModel as input argument to create a new version of the object");return new s(t.data,t.contributions,t.modelOptions)}equals(t,e=!0){if(!t||this.key!==t.key)return!1;let r=this.attributeCollection.all.filter(n=>!n.isResult).some(n=>t&&t.attributeCollection.hasAttributeByKey(n.key));return(e?this.repeatIndex===t.repeatIndex:!0)&&r}getAttributeByAttribute(t){return this.attributeCollection.getAttributeByAttribute(t)}getAttributeByKey(t){return this.attributeCollection.getAttributeByKey(t)}hasAttributeByKey(t){return this.attributeCollection.hasAttributeByKey(t)}getElements(){let t=[];if(Array.isArray(this.data.elements)&&t.push(...this.data.elements),Array.isArray(this.data.results)){let e=this.data.results.map(r=>({...r,isResult:!0}));t.push(...e)}return this.data.elementid&&t.push({...this.data}),t}getApplicableAttributeContributions(){if(this.data&&this.contributions){let t=this.getElements().map(r=>r.elementid),e=this.getAttributesInData(t,this.contributions.attributes);return this.isDynamic?e.map(r=>{let[i]=Object.keys(r);return{[i]:{...r[i],mandatory:!0}}}):e}return[]}getAttributesInData(t,e=[]){return e.filter(r=>{let[i]=Object.keys(r);return t.some(n=>n.split(".")[0]===i)})}getInitialChildModelLinks(){return this._attributeCollection.getInitialChildModelLinks()}setChildModels(t,e){this._attributeCollection.setChildModels(t,e)}get key(){return this.data.objectid||"unknown"}get contentConfiguration(){return this._contentConfiguration}get hasEndResultConfiguration(){return this.contributions.content?.results!=null}get isDynamic(){return this.getContributionAsBoolean("dynamicObject",!1)}get hasDynamicValidations(){return this.getContributionAsBoolean("dynamicValidations",!1)}get isRepeatable(){return this.getContributionAsBoolean("repeatable",!1)}get repeatIndex(){return this._repeatIndex??this.data.index??1}set repeatIndex(t){this._repeatIndex=t}get maxRepeats(){return this.isRepeatable?this.getDataAsNumber("numberofrepeats",-1):1}get hasFixedNrOfRepeats(){return this.maxRepeats>-1}get isRepeatWithUnknownTotal(){return this.isRepeatable&&this.maxRepeats===-1}get isLastRepeat(){return this.isRepeatable?this.getDataAsBoolean("last",!1):!0}get repeatIndexLabel(){return this.getDataAsString("index-identifier")}get label(){return this.getContributionAsString("label")}get introText(){if(typeof this.data.content=="object"&&this.data.content!=null&&"text"in this.data.content){let{message:t}=this.data.content.text;return t}return this.contributions.text?.message?this.contributions.text.message:this.contributions.introText}get assistent(){return this.contributions.assistent}get buttonLabels(){return this.getContributionAsObject("buttonLabels",{})}get attributeCollection(){return this._attributeCollection}set attributeCollection(t){this._attributeCollection=t}mergeObject(t){this.attributeCollection.forEach(e=>{let r=t.getAttributeByAttribute(e);r&&e.mergeAttribute(r)}),this.repeatIndex=t.repeatIndex}updateAttribute(t,e){let r=this.attributeCollection.getAttributeByAttribute(t);if(r==null)throw new Error(`Attribute with name: ${t.name} not found.`);return r instanceof M?r.update(e,t):r.update(e),r}isChangedSince(t){return this.attributeCollection.find(e=>e.isChangedSince(t))!=null}resetErrors(){this._errorCollection.clear(),this.attributeCollection.forEach(t=>t.resetErrors())}get errorCollection(){return this._errorCollection}addServerError(t){t.anchor?.elementid!=null?this.attributeCollection.addServerError(t):this._errorCollection.addServerError(t.id,t.message,t.properties,t.layouthint)}hasServerErrors(){return this.errorCollection.hasItems()||this.attributeCollection.hasServerErrors()}hasErrors(){return this.errorCollection.hasItems()||this.attributeCollection.hasErrors()}get isValid(){return this.attributeCollection.visible.every(t=>t.isValid)&&!this.errorCollection.hasItems()}get dynamicValidationsLoaded(){return this._dynamicValidationsLoaded}set dynamicValidationsLoaded(t){this._dynamicValidationsLoaded=t}handleErrorValidations(t){let e=[];t.filter(r=>r.anchor?.objectid===this.key).forEach(r=>{(0,Tr.has)(r.anchor,"elementid")?e.push(r):this.errorCollection.addServerError(r.id,r.message,r.properties,new b(r.layouthint))}),this.attributeCollection.updateValidations(e)}handleMissingValidations(t,e){let r=[];for(let i of t.anchors)if(!i.objectid||i.objectid===this.key)if(Array.isArray(i.elements))for(let n of i.elements)r.push({anchor:{objectid:n.objectid||"",elementid:n.elementid},id:"Constraint.Mandatory"});else r.push({anchor:{...i,objectid:i.objectid||""},id:"Constraint.Mandatory"});Array.isArray(e)&&e.filter(i=>i.id==="Constraint.Mandatory"&&i.anchor?.objectid===this.key&&(0,Tr.has)(i.anchor,"elementid")).forEach(i=>{r.push(i)}),this.attributeCollection.updateValidations(r)}updateValidations(t){return this.resetErrors(),Array.isArray(t.errors)&&this.handleErrorValidations(t.errors),Array.isArray(t.missing?.anchors)&&this.handleMissingValidations(t.missing,t.errors),this.dynamicValidationsLoaded=!0,this}get formdata(){return this.attributeCollection.formdata}getFormData(t=!1){return this.attributeCollection.getFormData(t)}};var Vt=L(lt(),1),_i=L(Ai(),1);import rn from"deepmerge";var Mi=class s extends u{_lastUpdate;_completedFormObjects=[];_currentFormObject=null;_previouslyEnteredFormObjects=[];_mergePreviouslyEnteredObjects=!0;_endResultFormObjects=[];_previousEndResultKeys=[];_useClientsideValidation=Q("USE_CLIENTSIDE_VALIDATION");_errorCollection=new j(0);_redirectLocation;_commit=!1;_isFinished=!1;_isComplete=!1;_success;_parameters=new re;_tokens=[];constructor(t){super(t),this._lastUpdate=0,this.currentFormObject=this.createFormObject(),this.endResultFormObjects=this.setEndResultFormObjects(),this.parameters=this.setParameters(t?.parameters),this.isComplete=this.getDataAsBoolean("complete",!1),Array.isArray(this.data.errors)&&this.handleRootErrors(this.data.errors),this.createSuccess(),this.setTokens()}get type(){return"Form"}get actiontype(){return this.layouthint.has(qt)?"create":this.layouthint.has($t)?"update":this.layouthint.has(zt)?"delete":this.getContributionAsString("actiontype","form")}getInitialChildModelLinks(){let t=(0,_i.default)(this.endResultFormObjects.map(e=>e.getInitialChildModelLinks()));return this.currentFormObject==null?t:[...this.currentFormObject.getInitialChildModelLinks(),...t]}setChildModels(t,e){this.currentFormObject&&this.currentFormObject.setChildModels(t,e),this.endResultFormObjects.forEach(r=>{r.setChildModels(t,e)})}get label(){return this.getContributionAsString("label","")}get buttonLabels(){return this.getContributionAsObject("buttonLabels",{})}getButtonLabel(t){if(t==="cancel"&&"cancel"in this.buttonLabels)return this.buttonLabels.cancel;let e=this.currentFormObject?.buttonLabels;if(e&&t in e)return e[t]}get allObjects(){return this.currentFormObject==null?this.completedFormObjects:[...this.completedFormObjects,this.currentFormObject]}get objectKeys(){let t=this.getContributionAsObject("objects",{});return Object.keys(t)}get numberOfExpectedQuestions(){return this.objectKeys.length}get hasNoQuestionsConfigured(){return this.isComplete&&(this.objectKeys.length===0||!("missing"in this.data)&&!("results"in this.data)&&!("errors"in this.data))}addDynamicSchemaToElements(t,e){return t?.map(r=>({...r,dynamicschema:r.dynamicschema?r.dynamicschema.map(i=>{let n="elements"in i?i.elements:[];return n.length?{...i,elements:{...n,dynamicschema:e}}:i}):void 0}))}getMissingAnchors(){return(this.data.missing?.anchors??[]).map(e=>{if(this.data.results){let r=this.data.results.find(i=>i.objectid===e.objectid&&"elements"in i);r&&(e.results=r.elements)}return e.elements&&this.data.dynamicschema?{...e,elements:this.addDynamicSchemaToElements(e.elements,this.data.dynamicschema)}:e})}createFormObject(){if(this.data&&this.contributions.objects){let t=this.getMissingAnchors();if(t.length){let e=t[0],r=t[0].objectid;if(r){let i=this.contributions.objects[r];if(i)return new pt(e,i)}}}return null}addEmptyFormObject(t=this.currentFormObject){if(t){let e=pt.createEmpty(t);e.repeatIndex=this.getHighestRepeatIndex(t)+1,this.addFormObject(e)}}getHighestRepeatIndex(t){return Math.max(...this.allObjects.filter(e=>e.equals(t,!1)).map(e=>e.repeatIndex))}addFormObject(t){if(!t)throw new A("Missing form object to add");this.completedFormObjects=[...this.allObjects],this.currentFormObject=t}getFormObjectByKey(t){return this.allObjects.find(e=>e.key===t)}getFormObjectByLayoutHint(t){return this.allObjects.find(e=>e.layouthint.has(t))}removeFormObject(t){if(!t)throw new A("Missing form object to remove");if(this.currentFormObject&&this.currentFormObject.equals(t))throw new A("Can not remove the current form object");this.completedFormObjects=this.completedFormObjects.filter(e=>!e.equals(t))}get currentFormObject(){return this._currentFormObject}set currentFormObject(t){this._currentFormObject=t}get completedFormObjects(){return this._completedFormObjects}set completedFormObjects(t){this._completedFormObjects=t}get previouslyEnteredFormObjects(){return this._previouslyEnteredFormObjects}set previouslyEnteredFormObjects(t){this._previouslyEnteredFormObjects=t}setEndResultFormObjects(){if(this.data&&this.data.results&&Array.isArray(this.data.results)){let e=(Array.isArray(this.data.missing?.anchors)?this.data.missing?.anchors:[]).map(i=>i.objectid),r=this.data.results.filter(i=>!e.includes(i.objectid)).map(i=>{let{elements:n,...o}=i;return{...o,results:n}});if(r.length>0)return r.map(i=>{let n=this.contributions.objects?.[i.objectid];return n?new pt(i,n):null}).filter(i=>i!=null)}return[]}get expectsEndResultFormObjects(){let t=this.endResultFormObjects.map(e=>e.key);return this.objectKeys.some(e=>this.contributions.objects?.[e]?.content?.results&&!t.includes(e))}get endResultFormObjects(){return this._endResultFormObjects}set endResultFormObjects(t){this.previousEndResultKeys=this.endResultFormObjects.map(e=>e.key),this._endResultFormObjects=t}getEndResultFormObjects(){return this.endResultFormObjects.filter(t=>!this.previousEndResultKeys.includes(t.key))}get previousEndResultKeys(){return this._previousEndResultKeys}set previousEndResultKeys(t){this._previousEndResultKeys=t}get isValid(){return this.currentFormObject?this.currentFormObject.isRepeatable&&(!this.currentFormObject.hasFixedNrOfRepeats||this.allObjects.filter(e=>this.currentFormObject!=null&&e.equals(this.currentFormObject,!1)).find(e=>e.isValid))?!0:this.currentFormObject?.isValid??!0:!0}hasServerErrors(){return this.errorCollection.hasItems()?!0:this.currentFormObject?this.currentFormObject.hasServerErrors():!1}hasErrors(){return this.errorCollection.hasItems()?!0:this.currentFormObject?this.currentFormObject.hasErrors():!1}addServerError(t){this.errorCollection.addServerError(t.id,t.message,t.properties,t.layouthint)}resetErrors(){this._errorCollection.clear(),this.currentFormObject&&this.currentFormObject.resetErrors()}get errorCollection(){return this._errorCollection}set errorCollection(t){this._errorCollection=t}get commit(){return this._commit||!1}set commit(t){this._commit=t}get isFinished(){return this._isFinished||this.success!=null}set isFinished(t){this._isFinished=t}get isComplete(){return this._isComplete}set isComplete(t){this._isComplete=t}get successRedirect(){return this.isFinished&&this.success?.redirect?new y(this.success.redirect):void 0}get redirectLocation(){return this._redirectLocation||this.successRedirect}getSuccessData(){return this.success?.data}getResultData(){let t={};if(this.contributions.resultdata){let e=this.contributions.resultdata,r=Object.keys(e),i=this.getSuccessData();for(let n of r){let o=i?.[n]||{},a=n in e?e[n]:{};t[n]=new dt(n,o,a)}}return t}get resultData(){return this.getSuccessData()}setParameters(t){let e=t?t.map(r=>new ee(r.prefix,r.name,r.value)):[];return new re(e)}get parameters(){return this._parameters}set parameters(t){this._parameters=t}selfhrefNoCommitParam(){let t=this.parameters.filter(r=>r.name!=="commit"),e=this.selflink?.href;return e?(e.method="POST",e.parameters=new re(t),e):new y}selfhrefWithCommitParam(){let t=this.selfhrefNoCommitParam();return this.expectsEndResultFormObjects&&!this.isComplete&&!this.commit&&t.addParameter("commit","false"),t}get selfhref(){if(!this.selflink)throw new Error("No self link found for form");return Jt("ALWAYS_COMMIT_FORM")?this.selfhrefNoCommitParam():this.selfhrefWithCommitParam()}get tokens(){if(!this._tokens){let t=this.data?.tokens;this._tokens=Array.isArray(t)?t:[]}return this._tokens}set tokens(t){this._tokens=t}removeTokens(){this._tokens=[]}setTokens(){let t=this.data?.tokens;this._tokens=Array.isArray(t)?t:[]}isChanged(){return this.currentFormObject!==null&&this.currentFormObject.isChangedSince(this.lastUpdate)}get lastUpdate(){return this._lastUpdate}set lastUpdate(t){this._lastUpdate=t}getFormDataObjects(t=!0,e=!1){let r=this.allObjects.filter(n=>n.isRepeatable&&!n.hasFixedNrOfRepeats&&!n.attributeCollection.some(a=>a.value!==null)?!1:n.isValid||!t),i=[];return r.forEach(n=>{let o=n.getFormData(e);if(!o)return;let a=o&&Object.values(o).some(c=>c!==null);if(n.isDynamic?a:!0){let c=i.findIndex(w=>w.key===n.key&&w.repeatIndex===n.repeatIndex);c>-1?i[c].formdata=rn(i[c].formdata,o):i.push({key:n.key,repeatIndex:n.repeatIndex,formdata:o})}}),i.map(n=>({[n.key]:n.formdata}))}getFormData(t=!0,e=!0,r=!1){return e&&this.tokens.length>0?JSON.stringify({objects:this.getFormDataObjects(t,r),tokens:this.tokens}):JSON.stringify({objects:this.getFormDataObjects(t,r)})}setUseClientsideValidation(t){this._useClientsideValidation=t,this.allObjects.forEach(e=>{e.attributeCollection.all.forEach(r=>r.setUseClientsideValidation(t))})}useClientsideValidation(){return this._useClientsideValidation??!0}get formdata(){return this.getFormData(this.useClientsideValidation())}get validationData(){return this.getFormData(!1,!1,!0)}get hasPreviousStep(){let t=this.currentFormObject!=null?this.currentFormObject.key:"";return this.completedFormObjects.filter(e=>!e.isRepeatWithUnknownTotal||e.key!==t).length>0}setPreviousObject(){this.isComplete=!1,this.isFinished=!1,this.success=void 0;let t=this.currentFormObject;this.currentFormObject!=null&&(this.previouslyEnteredFormObjects=[this.currentFormObject,...this.previouslyEnteredFormObjects]),this.currentFormObject=this.completedFormObjects[this.completedFormObjects.length-1],this.completedFormObjects=this.completedFormObjects.slice(0,-1);let e=this.completedFormObjects.map(r=>r.key).filter(r=>r!==this.currentFormObject?.key);this.endResultFormObjects=this._endResultFormObjects.filter(r=>e.includes(r.key)),this.previousEndResultKeys=this.endResultFormObjects.map(r=>r.key),this.currentFormObject&&this.currentFormObject.equals(t,this.currentFormObject.hasFixedNrOfRepeats)&&this.setPreviousObject()}get hasNextStep(){if(this.isComplete||this.isFinished||this.hasNoQuestionsConfigured||!this.contributions.objects)return!1;if(this.currentFormObject&&this.currentFormObject.isDynamic||this.expectsEndResultFormObjects)return!0;let t=this.objectKeys.findIndex(r=>r===this.currentFormObject?.key),e=this.objectKeys.length-1===t;return e&&this.currentFormObject&&this.currentFormObject.isRepeatable&&!this.currentFormObject.isLastRepeat?!0:!e}update(t){if(t instanceof s){this.resetErrors(),this.lastUpdate=Date.now(),this.lastServerUpdate=t.lastServerUpdate,this.tokens=t.tokens,this.isComplete=t.isComplete,this.isFinished=t.isFinished,this.success=t.success;let e=t.data??{},r=(0,Vt.has)(e,"missing"),i=(0,Vt.has)(e,"errors");!r&&!i&&this.handleFinished(t),i&&this.handleErrors(t),r&&this.handleMissing(t)}return this}updateCurrentFormObject(t){if(t instanceof s){let e=t.data??{},r=(0,Vt.has)(e,"missing");(0,Vt.has)(e,"errors")&&this.handleErrors(t),r&&this.handleMissing(t)}}updateValidations(t){return this.currentFormObject&&this.currentFormObject.updateValidations(t),this}get success(){return this._success}set success(t){this._success=t}createSuccess(){this._success=this.data.success}handleFinished(t){this.currentFormObject&&(this.completedFormObjects=[...this.completedFormObjects,this.currentFormObject]),this.currentFormObject=t.currentFormObject,this.endResultFormObjects=t.endResultFormObjects,this.replaceData({...this.data,...t.data})}handleRootErrors(t){t.filter(e=>!e.anchor).forEach(e=>{this.errorCollection.addServerError(e.id,e.message,e.properties,e.layouthint)})}handleErrors(t){let e=Array.isArray(t.data.errors)?t.data.errors:[];e&&e.forEach(r=>{r.anchor&&this.currentFormObject&&this.currentFormObject.key===r.anchor.objectid?this.currentFormObject.addServerError(r):this.errorCollection.addServerError(r.id,r.message,r.properties,r.layouthint)})}handleMissing(t){this.currentFormObject&&this.currentFormObject.equals(t.currentFormObject)?this.handleMissingErrors(t):this.handleNewFormObject(t)}processMissingErrors(t){return this.currentFormObject===null?null:(this.currentFormObject.attributeCollection.map(e=>{let r=t.currentFormObject?.getAttributeByKey(e.key);return r?e.addMissingError(r):e.removeMissingError(),e}),this.currentFormObject)}handleMissingErrors(t){this.currentFormObject=this.processMissingErrors(t)}handleNewFormObject(t){this.endResultFormObjects=t.endResultFormObjects;let e=t.currentFormObject;e===null?(this.completedFormObjects=[...this.allObjects],this.currentFormObject=null):(this.currentFormObject?.isRepeatable?this.completedFormObjects=[...this.completedFormObjects,this.currentFormObject]:this.currentFormObject&&(this.completedFormObjects=[...this.allObjects]),this.currentFormObject=e)}get mergePreviouslyEnteredObjects(){return this._mergePreviouslyEnteredObjects}set mergePreviouslyEnteredObjects(t){this._mergePreviouslyEnteredObjects=t}handlePreviouslyEnteredFormObjects(t,e){e.forEach(r=>{let i=this.mergePreviouslyEnteredObjects?this.mergeObjects(t,r):t;this.addFormObject(i)}),this.previouslyEnteredFormObjects=this.previouslyEnteredFormObjects.filter(r=>!e.find(n=>r.equals(n)))}mergeObjects(t,e){let r=pt.createEmpty(t);return r.mergeObject(e),r}findAttribute(t){return this.allObjects.flatMap(e=>e.attributeCollection.all).find(e=>t(e))}};var rr=L(lt(),1);var Ut=class extends nt{_contentConfiguration;_listitem;_givenAnswers;_results;_eventdata;constructor(t){super(t),this._contentConfiguration=new Rt(this.contributions?this.contributions.content:{}),this.setResultSection(),this._eventdata=this.setEventData()}getInitialChildModelLinks(){let t=this.listitem?this.listitem.links.getLinksByGroup("panel").all:[],e=[...super.getInitialChildModelLinks(),...t];return this.hasResults&&(this.results&&e.push(...this.results.getInitialChildModelLinks()),this.givenAnswers&&e.push(...this.givenAnswers.getInitialChildModelLinks())),e}setChildModels(t,e){this.attributeCollection.setChildModels(t,e),this.results&&this.results.setChildModels(t,e),this.givenAnswers&&this.givenAnswers.setChildModels(t,e)}get type(){return"ListDetail"}set listitem(t){this._listitem=t,t&&(this.actionCollection=t.actionCollection)}get listitem(){return this._listitem}get panelLinks(){return this.listitem?.links.getLinksByGroup("panel")}get contentConfiguration(){return this._contentConfiguration}set contentConfiguration(t){this._contentConfiguration=t}get introtext(){return this.data._content?this.data._content.text.message:this.contributions.text?this.contributions.text.message??this.contributions.text:Array.isArray(this.contributions.texts)?this.contributions.texts[0].text:""}setResultSection(){let t=this.contributions.resultSection,e=this.data.resultSection;e&&t&&(this.setResults(e.results,t.results),this.setGivenAnswers(e.givenAnswers,t.givenAnswers))}setResults(t,e){if(t&&e){e.type==="composite"&&(e.children=e.children.filter(i=>Object.keys(i)[0]in t));let r=v.createAttribute("results",{key:"results",dynamicschema:this.data.dynamicschema,content:this.data.content?.results,...this.data.resultSection},e,this.modelOptions);r instanceof M&&(r.isResult=!0,r.indicateContentConfiguration(this.contentConfiguration),this._results=r)}}setGivenAnswers(t,e){if(t&&e){let r=e.children?{...e,children:e.children.filter(n=>Object.keys(n)[0]in t)}:e,i=v.createAttribute("givenAnswers",{key:"givenAnswers",dynamicschema:this.data.dynamicschema,content:this.data.content?.givenAnswers,...this.data.resultSection},r,this.modelOptions);i instanceof M&&(i.isResult=!0,this._givenAnswers=i)}}get givenAnswers(){return this._givenAnswers}get hasResults(){return(0,rr.has)(this.contributions,"resultSection")}get results(){return this._results}get hasEventData(){return(0,rr.has)(this.contributions,"eventdata")&&(0,rr.has)(this.data,"eventdata")&&this.data.eventdata!=null&&this.contributions.eventdata!=null}setEventData(){if(!this.data.eventdata||!this.contributions.eventdata)return[];let t=[],{eventdata:e,dynamicschema:r}=this.data;return this.contributions.eventdata.forEach(n=>{for(let o of Object.keys(n)){let a=n[o],l=e[o];l&&(Array.isArray(l)?l.forEach((c,w)=>{let Ii=`${o}-${w+1}`;t.push(new dt(Ii,{...c,dynamicschema:r},a,this.modelOptions))}):t.push(new dt(o,{...l,dynamicschema:r},a,this.modelOptions)))}}),t}get eventdata(){return this._eventdata}};import{immerable as nn}from"immer";var Or=class{_group;_context;_attributeCollection;_grouping;constructor(t,e,r,i){this._group=t,this._context=e,this._attributeCollection=new E(t,e?.attributes,{...i,isReadonly:!0}),t.grouping&&(this._grouping=new Pt({...t.grouping,dynamicschema:t.dynamicschema},r,i))}get type(){return this._group.type}get id(){return this._group._id||"unknown"}get label(){return this._context?.label}get attributeCollection(){return this._attributeCollection}get grouping(){return this._grouping}get reference(){return this._group.reference||[]}hasAttributeByKey(t){return this.attributeCollection.hasAttributeByKey(t)?!0:this.grouping?this.grouping.hasAttributeByKey(t):!1}getAttributeByKey(t){let e=this.attributeCollection.getAttributeByKey(t);if(e)return e;if(this.grouping)return this.grouping.getAttributeByKey(t)}},Pt=class{[nn]=!0;_prefix;_groups=[];constructor(t,e,r){this._prefix=t?.prefix,t?.group&&(this._groups=this.createGroup(t,e,r))}createGroup(t,e,r){if(!t.group)return[];let i=this.getContextFromContributionsByPrefix(e,this._prefix);return t.group.map(n=>{let o=this.getDynamicSchema(n.type,t.dynamicschema),a={...n,dynamicschema:o};return new Or(a,i,e,r)})}getDynamicSchema(t,e){if(e)return this._prefix&&e[t]&&!e[this._prefix+t]&&(e[this._prefix+t]=e[t]),e}get groups(){return this._groups}hasGroups(){return this._groups.length>0}getContextFromContributionsByPrefix(t,e){if(t&&e)return t.find(r=>r.prefix===e)}hasAttributeByKey(t){return this.groups.some(e=>e.hasAttributeByKey(t))}getAttributeByKey(t){let e=this.groups.find(r=>r.hasAttributeByKey(t));if(e)return e.getAttributeByKey(t)}getGroupByAttributeKey(t){return this.groups.find(e=>e.hasAttributeByKey(t))}};var at=class s extends y{_isPrefixed;_prefix;_pagingName;_pagesizeName;_sortingName;_lookupToken;constructor(t,e,r=!0){super(t,void 0),this._isPrefixed=r,e?this.setParametersFromListModel(e):t!=null&&t instanceof s&&this.setParameterNamesFromHref(t)}setParameterNamesFromHref(t){this._prefix=this._isPrefixed?t.prefix:void 0,this._pagingName=t.pagingName,this._pagesizeName=t.pagesizeName,this._sortingName=t.sortingName}setParametersFromListModel(t){this._prefix=this._isPrefixed?t.key:void 0,this._pagingName=t.paging?.name||"",this._pagesizeName=t.paging?.pagesize?.name||"",this._sortingName=t.sorting?.name||"",this.page=t.paging?.page,this.pagesize=t.paging&&t.paging.pagesize.options.length>0?t.paging.pagesize.value:void 0,this.sort=t.sorting?.param,this.filterCollection=t.filterCollection,this.formdata=t.formdata,this.lookupToken=t.lookupToken}get prefix(){return this._prefix}get pagingName(){return this._pagingName}get pagesizeName(){return this._pagesizeName}get sortingName(){return this._sortingName}set page(t){this.pagingName&&this.setParameter(this.pagingName,t?.toString(),this.prefix)}get page(){return this.pagingName?this.getParameter(this.pagingName,this.prefix):void 0}set sort(t){this.sortingName&&this.setParameter(this.sortingName,t,this.prefix)}set pagesize(t){this.pagesizeName&&this.setParameter(this.pagesizeName,t?.toString(),this.prefix)}set lookupToken(t){this.setParameter("lookupToken",t,this.prefix)}set filterCollection(t){t&&t.filter(e=>e.parameterType==="queryParameter").forEach(e=>{e.params.forEach(r=>{r.value==null?this.removeParameter(r.name,this.prefix):this.setParameter(r.name,r.value,this.prefix)})})}};var ir=class s extends nt{static createFromListResult(t,e,r,i){let n=new B;return n.key=t,n.data=e,n.contributions=r,n.origin=i?.origin,n.contextPath=i?.contextPath,new s(n)}static createFromChoiceAttributeOption(t){let e=new B;e.key=t.code;let r=new s(e);return r.attributeCollection=t.attributeCollection,r}get selfhref(){let t=this.links.getLinkByKey("self");return t?t.href:new y("#")}get caseviewHref(){let t=this.attributeCollection.getAttributeByLayoutHint(gt);if(t){let e=t.name,r=this.links.getLinkByKey(e);if(r)return r.href}return this.selfhref}get panelLinks(){return this.links.getLinksByGroup("panel")}hasPanelLinks(){return this.panelLinks.length>-1}getActionsByType(t){return this.actionCollection.getActionsByType(t)}get additionalDetailRoutePath(){let t=this.panelLinks;return t.length===0?"__NON_EXISTING_ROUTE__":t.map(e=>e.href.path).join("|")}};var nr=class s extends p{static createFromList(t){let e=t.data._embedded;if(e){if(Array.isArray(e))throw new P(`One record panel with multiple tables is not supported, place all types in one panel for the panel with key ${t.key}`);let r=t.data.dynamicschema,i=e.results.map(n=>{let[o]=Object.keys(n),a=n[o];a.dynamicschema=r;let l=t.contributions.results[o];return ir.createFromListResult(o,a,l,t.modelOptions)});return new s(i)}return new s}get additionalDetailRoutePath(){if(this.isEmpty())return"__NON_EXISTING_ROUTE__";let t=this.all.map(e=>e.additionalDetailRoutePath).join("|");return t.includes("|")?`(${t})`:t}get actionCollection(){let t=new F;return this.all.forEach(e=>{t.collection.push(...e.actionCollection.all)}),t}};import{immerable as sn}from"immer";var sr=class{[sn]=!0;_pagesize;_options;constructor(t,e){this._pagesize=t,this._options=e?.options||[]}get name(){return"pagesize"}get value(){return this._pagesize}set value(t){this._pagesize=t}get options(){return this._options}get querystring(){return`${this.name}=${this.value}`}};import{immerable as on}from"immer";var or=class{[on]=!0;_data;_contributions;_page;_pagesize;constructor(t,e){this._data=t,this._contributions=e,this._page=this._data?.page,this._pagesize=new sr(this._data?.pagesize,this._contributions?.pagesize)}get isEnabled(){return typeof this.page<"u"}get name(){return"page"}get value(){return this.page}get maxpages(){return this._data?.maxpages}get page(){return this._page}set page(t){this._page=t}get totalResults(){return this._data?.totalresults||-1}get pagesize(){return this._pagesize}get querystring(){let t=[];return this.pagesize&&t.push(this.pagesize.querystring),t.push(`${this.name}=${this.page}`),t.join("&")}};import{immerable as an}from"immer";var Ei=(e=>(e.ASC="asc",e.DESC="desc",e))(Ei||{}),Ht=class{[an]=!0;_key;_label;_group;_sortorder="desc";_selected=!1;constructor(t,e,r){this._key=t,this._group=r,this._label=this.setLabel(t,e,r)}setLabel(t,e,r){if(e)this._label=e;else if(r){let i=r.getAttributeByKey(t);i&&(this._label=i.label)}return""}reset(){this.selected=!1,this.sortorder="desc"}get selected(){return this._selected}set selected(t){this._selected=t}get key(){return this._key}get value(){return`${this.key} ${this.sortorder}`}get oppositeDirection(){return this.sortorder==="desc"?"asc":"desc"}get oppositeValue(){return`${this.key} ${this.oppositeDirection}`}get label(){return this._label}get sortorder(){return this._sortorder}set sortorder(t){this._sortorder=t}get group(){return this._group}getHref(t){let e=new at(t);return(e.prefix?e.hasParameter("page",e.prefix):e.hasParameter("page"))&&(e.page=1),e.sort=this.oppositeValue,e}};var ar=class extends p{constructor(t,e,r,i){super();let n=t?.sorting?.attributes;n&&(this.collection=n.map(o=>{let a=e[o],l=r&&r.getGroupByAttributeKey(o);return new Ht(o,a,l)}),this.setSelected(i))}get name(){return"sort"}get value(){return this.filter(t=>t.selected).map(t=>t.value).join(",")}set value(t){this.reset(),this.setSelected(t)}get param(){return this.value}get options(){return this.collection}reset(){this.collection.forEach(t=>t.reset())}setSelected(t=""){t.split(",").forEach(e=>{let[r,i]=e.split(" ");this.collection.forEach(n=>{n.key===r&&(n.selected=!0,i==="asc"?n.sortorder="asc":i==="desc"&&(n.sortorder="desc"))})})}getUpdateQuerystring(t){if(!t)throw new A("Missing option key as input argument");return this.filter(e=>e.key===t).map(e=>e.key===t?e.oppositeValue:e.value).join(",")}getUpdateQuerystringBySortOption(t){if(!(t instanceof Ht))throw new A("Missing SortOptionModel as input argument");return this.getUpdateQuerystring(t.key)}createListHref(t,e){let r=new at(t);return(r.prefix?r.hasParameter("page",r.prefix):r.hasParameter("page"))&&(r.page=1),r.sort=this.getUpdateQuerystringBySortOption(e),r}};var lr=class extends u{_detail;_headers;_paging;_filterCollection;_sorting;_actionCollection;_listItemCollection;_grouping;_lookupToken;constructor(t){super(t),this._headers=this.setHeaders(),this._paging=this.setPaging(),this._filterCollection=this.setFilters(),this._sorting=this.setSorting(),this._actionCollection=this.setActionCollection(),this._grouping=this.setGrouping(),this._lookupToken=this.setLookupToken(),this._listItemCollection=this._listItemCollection=nr.createFromList(this)}get type(){return"List"}getInitialChildModelLinks(){return this.layouthint.has(Nr)&&this.listItemCollection.length===1?this.listItemCollection.map(t=>{let e=t.selflink;return e.targetModel=Ut,e}):[]}setChildModels(t,e){this.detail=t.find(r=>r instanceof Ut)}get requestMethod(){return this.filterCollection.some(e=>e.parameterType==="bodyParameter"&&e.hasValue())?"POST":"GET"}get label(){return this.contributions.label}get lookupToken(){return this._lookupToken}set lookupToken(t){this._lookupToken=t}get introtext(){return this.data.content?this.data.content.text.message:this.contributions.text?this.contributions.text.message??this.contributions.text:Array.isArray(this.contributions.texts)?this.contributions.texts[0].text:""}get listItemCollection(){return this._listItemCollection}set listItemCollection(t){this._listItemCollection=t}get detail(){return this._detail}set detail(t){let e=this.listItemCollection.find(r=>r.selfhref.equals(t?.selfhref));e&&t&&(t.listitem=e),this._detail=t}get grouping(){return this._grouping}setGrouping(){return new Pt({...this.data.grouping,dynamicschema:this.data.dynamicschema},this.contributions.contexts,this.modelOptions)}hasGrouping(){return this.grouping.hasGroups()}hasResults(){return this.listItemCollection.hasItems}isEmpty(){return!this.hasResults()}get shouldHide(){return this.layouthint.has(Br)&&this.isEmpty()&&this.actionCollection.isEmpty()&&!this.filterCollection.hasActiveFilters()}getListItemById(t){let e=decodeURIComponent(t.toString());return this.listItemCollection.find(r=>r.id.toString()===e)}getListItemByHref(t){return this.listItemCollection.find(e=>e.selfhref.equals(t))}get paging(){return this._paging}setPaging(){return new or(this.data.paging,this.contributions.paging)}get sorting(){return this._sorting}setSorting(){return new ar(this.contributions,this.getSortingLabels(),this.grouping,this.data.sorting)}get filterCollection(){return this._filterCollection}set filterCollection(t){Array.isArray(t)?this._filterCollection.collection=t:this._filterCollection=t}setFilters(){return new I(this.data.filter,{listkey:this.key,filter:this.contributions.filter||{},contexts:this.contributions.contexts,dynamicschema:this.data.dynamicschema},this.modelOptions)}isFiltered(){return this.filterCollection.hasActiveFilters()}get actionCollection(){return this._actionCollection}setActionCollection(){return new F(this.data.actions,this.contributions.actions,this.modelOptions)}hasList(){return this.key!=null}getSelfHref(){let t=this.links.getLinkByKey("self");return new at(t?.href,this)}setLookupToken(){return this.modularuiResponse.parameters?.find(t=>t.name==="lookupToken")?.value}get selfhref(){return this.getSelfHref()}get headers(){return this._headers}setHeaders(){let t=[];if(this.contributions.results){let{results:e}=this.contributions;Object.keys(e).forEach(r=>{e[r].attributes.forEach(i=>{let n=new Et(i,this.sorting);!t.some(a=>a.equals(n))&&!n.layouthint.has(gt)&&t.push(n)})})}return t}getSortingLabels(){let t={};return this.contributions.results&&Object.values(this.contributions.results).forEach(e=>{e.attributes.forEach(r=>{let i=Object.keys(r)[0],n=r[i].label;t[i]=n})}),t}getActionsByType(t){return this.actionCollection.getActionsByType(t)}getAdditionalDetailLabel(t){let e=Object.keys(this.contributions.results);for(let r of e){let i=this.contributions.results[r]._links?.panel?.find(n=>n.resourcetype===t);if(i)return i.label}}get formdata(){let{formdata:t}=this.filterCollection;return t!=null?JSON.stringify(t):null}};var ur=class s extends O{static create(t,e,r){let i=new s;return t.options&&e.options&&t.options.forEach(n=>{i.add(new G([],{...n,optionType:this.getOptionType(n,e),elementsContributions:e.options[0].elements},{...r,referenceDate:new Date().toISOString().split("T")[0]}))}),i}static getOptionType(t,e){return e.optionType?e.optionType:t._links?.download?.[0].name==="avatar"?"user":"generic"}};var Di=class extends u{_options;_filterCollection;constructor(t){super(t),this._options=ur.create(this.data,this.contributions,this.modelOptions),this._filterCollection=this.createFilterCollection(this.data.filter,this.contributions.filter)}get type(){return"LookupOptions"}get options(){return this._options}createFilterCollection(t,e){return t&&e?new I({[t.name]:t},{filter:e},this.modelOptions):new I}get filterCollection(){return this._filterCollection}};var cr=class{_modelCategory;constructor(t){this._modelCategory=t}get key(){return this._modelCategory._id}get label(){return this._modelCategory.label}get description(){return this._modelCategory.description}get iconSmall(){return this._modelCategory.iconSmall}get iconMedium(){return this._modelCategory.iconMedium}get iconLarge(){return this._modelCategory.iconLarge}};var hr=class extends p{constructor(t=[]){super(),this.collection=t?t.map(e=>new cr(e)):[]}};var vi=class extends u{get type(){return"ModelCatalog"}get label(){return this.locale==="nl"?"Model catalogus":"Model catalog"}get conceptIndexLink(){let t=this.links.getLinkByKey("concepts");if(!t)throw new D("Missing concepts index link in model catalog");return t}get contentIndexLink(){let t=this.links.getLinkByKey("content");if(!t)throw new D("Missing content index link in model catalog");return t}get modelcategories(){return new hr(this.data.modelcategories)}};var Si=class extends u{_taskGroupCollection;constructor(t){super(t),this._taskGroupCollection=this.createTaskGroupCollection()}get type(){return"GroupingPanel"}get label(){return this.contributions.label}getInitialChildModelLinks(){return this.links.getLinksByGroup("taskgroup").all}get panelLinks(){return this.links.getLinksByGroup("panel")}setChildModels(t,e){let r=t.filter(i=>i instanceof U);this.taskGroupCollection.add(r)}hasIntroText(){return this.introtext!==""}get introtext(){return this.data._content?this.data._content.text.message:this.contributions.text?this.contributions.text.message??this.contributions.text:Array.isArray(this.contributions.texts)?this.contributions.texts[0].text:""}createTaskGroupCollection(){let t=this.getDataAsArray("taskgroups",[]),e=this.getContributionAsArray("taskgroups",[]),r=[];for(let i of t){let n=i.name,o=e.find(a=>a.name===n);if(o){let a=U.create(n,i,o,this.modelOptions);r.push(a)}}return new st(r)}set taskGroupCollection(t){this._taskGroupCollection=t}get taskGroupCollection(){return this._taskGroupCollection}hasTaskGroups(){return this.taskGroupCollection&&this.taskGroupCollection.hasItems()}hasTasks(){return this.taskGroupCollection.hasTasks()}};var Ti=class extends lr{get type(){return"CaseSearch"}getQuickSearchFilters(){return this.filterCollection?this.filterCollection.filter(t=>t.isQuickSearch()):[]}hasQuickSearchFilters(){return this.getQuickSearchFilters().length>0}};var Oi=class extends u{_actionCollection;_taskGroupCollection;constructor(t){super(t),this._taskGroupCollection=this.createTaskGroupCollection(),this._actionCollection=new F(this.data.actions,this.contributions.actions,this.modelOptions)}get type(){return"Tab"}getInitialChildModelLinks(){return this.links.getLinksByGroup("taskgroup","actions").all}setChildModels(t,e){let r=t.filter(i=>i instanceof U);this.taskGroupCollection.add(r)}get searchLink(){return this.links.getLinksByGroup("search").first}createTaskGroupCollection(){let t=this.getDataAsArray("taskgroups",[]),e=this.getContributionAsArray("taskgroups",[]),r=[];for(let i of t){let n=i.name,o=e.find(a=>a.name===n);if(o){let a=U.create(n,i,o,this.modelOptions);r.push(a)}}return new st(r)}get taskGroupCollection(){return this._taskGroupCollection}set taskGroupCollection(t){this._taskGroupCollection=t}get label(){return this.getContributionAsString("label","")}get components(){return this.links.getLinksByGroup("component","search")}get actionCollection(){return this._actionCollection}hasComponents(){return this.components.size>0}hasTaskGroups(){return this.taskGroupCollection&&this.taskGroupCollection?.hasItems()}hasActions(){return this.actionCollection&&this.actionCollection.hasItems()}};var xi=L(lt(),1);var ki=class extends ht{_attributeCollection;constructor(t=new B){super(t);let e=this.contributions;if(e&&e.attributes&&Array.isArray(e.attributes)){let r=e.attributes.filter(i=>{let[n]=Object.keys(i);return n!=="sessiondata"&&(0,xi.has)(this.data,n)});this._attributeCollection=new E(this.data,r,{...this.modelOptions,isReadonly:!0})}else this._attributeCollection=new E(this.data,[],{...this.modelOptions,isReadonly:!0})}get type(){return"UserProfile"}get attributeCollection(){return this._attributeCollection}};export{O as a,b,k as c,d,B as e,Ct as f,H as g,Ur as h,C as i,u as j,ct as k,At as l,Mt as m,se as n,$ as o,R as p,wt as q,oe as r,tt as s,Nt as t,ae as u,j as v,le as w,et as x,_t as y,ue as z,m as A,ce as B,fe as C,h as D,Et as E,G as F,Y as G,q as H,_ as I,Pr as J,Hr as K,M as L,Kr as M,X as N,ye as O,be as P,Ce as Q,Ae as R,Me as S,_e as T,Ee as U,De as V,ve as W,Dt as X,Se as Y,Te as Z,Oe as _,vt as $,ke as aa,kl as ba,xl as ca,xe as da,Ie as ea,Re as fa,rt as ga,K as ha,Le as ia,Fe as ja,we as ka,Ne as la,St as ma,Be as na,jt as oa,je as pa,Ve as qa,Ue as ra,Pe as sa,He as ta,Ge as ua,Ke as va,it as wa,We as xa,ze as ya,v as za,qe as Aa,E as Ba,Xe as Ca,F as Da,ht as Ea,Ye as Fa,ri as Ga,dt as Ha,nt as Ia,st as Ja,U as Ka,ni as La,x as Ma,ot as Na,Ot as Oa,kt as Pa,Qe as Qa,xt as Ra,I as Sa,Ze as Ta,si as Ua,Je as Va,oi as Wa,ai as Xa,li as Ya,It as Za,tr as _a,er as $a,Rt as ab,ui as bb,pt as cb,Mi as db,Ut as eb,Or as fb,Pt as gb,at as hb,ir as ib,nr as jb,sr as kb,or as lb,Ei as mb,Ht as nb,ar as ob,lr as pb,ur as qb,Di as rb,cr as sb,hr as tb,vi as ub,Si as vb,Ti as wb,Oi as xb,ki as yb};
|
|
2
|
+
//# sourceMappingURL=chunk-RI2O4J7J.js.map
|