@viamedici-spc/configurator-framer 2.1.1 → 2.2.0-alpha0002

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/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),f=require("framer"),h=require("@viamedici-spc/configurator-ts"),U=require("@viamedici-spc/configurator-react"),T=require("react"),Li=require("url-join"),M=require("ts-pattern"),O=require("styled-components"),Mi=require("react-error-boundary"),p=require("@viamedici-spc/fp-ts-extensions"),et=require("@fortawesome/free-solid-svg-icons"),tt=require("@fortawesome/react-fontawesome"),no=require("react-dom"),Bi=require("clsx"),oo=require("merge-props"),$i=require("dyna-guid"),J=require("zod"),zi=require("zod-validation-error"),Ki=require("mustache"),Wi=require("react-number-format"),qi=require("use-debounce"),_i=require("framer-motion"),Hi=require("hex-to-css-filter"),Ui=require("rgb-hex"),Qi=require("camelcase");function io(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const A=io(T),Gi=io(no);function X(){return f.RenderTarget.current()!==f.RenderTarget.preview}const Yi=O.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),f=require("framer"),h=require("@viamedici-spc/configurator-ts"),U=require("@viamedici-spc/configurator-react"),S=require("react"),Mi=require("url-join"),M=require("ts-pattern"),O=require("styled-components"),Bi=require("react-error-boundary"),p=require("@viamedici-spc/fp-ts-extensions"),et=require("@fortawesome/free-solid-svg-icons"),tt=require("@fortawesome/react-fontawesome"),no=require("react-dom"),$i=require("clsx"),oo=require("merge-props"),zi=require("dyna-guid"),J=require("zod"),Ki=require("zod-validation-error"),Wi=require("mustache"),qi=require("react-number-format"),_i=require("use-debounce"),Hi=require("framer-motion"),Ui=require("hex-to-css-filter"),Qi=require("rgb-hex"),Gi=require("camelcase");function io(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const E=io(S),Yi=io(no);function Y(){return f.RenderTarget.current()!==f.RenderTarget.preview}const Xi=O.div`
2
2
  padding: var(--space-md);
3
3
  margin: var(--space-md);
4
4
  border-radius: var(--shape-border-radius-sm);
@@ -13,15 +13,15 @@
13
13
  border: 1px solid #DB0100;
14
14
  border-left-width: 15px;
15
15
  }
16
- `,Xi=O.h3`
16
+ `,Ji=O.h3`
17
17
  margin: 0 0 var(--space-xs);
18
- `,Ji=O.div`
18
+ `,Zi=O.div`
19
19
  white-space: break-spaces;
20
- `;function ro(e){return d.jsxs(Yi,{className:e.type,children:[d.jsx(Xi,{children:e.title}),d.jsx(Ji,{children:e.message})]})}function Zi(e){var r,i,l;if(X())return null;const{error:n}=U.useConfigurationInitialization();if(!n)return null;const o=a=>d.jsx(ro,{type:"error",title:"Configuration initialization failed",message:a});switch(n.type){case h.ConfiguratorErrorType.ConfigurationModelNotFound:return T.Children.toArray(e.configurationModelNotFoundContent).length>0?e.configurationModelNotFoundContent:o("The Configuration Model was not found for the specified deployment name.");case h.ConfiguratorErrorType.AuthenticationFailure:return T.Children.toArray(e.accessTokenInvalidContent).length>0?e.accessTokenInvalidContent:o("The HCA access token is invalid.");case h.ConfiguratorErrorType.SpecifiedDeploymentForbidden:return T.Children.toArray(e.accessTokenRestrictionContent).length>0?e.accessTokenRestrictionContent:o("The HCA access token does not permit using the specified Configuration Model.");case h.ConfiguratorErrorType.DecisionsToRespectInvalid:const a=`Attribute Id: ${((r=n.globalAttributeId)==null?void 0:r.localId)??""}`,s=`Component Path: ${((i=n.globalAttributeId.componentPath)==null?void 0:i.join(" -> "))??""}`,c=`Shared Configuration Model: ${((l=n.globalAttributeId)==null?void 0:l.sharedConfigurationModelId)??""}`;return o(`The definition of Attribute Relations is invalid: ${n.validationMessage}
20
+ `;function ro(e){return d.jsxs(Xi,{className:e.type,children:[d.jsx(Ji,{children:e.title}),d.jsx(Zi,{children:e.message})]})}function er(e){var r,i,l;if(Y())return null;const{error:n}=U.useConfigurationInitialization();if(!n)return null;const o=a=>d.jsx(ro,{type:"error",title:"Configuration initialization failed",message:a});switch(n.type){case h.ConfiguratorErrorType.ConfigurationModelNotFound:return S.Children.toArray(e.configurationModelNotFoundContent).length>0?e.configurationModelNotFoundContent:o("The Configuration Model was not found for the specified deployment name.");case h.ConfiguratorErrorType.AuthenticationFailure:return S.Children.toArray(e.accessTokenInvalidContent).length>0?e.accessTokenInvalidContent:o("The HCA access token is invalid.");case h.ConfiguratorErrorType.SpecifiedDeploymentForbidden:return S.Children.toArray(e.accessTokenRestrictionContent).length>0?e.accessTokenRestrictionContent:o("The HCA access token does not permit using the specified Configuration Model.");case h.ConfiguratorErrorType.DecisionsToRespectInvalid:const a=`Attribute Id: ${((r=n.globalAttributeId)==null?void 0:r.localId)??""}`,s=`Component Path: ${((i=n.globalAttributeId.componentPath)==null?void 0:i.join(" -> "))??""}`,c=`Shared Configuration Model: ${((l=n.globalAttributeId)==null?void 0:l.sharedConfigurationModelId)??""}`;return o(`The definition of Attribute Relations is invalid: ${n.validationMessage}
21
21
 
22
22
  ${a}
23
23
  ${s}
24
- ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configuration Session parameters are invalid: ${n.detail}`);default:return T.Children.toArray(e.errorContent).length>0?e.errorContent:o("An error occurred while initializing the configuration.")}}function se(e){return T.forwardRef((t,n)=>d.jsx(Mi.ErrorBoundary,{fallbackRender:()=>d.jsx("span",{children:"Component crashed"}),children:d.jsx(e,{...t,ref:n})}))}const er=O.createGlobalStyle`
24
+ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configuration Session parameters are invalid: ${n.detail}`);default:return S.Children.toArray(e.errorContent).length>0?e.errorContent:o("An error occurred while initializing the configuration.")}}function se(e){return S.forwardRef((t,n)=>d.jsx(Bi.ErrorBoundary,{fallbackRender:()=>d.jsx("span",{children:"Component crashed"}),children:d.jsx(e,{...t,ref:n})}))}const tr=O.createGlobalStyle`
25
25
  :root {
26
26
  --font-primary: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
27
27
  --font-heading: "Inter-Medium", "Inter", "Inter Placeholder", sans-serif;
@@ -40,7 +40,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
40
40
  --text-xxl: calc(1em * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
41
41
  --text-xxxl: calc(1em * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
42
42
  }
43
- `,tr=er,nr=O.createGlobalStyle`
43
+ `,nr=tr,or=O.createGlobalStyle`
44
44
  :root {
45
45
  --space-unit: 1em;
46
46
  --space-xxs: calc(0.25 * var(--space-unit));
@@ -60,14 +60,14 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
60
60
  --space-xl-fixed: calc(3.25 * var(--space-unit-fixed));
61
61
  --space-xxl-fixed: calc(5.25 * var(--space-unit-fixed));
62
62
  }
63
- `,or=nr,ir=O.createGlobalStyle`
63
+ `,ir=or,rr=O.createGlobalStyle`
64
64
  :root {
65
65
  --shape-border-radius-xs: 5px;
66
66
  --shape-border-radius-sm: 7px;
67
67
  --shape-border-radius-md: 12px;
68
68
  --shape-border-radius-lg: 20px;
69
69
  }
70
- `,rr=ir,lr=O.createGlobalStyle`
70
+ `,lr=rr,ar=O.createGlobalStyle`
71
71
  :root {
72
72
  --shadows-popover: drop-shadow(5px 5px 10px rgba(0, 0, 0, 0.4));
73
73
  --shadows-dialog: 0.2px 0.4px 2.3px rgba(0, 0, 0, 0.02),
@@ -79,7 +79,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
79
79
  13.9px 23.6px 54.7px rgba(0, 0, 0, 0.061),
80
80
  40px 68px 96px rgba(0, 0, 0, 0.1);
81
81
  }
82
- `,ar=lr;function sn(){return d.jsxs(d.Fragment,{children:[d.jsx(ar,{}),d.jsx(rr,{}),d.jsx(or,{}),d.jsx(tr,{})]})}const Ke=T.createContext(null);function ge(){const{process:e,switchMode:t,applySolution:n,dismiss:o}=T.useContext(Ke);return e?{...e,switchMode:t,applySolution:n,dismiss:o}:null}function lo(e){const{explanation:t,...n}=e,o=ge();return d.jsx("button",{...n,onClick:()=>o.applySolution(t.solution),children:e.children})}function ao(e,t,n){return M.match(e).returnType().with({type:h.AttributeType.Choice},o=>t.get(o.choiceValueId)??o.choiceValueId).with({type:h.AttributeType.Boolean,state:!0},()=>n.booleanDecisionStateTrueLabel).with({type:h.AttributeType.Boolean,state:!1},()=>n.booleanDecisionStateFalseLabel).with({type:h.AttributeType.Component,state:h.ComponentDecisionState.Included},()=>n.componentDecisionStateIncludedLabel).with({type:h.AttributeType.Component,state:h.ComponentDecisionState.Excluded},()=>n.componentDecisionStateExcludedLabel).with({type:h.AttributeType.Numeric},o=>o.state.toString()).exhaustive()}const so={applySolutionButtonCaption:{title:"Apply Solution Button Caption",type:f.ControlType.String,defaultValue:"Apply Solution"},configurationSubjectTitle:{title:"Configuration Subject Title",type:f.ControlType.String,defaultValue:"Configuration"},generalConflictTitle:{title:"General Conflict Title",type:f.ControlType.String,defaultValue:"Conflict"},componentDecisionStateIncludedLabel:{title:"Component Decision State Included Label",type:f.ControlType.String,defaultValue:"Included"},componentDecisionStateExcludedLabel:{title:"Component Decision State Excluded Label",type:f.ControlType.String,defaultValue:"Excluded"},booleanDecisionStateTrueLabel:{title:"Boolean Decision State True Label",type:f.ControlType.String,defaultValue:"Yes"},booleanDecisionStateFalseLabel:{title:"Boolean Decision State False Label",type:f.ControlType.String,defaultValue:"No"},isBlockedSuffix:{title:"Is Blocked Suffix",type:f.ControlType.String,defaultValue:"is blocked"},isNotSatisfiedSuffix:{title:"Is Not Satisfied Suffix",type:f.ControlType.String,defaultValue:"is not satisfied"}},sr={fill:{title:"Fill",type:f.ControlType.Color,defaultValue:"#002134"},color:{title:"Color",type:f.ControlType.Color,defaultValue:"white"},attributeValueFill:{title:"Attribute Value Fill",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.2)"},attributeValueAddFill:{title:"Attribute Value Add Fill",type:f.ControlType.Color,defaultValue:"rgba(47, 255, 0, 0.2)"},attributeValueAddColor:{title:"Attribute Value Add Color",type:f.ControlType.Color,defaultValue:"#63e446"},attributeValueRemoveFill:{title:"Attribute Value Remove Fill",type:f.ControlType.Color,defaultValue:"#ff00004a"},attributeValueRemoveColor:{title:"Attribute Value Remove Color",type:f.ControlType.Color,defaultValue:"#ff6060"},headerValueColor:{title:"Header Value Color",type:f.ControlType.Color,defaultValue:"rgb(0, 161, 230)"},closeButtonOutline:{title:"Close Button Outline",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},listSeparator:{title:"List Separator",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.3)"},applySolutionButtonFill:{title:"Apply Solution Button Fill",type:f.ControlType.Color,defaultValue:"rgb(0, 161, 230)"},applySolutionButtonColor:{title:"Apply Solution Button Color",type:f.ControlType.Color,defaultValue:"white"},applySolutionButtonOutline:{title:"Apply Solution Button Outline",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},showMoreButtonOutline:{title:"Show More Button Outline",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},solutionTitle:{title:"Solution Title",type:f.ControlType.String,defaultValue:"Solution"},showMoreButtonCaption:{title:"Show More Button Caption",type:f.ControlType.String,defaultValue:"Show more ({{amount}})"},showConstraintsButtonCaption:{title:"Show Constraints Button Caption",type:f.ControlType.String,defaultValue:"Show Constraints"},...so},$t=T.createContext(null),zt=()=>T.useContext($t),cr={fill:{title:"Fill",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.7)"},color:{title:"Color",type:f.ControlType.Color,defaultValue:"#171717"},attributeValueFill:{title:"Attribute Value Fill",type:f.ControlType.Color,defaultValue:"#efefef"},attributeValueAddFill:{title:"Attribute Value Add Fill",type:f.ControlType.Color,defaultValue:"#cfefc7"},attributeValueAddColor:{title:"Attribute Value Add Color",type:f.ControlType.Color,defaultValue:"#48c52b"},attributeValueRemoveFill:{title:"Attribute Value Remove Fill",type:f.ControlType.Color,defaultValue:"#ffdada"},attributeValueRemoveColor:{title:"Attribute Value Remove Color",type:f.ControlType.Color,defaultValue:"#c52b2b"},headerValueColor:{title:"Header Value Color",type:f.ControlType.Color,defaultValue:"#00a1e6"},closeButtonOutline:{title:"Close Button Outline",type:f.ControlType.Color,defaultValue:"#00a1e6"},applySolutionButtonFill:{title:"Apply Solution Button Fill",type:f.ControlType.Color,defaultValue:"#F2F2F2"},applySolutionButtonColor:{title:"Apply Solution Button Color",type:f.ControlType.Color,defaultValue:"#171717"},applySolutionButtonOutline:{title:"Apply Solution Button Outline",type:f.ControlType.Color,defaultValue:"#00a1e6"},explanationCard:{title:"Explanation Card",type:f.ControlType.Color,defaultValue:"white"},scrollShadowBorder:{title:"Scroll Shadow Border",type:f.ControlType.Color,defaultValue:"rgba(0, 0, 0, 0.3)"},backdropFilter:{title:"Backdrop Filter",type:f.ControlType.String,defaultValue:"blur(10px) saturate(200%)"},decisionExplanationSolutionsTitle:{title:"Decision Explanation Solutions Title",type:f.ControlType.String,defaultValue:"Solutions"},constraintExplanationSolutionsTitle:{title:"Constraint Explanation Solutions Title",type:f.ControlType.String,defaultValue:"Constraint Explanations"},...so},Kt=T.createContext(null),co=()=>T.useContext(Kt),ur=()=>T.useContext($t)||T.useContext(Kt),Wt=ur,dr=O.div`
82
+ `,sr=ar;function sn(){return d.jsxs(d.Fragment,{children:[d.jsx(sr,{}),d.jsx(lr,{}),d.jsx(ir,{}),d.jsx(nr,{})]})}const Ke=S.createContext(null);function ge(){const{process:e,switchMode:t,applySolution:n,dismiss:o}=S.useContext(Ke);return e?{...e,switchMode:t,applySolution:n,dismiss:o}:null}function lo(e){const{explanation:t,...n}=e,o=ge();return d.jsx("button",{...n,onClick:()=>o.applySolution(t.solution),children:e.children})}function ao(e,t,n){return M.match(e).returnType().with({type:h.AttributeType.Choice},o=>t.get(o.choiceValueId)??o.choiceValueId).with({type:h.AttributeType.Boolean,state:!0},()=>n.booleanDecisionStateTrueLabel).with({type:h.AttributeType.Boolean,state:!1},()=>n.booleanDecisionStateFalseLabel).with({type:h.AttributeType.Component,state:h.ComponentDecisionState.Included},()=>n.componentDecisionStateIncludedLabel).with({type:h.AttributeType.Component,state:h.ComponentDecisionState.Excluded},()=>n.componentDecisionStateExcludedLabel).with({type:h.AttributeType.Numeric},o=>o.state.toString()).exhaustive()}const so={applySolutionButtonCaption:{title:"Apply Solution Button Caption",type:f.ControlType.String,defaultValue:"Apply Solution"},configurationSubjectTitle:{title:"Configuration Subject Title",type:f.ControlType.String,defaultValue:"Configuration"},generalConflictTitle:{title:"General Conflict Title",type:f.ControlType.String,defaultValue:"Conflict"},componentDecisionStateIncludedLabel:{title:"Component Decision State Included Label",type:f.ControlType.String,defaultValue:"Included"},componentDecisionStateExcludedLabel:{title:"Component Decision State Excluded Label",type:f.ControlType.String,defaultValue:"Excluded"},booleanDecisionStateTrueLabel:{title:"Boolean Decision State True Label",type:f.ControlType.String,defaultValue:"Yes"},booleanDecisionStateFalseLabel:{title:"Boolean Decision State False Label",type:f.ControlType.String,defaultValue:"No"},isBlockedSuffix:{title:"Is Blocked Suffix",type:f.ControlType.String,defaultValue:"is blocked"},isNotSatisfiedSuffix:{title:"Is Not Satisfied Suffix",type:f.ControlType.String,defaultValue:"is not satisfied"}},cr={fill:{title:"Fill",type:f.ControlType.Color,defaultValue:"#002134"},color:{title:"Color",type:f.ControlType.Color,defaultValue:"white"},attributeValueFill:{title:"Attribute Value Fill",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.2)"},attributeValueAddFill:{title:"Attribute Value Add Fill",type:f.ControlType.Color,defaultValue:"rgba(47, 255, 0, 0.2)"},attributeValueAddColor:{title:"Attribute Value Add Color",type:f.ControlType.Color,defaultValue:"#63e446"},attributeValueRemoveFill:{title:"Attribute Value Remove Fill",type:f.ControlType.Color,defaultValue:"#ff00004a"},attributeValueRemoveColor:{title:"Attribute Value Remove Color",type:f.ControlType.Color,defaultValue:"#ff6060"},headerValueColor:{title:"Header Value Color",type:f.ControlType.Color,defaultValue:"rgb(0, 161, 230)"},closeButtonOutline:{title:"Close Button Outline",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},listSeparator:{title:"List Separator",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.3)"},applySolutionButtonFill:{title:"Apply Solution Button Fill",type:f.ControlType.Color,defaultValue:"rgb(0, 161, 230)"},applySolutionButtonColor:{title:"Apply Solution Button Color",type:f.ControlType.Color,defaultValue:"white"},applySolutionButtonOutline:{title:"Apply Solution Button Outline",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},showMoreButtonOutline:{title:"Show More Button Outline",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},solutionTitle:{title:"Solution Title",type:f.ControlType.String,defaultValue:"Solution"},showMoreButtonCaption:{title:"Show More Button Caption",type:f.ControlType.String,defaultValue:"Show more ({{amount}})"},showConstraintsButtonCaption:{title:"Show Constraints Button Caption",type:f.ControlType.String,defaultValue:"Show Constraints"},...so},$t=S.createContext(null),zt=()=>S.useContext($t),ur={fill:{title:"Fill",type:f.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.7)"},color:{title:"Color",type:f.ControlType.Color,defaultValue:"#171717"},attributeValueFill:{title:"Attribute Value Fill",type:f.ControlType.Color,defaultValue:"#efefef"},attributeValueAddFill:{title:"Attribute Value Add Fill",type:f.ControlType.Color,defaultValue:"#cfefc7"},attributeValueAddColor:{title:"Attribute Value Add Color",type:f.ControlType.Color,defaultValue:"#48c52b"},attributeValueRemoveFill:{title:"Attribute Value Remove Fill",type:f.ControlType.Color,defaultValue:"#ffdada"},attributeValueRemoveColor:{title:"Attribute Value Remove Color",type:f.ControlType.Color,defaultValue:"#c52b2b"},headerValueColor:{title:"Header Value Color",type:f.ControlType.Color,defaultValue:"#00a1e6"},closeButtonOutline:{title:"Close Button Outline",type:f.ControlType.Color,defaultValue:"#00a1e6"},applySolutionButtonFill:{title:"Apply Solution Button Fill",type:f.ControlType.Color,defaultValue:"#F2F2F2"},applySolutionButtonColor:{title:"Apply Solution Button Color",type:f.ControlType.Color,defaultValue:"#171717"},applySolutionButtonOutline:{title:"Apply Solution Button Outline",type:f.ControlType.Color,defaultValue:"#00a1e6"},explanationCard:{title:"Explanation Card",type:f.ControlType.Color,defaultValue:"white"},scrollShadowBorder:{title:"Scroll Shadow Border",type:f.ControlType.Color,defaultValue:"rgba(0, 0, 0, 0.3)"},backdropFilter:{title:"Backdrop Filter",type:f.ControlType.String,defaultValue:"blur(10px) saturate(200%)"},decisionExplanationSolutionsTitle:{title:"Decision Explanation Solutions Title",type:f.ControlType.String,defaultValue:"Solutions"},constraintExplanationSolutionsTitle:{title:"Constraint Explanation Solutions Title",type:f.ControlType.String,defaultValue:"Constraint Explanations"},...so},Kt=S.createContext(null),co=()=>S.useContext(Kt),dr=()=>S.useContext($t)||S.useContext(Kt),Wt=dr,fr=O.div`
83
83
  display: flex;
84
84
  gap: var(--space-xs);
85
85
  align-items: center;
@@ -90,7 +90,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
90
90
  font-family: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
91
91
  font-weight: 500;
92
92
  min-width: 0;
93
- `,fr=O.div`
93
+ `,pr=O.div`
94
94
  display: grid;
95
95
  place-content: center;
96
96
  border-top-left-radius: 360px;
@@ -108,36 +108,36 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
108
108
  background-color: var(--color-explain-attribute-value-remove-fill);
109
109
  color: var(--color-explain-attribute-value-remove-color);
110
110
  }
111
- `,pr=O.div`
111
+ `,hr=O.div`
112
112
  white-space: nowrap;
113
113
  overflow: hidden;
114
114
  text-overflow: ellipsis;
115
- `;function hr(e){const{decision:t,choiceValuesNames:n}=e,o=t.intention,r=Wt(),i=ao(t,n,r);return d.jsxs(dr,{children:[d.jsxs(fr,{className:`mode-${o}`,children:[o==="remove"&&d.jsx(tt.FontAwesomeIcon,{icon:et.faMinus}),o==="add"&&d.jsx(tt.FontAwesomeIcon,{icon:et.faPlus})]}),d.jsx(pr,{children:i})]})}function Z(e){var t;return{localId:e.attributeId,componentPath:e.componentPath===""?[]:((t=e.componentPath)==null?void 0:t.split(" -> "))??[],sharedConfigurationModelId:e.sharedConfigurationModel===""?null:e.sharedConfigurationModel}}const ft=T.createContext(null);function pt(e){const{attributes:t}=T.useContext(ft),{activeLocale:n}=f.useLocaleInfo(),o=n.code;return T.useMemo(()=>p.pipe(t,p.RA.findFirst(r=>h.globalAttributeIdEq.equals(Z(r),e)),p.O.map(r=>r.name),p.RA.fromOption,p.RA.flatten,qt(o),p.O.toUndefined),[t,o,e.localId,e.componentPath,e.sharedConfigurationModelId])}function _e(e){const{choiceValues:t}=T.useContext(ft),{activeLocale:n}=f.useLocaleInfo(),o=U.useChoiceAttribute(e);if(!o)return p.RM.empty;const r=T.useMemo(()=>p.pipe(t,p.RA.filter(a=>h.globalAttributeIdEq.equals(Z(a),e))),[t,e.localId,e.componentPath,e.sharedConfigurationModelId]),i=n.code,l=o.attribute.values;return T.useMemo(()=>p.pipe(l,p.RM.mapWithIndex((a,s)=>p.pipe(r,p.RA.findFirst(c=>c.choiceValueId===a),p.O.map(c=>c.name),p.RA.fromOption,p.RA.flatten,qt(i))),p.RM.compact),[l,r,i])}function uo(e,t){const{choiceValues:n}=T.useContext(ft),{activeLocale:o}=f.useLocaleInfo(),r=o.code;return T.useMemo(()=>p.pipe(n,p.RA.findFirst(i=>h.globalAttributeIdEq.equals(Z(i),e)&&i.choiceValueId===t),p.O.map(i=>i.name),p.RA.fromOption,p.RA.flatten,qt(r),p.O.toUndefined),[n,r,e.localId,e.componentPath,e.sharedConfigurationModelId,t])}function qt(e){return p.flow(p.RA.findFirst(t=>t.localeCode.localeCompare(e,void 0,{sensitivity:"accent"})===0),p.O.map(t=>t.translation))}const mr=O.div`
115
+ `;function mr(e){const{decision:t,choiceValuesNames:n}=e,o=t.intention,r=Wt(),i=ao(t,n,r);return d.jsxs(fr,{children:[d.jsxs(pr,{className:`mode-${o}`,children:[o==="remove"&&d.jsx(tt.FontAwesomeIcon,{icon:et.faMinus}),o==="add"&&d.jsx(tt.FontAwesomeIcon,{icon:et.faPlus})]}),d.jsx(hr,{children:i})]})}function Z(e){var t;return{localId:e.attributeId,componentPath:e.componentPath===""?[]:((t=e.componentPath)==null?void 0:t.split(" -> "))??[],sharedConfigurationModelId:e.sharedConfigurationModel===""?null:e.sharedConfigurationModel}}const ft=S.createContext(null);function pt(e){const{attributes:t}=S.useContext(ft),{activeLocale:n}=f.useLocaleInfo(),o=n.code;return S.useMemo(()=>p.pipe(t,p.RA.findFirst(r=>h.globalAttributeIdEq.equals(Z(r),e)),p.O.map(r=>r.name),p.RA.fromOption,p.RA.flatten,qt(o),p.O.toUndefined),[t,o,e.localId,e.componentPath,e.sharedConfigurationModelId])}function _e(e){const{choiceValues:t}=S.useContext(ft),{activeLocale:n}=f.useLocaleInfo(),o=U.useChoiceAttribute(e);if(!o)return p.RM.empty;const r=S.useMemo(()=>p.pipe(t,p.RA.filter(a=>h.globalAttributeIdEq.equals(Z(a),e))),[t,e.localId,e.componentPath,e.sharedConfigurationModelId]),i=n.code,l=o.attribute.values;return S.useMemo(()=>p.pipe(l,p.RM.mapWithIndex((a,s)=>p.pipe(r,p.RA.findFirst(c=>c.choiceValueId===a),p.O.map(c=>c.name),p.RA.fromOption,p.RA.flatten,qt(i))),p.RM.compact),[l,r,i])}function uo(e,t){const{choiceValues:n}=S.useContext(ft),{activeLocale:o}=f.useLocaleInfo(),r=o.code;return S.useMemo(()=>p.pipe(n,p.RA.findFirst(i=>h.globalAttributeIdEq.equals(Z(i),e)&&i.choiceValueId===t),p.O.map(i=>i.name),p.RA.fromOption,p.RA.flatten,qt(r),p.O.toUndefined),[n,r,e.localId,e.componentPath,e.sharedConfigurationModelId,t])}function qt(e){return p.flow(p.RA.findFirst(t=>t.localeCode.localeCompare(e,void 0,{sensitivity:"accent"})===0),p.O.map(t=>t.translation))}const yr=O.div`
116
116
  display: grid;
117
117
  grid-template-columns: subgrid;
118
118
  grid-column: span 2;
119
119
  align-items: center;
120
- `,yr=O.div`
120
+ `,gr=O.div`
121
121
  grid-area: name;
122
122
  white-space: nowrap;
123
123
  overflow: hidden;
124
124
  text-overflow: ellipsis;
125
- `,gr=O.div`
125
+ `,br=O.div`
126
126
  grid-area: values;
127
127
  display: flex;
128
128
  flex-wrap: wrap;
129
129
  min-width: 0;
130
130
  gap: var(--space-xxs);
131
- `;function br(e){const{decisions:t}=e,n=t[0].attributeId,o=_e(n),r=pt(n),i=Wt(),l=p.pipe(p.Str.Ord,p.Ord.contramap(s=>ao(s,o,i))),a=p.pipe(t,p.RA.sort(l));return d.jsxs(mr,{children:[d.jsx(yr,{children:r??n.localId}),d.jsx(gr,{children:a.map((s,c)=>d.jsx(hr,{decision:s,choiceValuesNames:o},c))})]})}function xr(e){const t=e.sharedConfigurationModelId&&`shared::${e.sharedConfigurationModelId}`,n=(e.componentPath??[]).join("::");return[t,n,e.localId].filter(o=>(o==null?void 0:o.length)>0).join("::")}const Cr=p.pipe(p.Str.Ord,p.Ord.contramap(e=>e.attributeId.localId));function fo(e){const{blockingDecisions:t,desiredDecisions:n,...o}=e,r=p.pipe([...n.map(i=>({...i,intention:"add"})),...t.map(i=>({...i,intention:"remove"}))],p.RNEA.groupBy(i=>xr(i.attributeId)),p.RR.collect(p.Ord.trivial)((i,l)=>({key:i,attributeId:p.RNEA.head(l).attributeId,decisions:l})),p.RA.sort(Cr));return d.jsx("div",{...o,children:r.map(i=>d.jsx(br,{decisions:i.decisions},i.key))})}const vr=O.div`
131
+ `;function xr(e){const{decisions:t}=e,n=t[0].attributeId,o=_e(n),r=pt(n),i=Wt(),l=p.pipe(p.Str.Ord,p.Ord.contramap(s=>ao(s,o,i))),a=p.pipe(t,p.RA.sort(l));return d.jsxs(yr,{children:[d.jsx(gr,{children:r??n.localId}),d.jsx(br,{children:a.map((s,c)=>d.jsx(mr,{decision:s,choiceValuesNames:o},c))})]})}function Cr(e){const t=e.sharedConfigurationModelId&&`shared::${e.sharedConfigurationModelId}`,n=(e.componentPath??[]).join("::");return[t,n,e.localId].filter(o=>(o==null?void 0:o.length)>0).join("::")}const vr=p.pipe(p.Str.Ord,p.Ord.contramap(e=>e.attributeId.localId));function fo(e){const{blockingDecisions:t,desiredDecisions:n,...o}=e,r=p.pipe([...n.map(i=>({...i,intention:"add"})),...t.map(i=>({...i,intention:"remove"}))],p.RNEA.groupBy(i=>Cr(i.attributeId)),p.RR.collect(p.Ord.trivial)((i,l)=>({key:i,attributeId:p.RNEA.head(l).attributeId,decisions:l})),p.RA.sort(vr));return d.jsx("div",{...o,children:r.map(i=>d.jsx(xr,{decisions:i.decisions},i.key))})}const wr=O.div`
132
132
  background-color: var(--color-explain-dialog-explanation-card);
133
133
  padding: var(--space-sm-fixed);
134
134
  box-shadow: 2px 1px 10px -5px rgba(0, 0, 0, 0.4);
135
135
  border-radius: var(--shape-border-radius-sm);
136
- `,po=vr,wr=O(fo)`
136
+ `,po=wr,Sr=O(fo)`
137
137
  display: grid;
138
138
  grid-template-columns: [name] minmax(150px, auto) [values] minmax(0px, 1fr);
139
139
  gap: var(--space-sm);
140
- `,Sr=O(lo)`
140
+ `,Tr=O(lo)`
141
141
  border-radius: var(--shape-border-radius-sm);
142
142
  background-color: var(--color-explain-dialog-apply-solution-button-fill);
143
143
  color: var(--color-explain-dialog-apply-solution-button-color);
@@ -154,13 +154,13 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
154
154
  outline: 2px solid var(--color-explain-dialog-apply-solution-button-outline);
155
155
  outline-offset: 1px;
156
156
  }
157
- `;function Tr(e){const{explanation:t}=e,{applySolutionButtonCaption:n}=co(),o=t.solution.decisions.filter(r=>r.state!=null);return d.jsxs(po,{children:[d.jsx(wr,{blockingDecisions:t.causedByDecisions,desiredDecisions:o}),d.jsx(Sr,{explanation:t,children:n})]})}const Ar=O(po)`
157
+ `;function Er(e){const{explanation:t}=e,{applySolutionButtonCaption:n}=co(),o=t.solution.decisions.filter(r=>r.state!=null);return d.jsxs(po,{children:[d.jsx(Sr,{blockingDecisions:t.causedByDecisions,desiredDecisions:o}),d.jsx(Tr,{explanation:t,children:n})]})}const Ar=O(po)`
158
158
  ul {
159
159
  margin: 0;
160
160
  }
161
161
 
162
162
  line-height: 1.5em;
163
- `,Er=O.ul`
163
+ `,Rr=O.ul`
164
164
  list-style-type: none;
165
165
  margin-inline-start: 0;
166
166
  padding-inline-start: 0;
@@ -172,7 +172,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
172
172
  font-size: 0.9em;
173
173
  font-family: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
174
174
  font-weight: 500;
175
- `;function Rr(e){const{explanation:t}=e,n=t.causedByCardinalities,o=p.pipe(t.causedByRules,p.RNEA.groupBy(r=>r.configurationModelId),p.RR.collect(p.Str.Ord)((r,i)=>({configurationModelId:r,rules:p.pipe(i,p.RA.map(l=>l.localId),p.RA.sort(p.Str.Ord))})));return d.jsx(Ar,{children:d.jsxs(Er,{children:[o.map(r=>d.jsxs("li",{children:[d.jsx("span",{children:r.configurationModelId}),d.jsx(cn,{children:r.rules.map(i=>d.jsx(un,{children:i}))})]})),n.length>0&&d.jsxs("li",{children:[d.jsx("span",{children:"Cardinality"}),d.jsx(cn,{children:n.map(r=>d.jsx(un,{children:r.localId}))})]})]})})}function ho(e){const{variant:t,...n}=e,{explainQuestion:o}=ge(),r=M.match(o).returnType().with({question:h.ExplainQuestionType.whyIsStateNotPossible},()=>"why your selection is not possible").with({question:h.ExplainQuestionType.whyIsNotSatisfied,subject:h.ExplainQuestionSubject.configuration},()=>"why your configuration is not satisfied").with({question:h.ExplainQuestionType.whyIsNotSatisfied,subject:h.ExplainQuestionSubject.attribute},()=>"why your attribute is not satisfied").with(M.P.nullish,()=>"why your selections are not possible").exhaustive(),i=M.match(t).returnType().with("failedToExplain",()=>d.jsxs(d.Fragment,{children:["Failed to explain ",r,".",d.jsx("br",{}),"Please check your internet connection and try again."]})).with("noExplanationFound",()=>d.jsxs(d.Fragment,{children:["There was no explanation found for ",r,"."]})).with("noSolutionFound",()=>d.jsxs(d.Fragment,{children:["There was no solution found for ",r,"."]})).exhaustive();return d.jsx("div",{...n,children:i})}const dn=O.div`
175
+ `;function Ir(e){const{explanation:t}=e,n=t.causedByCardinalities,o=p.pipe(t.causedByRules,p.RNEA.groupBy(r=>r.configurationModelId),p.RR.collect(p.Str.Ord)((r,i)=>({configurationModelId:r,rules:p.pipe(i,p.RA.map(l=>l.localId),p.RA.sort(p.Str.Ord))})));return d.jsx(Ar,{children:d.jsxs(Rr,{children:[o.map(r=>d.jsxs("li",{children:[d.jsx("span",{children:r.configurationModelId}),d.jsx(cn,{children:r.rules.map(i=>d.jsx(un,{children:i}))})]})),n.length>0&&d.jsxs("li",{children:[d.jsx("span",{children:"Cardinality"}),d.jsx(cn,{children:n.map(r=>d.jsx(un,{children:r.localId}))})]})]})})}function ho(e){const{variant:t,...n}=e,{explainQuestion:o}=ge(),r=M.match(o).returnType().with({question:h.ExplainQuestionType.whyIsStateNotPossible},()=>"why your selection is not possible").with({question:h.ExplainQuestionType.whyIsNotSatisfied,subject:h.ExplainQuestionSubject.configuration},()=>"why your configuration is not satisfied").with({question:h.ExplainQuestionType.whyIsNotSatisfied,subject:h.ExplainQuestionSubject.attribute},()=>"why your attribute is not satisfied").with(M.P.nullish,()=>"why your selections are not possible").exhaustive(),i=M.match(t).returnType().with("failedToExplain",()=>d.jsxs(d.Fragment,{children:["Failed to explain ",r,".",d.jsx("br",{}),"Please check your internet connection and try again."]})).with("noExplanationFound",()=>d.jsxs(d.Fragment,{children:["There was no explanation found for ",r,"."]})).with("noSolutionFound",()=>d.jsxs(d.Fragment,{children:["There was no solution found for ",r,"."]})).exhaustive();return d.jsx("div",{...n,children:i})}const dn=O.div`
176
176
  font-weight: 500;
177
177
  font-family: var(--font-heading);
178
178
  margin-bottom: var(--space-xs);
@@ -181,7 +181,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
181
181
  display: flex;
182
182
  flex-direction: column;
183
183
  gap: var(--space-xs);
184
- `,Ir=O.div`
184
+ `,Pr=O.div`
185
185
  display: flex;
186
186
  flex-direction: column;
187
187
  gap: var(--space-md);
@@ -189,23 +189,23 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
189
189
  width: min-content;
190
190
  min-width: 400px;
191
191
  margin: var(--space-sm-fixed) var(--space-md-fixed) var(--space-sm-fixed) var(--space-sm-fixed);
192
- `;function Pr(){const{decisionExplanations:e,constraintExplanations:t,hasError:n}=ge(),{decisionExplanationSolutionsTitle:o,constraintExplanationSolutionsTitle:r}=co();return n?d.jsx(pn,{variant:"failedToExplain"}):e.length===0&&t.length===0?d.jsx(pn,{variant:"noExplanationFound"}):d.jsxs(Ir,{children:[e.length>0&&d.jsxs("div",{children:[d.jsx(dn,{children:o}),d.jsx(fn,{children:e.map(i=>d.jsx(Tr,{explanation:i},e.indexOf(i)))})]}),t.length>0&&d.jsxs("div",{children:[d.jsx(dn,{children:r}),d.jsx(fn,{children:t.map(i=>d.jsx(Rr,{explanation:i},t.indexOf(i)))})]})]})}function ye(e){return mo(e)?(e.nodeName||"").toLowerCase():"#document"}function re(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function be(e){var t;return(t=(mo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mo(e){return e instanceof Node||e instanceof re(e).Node}function Y(e){return e instanceof Element||e instanceof re(e).Element}function ne(e){return e instanceof HTMLElement||e instanceof re(e).HTMLElement}function Ot(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof re(e).ShadowRoot}function He(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=le(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function Vr(e){return["table","td","th"].includes(ye(e))}function _t(e){const t=Ht(),n=le(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function yo(e){let t=Te(e);for(;ne(t)&&!Oe(t);){if(_t(t))return t;t=Te(t)}return null}function Ht(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Oe(e){return["html","body","#document"].includes(ye(e))}function le(e){return re(e).getComputedStyle(e)}function ht(e){return Y(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Te(e){if(ye(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ot(e)&&e.host||be(e);return Ot(t)?t.host:t}function go(e){const t=Te(e);return Oe(t)?e.ownerDocument?e.ownerDocument.body:e.body:ne(t)&&He(t)?t:go(t)}function xe(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=go(e),i=r===((o=e.ownerDocument)==null?void 0:o.body),l=re(r);return i?t.concat(l,l.visualViewport||[],He(r)?r:[],l.frameElement&&n?xe(l.frameElement):[]):t.concat(r,xe(r,[],n))}function Ie(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function ie(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Ot(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function bo(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function xo(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:o}=t;return n+"/"+o}).join(" "):navigator.userAgent}function Dr(e){return e.mozInputSource===0&&e.isTrusted?!0:jt()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Or(e){return kr()?!1:!jt()&&e.width===0&&e.height===0||jt()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function jr(){return/apple/i.test(navigator.vendor)}function jt(){const e=/android/i;return e.test(bo())||e.test(xo())}function kr(){return xo().includes("jsdom/")}function hn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Fr(e){return"nativeEvent"in e}function Nr(e){return e.matches("html,body")}function me(e){return(e==null?void 0:e.ownerDocument)||document}function bt(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Pe(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Lr="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Co(e){return ne(e)&&e.matches(Lr)}function xt(e){e.preventDefault(),e.stopPropagation()}function Mr(e){return e?e.getAttribute("role")==="combobox"&&Co(e):!1}const je=Math.min,Se=Math.max,nt=Math.round,Ye=Math.floor,Ce=e=>({x:e,y:e}),Br={left:"right",right:"left",bottom:"top",top:"bottom"},$r={start:"end",end:"start"};function kt(e,t,n){return Se(e,je(t,n))}function Ue(e,t){return typeof e=="function"?e(t):e}function Ae(e){return e.split("-")[0]}function Qe(e){return e.split("-")[1]}function vo(e){return e==="x"?"y":"x"}function Ut(e){return e==="y"?"height":"width"}function mt(e){return["top","bottom"].includes(Ae(e))?"y":"x"}function Qt(e){return vo(mt(e))}function zr(e,t,n){n===void 0&&(n=!1);const o=Qe(e),r=Qt(e),i=Ut(r);let l=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ot(l)),[l,ot(l)]}function Kr(e){const t=ot(e);return[Ft(e),t,Ft(t)]}function Ft(e){return e.replace(/start|end/g,t=>$r[t])}function Wr(e,t,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:o:t?o:r;case"left":case"right":return t?i:l;default:return[]}}function qr(e,t,n,o){const r=Qe(e);let i=Wr(Ae(e),n==="start",o);return r&&(i=i.map(l=>l+"-"+r),t&&(i=i.concat(i.map(Ft)))),i}function ot(e){return e.replace(/left|right|bottom|top/g,t=>Br[t])}function _r(e){return{top:0,right:0,bottom:0,left:0,...e}}function wo(e){return typeof e!="number"?_r(e):{top:e,right:e,bottom:e,left:e}}function it(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function mn(e,t,n){let{reference:o,floating:r}=e;const i=mt(t),l=Qt(t),a=Ut(l),s=Ae(t),c=i==="y",C=o.x+o.width/2-r.width/2,m=o.y+o.height/2-r.height/2,b=o[a]/2-r[a]/2;let u;switch(s){case"top":u={x:C,y:o.y-r.height};break;case"bottom":u={x:C,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:m};break;case"left":u={x:o.x-r.width,y:m};break;default:u={x:o.x,y:o.y}}switch(Qe(t)){case"start":u[l]-=b*(n&&c?-1:1);break;case"end":u[l]+=b*(n&&c?-1:1);break}return u}const Hr=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),s=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:C,y:m}=mn(c,o,s),b=o,u={},x=0;for(let w=0;w<a.length;w++){const{name:g,fn:y}=a[w],{x:v,y:V,data:S,reset:R}=await y({x:C,y:m,initialPlacement:o,placement:b,strategy:r,middlewareData:u,rects:c,platform:l,elements:{reference:e,floating:t}});C=v??C,m=V??m,u={...u,[g]:{...u[g],...S}},R&&x<=50&&(x++,typeof R=="object"&&(R.placement&&(b=R.placement),R.rects&&(c=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:C,y:m}=mn(c,b,s)),w=-1)}return{x:C,y:m,placement:b,strategy:r,middlewareData:u}};async function So(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:C="viewport",elementContext:m="floating",altBoundary:b=!1,padding:u=0}=Ue(t,e),x=wo(u),g=a[b?m==="floating"?"reference":"floating":m],y=it(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:C,strategy:s})),v=m==="floating"?{...l.floating,x:o,y:r}:l.reference,V=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(V))?await(i.getScale==null?void 0:i.getScale(V))||{x:1,y:1}:{x:1,y:1},R=it(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:V,strategy:s}):v);return{top:(y.top-R.top+x.top)/S.y,bottom:(R.bottom-y.bottom+x.bottom)/S.y,left:(y.left-R.left+x.left)/S.x,right:(R.right-y.right+x.right)/S.x}}const Ur=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:l,elements:a,middlewareData:s}=t,{element:c,padding:C=0}=Ue(e,t)||{};if(c==null)return{};const m=wo(C),b={x:n,y:o},u=Qt(r),x=Ut(u),w=await l.getDimensions(c),g=u==="y",y=g?"top":"left",v=g?"bottom":"right",V=g?"clientHeight":"clientWidth",S=i.reference[x]+i.reference[u]-b[u]-i.floating[x],R=b[u]-i.reference[u],I=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let D=I?I[V]:0;(!D||!await(l.isElement==null?void 0:l.isElement(I)))&&(D=a.floating[V]||i.floating[x]);const P=S/2-R/2,k=D/2-w[x]/2-1,E=je(m[y],k),N=je(m[v],k),B=E,K=D-w[x]-N,_=D/2-w[x]/2+P,F=kt(B,_,K),$=!s.arrow&&Qe(r)!=null&&_!==F&&i.reference[x]/2-(_<B?E:N)-w[x]/2<0,j=$?_<B?_-B:_-K:0;return{[u]:b[u]+j,data:{[u]:F,centerOffset:_-F-j,...$&&{alignmentOffset:j}},reset:$}}}),Qr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:a,platform:s,elements:c}=t,{mainAxis:C=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...g}=Ue(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Ae(r),v=Ae(a)===a,V=await(s.isRTL==null?void 0:s.isRTL(c.floating)),S=b||(v||!w?[ot(a)]:Kr(a));!b&&x!=="none"&&S.push(...qr(a,w,x,V));const R=[a,...S],I=await So(t,g),D=[];let P=((o=i.flip)==null?void 0:o.overflows)||[];if(C&&D.push(I[y]),m){const B=zr(r,l,V);D.push(I[B[0]],I[B[1]])}if(P=[...P,{placement:r,overflows:D}],!D.every(B=>B<=0)){var k,E;const B=(((k=i.flip)==null?void 0:k.index)||0)+1,K=R[B];if(K)return{data:{index:B,overflows:P},reset:{placement:K}};let _=(E=P.filter(F=>F.overflows[0]<=0).sort((F,$)=>F.overflows[1]-$.overflows[1])[0])==null?void 0:E.placement;if(!_)switch(u){case"bestFit":{var N;const F=(N=P.map($=>[$.placement,$.overflows.filter(j=>j>0).reduce((j,L)=>j+L,0)]).sort(($,j)=>$[1]-j[1])[0])==null?void 0:N[0];F&&(_=F);break}case"initialPlacement":_=a;break}if(r!==_)return{reset:{placement:_}}}return{}}}};async function Gr(e,t){const{placement:n,platform:o,elements:r}=e,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),l=Ae(n),a=Qe(n),s=mt(n)==="y",c=["left","top"].includes(l)?-1:1,C=i&&s?-1:1,m=Ue(t,e);let{mainAxis:b,crossAxis:u,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return a&&typeof x=="number"&&(u=a==="end"?x*-1:x),s?{x:u*C,y:b*c}:{x:b*c,y:u*C}}const Yr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:a}=t,s=await Gr(t,e);return l===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:l}}}}},Xr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:g=>{let{x:y,y:v}=g;return{x:y,y:v}}},...s}=Ue(e,t),c={x:n,y:o},C=await So(t,s),m=mt(Ae(r)),b=vo(m);let u=c[b],x=c[m];if(i){const g=b==="y"?"top":"left",y=b==="y"?"bottom":"right",v=u+C[g],V=u-C[y];u=kt(v,u,V)}if(l){const g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",v=x+C[g],V=x-C[y];x=kt(v,x,V)}const w=a.fn({...t,[b]:u,[m]:x});return{...w,data:{x:w.x-n,y:w.y-o}}}}};function To(e){const t=le(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=ne(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,a=nt(n)!==i||nt(o)!==l;return a&&(n=i,o=l),{width:n,height:o,$:a}}function Gt(e){return Y(e)?e:e.contextElement}function De(e){const t=Gt(e);if(!ne(t))return Ce(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=To(t);let l=(i?nt(n.width):n.width)/o,a=(i?nt(n.height):n.height)/r;return(!l||!Number.isFinite(l))&&(l=1),(!a||!Number.isFinite(a))&&(a=1),{x:l,y:a}}const Jr=Ce(0);function Ao(e){const t=re(e);return!Ht()||!t.visualViewport?Jr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==re(e)?!1:t}function Ee(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=Gt(e);let l=Ce(1);t&&(o?Y(o)&&(l=De(o)):l=De(e));const a=Zr(i,n,o)?Ao(i):Ce(0);let s=(r.left+a.x)/l.x,c=(r.top+a.y)/l.y,C=r.width/l.x,m=r.height/l.y;if(i){const b=re(i),u=o&&Y(o)?re(o):o;let x=b.frameElement;for(;x&&o&&u!==b;){const w=De(x),g=x.getBoundingClientRect(),y=le(x),v=g.left+(x.clientLeft+parseFloat(y.paddingLeft))*w.x,V=g.top+(x.clientTop+parseFloat(y.paddingTop))*w.y;s*=w.x,c*=w.y,C*=w.x,m*=w.y,s+=v,c+=V,x=re(x).frameElement}}return it({width:C,height:m,x:s,y:c})}const el=[":popover-open",":modal"];function Eo(e){let t=!1,n=0,o=0;function r(i){try{t=t||e.matches(i)}catch{}}if(el.forEach(i=>{r(i)}),t){const i=yo(e);if(i){const l=i.getBoundingClientRect();n=l.x,o=l.y}}return[t,n,o]}function tl(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i=be(o),[l]=t?Eo(t.floating):[!1];if(o===i||l)return n;let a={scrollLeft:0,scrollTop:0},s=Ce(1);const c=Ce(0),C=ne(o);if((C||!C&&r!=="fixed")&&((ye(o)!=="body"||He(i))&&(a=ht(o)),ne(o))){const m=Ee(o);s=De(o),c.x=m.x+o.clientLeft,c.y=m.y+o.clientTop}return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-a.scrollLeft*s.x+c.x,y:n.y*s.y-a.scrollTop*s.y+c.y}}function nl(e){return Array.from(e.getClientRects())}function Ro(e){return Ee(be(e)).left+ht(e).scrollLeft}function ol(e){const t=be(e),n=ht(e),o=e.ownerDocument.body,r=Se(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=Se(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+Ro(e);const a=-n.scrollTop;return le(o).direction==="rtl"&&(l+=Se(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:a}}function il(e,t){const n=re(e),o=be(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,a=0,s=0;if(r){i=r.width,l=r.height;const c=Ht();(!c||c&&t==="fixed")&&(a=r.offsetLeft,s=r.offsetTop)}return{width:i,height:l,x:a,y:s}}function rl(e,t){const n=Ee(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=ne(e)?De(e):Ce(1),l=e.clientWidth*i.x,a=e.clientHeight*i.y,s=r*i.x,c=o*i.y;return{width:l,height:a,x:s,y:c}}function yn(e,t,n){let o;if(t==="viewport")o=il(e,n);else if(t==="document")o=ol(be(e));else if(Y(t))o=rl(t,n);else{const r=Ao(e);o={...t,x:t.x-r.x,y:t.y-r.y}}return it(o)}function Io(e,t){const n=Te(e);return n===t||!Y(n)||Oe(n)?!1:le(n).position==="fixed"||Io(n,t)}function ll(e,t){const n=t.get(e);if(n)return n;let o=xe(e,[],!1).filter(a=>Y(a)&&ye(a)!=="body"),r=null;const i=le(e).position==="fixed";let l=i?Te(e):e;for(;Y(l)&&!Oe(l);){const a=le(l),s=_t(l);!s&&a.position==="fixed"&&(r=null),(i?!s&&!r:!s&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||He(l)&&!s&&Io(e,l))?o=o.filter(C=>C!==l):r=a,l=Te(l)}return t.set(e,o),o}function al(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const l=[...n==="clippingAncestors"?ll(t,this._c):[].concat(n),o],a=l[0],s=l.reduce((c,C)=>{const m=yn(t,C,r);return c.top=Se(m.top,c.top),c.right=je(m.right,c.right),c.bottom=je(m.bottom,c.bottom),c.left=Se(m.left,c.left),c},yn(t,a,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function sl(e){const{width:t,height:n}=To(e);return{width:t,height:n}}function cl(e,t,n,o){const r=ne(t),i=be(t),l=n==="fixed",a=Ee(e,!0,l,t);let s={scrollLeft:0,scrollTop:0};const c=Ce(0);if(r||!r&&!l)if((ye(t)!=="body"||He(i))&&(s=ht(t)),r){const w=Ee(t,!0,l,t);c.x=w.x+t.clientLeft,c.y=w.y+t.clientTop}else i&&(c.x=Ro(i));let C=a.left+s.scrollLeft-c.x,m=a.top+s.scrollTop-c.y;const[b,u,x]=Eo(o);return b&&(C+=u,m+=x,r&&(C+=t.clientLeft,m+=t.clientTop)),{x:C,y:m,width:a.width,height:a.height}}function gn(e,t){return!ne(e)||le(e).position==="fixed"?null:t?t(e):e.offsetParent}function Po(e,t){const n=re(e);if(!ne(e))return n;let o=gn(e,t);for(;o&&Vr(o)&&le(o).position==="static";)o=gn(o,t);return o&&(ye(o)==="html"||ye(o)==="body"&&le(o).position==="static"&&!_t(o))?n:o||yo(e)||n}const ul=async function(e){const t=this.getOffsetParent||Po,n=this.getDimensions;return{reference:cl(e.reference,await t(e.floating),e.strategy,e.floating),floating:{x:0,y:0,...await n(e.floating)}}};function dl(e){return le(e).direction==="rtl"}const Vo={convertOffsetParentRelativeRectToViewportRelativeRect:tl,getDocumentElement:be,getClippingRect:al,getOffsetParent:Po,getElementRects:ul,getClientRects:nl,getDimensions:sl,getScale:De,isElement:Y,isRTL:dl};function fl(e,t){let n=null,o;const r=be(e);function i(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function l(a,s){a===void 0&&(a=!1),s===void 0&&(s=1),i();const{left:c,top:C,width:m,height:b}=e.getBoundingClientRect();if(a||t(),!m||!b)return;const u=Ye(C),x=Ye(r.clientWidth-(c+m)),w=Ye(r.clientHeight-(C+b)),g=Ye(c),v={rootMargin:-u+"px "+-x+"px "+-w+"px "+-g+"px",threshold:Se(0,je(1,s))||1};let V=!0;function S(R){const I=R[0].intersectionRatio;if(I!==s){if(!V)return l();I?l(!1,I):o=setTimeout(()=>{l(!1,1e-7)},100)}V=!1}try{n=new IntersectionObserver(S,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(S,v)}n.observe(e)}return l(!0),i}function pl(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:s=!1}=o,c=Gt(e),C=r||i?[...c?xe(c):[],...xe(t)]:[];C.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const m=c&&a?fl(c,n):null;let b=-1,u=null;l&&(u=new ResizeObserver(y=>{let[v]=y;v&&v.target===c&&u&&(u.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var V;(V=u)==null||V.observe(t)})),n()}),c&&!s&&u.observe(c),u.observe(t));let x,w=s?Ee(e):null;s&&g();function g(){const y=Ee(e);w&&(y.x!==w.x||y.y!==w.y||y.width!==w.width||y.height!==w.height)&&n(),w=y,x=requestAnimationFrame(g)}return n(),()=>{var y;C.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),m==null||m(),(y=u)==null||y.disconnect(),u=null,s&&cancelAnimationFrame(x)}}const hl=Xr,ml=Qr,bn=Ur,yl=(e,t,n)=>{const o=new Map,r={platform:Vo,...n},i={...r.platform,_c:o};return Hr(e,t,{...r,platform:i})},gl=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?bn({element:o.current,padding:r}).fn(n):{}:o?bn({element:o,padding:r}).fn(n):{}}}};var Ze=typeof document<"u"?T.useLayoutEffect:T.useEffect;function rt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!rt(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&e.$$typeof)&&!rt(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Do(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xn(e,t){const n=Do(e);return Math.round(t*n)/n}function Cn(e){const t=A.useRef(e);return Ze(()=>{t.current=e}),t}function bl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:l}={},transform:a=!0,whileElementsMounted:s,open:c}=e,[C,m]=A.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,u]=A.useState(o);rt(b,o)||u(o);const[x,w]=A.useState(null),[g,y]=A.useState(null),v=A.useCallback(j=>{j!==I.current&&(I.current=j,w(j))},[]),V=A.useCallback(j=>{j!==D.current&&(D.current=j,y(j))},[]),S=i||x,R=l||g,I=A.useRef(null),D=A.useRef(null),P=A.useRef(C),k=s!=null,E=Cn(s),N=Cn(r),B=A.useCallback(()=>{if(!I.current||!D.current)return;const j={placement:t,strategy:n,middleware:b};N.current&&(j.platform=N.current),yl(I.current,D.current,j).then(L=>{const te={...L,isPositioned:!0};K.current&&!rt(P.current,te)&&(P.current=te,Gi.flushSync(()=>{m(te)}))})},[b,t,n,N]);Ze(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(j=>({...j,isPositioned:!1})))},[c]);const K=A.useRef(!1);Ze(()=>(K.current=!0,()=>{K.current=!1}),[]),Ze(()=>{if(S&&(I.current=S),R&&(D.current=R),S&&R){if(E.current)return E.current(S,R,B);B()}},[S,R,B,E,k]);const _=A.useMemo(()=>({reference:I,floating:D,setReference:v,setFloating:V}),[v,V]),F=A.useMemo(()=>({reference:S,floating:R}),[S,R]),$=A.useMemo(()=>{const j={position:n,left:0,top:0};if(!F.floating)return j;const L=xn(F.floating,C.x),te=xn(F.floating,C.y);return a?{...j,transform:"translate("+L+"px, "+te+"px)",...Do(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:te}},[n,a,F.floating,C.x,C.y]);return A.useMemo(()=>({...C,update:B,refs:_,elements:F,floatingStyles:$}),[C,B,_,F,$])}/*!
192
+ `;function Vr(){const{decisionExplanations:e,constraintExplanations:t,hasError:n}=ge(),{decisionExplanationSolutionsTitle:o,constraintExplanationSolutionsTitle:r}=co();return n?d.jsx(pn,{variant:"failedToExplain"}):e.length===0&&t.length===0?d.jsx(pn,{variant:"noExplanationFound"}):d.jsxs(Pr,{children:[e.length>0&&d.jsxs("div",{children:[d.jsx(dn,{children:o}),d.jsx(fn,{children:e.map(i=>d.jsx(Er,{explanation:i},e.indexOf(i)))})]}),t.length>0&&d.jsxs("div",{children:[d.jsx(dn,{children:r}),d.jsx(fn,{children:t.map(i=>d.jsx(Ir,{explanation:i},t.indexOf(i)))})]})]})}function ye(e){return mo(e)?(e.nodeName||"").toLowerCase():"#document"}function re(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function be(e){var t;return(t=(mo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mo(e){return e instanceof Node||e instanceof re(e).Node}function X(e){return e instanceof Element||e instanceof re(e).Element}function ne(e){return e instanceof HTMLElement||e instanceof re(e).HTMLElement}function Ot(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof re(e).ShadowRoot}function He(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=le(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function Dr(e){return["table","td","th"].includes(ye(e))}function _t(e){const t=Ht(),n=le(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function yo(e){let t=Te(e);for(;ne(t)&&!Oe(t);){if(_t(t))return t;t=Te(t)}return null}function Ht(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Oe(e){return["html","body","#document"].includes(ye(e))}function le(e){return re(e).getComputedStyle(e)}function ht(e){return X(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Te(e){if(ye(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ot(e)&&e.host||be(e);return Ot(t)?t.host:t}function go(e){const t=Te(e);return Oe(t)?e.ownerDocument?e.ownerDocument.body:e.body:ne(t)&&He(t)?t:go(t)}function xe(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=go(e),i=r===((o=e.ownerDocument)==null?void 0:o.body),l=re(r);return i?t.concat(l,l.visualViewport||[],He(r)?r:[],l.frameElement&&n?xe(l.frameElement):[]):t.concat(r,xe(r,[],n))}function Ie(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function ie(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Ot(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function bo(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function xo(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:o}=t;return n+"/"+o}).join(" "):navigator.userAgent}function Or(e){return e.mozInputSource===0&&e.isTrusted?!0:jt()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function jr(e){return Fr()?!1:!jt()&&e.width===0&&e.height===0||jt()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function kr(){return/apple/i.test(navigator.vendor)}function jt(){const e=/android/i;return e.test(bo())||e.test(xo())}function Fr(){return xo().includes("jsdom/")}function hn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Nr(e){return"nativeEvent"in e}function Lr(e){return e.matches("html,body")}function me(e){return(e==null?void 0:e.ownerDocument)||document}function bt(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Pe(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Mr="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Co(e){return ne(e)&&e.matches(Mr)}function xt(e){e.preventDefault(),e.stopPropagation()}function Br(e){return e?e.getAttribute("role")==="combobox"&&Co(e):!1}const je=Math.min,Se=Math.max,nt=Math.round,Ye=Math.floor,Ce=e=>({x:e,y:e}),$r={left:"right",right:"left",bottom:"top",top:"bottom"},zr={start:"end",end:"start"};function kt(e,t,n){return Se(e,je(t,n))}function Ue(e,t){return typeof e=="function"?e(t):e}function Ee(e){return e.split("-")[0]}function Qe(e){return e.split("-")[1]}function vo(e){return e==="x"?"y":"x"}function Ut(e){return e==="y"?"height":"width"}function mt(e){return["top","bottom"].includes(Ee(e))?"y":"x"}function Qt(e){return vo(mt(e))}function Kr(e,t,n){n===void 0&&(n=!1);const o=Qe(e),r=Qt(e),i=Ut(r);let l=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ot(l)),[l,ot(l)]}function Wr(e){const t=ot(e);return[Ft(e),t,Ft(t)]}function Ft(e){return e.replace(/start|end/g,t=>zr[t])}function qr(e,t,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:o:t?o:r;case"left":case"right":return t?i:l;default:return[]}}function _r(e,t,n,o){const r=Qe(e);let i=qr(Ee(e),n==="start",o);return r&&(i=i.map(l=>l+"-"+r),t&&(i=i.concat(i.map(Ft)))),i}function ot(e){return e.replace(/left|right|bottom|top/g,t=>$r[t])}function Hr(e){return{top:0,right:0,bottom:0,left:0,...e}}function wo(e){return typeof e!="number"?Hr(e):{top:e,right:e,bottom:e,left:e}}function it(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function mn(e,t,n){let{reference:o,floating:r}=e;const i=mt(t),l=Qt(t),a=Ut(l),s=Ee(t),c=i==="y",C=o.x+o.width/2-r.width/2,m=o.y+o.height/2-r.height/2,b=o[a]/2-r[a]/2;let u;switch(s){case"top":u={x:C,y:o.y-r.height};break;case"bottom":u={x:C,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:m};break;case"left":u={x:o.x-r.width,y:m};break;default:u={x:o.x,y:o.y}}switch(Qe(t)){case"start":u[l]-=b*(n&&c?-1:1);break;case"end":u[l]+=b*(n&&c?-1:1);break}return u}const Ur=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),s=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:C,y:m}=mn(c,o,s),b=o,u={},x=0;for(let w=0;w<a.length;w++){const{name:g,fn:y}=a[w],{x:v,y:V,data:T,reset:R}=await y({x:C,y:m,initialPlacement:o,placement:b,strategy:r,middlewareData:u,rects:c,platform:l,elements:{reference:e,floating:t}});C=v??C,m=V??m,u={...u,[g]:{...u[g],...T}},R&&x<=50&&(x++,typeof R=="object"&&(R.placement&&(b=R.placement),R.rects&&(c=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:C,y:m}=mn(c,b,s)),w=-1)}return{x:C,y:m,placement:b,strategy:r,middlewareData:u}};async function So(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:C="viewport",elementContext:m="floating",altBoundary:b=!1,padding:u=0}=Ue(t,e),x=wo(u),g=a[b?m==="floating"?"reference":"floating":m],y=it(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:C,strategy:s})),v=m==="floating"?{...l.floating,x:o,y:r}:l.reference,V=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),T=await(i.isElement==null?void 0:i.isElement(V))?await(i.getScale==null?void 0:i.getScale(V))||{x:1,y:1}:{x:1,y:1},R=it(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:V,strategy:s}):v);return{top:(y.top-R.top+x.top)/T.y,bottom:(R.bottom-y.bottom+x.bottom)/T.y,left:(y.left-R.left+x.left)/T.x,right:(R.right-y.right+x.right)/T.x}}const Qr=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:l,elements:a,middlewareData:s}=t,{element:c,padding:C=0}=Ue(e,t)||{};if(c==null)return{};const m=wo(C),b={x:n,y:o},u=Qt(r),x=Ut(u),w=await l.getDimensions(c),g=u==="y",y=g?"top":"left",v=g?"bottom":"right",V=g?"clientHeight":"clientWidth",T=i.reference[x]+i.reference[u]-b[u]-i.floating[x],R=b[u]-i.reference[u],I=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let D=I?I[V]:0;(!D||!await(l.isElement==null?void 0:l.isElement(I)))&&(D=a.floating[V]||i.floating[x]);const P=T/2-R/2,k=D/2-w[x]/2-1,A=je(m[y],k),N=je(m[v],k),B=A,K=D-w[x]-N,_=D/2-w[x]/2+P,F=kt(B,_,K),$=!s.arrow&&Qe(r)!=null&&_!==F&&i.reference[x]/2-(_<B?A:N)-w[x]/2<0,j=$?_<B?_-B:_-K:0;return{[u]:b[u]+j,data:{[u]:F,centerOffset:_-F-j,...$&&{alignmentOffset:j}},reset:$}}}),Gr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:a,platform:s,elements:c}=t,{mainAxis:C=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...g}=Ue(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Ee(r),v=Ee(a)===a,V=await(s.isRTL==null?void 0:s.isRTL(c.floating)),T=b||(v||!w?[ot(a)]:Wr(a));!b&&x!=="none"&&T.push(..._r(a,w,x,V));const R=[a,...T],I=await So(t,g),D=[];let P=((o=i.flip)==null?void 0:o.overflows)||[];if(C&&D.push(I[y]),m){const B=Kr(r,l,V);D.push(I[B[0]],I[B[1]])}if(P=[...P,{placement:r,overflows:D}],!D.every(B=>B<=0)){var k,A;const B=(((k=i.flip)==null?void 0:k.index)||0)+1,K=R[B];if(K)return{data:{index:B,overflows:P},reset:{placement:K}};let _=(A=P.filter(F=>F.overflows[0]<=0).sort((F,$)=>F.overflows[1]-$.overflows[1])[0])==null?void 0:A.placement;if(!_)switch(u){case"bestFit":{var N;const F=(N=P.map($=>[$.placement,$.overflows.filter(j=>j>0).reduce((j,L)=>j+L,0)]).sort(($,j)=>$[1]-j[1])[0])==null?void 0:N[0];F&&(_=F);break}case"initialPlacement":_=a;break}if(r!==_)return{reset:{placement:_}}}return{}}}};async function Yr(e,t){const{placement:n,platform:o,elements:r}=e,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),l=Ee(n),a=Qe(n),s=mt(n)==="y",c=["left","top"].includes(l)?-1:1,C=i&&s?-1:1,m=Ue(t,e);let{mainAxis:b,crossAxis:u,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return a&&typeof x=="number"&&(u=a==="end"?x*-1:x),s?{x:u*C,y:b*c}:{x:b*c,y:u*C}}const Xr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:a}=t,s=await Yr(t,e);return l===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:l}}}}},Jr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:g=>{let{x:y,y:v}=g;return{x:y,y:v}}},...s}=Ue(e,t),c={x:n,y:o},C=await So(t,s),m=mt(Ee(r)),b=vo(m);let u=c[b],x=c[m];if(i){const g=b==="y"?"top":"left",y=b==="y"?"bottom":"right",v=u+C[g],V=u-C[y];u=kt(v,u,V)}if(l){const g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",v=x+C[g],V=x-C[y];x=kt(v,x,V)}const w=a.fn({...t,[b]:u,[m]:x});return{...w,data:{x:w.x-n,y:w.y-o}}}}};function To(e){const t=le(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=ne(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,a=nt(n)!==i||nt(o)!==l;return a&&(n=i,o=l),{width:n,height:o,$:a}}function Gt(e){return X(e)?e:e.contextElement}function De(e){const t=Gt(e);if(!ne(t))return Ce(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=To(t);let l=(i?nt(n.width):n.width)/o,a=(i?nt(n.height):n.height)/r;return(!l||!Number.isFinite(l))&&(l=1),(!a||!Number.isFinite(a))&&(a=1),{x:l,y:a}}const Zr=Ce(0);function Eo(e){const t=re(e);return!Ht()||!t.visualViewport?Zr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function el(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==re(e)?!1:t}function Ae(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=Gt(e);let l=Ce(1);t&&(o?X(o)&&(l=De(o)):l=De(e));const a=el(i,n,o)?Eo(i):Ce(0);let s=(r.left+a.x)/l.x,c=(r.top+a.y)/l.y,C=r.width/l.x,m=r.height/l.y;if(i){const b=re(i),u=o&&X(o)?re(o):o;let x=b.frameElement;for(;x&&o&&u!==b;){const w=De(x),g=x.getBoundingClientRect(),y=le(x),v=g.left+(x.clientLeft+parseFloat(y.paddingLeft))*w.x,V=g.top+(x.clientTop+parseFloat(y.paddingTop))*w.y;s*=w.x,c*=w.y,C*=w.x,m*=w.y,s+=v,c+=V,x=re(x).frameElement}}return it({width:C,height:m,x:s,y:c})}const tl=[":popover-open",":modal"];function Ao(e){let t=!1,n=0,o=0;function r(i){try{t=t||e.matches(i)}catch{}}if(tl.forEach(i=>{r(i)}),t){const i=yo(e);if(i){const l=i.getBoundingClientRect();n=l.x,o=l.y}}return[t,n,o]}function nl(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i=be(o),[l]=t?Ao(t.floating):[!1];if(o===i||l)return n;let a={scrollLeft:0,scrollTop:0},s=Ce(1);const c=Ce(0),C=ne(o);if((C||!C&&r!=="fixed")&&((ye(o)!=="body"||He(i))&&(a=ht(o)),ne(o))){const m=Ae(o);s=De(o),c.x=m.x+o.clientLeft,c.y=m.y+o.clientTop}return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-a.scrollLeft*s.x+c.x,y:n.y*s.y-a.scrollTop*s.y+c.y}}function ol(e){return Array.from(e.getClientRects())}function Ro(e){return Ae(be(e)).left+ht(e).scrollLeft}function il(e){const t=be(e),n=ht(e),o=e.ownerDocument.body,r=Se(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=Se(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+Ro(e);const a=-n.scrollTop;return le(o).direction==="rtl"&&(l+=Se(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:a}}function rl(e,t){const n=re(e),o=be(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,a=0,s=0;if(r){i=r.width,l=r.height;const c=Ht();(!c||c&&t==="fixed")&&(a=r.offsetLeft,s=r.offsetTop)}return{width:i,height:l,x:a,y:s}}function ll(e,t){const n=Ae(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=ne(e)?De(e):Ce(1),l=e.clientWidth*i.x,a=e.clientHeight*i.y,s=r*i.x,c=o*i.y;return{width:l,height:a,x:s,y:c}}function yn(e,t,n){let o;if(t==="viewport")o=rl(e,n);else if(t==="document")o=il(be(e));else if(X(t))o=ll(t,n);else{const r=Eo(e);o={...t,x:t.x-r.x,y:t.y-r.y}}return it(o)}function Io(e,t){const n=Te(e);return n===t||!X(n)||Oe(n)?!1:le(n).position==="fixed"||Io(n,t)}function al(e,t){const n=t.get(e);if(n)return n;let o=xe(e,[],!1).filter(a=>X(a)&&ye(a)!=="body"),r=null;const i=le(e).position==="fixed";let l=i?Te(e):e;for(;X(l)&&!Oe(l);){const a=le(l),s=_t(l);!s&&a.position==="fixed"&&(r=null),(i?!s&&!r:!s&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||He(l)&&!s&&Io(e,l))?o=o.filter(C=>C!==l):r=a,l=Te(l)}return t.set(e,o),o}function sl(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const l=[...n==="clippingAncestors"?al(t,this._c):[].concat(n),o],a=l[0],s=l.reduce((c,C)=>{const m=yn(t,C,r);return c.top=Se(m.top,c.top),c.right=je(m.right,c.right),c.bottom=je(m.bottom,c.bottom),c.left=Se(m.left,c.left),c},yn(t,a,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function cl(e){const{width:t,height:n}=To(e);return{width:t,height:n}}function ul(e,t,n,o){const r=ne(t),i=be(t),l=n==="fixed",a=Ae(e,!0,l,t);let s={scrollLeft:0,scrollTop:0};const c=Ce(0);if(r||!r&&!l)if((ye(t)!=="body"||He(i))&&(s=ht(t)),r){const w=Ae(t,!0,l,t);c.x=w.x+t.clientLeft,c.y=w.y+t.clientTop}else i&&(c.x=Ro(i));let C=a.left+s.scrollLeft-c.x,m=a.top+s.scrollTop-c.y;const[b,u,x]=Ao(o);return b&&(C+=u,m+=x,r&&(C+=t.clientLeft,m+=t.clientTop)),{x:C,y:m,width:a.width,height:a.height}}function gn(e,t){return!ne(e)||le(e).position==="fixed"?null:t?t(e):e.offsetParent}function Po(e,t){const n=re(e);if(!ne(e))return n;let o=gn(e,t);for(;o&&Dr(o)&&le(o).position==="static";)o=gn(o,t);return o&&(ye(o)==="html"||ye(o)==="body"&&le(o).position==="static"&&!_t(o))?n:o||yo(e)||n}const dl=async function(e){const t=this.getOffsetParent||Po,n=this.getDimensions;return{reference:ul(e.reference,await t(e.floating),e.strategy,e.floating),floating:{x:0,y:0,...await n(e.floating)}}};function fl(e){return le(e).direction==="rtl"}const Vo={convertOffsetParentRelativeRectToViewportRelativeRect:nl,getDocumentElement:be,getClippingRect:sl,getOffsetParent:Po,getElementRects:dl,getClientRects:ol,getDimensions:cl,getScale:De,isElement:X,isRTL:fl};function pl(e,t){let n=null,o;const r=be(e);function i(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function l(a,s){a===void 0&&(a=!1),s===void 0&&(s=1),i();const{left:c,top:C,width:m,height:b}=e.getBoundingClientRect();if(a||t(),!m||!b)return;const u=Ye(C),x=Ye(r.clientWidth-(c+m)),w=Ye(r.clientHeight-(C+b)),g=Ye(c),v={rootMargin:-u+"px "+-x+"px "+-w+"px "+-g+"px",threshold:Se(0,je(1,s))||1};let V=!0;function T(R){const I=R[0].intersectionRatio;if(I!==s){if(!V)return l();I?l(!1,I):o=setTimeout(()=>{l(!1,1e-7)},100)}V=!1}try{n=new IntersectionObserver(T,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(T,v)}n.observe(e)}return l(!0),i}function hl(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:s=!1}=o,c=Gt(e),C=r||i?[...c?xe(c):[],...xe(t)]:[];C.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const m=c&&a?pl(c,n):null;let b=-1,u=null;l&&(u=new ResizeObserver(y=>{let[v]=y;v&&v.target===c&&u&&(u.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var V;(V=u)==null||V.observe(t)})),n()}),c&&!s&&u.observe(c),u.observe(t));let x,w=s?Ae(e):null;s&&g();function g(){const y=Ae(e);w&&(y.x!==w.x||y.y!==w.y||y.width!==w.width||y.height!==w.height)&&n(),w=y,x=requestAnimationFrame(g)}return n(),()=>{var y;C.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),m==null||m(),(y=u)==null||y.disconnect(),u=null,s&&cancelAnimationFrame(x)}}const ml=Jr,yl=Gr,bn=Qr,gl=(e,t,n)=>{const o=new Map,r={platform:Vo,...n},i={...r.platform,_c:o};return Ur(e,t,{...r,platform:i})},bl=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?bn({element:o.current,padding:r}).fn(n):{}:o?bn({element:o,padding:r}).fn(n):{}}}};var Ze=typeof document<"u"?S.useLayoutEffect:S.useEffect;function rt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!rt(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&e.$$typeof)&&!rt(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Do(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xn(e,t){const n=Do(e);return Math.round(t*n)/n}function Cn(e){const t=E.useRef(e);return Ze(()=>{t.current=e}),t}function xl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:l}={},transform:a=!0,whileElementsMounted:s,open:c}=e,[C,m]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,u]=E.useState(o);rt(b,o)||u(o);const[x,w]=E.useState(null),[g,y]=E.useState(null),v=E.useCallback(j=>{j!==I.current&&(I.current=j,w(j))},[]),V=E.useCallback(j=>{j!==D.current&&(D.current=j,y(j))},[]),T=i||x,R=l||g,I=E.useRef(null),D=E.useRef(null),P=E.useRef(C),k=s!=null,A=Cn(s),N=Cn(r),B=E.useCallback(()=>{if(!I.current||!D.current)return;const j={placement:t,strategy:n,middleware:b};N.current&&(j.platform=N.current),gl(I.current,D.current,j).then(L=>{const te={...L,isPositioned:!0};K.current&&!rt(P.current,te)&&(P.current=te,Yi.flushSync(()=>{m(te)}))})},[b,t,n,N]);Ze(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(j=>({...j,isPositioned:!1})))},[c]);const K=E.useRef(!1);Ze(()=>(K.current=!0,()=>{K.current=!1}),[]),Ze(()=>{if(T&&(I.current=T),R&&(D.current=R),T&&R){if(A.current)return A.current(T,R,B);B()}},[T,R,B,A,k]);const _=E.useMemo(()=>({reference:I,floating:D,setReference:v,setFloating:V}),[v,V]),F=E.useMemo(()=>({reference:T,floating:R}),[T,R]),$=E.useMemo(()=>{const j={position:n,left:0,top:0};if(!F.floating)return j;const L=xn(F.floating,C.x),te=xn(F.floating,C.y);return a?{...j,transform:"translate("+L+"px, "+te+"px)",...Do(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:te}},[n,a,F.floating,C.x,C.y]);return E.useMemo(()=>({...C,update:B,refs:_,elements:F,floatingStyles:$}),[C,B,_,F,$])}/*!
193
193
  * tabbable 6.2.0
194
194
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
195
- */var xl=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Nt=xl.join(","),Oo=typeof Element>"u",We=Oo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,lt=!Oo&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},at=function e(t,n){var o;n===void 0&&(n=!0);var r=t==null||(o=t.getAttribute)===null||o===void 0?void 0:o.call(t,"inert"),i=r===""||r==="true",l=i||n&&t&&e(t.parentNode);return l},Cl=function(t){var n,o=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return o===""||o==="true"},vl=function(t,n,o){if(at(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(Nt));return n&&We.call(t,Nt)&&r.unshift(t),r=r.filter(o),r},wl=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var l=i.shift();if(!at(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),s=a.length?a:l.children,c=e(s,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:l,candidates:c})}else{var C=We.call(l,Nt);C&&o.filter(l)&&(n||!t.includes(l))&&r.push(l);var m=l.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(l),b=!at(m,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(l));if(m&&b){var u=e(m===!0?l.children:m.children,!0,o);o.flatten?r.push.apply(r,u):r.push({scopeParent:l,candidates:u})}else i.unshift.apply(i,l.children)}}return r},jo=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ko=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Cl(t))&&!jo(t)?0:t.tabIndex},Sl=function(t,n){var o=ko(t);return o<0&&n&&!jo(t)?0:o},Tl=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Fo=function(t){return t.tagName==="INPUT"},Al=function(t){return Fo(t)&&t.type==="hidden"},El=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(o){return o.tagName==="SUMMARY"});return n},Rl=function(t,n){for(var o=0;o<t.length;o++)if(t[o].checked&&t[o].form===n)return t[o]},Il=function(t){if(!t.name)return!0;var n=t.form||lt(t),o=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(t.name));else try{r=o(t.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var i=Rl(r,t.form);return!i||i===t},Pl=function(t){return Fo(t)&&t.type==="radio"},Vl=function(t){return Pl(t)&&!Il(t)},Dl=function(t){var n,o=t&&lt(t),r=(n=o)===null||n===void 0?void 0:n.host,i=!1;if(o&&o!==t){var l,a,s;for(i=!!((l=r)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(r)||t!=null&&(s=t.ownerDocument)!==null&&s!==void 0&&s.contains(t));!i&&r;){var c,C,m;o=lt(r),r=(c=o)===null||c===void 0?void 0:c.host,i=!!((C=r)!==null&&C!==void 0&&(m=C.ownerDocument)!==null&&m!==void 0&&m.contains(r))}}return i},vn=function(t){var n=t.getBoundingClientRect(),o=n.width,r=n.height;return o===0&&r===0},Ol=function(t,n){var o=n.displayCheck,r=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=We.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(We.call(l,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="legacy-full"){if(typeof r=="function"){for(var a=t;t;){var s=t.parentElement,c=lt(t);if(s&&!s.shadowRoot&&r(s)===!0)return vn(t);t.assignedSlot?t=t.assignedSlot:!s&&c!==t.ownerDocument?t=c.host:t=s}t=a}if(Dl(t))return!t.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return vn(t);return!1},jl=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var o=0;o<n.children.length;o++){var r=n.children.item(o);if(r.tagName==="LEGEND")return We.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}return!1},kl=function(t,n){return!(n.disabled||at(n)||Al(n)||Ol(n,t)||El(n)||jl(n))},wn=function(t,n){return!(Vl(n)||ko(n)<0||!kl(t,n))},Fl=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Nl=function e(t){var n=[],o=[];return t.forEach(function(r,i){var l=!!r.scopeParent,a=l?r.scopeParent:r,s=Sl(a,l),c=l?e(r.candidates):a;s===0?l?n.push.apply(n,c):n.push(a):o.push({documentOrder:i,tabIndex:s,item:r,isScope:l,content:c})}),o.sort(Tl).reduce(function(r,i){return i.isScope?r.push.apply(r,i.content):r.push(i.content),r},[]).concat(n)},Yt=function(t,n){n=n||{};var o;return n.getShadowRoot?o=wl([t],n.includeContainer,{filter:wn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Fl}):o=vl(t,n.includeContainer,wn.bind(null,n)),Nl(o)};function Xt(e){return A.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})},e)}const Ll=A["useInsertionEffect".toString()],Ml=Ll||(e=>e());function Ve(e){const t=A.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Ml(()=>{t.current=e}),A.useCallback(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}let Sn=0;function ve(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Sn);const i=()=>e==null?void 0:e.focus({preventScroll:n});r?i():Sn=requestAnimationFrame(i)}var ae=typeof document<"u"?T.useLayoutEffect:T.useEffect;function ke(){return ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ke.apply(this,arguments)}let Ct=!1,Bl=0;const Tn=()=>"floating-ui-"+Bl++;function $l(){const[e,t]=A.useState(()=>Ct?Tn():void 0);return ae(()=>{e==null&&t(Tn())},[]),A.useEffect(()=>{Ct||(Ct=!0)},[]),e}const zl=A["useId".toString()],yt=zl||$l,Kl=A.forwardRef(function(t,n){let{context:{placement:o,elements:{floating:r},middlewareData:{arrow:i}},width:l=14,height:a=7,tipRadius:s=0,strokeWidth:c=0,staticOffset:C,stroke:m,d:b,style:{transform:u,...x}={},...w}=t;process.env.NODE_ENV!=="production"&&(n||console.warn("Floating UI: The `ref` prop is required for the `FloatingArrow`","component."));const g=yt();if(!r)return null;c*=2;const y=c/2,v=l/2*(s/-8+1),V=a/2*s/4,[S,R]=o.split("-"),I=Vo.isRTL(r),D=!!b,P=S==="top"||S==="bottom",k=C&&R==="end"?"bottom":"top";let E=C&&R==="end"?"right":"left";C&&I&&(E=R==="end"?"left":"right");const N=(i==null?void 0:i.x)!=null?C||i.x:"",B=(i==null?void 0:i.y)!=null?C||i.y:"",K=b||"M0,0"+(" H"+l)+(" L"+(l-v)+","+(a-V))+(" Q"+l/2+","+a+" "+v+","+(a-V))+" Z",_={top:D?"rotate(180deg)":"",left:D?"rotate(90deg)":"rotate(-90deg)",bottom:D?"":"rotate(180deg)",right:D?"rotate(-90deg)":"rotate(90deg)"}[S];return A.createElement("svg",ke({},w,{"aria-hidden":!0,ref:n,width:D?l:l+c,height:l,viewBox:"0 0 "+l+" "+(a>l?a:l),style:{position:"absolute",pointerEvents:"none",[E]:N,[k]:B,[S]:P||D?"100%":"calc(100% - "+c/2+"px)",transform:""+_+(u??""),...x}}),c>0&&A.createElement("path",{clipPath:"url(#"+g+")",fill:"none",stroke:m,strokeWidth:c+(b?0:1),d:K}),A.createElement("path",{stroke:c&&!b?w.fill:"none",d:K}),A.createElement("clipPath",{id:g},A.createElement("rect",{x:-y,y:y*(D?-1:1),width:l+c,height:l})))});function Wl(){const e=new Map;return{emit(t,n){var o;(o=e.get(t))==null||o.forEach(r=>r(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,((o=e.get(t))==null?void 0:o.filter(r=>r!==n))||[])}}}const ql=A.createContext(null),_l=A.createContext(null),Hl=()=>{var e;return((e=A.useContext(ql))==null?void 0:e.id)||null},Jt=()=>A.useContext(_l);function qe(e){return"data-floating-ui-"+e}function vt(e){const t=T.useRef(e);return ae(()=>{t.current=e}),t}function Ul(e,t){var n;let o=[],r=(n=e.find(i=>i.id===t))==null?void 0:n.parentId;for(;r;){const i=e.find(l=>l.id===r);r=i==null?void 0:i.parentId,i&&(o=o.concat(i))}return o}function $e(e,t){let n=e.filter(r=>{var i;return r.parentId===t&&((i=r.context)==null?void 0:i.open)}),o=n;for(;o.length;)o=e.filter(r=>{var i;return(i=o)==null?void 0:i.some(l=>{var a;return r.parentId===l.id&&((a=r.context)==null?void 0:a.open)})}),n=n.concat(o);return n}let Re=new WeakMap,Xe=new WeakSet,Je={},wt=0;const Ql=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,No=e=>e&&(e.host||No(e.parentNode)),Gl=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=No(n);return e.contains(o)?o:null}).filter(n=>n!=null);function Yl(e,t,n,o){const r="data-floating-ui-inert",i=o?"inert":n?"aria-hidden":null,l=Gl(t,e),a=new Set,s=new Set(l),c=[];Je[r]||(Je[r]=new WeakMap);const C=Je[r];l.forEach(m),b(t),a.clear();function m(u){!u||a.has(u)||(a.add(u),u.parentNode&&m(u.parentNode))}function b(u){!u||s.has(u)||Array.prototype.forEach.call(u.children,x=>{if(a.has(x))b(x);else{const w=i?x.getAttribute(i):null,g=w!==null&&w!=="false",y=(Re.get(x)||0)+1,v=(C.get(x)||0)+1;Re.set(x,y),C.set(x,v),c.push(x),y===1&&g&&Xe.add(x),v===1&&x.setAttribute(r,""),!g&&i&&x.setAttribute(i,"true")}})}return wt++,()=>{c.forEach(u=>{const x=(Re.get(u)||0)-1,w=(C.get(u)||0)-1;Re.set(u,x),C.set(u,w),x||(!Xe.has(u)&&i&&u.removeAttribute(i),Xe.delete(u)),w||u.removeAttribute(r)}),wt--,wt||(Re=new WeakMap,Re=new WeakMap,Xe=new WeakSet,Je={})}}function An(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=me(e[0]).body;return Yl(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const Zt=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Lo(e,t){const n=Yt(e,Zt());t==="prev"&&n.reverse();const o=n.indexOf(Ie(me(e)));return n.slice(o+1)[0]}function Mo(){return Lo(document.body,"next")}function Bo(){return Lo(document.body,"prev")}function ze(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!ie(n,o)}function Xl(e){Yt(e,Zt()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Jl(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}const en={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let Zl;function En(e){e.key==="Tab"&&(e.target,clearTimeout(Zl))}const st=A.forwardRef(function(t,n){const[o,r]=A.useState();ae(()=>(jr()&&r("button"),document.addEventListener("keydown",En),()=>{document.removeEventListener("keydown",En)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[qe("focus-guard")]:"",style:en};return A.createElement("span",ke({},t,i))}),$o=A.createContext(null),Rn=qe("portal");function ea(e){let{id:t,root:n}=e===void 0?{}:e;const[o,r]=A.useState(null),i=yt(),l=Ko(),a=A.useRef(null);return ae(()=>()=>{o==null||o.remove(),queueMicrotask(()=>{a.current=null})},[o]),ae(()=>{if(a.current)return;const s=t?document.getElementById(t):null;if(!s)return;const c=document.createElement("div");c.id=i,c.setAttribute(Rn,""),s.appendChild(c),a.current=c,r(c)},[t,i]),ae(()=>{if(a.current)return;let s=n||(l==null?void 0:l.portalNode);s&&!Y(s)&&(s=s.current),s=s||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,s.appendChild(c));const C=document.createElement("div");C.id=i,C.setAttribute(Rn,""),s=c||s,s.appendChild(C),a.current=C,r(C)},[t,n,i,l]),o}function zo(e){let{children:t,id:n,root:o=null,preserveTabOrder:r=!0}=e;const i=ea({id:n,root:o}),[l,a]=A.useState(null),s=A.useRef(null),c=A.useRef(null),C=A.useRef(null),m=A.useRef(null),b=!!l&&!l.modal&&l.open&&r&&!!(o||i);return A.useEffect(()=>{if(!i||!r||l!=null&&l.modal)return;function u(x){i&&ze(x)&&(x.type==="focusin"?Jl:Xl)(i)}return i.addEventListener("focusin",u,!0),i.addEventListener("focusout",u,!0),()=>{i.removeEventListener("focusin",u,!0),i.removeEventListener("focusout",u,!0)}},[i,r,l==null?void 0:l.modal]),A.createElement($o.Provider,{value:A.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:s,afterOutsideRef:c,beforeInsideRef:C,afterInsideRef:m,portalNode:i,setFocusManagerState:a}),[r,i])},b&&i&&A.createElement(st,{"data-type":"outside",ref:s,onFocus:u=>{if(ze(u,i)){var x;(x=C.current)==null||x.focus()}else{const w=Bo()||(l==null?void 0:l.refs.domReference.current);w==null||w.focus()}}}),b&&i&&A.createElement("span",{"aria-owns":i.id,style:en}),i&&no.createPortal(t,i),b&&i&&A.createElement(st,{"data-type":"outside",ref:c,onFocus:u=>{if(ze(u,i)){var x;(x=m.current)==null||x.focus()}else{const w=Mo()||(l==null?void 0:l.refs.domReference.current);w==null||w.focus(),l!=null&&l.closeOnFocusOut&&(l==null||l.onOpenChange(!1,u.nativeEvent))}}}))}const Ko=()=>A.useContext($o),In=20;let we=[];function St(e){we=we.filter(t=>t.isConnected),e&&ye(e)!=="body"&&(we.push(e),we.length>In&&(we=we.slice(-In)))}function Pn(){return we.slice().reverse().find(e=>e.isConnected)}const ta=A.forwardRef(function(t,n){return A.createElement("button",ke({},t,{type:"button",ref:n,tabIndex:-1,style:en}))});function Wo(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],guards:i=!0,initialFocus:l=0,returnFocus:a=!0,modal:s=!0,visuallyHiddenDismiss:c=!1,closeOnFocusOut:C=!0}=e,{open:m,refs:b,nodeId:u,onOpenChange:x,events:w,dataRef:g,elements:{domReference:y,floating:v}}=t,V=typeof l=="number"&&l<0,S=Mr(y)&&V,R=Ql()?i:!0,I=vt(r),D=vt(l),P=vt(a),k=Jt(),E=Ko(),N=A.useRef(null),B=A.useRef(null),K=A.useRef(!1),_=A.useRef(!1),F=E!=null,$=A.useCallback(function(q){return q===void 0&&(q=v),q?Yt(q,Zt()):[]},[v]),j=A.useCallback(q=>{const W=$(q);return I.current.map(z=>y&&z==="reference"?y:v&&z==="floating"?v:W).filter(Boolean).flat()},[y,v,I,$]);A.useEffect(()=>{if(o||!s)return;function q(z){if(z.key==="Tab"){ie(v,Ie(me(v)))&&$().length===0&&!S&&xt(z);const H=j(),Q=Pe(z);I.current[0]==="reference"&&Q===y&&(xt(z),z.shiftKey?ve(H[H.length-1]):ve(H[1])),I.current[1]==="floating"&&Q===v&&z.shiftKey&&(xt(z),ve(H[0]))}}const W=me(v);return W.addEventListener("keydown",q),()=>{W.removeEventListener("keydown",q)}},[o,y,v,s,I,S,$,j]),A.useEffect(()=>{if(o||!C)return;function q(){_.current=!0,setTimeout(()=>{_.current=!1})}function W(z){const H=z.relatedTarget;queueMicrotask(()=>{const Q=!(ie(y,H)||ie(v,H)||ie(H,v)||ie(E==null?void 0:E.portalNode,H)||H!=null&&H.hasAttribute(qe("focus-guard"))||k&&($e(k.nodesRef.current,u).find(G=>{var ee,ue;return ie((ee=G.context)==null?void 0:ee.elements.floating,H)||ie((ue=G.context)==null?void 0:ue.elements.domReference,H)})||Ul(k.nodesRef.current,u).find(G=>{var ee,ue;return((ee=G.context)==null?void 0:ee.elements.floating)===H||((ue=G.context)==null?void 0:ue.elements.domReference)===H})));H&&Q&&!_.current&&H!==Pn()&&(K.current=!0,x(!1,z))})}if(v&&ne(y))return y.addEventListener("focusout",W),y.addEventListener("pointerdown",q),!s&&v.addEventListener("focusout",W),()=>{y.removeEventListener("focusout",W),y.removeEventListener("pointerdown",q),!s&&v.removeEventListener("focusout",W)}},[o,y,v,s,u,k,E,x,C]),A.useEffect(()=>{var q;if(o)return;const W=Array.from((E==null||(q=E.portalNode)==null?void 0:q.querySelectorAll("["+qe("portal")+"]"))||[]);if(v){const z=[v,...W,N.current,B.current,I.current.includes("reference")||S?y:null].filter(Q=>Q!=null),H=s||S?An(z,R,!R):An(z);return()=>{H()}}},[o,y,v,s,I,E,S,R]),ae(()=>{if(o||!v)return;const q=me(v),W=Ie(q);queueMicrotask(()=>{const z=j(v),H=D.current,Q=(typeof H=="number"?z[H]:H.current)||v,G=ie(v,W);!V&&!G&&m&&ve(Q,{preventScroll:Q===v})})},[o,m,v,V,j,D]),ae(()=>{if(o||!v)return;let q=!1;const W=me(v),z=Ie(W),H=g.current;St(z);function Q(G){let{reason:ee,event:ue,nested:Be}=G;ee==="escape-key"&&b.domReference.current&&St(b.domReference.current),ee==="hover"&&ue.type==="mouseleave"&&(K.current=!0),ee==="outside-press"&&(Be?(K.current=!1,q=!0):K.current=!(Dr(ue)||Or(ue)))}return w.on("openchange",Q),()=>{w.off("openchange",Q);const G=Ie(W),ee=ie(v,G)||k&&$e(k.nodesRef.current,u).some(Ni=>{var an;return ie((an=Ni.context)==null?void 0:an.elements.floating,G)});(ee||H.openEvent&&["click","mousedown"].includes(H.openEvent.type))&&b.domReference.current&&St(b.domReference.current);const Be=Pn();P.current&&!K.current&&ne(Be)&&(!(Be!==G&&G!==W.body)||ee)&&ve(Be,{cancelPrevious:!1,preventScroll:q})}},[o,v,P,g,b,w,k,u]),ae(()=>{if(!(o||!E))return E.setFocusManagerState({modal:s,closeOnFocusOut:C,open:m,onOpenChange:x,refs:b}),()=>{E.setFocusManagerState(null)}},[o,E,s,m,x,b,C]),ae(()=>{if(o||!v||typeof MutationObserver!="function"||V)return;const q=()=>{const z=v.getAttribute("tabindex");I.current.includes("floating")||Ie(me(v))!==b.domReference.current&&$().length===0?z!=="0"&&v.setAttribute("tabindex","0"):z!=="-1"&&v.setAttribute("tabindex","-1")};q();const W=new MutationObserver(q);return W.observe(v,{childList:!0,subtree:!0,attributes:!0}),()=>{W.disconnect()}},[o,v,b,I,$,V]);function L(q){return o||!c||!s?null:A.createElement(ta,{ref:q==="start"?N:B,onClick:W=>x(!1,W.nativeEvent)},typeof c=="string"?c:"Dismiss")}const te=!o&&R&&(F||s);return A.createElement(A.Fragment,null,te&&A.createElement(st,{"data-type":"inside",ref:E==null?void 0:E.beforeInsideRef,onFocus:q=>{if(s){const z=j();ve(r[0]==="reference"?z[0]:z[z.length-1])}else if(E!=null&&E.preserveTabOrder&&E.portalNode)if(K.current=!1,ze(q,E.portalNode)){const z=Mo()||y;z==null||z.focus()}else{var W;(W=E.beforeOutsideRef.current)==null||W.focus()}}}),!S&&L("start"),n,L("end"),te&&A.createElement(st,{"data-type":"inside",ref:E==null?void 0:E.afterInsideRef,onFocus:q=>{if(s)ve(j()[0]);else if(E!=null&&E.preserveTabOrder&&E.portalNode)if(C&&(K.current=!0),ze(q,E.portalNode)){const z=Bo()||y;z==null||z.focus()}else{var W;(W=E.afterOutsideRef.current)==null||W.focus()}}}))}const Tt=new Set,qo=A.forwardRef(function(t,n){let{lockScroll:o=!1,...r}=t;const i=yt();return ae(()=>{if(!o)return;Tt.add(i);const l=/iP(hone|ad|od)|iOS/.test(bo()),a=document.body.style,c=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",C=window.innerWidth-document.documentElement.clientWidth,m=a.left?parseFloat(a.left):window.pageXOffset,b=a.top?parseFloat(a.top):window.pageYOffset;if(a.overflow="hidden",C&&(a[c]=C+"px"),l){var u,x;const w=((u=window.visualViewport)==null?void 0:u.offsetLeft)||0,g=((x=window.visualViewport)==null?void 0:x.offsetTop)||0;Object.assign(a,{position:"fixed",top:-(b-Math.floor(g))+"px",left:-(m-Math.floor(w))+"px",right:"0"})}return()=>{Tt.delete(i),Tt.size===0&&(Object.assign(a,{overflow:"",[c]:""}),l&&(Object.assign(a,{position:"",top:"",left:"",right:""}),window.scrollTo(m,b)))}},[i,o]),A.createElement("div",ke({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))});function Vn(e){return ne(e.target)&&e.target.tagName==="BUTTON"}function Dn(e){return Co(e)}function _o(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,dataRef:r,elements:{domReference:i}}=e,{enabled:l=!0,event:a="click",toggle:s=!0,ignoreMouse:c=!1,keyboardHandlers:C=!0}=t,m=A.useRef(),b=A.useRef(!1);return A.useMemo(()=>l?{reference:{onPointerDown(u){m.current=u.pointerType},onMouseDown(u){u.button===0&&(hn(m.current,!0)&&c||a!=="click"&&(n&&s&&(!r.current.openEvent||r.current.openEvent.type==="mousedown")?o(!1,u.nativeEvent,"click"):(u.preventDefault(),o(!0,u.nativeEvent,"click"))))},onClick(u){if(a==="mousedown"&&m.current){m.current=void 0;return}hn(m.current,!0)&&c||(n&&s&&(!r.current.openEvent||r.current.openEvent.type==="click")?o(!1,u.nativeEvent,"click"):o(!0,u.nativeEvent,"click"))},onKeyDown(u){m.current=void 0,!(u.defaultPrevented||!C||Vn(u))&&(u.key===" "&&!Dn(i)&&(u.preventDefault(),b.current=!0),u.key==="Enter"&&o(!(n&&s),u.nativeEvent,"click"))},onKeyUp(u){u.defaultPrevented||!C||Vn(u)||Dn(i)||u.key===" "&&b.current&&(b.current=!1,o(!(n&&s),u.nativeEvent,"click"))}}}:{},[l,r,a,c,C,i,s,n,o])}const na={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},oa={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},On=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function Ho(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,nodeId:r,elements:{reference:i,domReference:l,floating:a},dataRef:s}=e,{enabled:c=!0,escapeKey:C=!0,outsidePress:m=!0,outsidePressEvent:b="pointerdown",referencePress:u=!1,referencePressEvent:x="pointerdown",ancestorScroll:w=!1,bubbles:g,capture:y}=t,v=Jt(),V=Ve(typeof m=="function"?m:()=>!1),S=typeof m=="function"?V:m,R=A.useRef(!1),I=A.useRef(!1),{escapeKey:D,outsidePress:P}=On(g),{escapeKey:k,outsidePress:E}=On(y),N=Ve(F=>{if(!n||!c||!C||F.key!=="Escape")return;const $=v?$e(v.nodesRef.current,r):[];if(!D&&(F.stopPropagation(),$.length>0)){let j=!0;if($.forEach(L=>{var te;if((te=L.context)!=null&&te.open&&!L.context.dataRef.current.__escapeKeyBubbles){j=!1;return}}),!j)return}o(!1,Fr(F)?F.nativeEvent:F,"escape-key")}),B=Ve(F=>{var $;const j=()=>{var L;N(F),(L=Pe(F))==null||L.removeEventListener("keydown",j)};($=Pe(F))==null||$.addEventListener("keydown",j)}),K=Ve(F=>{const $=R.current;R.current=!1;const j=I.current;if(I.current=!1,b==="click"&&j||$||typeof S=="function"&&!S(F))return;const L=Pe(F),te="["+qe("inert")+"]",q=me(a).querySelectorAll(te);let W=Y(L)?L:null;for(;W&&!Oe(W);){const Q=Te(W);if(Oe(Q)||!Y(Q))break;W=Q}if(q.length&&Y(L)&&!Nr(L)&&!ie(L,a)&&Array.from(q).every(Q=>!ie(W,Q)))return;if(ne(L)&&a){const Q=L.clientWidth>0&&L.scrollWidth>L.clientWidth,G=L.clientHeight>0&&L.scrollHeight>L.clientHeight;let ee=G&&F.offsetX>L.clientWidth;if(G&&le(L).direction==="rtl"&&(ee=F.offsetX<=L.offsetWidth-L.clientWidth),ee||Q&&F.offsetY>L.clientHeight)return}const z=v&&$e(v.nodesRef.current,r).some(Q=>{var G;return bt(F,(G=Q.context)==null?void 0:G.elements.floating)});if(bt(F,a)||bt(F,l)||z)return;const H=v?$e(v.nodesRef.current,r):[];if(H.length>0){let Q=!0;if(H.forEach(G=>{var ee;if((ee=G.context)!=null&&ee.open&&!G.context.dataRef.current.__outsidePressBubbles){Q=!1;return}}),!Q)return}o(!1,F,"outside-press")}),_=Ve(F=>{var $;const j=()=>{var L;K(F),(L=Pe(F))==null||L.removeEventListener(b,j)};($=Pe(F))==null||$.addEventListener(b,j)});return A.useEffect(()=>{if(!n||!c)return;s.current.__escapeKeyBubbles=D,s.current.__outsidePressBubbles=P;function F(L){o(!1,L,"ancestor-scroll")}const $=me(a);C&&$.addEventListener("keydown",k?B:N,k),S&&$.addEventListener(b,E?_:K,E);let j=[];return w&&(Y(l)&&(j=xe(l)),Y(a)&&(j=j.concat(xe(a))),!Y(i)&&i&&i.contextElement&&(j=j.concat(xe(i.contextElement)))),j=j.filter(L=>{var te;return L!==((te=$.defaultView)==null?void 0:te.visualViewport)}),j.forEach(L=>{L.addEventListener("scroll",F,{passive:!0})}),()=>{C&&$.removeEventListener("keydown",k?B:N,k),S&&$.removeEventListener(b,E?_:K,E),j.forEach(L=>{L.removeEventListener("scroll",F)})}},[s,a,l,i,C,S,b,n,o,w,c,D,P,N,k,B,K,E,_]),A.useEffect(()=>{R.current=!1},[S,b]),A.useMemo(()=>c?{reference:{onKeyDown:N,[na[x]]:F=>{u&&o(!1,F.nativeEvent,"reference-press")}},floating:{onKeyDown:N,onMouseDown(){I.current=!0},onMouseUp(){I.current=!0},[oa[b]]:()=>{R.current=!0}}}:{},[c,u,b,x,o,N])}let Lt;process.env.NODE_ENV!=="production"&&(Lt=new Set);function Uo(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:o,nodeId:r}=e;if(process.env.NODE_ENV!=="production"){var i;const P="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";if((i=e.elements)!=null&&i.reference&&!Y(e.elements.reference)){var l;if(!((l=Lt)!=null&&l.has(P))){var a;(a=Lt)==null||a.add(P),console.error(P)}}}const[s,c]=A.useState(null),C=((t=e.elements)==null?void 0:t.reference)||s,m=bl(e),b=Jt(),u=Hl()!=null,x=Ve((P,k,E)=>{P&&(g.current.openEvent=k),y.emit("openchange",{open:P,event:k,reason:E,nested:u}),o==null||o(P,k,E)}),w=A.useRef(null),g=A.useRef({}),y=A.useState(()=>Wl())[0],v=yt(),V=A.useCallback(P=>{const k=Y(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;m.refs.setReference(k)},[m.refs]),S=A.useCallback(P=>{(Y(P)||P===null)&&(w.current=P,c(P)),(Y(m.refs.reference.current)||m.refs.reference.current===null||P!==null&&!Y(P))&&m.refs.setReference(P)},[m.refs]),R=A.useMemo(()=>({...m.refs,setReference:S,setPositionReference:V,domReference:w}),[m.refs,S,V]),I=A.useMemo(()=>({...m.elements,domReference:C}),[m.elements,C]),D=A.useMemo(()=>({...m,refs:R,elements:I,dataRef:g,nodeId:r,floatingId:v,events:y,open:n,onOpenChange:x}),[m,r,v,y,n,x,R,I]);return ae(()=>{const P=b==null?void 0:b.nodesRef.current.find(k=>k.id===r);P&&(P.context=D)}),A.useMemo(()=>({...m,context:D,refs:R,elements:I}),[m,R,I,D])}const jn="active",kn="selected";function At(e,t,n){const o=new Map,r=n==="item";let i=e;if(r&&e){const{[jn]:l,[kn]:a,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1},...i,...t.map(l=>{const a=l?l[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((l,a)=>(a&&Object.entries(a).forEach(s=>{let[c,C]=s;if(!(r&&[jn,kn].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof C=="function"){var m;(m=o.get(c))==null||m.push(C),l[c]=function(){for(var b,u=arguments.length,x=new Array(u),w=0;w<u;w++)x[w]=arguments[w];return(b=o.get(c))==null?void 0:b.map(g=>g(...x)).find(g=>g!==void 0)}}}else l[c]=C}),l),{})}}function Qo(e){e===void 0&&(e=[]);const t=e,n=A.useCallback(i=>At(i,e,"reference"),t),o=A.useCallback(i=>At(i,e,"floating"),t),r=A.useCallback(i=>At(i,e,"item"),e.map(i=>i==null?void 0:i.item));return A.useMemo(()=>({getReferenceProps:n,getFloatingProps:o,getItemProps:r}),[n,o,r])}function ia(e={}){const{initialOpen:t=!1,open:n,onOpenChange:o}=e,[r,i]=A.useState(t),l=n??r,a=o??i,s=Uo({open:l,onOpenChange:a}),c=s.context,C=_o(c,{enabled:n==null}),m=Ho(c,{outsidePressEvent:"mousedown"}),b=Qo([C,m]);return A.useMemo(()=>({open:l,setOpen:a,...b,...s}),[l,a,b,s])}const Go=A.createContext(null),Yo=()=>{const e=A.useContext(Go);if(e==null)throw new Error("Dialog components must be wrapped in <Dialog />");return e};function ra({children:e,...t}){const n=ia(t);return d.jsx(Go.Provider,{value:n,children:e})}const Xo=O.css`
195
+ */var Cl=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Nt=Cl.join(","),Oo=typeof Element>"u",We=Oo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,lt=!Oo&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},at=function e(t,n){var o;n===void 0&&(n=!0);var r=t==null||(o=t.getAttribute)===null||o===void 0?void 0:o.call(t,"inert"),i=r===""||r==="true",l=i||n&&t&&e(t.parentNode);return l},vl=function(t){var n,o=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return o===""||o==="true"},wl=function(t,n,o){if(at(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(Nt));return n&&We.call(t,Nt)&&r.unshift(t),r=r.filter(o),r},Sl=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var l=i.shift();if(!at(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),s=a.length?a:l.children,c=e(s,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:l,candidates:c})}else{var C=We.call(l,Nt);C&&o.filter(l)&&(n||!t.includes(l))&&r.push(l);var m=l.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(l),b=!at(m,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(l));if(m&&b){var u=e(m===!0?l.children:m.children,!0,o);o.flatten?r.push.apply(r,u):r.push({scopeParent:l,candidates:u})}else i.unshift.apply(i,l.children)}}return r},jo=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ko=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||vl(t))&&!jo(t)?0:t.tabIndex},Tl=function(t,n){var o=ko(t);return o<0&&n&&!jo(t)?0:o},El=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Fo=function(t){return t.tagName==="INPUT"},Al=function(t){return Fo(t)&&t.type==="hidden"},Rl=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(o){return o.tagName==="SUMMARY"});return n},Il=function(t,n){for(var o=0;o<t.length;o++)if(t[o].checked&&t[o].form===n)return t[o]},Pl=function(t){if(!t.name)return!0;var n=t.form||lt(t),o=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(t.name));else try{r=o(t.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var i=Il(r,t.form);return!i||i===t},Vl=function(t){return Fo(t)&&t.type==="radio"},Dl=function(t){return Vl(t)&&!Pl(t)},Ol=function(t){var n,o=t&&lt(t),r=(n=o)===null||n===void 0?void 0:n.host,i=!1;if(o&&o!==t){var l,a,s;for(i=!!((l=r)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(r)||t!=null&&(s=t.ownerDocument)!==null&&s!==void 0&&s.contains(t));!i&&r;){var c,C,m;o=lt(r),r=(c=o)===null||c===void 0?void 0:c.host,i=!!((C=r)!==null&&C!==void 0&&(m=C.ownerDocument)!==null&&m!==void 0&&m.contains(r))}}return i},vn=function(t){var n=t.getBoundingClientRect(),o=n.width,r=n.height;return o===0&&r===0},jl=function(t,n){var o=n.displayCheck,r=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=We.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(We.call(l,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="legacy-full"){if(typeof r=="function"){for(var a=t;t;){var s=t.parentElement,c=lt(t);if(s&&!s.shadowRoot&&r(s)===!0)return vn(t);t.assignedSlot?t=t.assignedSlot:!s&&c!==t.ownerDocument?t=c.host:t=s}t=a}if(Ol(t))return!t.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return vn(t);return!1},kl=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var o=0;o<n.children.length;o++){var r=n.children.item(o);if(r.tagName==="LEGEND")return We.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}return!1},Fl=function(t,n){return!(n.disabled||at(n)||Al(n)||jl(n,t)||Rl(n)||kl(n))},wn=function(t,n){return!(Dl(n)||ko(n)<0||!Fl(t,n))},Nl=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ll=function e(t){var n=[],o=[];return t.forEach(function(r,i){var l=!!r.scopeParent,a=l?r.scopeParent:r,s=Tl(a,l),c=l?e(r.candidates):a;s===0?l?n.push.apply(n,c):n.push(a):o.push({documentOrder:i,tabIndex:s,item:r,isScope:l,content:c})}),o.sort(El).reduce(function(r,i){return i.isScope?r.push.apply(r,i.content):r.push(i.content),r},[]).concat(n)},Yt=function(t,n){n=n||{};var o;return n.getShadowRoot?o=Sl([t],n.includeContainer,{filter:wn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Nl}):o=wl(t,n.includeContainer,wn.bind(null,n)),Ll(o)};function Xt(e){return E.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})},e)}const Ml=E["useInsertionEffect".toString()],Bl=Ml||(e=>e());function Ve(e){const t=E.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Bl(()=>{t.current=e}),E.useCallback(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}let Sn=0;function ve(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Sn);const i=()=>e==null?void 0:e.focus({preventScroll:n});r?i():Sn=requestAnimationFrame(i)}var ae=typeof document<"u"?S.useLayoutEffect:S.useEffect;function ke(){return ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ke.apply(this,arguments)}let Ct=!1,$l=0;const Tn=()=>"floating-ui-"+$l++;function zl(){const[e,t]=E.useState(()=>Ct?Tn():void 0);return ae(()=>{e==null&&t(Tn())},[]),E.useEffect(()=>{Ct||(Ct=!0)},[]),e}const Kl=E["useId".toString()],yt=Kl||zl,Wl=E.forwardRef(function(t,n){let{context:{placement:o,elements:{floating:r},middlewareData:{arrow:i}},width:l=14,height:a=7,tipRadius:s=0,strokeWidth:c=0,staticOffset:C,stroke:m,d:b,style:{transform:u,...x}={},...w}=t;process.env.NODE_ENV!=="production"&&(n||console.warn("Floating UI: The `ref` prop is required for the `FloatingArrow`","component."));const g=yt();if(!r)return null;c*=2;const y=c/2,v=l/2*(s/-8+1),V=a/2*s/4,[T,R]=o.split("-"),I=Vo.isRTL(r),D=!!b,P=T==="top"||T==="bottom",k=C&&R==="end"?"bottom":"top";let A=C&&R==="end"?"right":"left";C&&I&&(A=R==="end"?"left":"right");const N=(i==null?void 0:i.x)!=null?C||i.x:"",B=(i==null?void 0:i.y)!=null?C||i.y:"",K=b||"M0,0"+(" H"+l)+(" L"+(l-v)+","+(a-V))+(" Q"+l/2+","+a+" "+v+","+(a-V))+" Z",_={top:D?"rotate(180deg)":"",left:D?"rotate(90deg)":"rotate(-90deg)",bottom:D?"":"rotate(180deg)",right:D?"rotate(-90deg)":"rotate(90deg)"}[T];return E.createElement("svg",ke({},w,{"aria-hidden":!0,ref:n,width:D?l:l+c,height:l,viewBox:"0 0 "+l+" "+(a>l?a:l),style:{position:"absolute",pointerEvents:"none",[A]:N,[k]:B,[T]:P||D?"100%":"calc(100% - "+c/2+"px)",transform:""+_+(u??""),...x}}),c>0&&E.createElement("path",{clipPath:"url(#"+g+")",fill:"none",stroke:m,strokeWidth:c+(b?0:1),d:K}),E.createElement("path",{stroke:c&&!b?w.fill:"none",d:K}),E.createElement("clipPath",{id:g},E.createElement("rect",{x:-y,y:y*(D?-1:1),width:l+c,height:l})))});function ql(){const e=new Map;return{emit(t,n){var o;(o=e.get(t))==null||o.forEach(r=>r(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,((o=e.get(t))==null?void 0:o.filter(r=>r!==n))||[])}}}const _l=E.createContext(null),Hl=E.createContext(null),Ul=()=>{var e;return((e=E.useContext(_l))==null?void 0:e.id)||null},Jt=()=>E.useContext(Hl);function qe(e){return"data-floating-ui-"+e}function vt(e){const t=S.useRef(e);return ae(()=>{t.current=e}),t}function Ql(e,t){var n;let o=[],r=(n=e.find(i=>i.id===t))==null?void 0:n.parentId;for(;r;){const i=e.find(l=>l.id===r);r=i==null?void 0:i.parentId,i&&(o=o.concat(i))}return o}function $e(e,t){let n=e.filter(r=>{var i;return r.parentId===t&&((i=r.context)==null?void 0:i.open)}),o=n;for(;o.length;)o=e.filter(r=>{var i;return(i=o)==null?void 0:i.some(l=>{var a;return r.parentId===l.id&&((a=r.context)==null?void 0:a.open)})}),n=n.concat(o);return n}let Re=new WeakMap,Xe=new WeakSet,Je={},wt=0;const Gl=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,No=e=>e&&(e.host||No(e.parentNode)),Yl=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=No(n);return e.contains(o)?o:null}).filter(n=>n!=null);function Xl(e,t,n,o){const r="data-floating-ui-inert",i=o?"inert":n?"aria-hidden":null,l=Yl(t,e),a=new Set,s=new Set(l),c=[];Je[r]||(Je[r]=new WeakMap);const C=Je[r];l.forEach(m),b(t),a.clear();function m(u){!u||a.has(u)||(a.add(u),u.parentNode&&m(u.parentNode))}function b(u){!u||s.has(u)||Array.prototype.forEach.call(u.children,x=>{if(a.has(x))b(x);else{const w=i?x.getAttribute(i):null,g=w!==null&&w!=="false",y=(Re.get(x)||0)+1,v=(C.get(x)||0)+1;Re.set(x,y),C.set(x,v),c.push(x),y===1&&g&&Xe.add(x),v===1&&x.setAttribute(r,""),!g&&i&&x.setAttribute(i,"true")}})}return wt++,()=>{c.forEach(u=>{const x=(Re.get(u)||0)-1,w=(C.get(u)||0)-1;Re.set(u,x),C.set(u,w),x||(!Xe.has(u)&&i&&u.removeAttribute(i),Xe.delete(u)),w||u.removeAttribute(r)}),wt--,wt||(Re=new WeakMap,Re=new WeakMap,Xe=new WeakSet,Je={})}}function En(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=me(e[0]).body;return Xl(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const Zt=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Lo(e,t){const n=Yt(e,Zt());t==="prev"&&n.reverse();const o=n.indexOf(Ie(me(e)));return n.slice(o+1)[0]}function Mo(){return Lo(document.body,"next")}function Bo(){return Lo(document.body,"prev")}function ze(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!ie(n,o)}function Jl(e){Yt(e,Zt()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Zl(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}const en={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let ea;function An(e){e.key==="Tab"&&(e.target,clearTimeout(ea))}const st=E.forwardRef(function(t,n){const[o,r]=E.useState();ae(()=>(kr()&&r("button"),document.addEventListener("keydown",An),()=>{document.removeEventListener("keydown",An)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[qe("focus-guard")]:"",style:en};return E.createElement("span",ke({},t,i))}),$o=E.createContext(null),Rn=qe("portal");function ta(e){let{id:t,root:n}=e===void 0?{}:e;const[o,r]=E.useState(null),i=yt(),l=Ko(),a=E.useRef(null);return ae(()=>()=>{o==null||o.remove(),queueMicrotask(()=>{a.current=null})},[o]),ae(()=>{if(a.current)return;const s=t?document.getElementById(t):null;if(!s)return;const c=document.createElement("div");c.id=i,c.setAttribute(Rn,""),s.appendChild(c),a.current=c,r(c)},[t,i]),ae(()=>{if(a.current)return;let s=n||(l==null?void 0:l.portalNode);s&&!X(s)&&(s=s.current),s=s||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,s.appendChild(c));const C=document.createElement("div");C.id=i,C.setAttribute(Rn,""),s=c||s,s.appendChild(C),a.current=C,r(C)},[t,n,i,l]),o}function zo(e){let{children:t,id:n,root:o=null,preserveTabOrder:r=!0}=e;const i=ta({id:n,root:o}),[l,a]=E.useState(null),s=E.useRef(null),c=E.useRef(null),C=E.useRef(null),m=E.useRef(null),b=!!l&&!l.modal&&l.open&&r&&!!(o||i);return E.useEffect(()=>{if(!i||!r||l!=null&&l.modal)return;function u(x){i&&ze(x)&&(x.type==="focusin"?Zl:Jl)(i)}return i.addEventListener("focusin",u,!0),i.addEventListener("focusout",u,!0),()=>{i.removeEventListener("focusin",u,!0),i.removeEventListener("focusout",u,!0)}},[i,r,l==null?void 0:l.modal]),E.createElement($o.Provider,{value:E.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:s,afterOutsideRef:c,beforeInsideRef:C,afterInsideRef:m,portalNode:i,setFocusManagerState:a}),[r,i])},b&&i&&E.createElement(st,{"data-type":"outside",ref:s,onFocus:u=>{if(ze(u,i)){var x;(x=C.current)==null||x.focus()}else{const w=Bo()||(l==null?void 0:l.refs.domReference.current);w==null||w.focus()}}}),b&&i&&E.createElement("span",{"aria-owns":i.id,style:en}),i&&no.createPortal(t,i),b&&i&&E.createElement(st,{"data-type":"outside",ref:c,onFocus:u=>{if(ze(u,i)){var x;(x=m.current)==null||x.focus()}else{const w=Mo()||(l==null?void 0:l.refs.domReference.current);w==null||w.focus(),l!=null&&l.closeOnFocusOut&&(l==null||l.onOpenChange(!1,u.nativeEvent))}}}))}const Ko=()=>E.useContext($o),In=20;let we=[];function St(e){we=we.filter(t=>t.isConnected),e&&ye(e)!=="body"&&(we.push(e),we.length>In&&(we=we.slice(-In)))}function Pn(){return we.slice().reverse().find(e=>e.isConnected)}const na=E.forwardRef(function(t,n){return E.createElement("button",ke({},t,{type:"button",ref:n,tabIndex:-1,style:en}))});function Wo(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],guards:i=!0,initialFocus:l=0,returnFocus:a=!0,modal:s=!0,visuallyHiddenDismiss:c=!1,closeOnFocusOut:C=!0}=e,{open:m,refs:b,nodeId:u,onOpenChange:x,events:w,dataRef:g,elements:{domReference:y,floating:v}}=t,V=typeof l=="number"&&l<0,T=Br(y)&&V,R=Gl()?i:!0,I=vt(r),D=vt(l),P=vt(a),k=Jt(),A=Ko(),N=E.useRef(null),B=E.useRef(null),K=E.useRef(!1),_=E.useRef(!1),F=A!=null,$=E.useCallback(function(q){return q===void 0&&(q=v),q?Yt(q,Zt()):[]},[v]),j=E.useCallback(q=>{const W=$(q);return I.current.map(z=>y&&z==="reference"?y:v&&z==="floating"?v:W).filter(Boolean).flat()},[y,v,I,$]);E.useEffect(()=>{if(o||!s)return;function q(z){if(z.key==="Tab"){ie(v,Ie(me(v)))&&$().length===0&&!T&&xt(z);const H=j(),Q=Pe(z);I.current[0]==="reference"&&Q===y&&(xt(z),z.shiftKey?ve(H[H.length-1]):ve(H[1])),I.current[1]==="floating"&&Q===v&&z.shiftKey&&(xt(z),ve(H[0]))}}const W=me(v);return W.addEventListener("keydown",q),()=>{W.removeEventListener("keydown",q)}},[o,y,v,s,I,T,$,j]),E.useEffect(()=>{if(o||!C)return;function q(){_.current=!0,setTimeout(()=>{_.current=!1})}function W(z){const H=z.relatedTarget;queueMicrotask(()=>{const Q=!(ie(y,H)||ie(v,H)||ie(H,v)||ie(A==null?void 0:A.portalNode,H)||H!=null&&H.hasAttribute(qe("focus-guard"))||k&&($e(k.nodesRef.current,u).find(G=>{var ee,ue;return ie((ee=G.context)==null?void 0:ee.elements.floating,H)||ie((ue=G.context)==null?void 0:ue.elements.domReference,H)})||Ql(k.nodesRef.current,u).find(G=>{var ee,ue;return((ee=G.context)==null?void 0:ee.elements.floating)===H||((ue=G.context)==null?void 0:ue.elements.domReference)===H})));H&&Q&&!_.current&&H!==Pn()&&(K.current=!0,x(!1,z))})}if(v&&ne(y))return y.addEventListener("focusout",W),y.addEventListener("pointerdown",q),!s&&v.addEventListener("focusout",W),()=>{y.removeEventListener("focusout",W),y.removeEventListener("pointerdown",q),!s&&v.removeEventListener("focusout",W)}},[o,y,v,s,u,k,A,x,C]),E.useEffect(()=>{var q;if(o)return;const W=Array.from((A==null||(q=A.portalNode)==null?void 0:q.querySelectorAll("["+qe("portal")+"]"))||[]);if(v){const z=[v,...W,N.current,B.current,I.current.includes("reference")||T?y:null].filter(Q=>Q!=null),H=s||T?En(z,R,!R):En(z);return()=>{H()}}},[o,y,v,s,I,A,T,R]),ae(()=>{if(o||!v)return;const q=me(v),W=Ie(q);queueMicrotask(()=>{const z=j(v),H=D.current,Q=(typeof H=="number"?z[H]:H.current)||v,G=ie(v,W);!V&&!G&&m&&ve(Q,{preventScroll:Q===v})})},[o,m,v,V,j,D]),ae(()=>{if(o||!v)return;let q=!1;const W=me(v),z=Ie(W),H=g.current;St(z);function Q(G){let{reason:ee,event:ue,nested:Be}=G;ee==="escape-key"&&b.domReference.current&&St(b.domReference.current),ee==="hover"&&ue.type==="mouseleave"&&(K.current=!0),ee==="outside-press"&&(Be?(K.current=!1,q=!0):K.current=!(Or(ue)||jr(ue)))}return w.on("openchange",Q),()=>{w.off("openchange",Q);const G=Ie(W),ee=ie(v,G)||k&&$e(k.nodesRef.current,u).some(Li=>{var an;return ie((an=Li.context)==null?void 0:an.elements.floating,G)});(ee||H.openEvent&&["click","mousedown"].includes(H.openEvent.type))&&b.domReference.current&&St(b.domReference.current);const Be=Pn();P.current&&!K.current&&ne(Be)&&(!(Be!==G&&G!==W.body)||ee)&&ve(Be,{cancelPrevious:!1,preventScroll:q})}},[o,v,P,g,b,w,k,u]),ae(()=>{if(!(o||!A))return A.setFocusManagerState({modal:s,closeOnFocusOut:C,open:m,onOpenChange:x,refs:b}),()=>{A.setFocusManagerState(null)}},[o,A,s,m,x,b,C]),ae(()=>{if(o||!v||typeof MutationObserver!="function"||V)return;const q=()=>{const z=v.getAttribute("tabindex");I.current.includes("floating")||Ie(me(v))!==b.domReference.current&&$().length===0?z!=="0"&&v.setAttribute("tabindex","0"):z!=="-1"&&v.setAttribute("tabindex","-1")};q();const W=new MutationObserver(q);return W.observe(v,{childList:!0,subtree:!0,attributes:!0}),()=>{W.disconnect()}},[o,v,b,I,$,V]);function L(q){return o||!c||!s?null:E.createElement(na,{ref:q==="start"?N:B,onClick:W=>x(!1,W.nativeEvent)},typeof c=="string"?c:"Dismiss")}const te=!o&&R&&(F||s);return E.createElement(E.Fragment,null,te&&E.createElement(st,{"data-type":"inside",ref:A==null?void 0:A.beforeInsideRef,onFocus:q=>{if(s){const z=j();ve(r[0]==="reference"?z[0]:z[z.length-1])}else if(A!=null&&A.preserveTabOrder&&A.portalNode)if(K.current=!1,ze(q,A.portalNode)){const z=Mo()||y;z==null||z.focus()}else{var W;(W=A.beforeOutsideRef.current)==null||W.focus()}}}),!T&&L("start"),n,L("end"),te&&E.createElement(st,{"data-type":"inside",ref:A==null?void 0:A.afterInsideRef,onFocus:q=>{if(s)ve(j()[0]);else if(A!=null&&A.preserveTabOrder&&A.portalNode)if(C&&(K.current=!0),ze(q,A.portalNode)){const z=Bo()||y;z==null||z.focus()}else{var W;(W=A.afterOutsideRef.current)==null||W.focus()}}}))}const Tt=new Set,qo=E.forwardRef(function(t,n){let{lockScroll:o=!1,...r}=t;const i=yt();return ae(()=>{if(!o)return;Tt.add(i);const l=/iP(hone|ad|od)|iOS/.test(bo()),a=document.body.style,c=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",C=window.innerWidth-document.documentElement.clientWidth,m=a.left?parseFloat(a.left):window.pageXOffset,b=a.top?parseFloat(a.top):window.pageYOffset;if(a.overflow="hidden",C&&(a[c]=C+"px"),l){var u,x;const w=((u=window.visualViewport)==null?void 0:u.offsetLeft)||0,g=((x=window.visualViewport)==null?void 0:x.offsetTop)||0;Object.assign(a,{position:"fixed",top:-(b-Math.floor(g))+"px",left:-(m-Math.floor(w))+"px",right:"0"})}return()=>{Tt.delete(i),Tt.size===0&&(Object.assign(a,{overflow:"",[c]:""}),l&&(Object.assign(a,{position:"",top:"",left:"",right:""}),window.scrollTo(m,b)))}},[i,o]),E.createElement("div",ke({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))});function Vn(e){return ne(e.target)&&e.target.tagName==="BUTTON"}function Dn(e){return Co(e)}function _o(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,dataRef:r,elements:{domReference:i}}=e,{enabled:l=!0,event:a="click",toggle:s=!0,ignoreMouse:c=!1,keyboardHandlers:C=!0}=t,m=E.useRef(),b=E.useRef(!1);return E.useMemo(()=>l?{reference:{onPointerDown(u){m.current=u.pointerType},onMouseDown(u){u.button===0&&(hn(m.current,!0)&&c||a!=="click"&&(n&&s&&(!r.current.openEvent||r.current.openEvent.type==="mousedown")?o(!1,u.nativeEvent,"click"):(u.preventDefault(),o(!0,u.nativeEvent,"click"))))},onClick(u){if(a==="mousedown"&&m.current){m.current=void 0;return}hn(m.current,!0)&&c||(n&&s&&(!r.current.openEvent||r.current.openEvent.type==="click")?o(!1,u.nativeEvent,"click"):o(!0,u.nativeEvent,"click"))},onKeyDown(u){m.current=void 0,!(u.defaultPrevented||!C||Vn(u))&&(u.key===" "&&!Dn(i)&&(u.preventDefault(),b.current=!0),u.key==="Enter"&&o(!(n&&s),u.nativeEvent,"click"))},onKeyUp(u){u.defaultPrevented||!C||Vn(u)||Dn(i)||u.key===" "&&b.current&&(b.current=!1,o(!(n&&s),u.nativeEvent,"click"))}}}:{},[l,r,a,c,C,i,s,n,o])}const oa={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ia={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},On=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function Ho(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,nodeId:r,elements:{reference:i,domReference:l,floating:a},dataRef:s}=e,{enabled:c=!0,escapeKey:C=!0,outsidePress:m=!0,outsidePressEvent:b="pointerdown",referencePress:u=!1,referencePressEvent:x="pointerdown",ancestorScroll:w=!1,bubbles:g,capture:y}=t,v=Jt(),V=Ve(typeof m=="function"?m:()=>!1),T=typeof m=="function"?V:m,R=E.useRef(!1),I=E.useRef(!1),{escapeKey:D,outsidePress:P}=On(g),{escapeKey:k,outsidePress:A}=On(y),N=Ve(F=>{if(!n||!c||!C||F.key!=="Escape")return;const $=v?$e(v.nodesRef.current,r):[];if(!D&&(F.stopPropagation(),$.length>0)){let j=!0;if($.forEach(L=>{var te;if((te=L.context)!=null&&te.open&&!L.context.dataRef.current.__escapeKeyBubbles){j=!1;return}}),!j)return}o(!1,Nr(F)?F.nativeEvent:F,"escape-key")}),B=Ve(F=>{var $;const j=()=>{var L;N(F),(L=Pe(F))==null||L.removeEventListener("keydown",j)};($=Pe(F))==null||$.addEventListener("keydown",j)}),K=Ve(F=>{const $=R.current;R.current=!1;const j=I.current;if(I.current=!1,b==="click"&&j||$||typeof T=="function"&&!T(F))return;const L=Pe(F),te="["+qe("inert")+"]",q=me(a).querySelectorAll(te);let W=X(L)?L:null;for(;W&&!Oe(W);){const Q=Te(W);if(Oe(Q)||!X(Q))break;W=Q}if(q.length&&X(L)&&!Lr(L)&&!ie(L,a)&&Array.from(q).every(Q=>!ie(W,Q)))return;if(ne(L)&&a){const Q=L.clientWidth>0&&L.scrollWidth>L.clientWidth,G=L.clientHeight>0&&L.scrollHeight>L.clientHeight;let ee=G&&F.offsetX>L.clientWidth;if(G&&le(L).direction==="rtl"&&(ee=F.offsetX<=L.offsetWidth-L.clientWidth),ee||Q&&F.offsetY>L.clientHeight)return}const z=v&&$e(v.nodesRef.current,r).some(Q=>{var G;return bt(F,(G=Q.context)==null?void 0:G.elements.floating)});if(bt(F,a)||bt(F,l)||z)return;const H=v?$e(v.nodesRef.current,r):[];if(H.length>0){let Q=!0;if(H.forEach(G=>{var ee;if((ee=G.context)!=null&&ee.open&&!G.context.dataRef.current.__outsidePressBubbles){Q=!1;return}}),!Q)return}o(!1,F,"outside-press")}),_=Ve(F=>{var $;const j=()=>{var L;K(F),(L=Pe(F))==null||L.removeEventListener(b,j)};($=Pe(F))==null||$.addEventListener(b,j)});return E.useEffect(()=>{if(!n||!c)return;s.current.__escapeKeyBubbles=D,s.current.__outsidePressBubbles=P;function F(L){o(!1,L,"ancestor-scroll")}const $=me(a);C&&$.addEventListener("keydown",k?B:N,k),T&&$.addEventListener(b,A?_:K,A);let j=[];return w&&(X(l)&&(j=xe(l)),X(a)&&(j=j.concat(xe(a))),!X(i)&&i&&i.contextElement&&(j=j.concat(xe(i.contextElement)))),j=j.filter(L=>{var te;return L!==((te=$.defaultView)==null?void 0:te.visualViewport)}),j.forEach(L=>{L.addEventListener("scroll",F,{passive:!0})}),()=>{C&&$.removeEventListener("keydown",k?B:N,k),T&&$.removeEventListener(b,A?_:K,A),j.forEach(L=>{L.removeEventListener("scroll",F)})}},[s,a,l,i,C,T,b,n,o,w,c,D,P,N,k,B,K,A,_]),E.useEffect(()=>{R.current=!1},[T,b]),E.useMemo(()=>c?{reference:{onKeyDown:N,[oa[x]]:F=>{u&&o(!1,F.nativeEvent,"reference-press")}},floating:{onKeyDown:N,onMouseDown(){I.current=!0},onMouseUp(){I.current=!0},[ia[b]]:()=>{R.current=!0}}}:{},[c,u,b,x,o,N])}let Lt;process.env.NODE_ENV!=="production"&&(Lt=new Set);function Uo(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:o,nodeId:r}=e;if(process.env.NODE_ENV!=="production"){var i;const P="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";if((i=e.elements)!=null&&i.reference&&!X(e.elements.reference)){var l;if(!((l=Lt)!=null&&l.has(P))){var a;(a=Lt)==null||a.add(P),console.error(P)}}}const[s,c]=E.useState(null),C=((t=e.elements)==null?void 0:t.reference)||s,m=xl(e),b=Jt(),u=Ul()!=null,x=Ve((P,k,A)=>{P&&(g.current.openEvent=k),y.emit("openchange",{open:P,event:k,reason:A,nested:u}),o==null||o(P,k,A)}),w=E.useRef(null),g=E.useRef({}),y=E.useState(()=>ql())[0],v=yt(),V=E.useCallback(P=>{const k=X(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;m.refs.setReference(k)},[m.refs]),T=E.useCallback(P=>{(X(P)||P===null)&&(w.current=P,c(P)),(X(m.refs.reference.current)||m.refs.reference.current===null||P!==null&&!X(P))&&m.refs.setReference(P)},[m.refs]),R=E.useMemo(()=>({...m.refs,setReference:T,setPositionReference:V,domReference:w}),[m.refs,T,V]),I=E.useMemo(()=>({...m.elements,domReference:C}),[m.elements,C]),D=E.useMemo(()=>({...m,refs:R,elements:I,dataRef:g,nodeId:r,floatingId:v,events:y,open:n,onOpenChange:x}),[m,r,v,y,n,x,R,I]);return ae(()=>{const P=b==null?void 0:b.nodesRef.current.find(k=>k.id===r);P&&(P.context=D)}),E.useMemo(()=>({...m,context:D,refs:R,elements:I}),[m,R,I,D])}const jn="active",kn="selected";function Et(e,t,n){const o=new Map,r=n==="item";let i=e;if(r&&e){const{[jn]:l,[kn]:a,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1},...i,...t.map(l=>{const a=l?l[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((l,a)=>(a&&Object.entries(a).forEach(s=>{let[c,C]=s;if(!(r&&[jn,kn].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof C=="function"){var m;(m=o.get(c))==null||m.push(C),l[c]=function(){for(var b,u=arguments.length,x=new Array(u),w=0;w<u;w++)x[w]=arguments[w];return(b=o.get(c))==null?void 0:b.map(g=>g(...x)).find(g=>g!==void 0)}}}else l[c]=C}),l),{})}}function Qo(e){e===void 0&&(e=[]);const t=e,n=E.useCallback(i=>Et(i,e,"reference"),t),o=E.useCallback(i=>Et(i,e,"floating"),t),r=E.useCallback(i=>Et(i,e,"item"),e.map(i=>i==null?void 0:i.item));return E.useMemo(()=>({getReferenceProps:n,getFloatingProps:o,getItemProps:r}),[n,o,r])}function ra(e={}){const{initialOpen:t=!1,open:n,onOpenChange:o}=e,[r,i]=E.useState(t),l=n??r,a=o??i,s=Uo({open:l,onOpenChange:a}),c=s.context,C=_o(c,{enabled:n==null}),m=Ho(c,{outsidePressEvent:"mousedown"}),b=Qo([C,m]);return E.useMemo(()=>({open:l,setOpen:a,...b,...s}),[l,a,b,s])}const Go=E.createContext(null),Yo=()=>{const e=E.useContext(Go);if(e==null)throw new Error("Dialog components must be wrapped in <Dialog />");return e};function la({children:e,...t}){const n=ra(t);return d.jsx(Go.Provider,{value:n,children:e})}const Xo=O.css`
196
196
  display: flex;
197
197
  justify-content: center;
198
198
  align-items: center;
199
199
  z-index: 100;
200
200
  padding: var(--space-md-fixed);
201
- `,la=O(qo)`
201
+ `,aa=O(qo)`
202
202
  ${Xo};
203
- `,aa=T.forwardRef((e,t)=>{const{style:n,children:o,components:r,...i}=e,l=Yo(),a=Xt([l.refs.setFloating,t]),s=(r==null?void 0:r.Overlay)??la;return d.jsx(zo,{children:d.jsx(s,{lockScroll:!0,children:d.jsx(Wo,{context:l.context,children:d.jsx("div",{ref:a,...l.getFloatingProps(i),children:o})})})})}),sa=aa;function Jo(e){const t=T.useContext(Ke),[n,o]=T.useState(t);return d.jsx(Ke.Provider,{value:n,children:e.children})}const ca=T.forwardRef((e,t)=>{const{setOpen:n}=Yo();return d.jsx("button",{type:"button",...e,ref:t,onClick:o=>{var r;(r=e.onClick)==null||r.call(e,o),n(!1)}})}),ua=ca,da=O.span`
203
+ `,sa=S.forwardRef((e,t)=>{const{style:n,children:o,components:r,...i}=e,l=Yo(),a=Xt([l.refs.setFloating,t]),s=(r==null?void 0:r.Overlay)??aa;return d.jsx(zo,{children:d.jsx(s,{lockScroll:!0,children:d.jsx(Wo,{context:l.context,children:d.jsx("div",{ref:a,...l.getFloatingProps(i),children:o})})})})}),ca=sa;function Jo(e){const t=S.useContext(Ke),[n,o]=S.useState(t);return d.jsx(Ke.Provider,{value:n,children:e.children})}const ua=S.forwardRef((e,t)=>{const{setOpen:n}=Yo();return d.jsx("button",{type:"button",...e,ref:t,onClick:o=>{var r;(r=e.onClick)==null||r.call(e,o),n(!1)}})}),da=ua,fa=O.span`
204
204
  color: var(--color-explain-header-value-color);
205
205
  overflow: hidden;
206
206
  white-space: nowrap;
207
207
  text-overflow: ellipsis;
208
- `;function Zo(e){const{explainQuestion:t}=ge(),{configurationSubjectTitle:n,componentDecisionStateIncludedLabel:o,componentDecisionStateExcludedLabel:r,booleanDecisionStateFalseLabel:i,booleanDecisionStateTrueLabel:l,isBlockedSuffix:a,isNotSatisfiedSuffix:s,generalConflictTitle:c}=Wt();if(!t)return d.jsx("div",{...e,children:c});const C=M.match(t).returnType().with({subject:h.ExplainQuestionSubject.configuration},()=>n).with({subject:h.ExplainQuestionSubject.attribute},b=>pt(b.attributeId)??b.attributeId.localId).with({subject:h.ExplainQuestionSubject.choiceValue},b=>_e(b.attributeId).get(b.choiceValueId)??b.choiceValueId).with({subject:h.ExplainQuestionSubject.component,state:h.ComponentDecisionState.Included},()=>o).with({subject:h.ExplainQuestionSubject.component,state:h.ComponentDecisionState.Excluded},()=>r).with({subject:h.ExplainQuestionSubject.boolean,state:!0},()=>l).with({subject:h.ExplainQuestionSubject.boolean,state:!1},()=>i).with({subject:h.ExplainQuestionSubject.numeric},b=>b.state.toString()).exhaustive(),m=M.match(t).returnType().with({question:h.ExplainQuestionType.whyIsStateNotPossible},()=>a).with({question:h.ExplainQuestionType.whyIsNotSatisfied},()=>s).exhaustive();return d.jsxs("div",{...e,children:[d.jsx(da,{children:C})," ",m]})}const fa=O.div`
208
+ `;function Zo(e){const{explainQuestion:t}=ge(),{configurationSubjectTitle:n,componentDecisionStateIncludedLabel:o,componentDecisionStateExcludedLabel:r,booleanDecisionStateFalseLabel:i,booleanDecisionStateTrueLabel:l,isBlockedSuffix:a,isNotSatisfiedSuffix:s,generalConflictTitle:c}=Wt();if(!t)return d.jsx("div",{...e,children:c});const C=M.match(t).returnType().with({subject:h.ExplainQuestionSubject.configuration},()=>n).with({subject:h.ExplainQuestionSubject.attribute},b=>pt(b.attributeId)??b.attributeId.localId).with({subject:h.ExplainQuestionSubject.choiceValue},b=>_e(b.attributeId).get(b.choiceValueId)??b.choiceValueId).with({subject:h.ExplainQuestionSubject.component,state:h.ComponentDecisionState.Included},()=>o).with({subject:h.ExplainQuestionSubject.component,state:h.ComponentDecisionState.Excluded},()=>r).with({subject:h.ExplainQuestionSubject.boolean,state:!0},()=>l).with({subject:h.ExplainQuestionSubject.boolean,state:!1},()=>i).with({subject:h.ExplainQuestionSubject.numeric},b=>b.state.toString()).exhaustive(),m=M.match(t).returnType().with({question:h.ExplainQuestionType.whyIsStateNotPossible},()=>a).with({question:h.ExplainQuestionType.whyIsNotSatisfied},()=>s).exhaustive();return d.jsxs("div",{...e,children:[d.jsx(fa,{children:C})," ",m]})}const pa=O.div`
209
209
  position: sticky;
210
210
  top: 0;
211
211
  transition: all 0.1s;
@@ -219,7 +219,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
219
219
  @media only screen and (min-resolution: 2dppx) {
220
220
  border-top-width: 0.5px;
221
221
  }
222
- `;function pa(e){const[t,n]=T.useState(!1),o=T.useRef(null);return T.useEffect(()=>{const r=new IntersectionObserver(([l])=>n(!l.isIntersecting),{root:null,threshold:1}),i=o.current;return i&&r.observe(i),()=>{i&&r.unobserve(i)}},[]),d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:o}),d.jsx(fa,{...oo(e,{className:Bi(t&&"active")})})]})}const ha=O(f.motion.div)`
222
+ `;function ha(e){const[t,n]=S.useState(!1),o=S.useRef(null);return S.useEffect(()=>{const r=new IntersectionObserver(([l])=>n(!l.isIntersecting),{root:null,threshold:1}),i=o.current;return i&&r.observe(i),()=>{i&&r.unobserve(i)}},[]),d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:o}),d.jsx(pa,{...oo(e,{className:$i(t&&"active")})})]})}const ma=O(f.motion.div)`
223
223
  position: relative;
224
224
  background-color: var(--color-explain-dialog-fill);
225
225
  backdrop-filter: var(--backdrop-filter-explain-dialog);
@@ -238,16 +238,16 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
238
238
  max-height: min(calc(100vh - var(--space-md) * 2), 700px);
239
239
  max-width: min(calc(100vw - var(--space-md) * 2), 700px);
240
240
  min-width: min(calc(100vw - var(--space-md) * 2), 500px);
241
- `,ma=O.div`
241
+ `,ya=O.div`
242
242
  overflow-y: auto;
243
243
  grid-area: content;
244
244
  padding-left: var(--space-xs-fixed);
245
245
  padding-right: var(--space-xs-fixed);
246
246
  padding-bottom: var(--space-xs-fixed);
247
- `,ya=O(pa)`
247
+ `,ga=O(ha)`
248
248
  margin-left: calc(var(--space-xs-fixed) * -1);
249
249
  margin-right: calc(var(--space-xs-fixed) * -1);
250
- `,ga=O(ua)`
250
+ `,ba=O(da)`
251
251
  position: absolute;
252
252
  right: var(--space-sm-fixed);
253
253
  top: var(--space-sm-fixed);
@@ -262,7 +262,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
262
262
  outline: 2px solid var(--color-explain-dialog-close-button-outline);
263
263
  outline-offset: 1px;
264
264
  }
265
- `,ba=O(Zo)`
265
+ `,xa=O(Zo)`
266
266
  grid-area: header;
267
267
  font-size: var(--text-md);
268
268
  font-weight: 500;
@@ -274,7 +274,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
274
274
  text-overflow: ellipsis;
275
275
  margin-right: var(--space-md);
276
276
  margin-left: calc(var(--space-xs-fixed) + var(--space-sm-fixed));
277
- `,xa={initial:{opacity:0,scale:.5},open:{opacity:1,scale:1,transition:{type:"spring",stiffness:600,damping:40}},close:{opacity:0,scale:.7,transition:{duration:.1,ease:"cubicInOut"}}};function Ca(e){return d.jsxs(ha,{variants:xa,initial:"initial",animate:"open",exit:"close",children:[d.jsx(ba,{}),d.jsxs(ma,{children:[d.jsx(ya,{}),e.children]}),d.jsx(ga,{children:d.jsx(tt.FontAwesomeIcon,{icon:et.faXmark})})]})}const va=O(sa)`
277
+ `,Ca={initial:{opacity:0,scale:.5},open:{opacity:1,scale:1,transition:{type:"spring",stiffness:600,damping:40}},close:{opacity:0,scale:.7,transition:{duration:.1,ease:"cubicInOut"}}};function va(e){return d.jsxs(ma,{variants:Ca,initial:"initial",animate:"open",exit:"close",children:[d.jsx(xa,{}),d.jsxs(ya,{children:[d.jsx(ga,{}),e.children]}),d.jsx(ba,{children:d.jsx(tt.FontAwesomeIcon,{icon:et.faXmark})})]})}const wa=O(ca)`
278
278
  --color-explain-attribute-value-fill: ${e=>e.attributeValueFill};
279
279
  --color-explain-attribute-value-add-fill: ${e=>e.attributeValueAddFill};
280
280
  --color-explain-attribute-value-add-color: ${e=>e.attributeValueAddColor};
@@ -296,12 +296,12 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
296
296
  &:focus {
297
297
  outline: none;
298
298
  }
299
- `;function wa(e){const t=ge(),n=(t==null?void 0:t.displayMode)==="dialog";return d.jsx(ra,{open:n,onOpenChange:o=>!o&&n&&(t==null?void 0:t.dismiss()),children:d.jsx(Sa,{...e,isOpen:n,children:T.Children.toArray(e.content)[0]??d.jsx(Ca,{children:d.jsx(Pr,{})})})})}function Sa(e){return d.jsx(f.AnimatePresence,{initial:!1,children:e.isOpen&&d.jsx(Kt.Provider,{value:e,children:d.jsx(va,{...e,components:{Overlay:Aa},children:d.jsx(Jo,{children:e.children})})})})}const Ta=O(f.motion(qo))`
299
+ `;function Sa(e){const t=ge(),n=(t==null?void 0:t.displayMode)==="dialog";return d.jsx(la,{open:n,onOpenChange:o=>!o&&n&&(t==null?void 0:t.dismiss()),children:d.jsx(Ta,{...e,isOpen:n,children:S.Children.toArray(e.content)[0]??d.jsx(va,{children:d.jsx(Vr,{})})})})}function Ta(e){return d.jsx(f.AnimatePresence,{initial:!1,children:e.isOpen&&d.jsx(Kt.Provider,{value:e,children:d.jsx(wa,{...e,components:{Overlay:Aa},children:d.jsx(Jo,{children:e.children})})})})}const Ea=O(f.motion(qo))`
300
300
  ${Xo}
301
- `;function Aa(e){return d.jsx(Ta,{...e,initial:{backgroundColor:"rgba(0,0,0,0)"},animate:{backgroundColor:"rgba(0,0,0,0.1)"},exit:{backgroundColor:"rgba(0,0,0,0)"}})}function Ea(e){const[t,n]=T.useState(null),{explain:o,applySolution:r}=U.useExplain(),i=T.useRef(null),l=T.useCallback(async(u,x,w,g)=>{const y=$i.guid();i.current=y,n(null);try{const v=await u(),V=v,S=v,R=(V==null?void 0:V.decisionExplanations)??[],I=(S==null?void 0:S.constraintExplanations)??[];y==i.current&&n({controlId:g,displayMode:R.length===0&&I.length>0?"dialog":w,explainQuestion:x,hasError:!1,decisionExplanations:Ra(R),constraintExplanations:I})}catch{y==i.current&&n({controlId:g,displayMode:w,explainQuestion:x,hasError:!0,decisionExplanations:null,constraintExplanations:null})}},[]),a=T.useCallback((u,x,w)=>{const g=typeof u=="function"?u(h.explainQuestionBuilder):u;return l(()=>e.explainConstraints?o(g,"full"):o(g,"decisions"),g,x,w)},[e.explainConstraints,o,l]),s=T.useCallback((u,x,w)=>l(()=>Promise.resolve(u),null,x,w),[l]),c=T.useCallback(()=>{n(null)},[]),C=T.useCallback(u=>(c(),r(u)),[r,c]),m=T.useCallback(u=>{n(x=>x!=null?{...x,displayMode:u}:x)},[]),b=T.useMemo(()=>({process:t,applySolution:C,explain:a,handleExplainAnswer:s,dismiss:c,switchMode:m}),[t,C,a,s,c,m]);return d.jsx(Ke.Provider,{value:b,children:e.children})}function Ra(e){const t=p.pipe(p.Bool.Ord,p.Ord.contramap(o=>o.solution==null)),n=p.pipe(p.Num.Ord,p.Ord.contramap(o=>o.causedByDecisions.length));return p.pipe(e,p.RA.sortBy([t,n]))}const Fe=new Map;function ct(e){const{singletonId:t,children:n}=e,[o,r]=T.useState(!1),i=T.useRef({chose:()=>r(!0)});return T.useEffect(()=>(Ia(t,i.current),()=>Pa(t,i.current)),[]),o?d.jsx(d.Fragment,{children:n}):null}function Ia(e,t){Da(e).candidates.add(t),ei(e)}function Pa(e,t){let n=Fe.get(e);n!=null&&(n.candidates.delete(t),n.chosen===t&&(n.chosen=null),Va(e),ei(e))}function ei(e){let t=Fe.get(e);if(t==null||t.chosen!=null)return;const n=t.candidates.values().next().value;n!=null&&(t.chosen=n,n.chose())}function Va(e){let t=Fe.get(e);t==null||t.candidates.size>0||Fe.delete(e)}function Da(e){let t=Fe.get(e);return t==null&&(t={chosen:null,candidates:new Set},Fe.set(e,t)),t}const oe={attributeId:{title:"Attribute Id",type:f.ControlType.String},componentPath:{title:"Component Path",type:f.ControlType.String},sharedConfigurationModel:{title:"Shared Configuration Model",type:f.ControlType.String}},Fn={description:{title:"Description",type:f.ControlType.String},regex:{title:"Regex",type:f.ControlType.String},direction:{title:"Direction",type:f.ControlType.Enum,defaultValue:"asc",options:["asc","desc"],displaySegmentedControl:!0},mode:{title:"Mode",type:f.ControlType.Enum,defaultValue:"isMatch",options:["isMatch","string","numeric"]}},Oa={choiceValueSorting:{title:"Choice Value Sorting",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{defaultRules:{title:"Default Rules",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:Fn}},attributes:{title:"Attribute",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...oe,choiceValues:{title:"Choice Values",type:f.ControlType.Array,control:{type:f.ControlType.String}},rules:{title:"Rules",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:Fn}}}}},jsonDefinition:{title:"Definition – JSON",type:f.ControlType.String,displayTextArea:!0}}}};function ja(e,t){const n=[],o=(i,l)=>{const a=n.find(c=>e.equals(c.first,i)&&e.equals(c.second,l));if(a)return a.ordering;const s=t.compare(i,l);return n.push({first:i,second:l,ordering:s}),s},r=p.Ord.fromCompare(o);return{cachedOrderings:n,...r}}function ka(){const e=[];return{getCache:(t,n)=>{const o=e.find(i=>i.eq===t&&i.ord===n);if(o)return o.ordCache;const r=ja(t,n);return e.push({eq:t,ord:n,ordCache:r}),r}}}const ti=p.Ord.getMonoid(),Fa=new Intl.Collator("en",{sensitivity:"base"}),Na=new Intl.Collator("en",{sensitivity:"variant"}),La={regex:".*",direction:"asc",mode:"string"},Ma=p.pipe([Fa,Na],p.RA.map(Ha),p.MO.concatAll(p.Ord.getMonoid())),Ba=p.pipe(p.Bool.Ord,p.Ord.contramap(e=>p.O.isSome(e))),$a=p.Num.Ord;function za(e,t){return p.pipe((t==null?void 0:t.attributes)??[],p.RA.findFirst(n=>h.globalAttributeIdEq.equals(Z(n),e)),p.O.map(n=>[Ka(n.choiceValues??[]),Nn(n.rules??[])]),p.O.getOrElse(()=>[Nn((t==null?void 0:t.defaultRules)??[])]),p.RA.append(ni(La)),p.MO.concatAll(ti))}function Ka(e){return p.pipe(p.Num.Ord,p.Ord.reverse,p.O.getOrd,p.Ord.reverse,p.Ord.contramap(t=>p.pipe(e,p.RA.findIndex(n=>p.Str.Eq.equals(t,n)))))}function Nn(e){return p.pipe(e,p.RA.map(ni),p.MO.concatAll(ti))}function ni(e){const t=p.O.tryCatch(()=>new RegExp(e.regex)),n=M.match(e.mode).returnType().with("string",()=>Wa(e.direction)).with("numeric",()=>qa(e.direction)).with("isMatch",()=>_a(e.direction)).exhaustive();return p.pipe(n,p.Ord.contramap(o=>p.pipe(t,p.O.chainNullableK(r=>(r.lastIndex=0,r[Symbol.match](o))),p.O.chain(r=>p.pipe(r,p.RA.lookup(1),p.O.alt(()=>p.pipe(r,p.RA.lookup(0))))))))}function Wa(e){return p.pipe(Ma,tn(e),oi)}function qa(e){return p.pipe($a,tn(e),oi,p.Ord.contramap(p.O.chain(p.Num.parseFloatO)))}function _a(e){return p.pipe(Ba,tn(e))}function oi(e){return p.pipe(e,p.Ord.reverse,p.O.getOrd,p.Ord.reverse)}function tn(e){return t=>M.match(e).returnType().with("asc",()=>t).with("desc",()=>p.Ord.reverse(t)).exhaustive()}function Ha(e){return p.Ord.fromCompare((t,n)=>M.match(e.compare(t,n)).returnType().with(M.P.number.gt(0),()=>1).with(M.P.number.lt(0),()=>-1).otherwise(()=>0))}const Ua=ka(),ii=T.createContext(null);function ut(e,t){const n=T.useContext(ii),o=T.useMemo(()=>p.pipe(za(e,n),i=>Ua.getCache(p.Str.Eq,i),p.Ord.contramap(i=>i.id)),[]),{attribute:r}=U.useChoiceAttribute(e);return p.pipe(t??(r==null?void 0:r.values)??[],p.RA.sort(o))}const Qa={localization:{title:"Localization",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:f.ControlType.String,displayTextArea:!0}}}};globalThis&&globalThis.__spreadArray;function Ga(e){return e}globalThis&&globalThis.__spreadArray;var Ya=function(e){return{_tag:"Left",left:e}},Xa=function(e){return{_tag:"Right",right:e}},Ja=Ya,Za=Xa,es=function(e,t){try{return Za(e())}catch(n){return Ja(t(n))}},ts=function(e){return es(function(){return JSON.parse(e)},Ga)};const dt=J.z.object({localId:J.z.string(),componentPath:J.z.string().array().optional().nullish(),sharedConfigurationModelId:J.z.string().optional().nullish()});function ri(e){var t;return{sharedConfigurationModel:e.sharedConfigurationModelId??"",componentPath:((t=e.componentPath)==null?void 0:t.join(" -> "))??"",attributeId:e.localId}}function nn(e,t,n){return o=>T.useMemo(()=>p.pipe(o,p.O.fromNullable,p.O.filter(p.P.not(p.Str.isEmpty)),p.E.fromOption(()=>null),p.E.chain(p.flow(ts,p.E.mapLeft(r=>`The JSON content could not be parsed. Please check for syntax errors.
302
- `+r.toString()),p.E.chain(r=>p.pipe(t.safeParse(r),i=>i.success?p.E.right(i.data):p.E.left(i.error),p.E.mapLeft(i=>zi.fromError(i,{maxIssuesInMessage:5,issueSeparator:`
301
+ `;function Aa(e){return d.jsx(Ea,{...e,initial:{backgroundColor:"rgba(0,0,0,0)"},animate:{backgroundColor:"rgba(0,0,0,0.1)"},exit:{backgroundColor:"rgba(0,0,0,0)"}})}function Ra(e){const[t,n]=S.useState(null),{explain:o,applySolution:r}=U.useExplain(),i=S.useRef(null),l=S.useCallback(async(u,x,w,g)=>{const y=zi.guid();i.current=y,n(null);try{const v=await u(),V=v,T=v,R=(V==null?void 0:V.decisionExplanations)??[],I=(T==null?void 0:T.constraintExplanations)??[];y==i.current&&n({controlId:g,displayMode:R.length===0&&I.length>0?"dialog":w,explainQuestion:x,hasError:!1,decisionExplanations:Ia(R),constraintExplanations:I})}catch{y==i.current&&n({controlId:g,displayMode:w,explainQuestion:x,hasError:!0,decisionExplanations:null,constraintExplanations:null})}},[]),a=S.useCallback((u,x,w)=>{const g=typeof u=="function"?u(h.explainQuestionBuilder):u;return l(()=>e.explainConstraints?o(g,"full"):o(g,"decisions"),g,x,w)},[e.explainConstraints,o,l]),s=S.useCallback((u,x,w)=>l(()=>Promise.resolve(u),null,x,w),[l]),c=S.useCallback(()=>{n(null)},[]),C=S.useCallback(u=>(c(),r(u)),[r,c]),m=S.useCallback(u=>{n(x=>x!=null?{...x,displayMode:u}:x)},[]),b=S.useMemo(()=>({process:t,applySolution:C,explain:a,handleExplainAnswer:s,dismiss:c,switchMode:m}),[t,C,a,s,c,m]);return d.jsx(Ke.Provider,{value:b,children:e.children})}function Ia(e){const t=p.pipe(p.Bool.Ord,p.Ord.contramap(o=>o.solution==null)),n=p.pipe(p.Num.Ord,p.Ord.contramap(o=>o.causedByDecisions.length));return p.pipe(e,p.RA.sortBy([t,n]))}const Fe=new Map;function ct(e){const{singletonId:t,children:n}=e,[o,r]=S.useState(!1),i=S.useRef({chose:()=>r(!0)});return S.useEffect(()=>(Pa(t,i.current),()=>Va(t,i.current)),[]),o?d.jsx(d.Fragment,{children:n}):null}function Pa(e,t){Oa(e).candidates.add(t),ei(e)}function Va(e,t){let n=Fe.get(e);n!=null&&(n.candidates.delete(t),n.chosen===t&&(n.chosen=null),Da(e),ei(e))}function ei(e){let t=Fe.get(e);if(t==null||t.chosen!=null)return;const n=t.candidates.values().next().value;n!=null&&(t.chosen=n,n.chose())}function Da(e){let t=Fe.get(e);t==null||t.candidates.size>0||Fe.delete(e)}function Oa(e){let t=Fe.get(e);return t==null&&(t={chosen:null,candidates:new Set},Fe.set(e,t)),t}const oe={attributeId:{title:"Attribute Id",type:f.ControlType.String},componentPath:{title:"Component Path",type:f.ControlType.String},sharedConfigurationModel:{title:"Shared Configuration Model",type:f.ControlType.String}},Fn={description:{title:"Description",type:f.ControlType.String},regex:{title:"Regex",type:f.ControlType.String},direction:{title:"Direction",type:f.ControlType.Enum,defaultValue:"asc",options:["asc","desc"],displaySegmentedControl:!0},mode:{title:"Mode",type:f.ControlType.Enum,defaultValue:"isMatch",options:["isMatch","string","numeric"]}},ja={choiceValueSorting:{title:"Choice Value Sorting",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{defaultRules:{title:"Default Rules",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:Fn}},attributes:{title:"Attribute",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...oe,choiceValues:{title:"Choice Values",type:f.ControlType.Array,control:{type:f.ControlType.String}},rules:{title:"Rules",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:Fn}}}}},jsonDefinition:{title:"Definition – JSON",type:f.ControlType.String,displayTextArea:!0}}}};function ka(e,t){const n=[],o=(i,l)=>{const a=n.find(c=>e.equals(c.first,i)&&e.equals(c.second,l));if(a)return a.ordering;const s=t.compare(i,l);return n.push({first:i,second:l,ordering:s}),s},r=p.Ord.fromCompare(o);return{cachedOrderings:n,...r}}function Fa(){const e=[];return{getCache:(t,n)=>{const o=e.find(i=>i.eq===t&&i.ord===n);if(o)return o.ordCache;const r=ka(t,n);return e.push({eq:t,ord:n,ordCache:r}),r}}}const ti=p.Ord.getMonoid(),Na=new Intl.Collator("en",{sensitivity:"base"}),La=new Intl.Collator("en",{sensitivity:"variant"}),Ma={regex:".*",direction:"asc",mode:"string"},Ba=p.pipe([Na,La],p.RA.map(Ua),p.MO.concatAll(p.Ord.getMonoid())),$a=p.pipe(p.Bool.Ord,p.Ord.contramap(e=>p.O.isSome(e))),za=p.Num.Ord;function Ka(e,t){return p.pipe((t==null?void 0:t.attributes)??[],p.RA.findFirst(n=>h.globalAttributeIdEq.equals(Z(n),e)),p.O.map(n=>[Wa(n.choiceValues??[]),Nn(n.rules??[])]),p.O.getOrElse(()=>[Nn((t==null?void 0:t.defaultRules)??[])]),p.RA.append(ni(Ma)),p.MO.concatAll(ti))}function Wa(e){return p.pipe(p.Num.Ord,p.Ord.reverse,p.O.getOrd,p.Ord.reverse,p.Ord.contramap(t=>p.pipe(e,p.RA.findIndex(n=>p.Str.Eq.equals(t,n)))))}function Nn(e){return p.pipe(e,p.RA.map(ni),p.MO.concatAll(ti))}function ni(e){const t=p.O.tryCatch(()=>new RegExp(e.regex)),n=M.match(e.mode).returnType().with("string",()=>qa(e.direction)).with("numeric",()=>_a(e.direction)).with("isMatch",()=>Ha(e.direction)).exhaustive();return p.pipe(n,p.Ord.contramap(o=>p.pipe(t,p.O.chainNullableK(r=>(r.lastIndex=0,r[Symbol.match](o))),p.O.chain(r=>p.pipe(r,p.RA.lookup(1),p.O.alt(()=>p.pipe(r,p.RA.lookup(0))))))))}function qa(e){return p.pipe(Ba,tn(e),oi)}function _a(e){return p.pipe(za,tn(e),oi,p.Ord.contramap(p.O.chain(p.Num.parseFloatO)))}function Ha(e){return p.pipe($a,tn(e))}function oi(e){return p.pipe(e,p.Ord.reverse,p.O.getOrd,p.Ord.reverse)}function tn(e){return t=>M.match(e).returnType().with("asc",()=>t).with("desc",()=>p.Ord.reverse(t)).exhaustive()}function Ua(e){return p.Ord.fromCompare((t,n)=>M.match(e.compare(t,n)).returnType().with(M.P.number.gt(0),()=>1).with(M.P.number.lt(0),()=>-1).otherwise(()=>0))}const Qa=Fa(),ii=S.createContext(null);function ut(e,t){const n=S.useContext(ii),o=S.useMemo(()=>p.pipe(Ka(e,n),i=>Qa.getCache(p.Str.Eq,i),p.Ord.contramap(i=>i.id)),[]),{attribute:r}=U.useChoiceAttribute(e);return p.pipe(t??(r==null?void 0:r.values)??[],p.RA.sort(o))}const Ga={localization:{title:"Localization",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:f.ControlType.String,displayTextArea:!0}}}};globalThis&&globalThis.__spreadArray;function Ya(e){return e}globalThis&&globalThis.__spreadArray;var Xa=function(e){return{_tag:"Left",left:e}},Ja=function(e){return{_tag:"Right",right:e}},Za=Xa,es=Ja,ts=function(e,t){try{return es(e())}catch(n){return Za(t(n))}},ns=function(e){return ts(function(){return JSON.parse(e)},Ya)};const dt=J.z.object({localId:J.z.string(),componentPath:J.z.string().array().optional().nullish(),sharedConfigurationModelId:J.z.string().optional().nullish()});function ri(e){var t;return{sharedConfigurationModel:e.sharedConfigurationModelId??"",componentPath:((t=e.componentPath)==null?void 0:t.join(" -> "))??"",attributeId:e.localId}}function nn(e,t,n){return o=>S.useMemo(()=>p.pipe(o,p.O.fromNullable,p.O.filter(p.P.not(p.Str.isEmpty)),p.E.fromOption(()=>null),p.E.chain(p.flow(ns,p.E.mapLeft(r=>`The JSON content could not be parsed. Please check for syntax errors.
302
+ `+r.toString()),p.E.chain(r=>p.pipe(t.safeParse(r),i=>i.success?p.E.right(i.data):p.E.left(i.error),p.E.mapLeft(i=>Ki.fromError(i,{maxIssuesInMessage:5,issueSeparator:`
303
303
  - `})),p.E.mapLeft(i=>`The JSON schema is invalid. Ensure all required fields and types are correctly defined.
304
- `+i.toString()))),p.E.map(n),p.E.mapLeft(r=>d.jsx(ro,{type:"warning",title:e+" definition is invalid and was ignored",message:r}))))),[o])}const li=J.z.object({attributeId:dt,name:J.z.array(J.z.object({localeCode:J.z.string(),translation:J.z.string()}))}),ns=li.extend({choiceValueId:J.z.string()}),os=J.z.object({attributes:li.array().optional().nullish(),choiceValues:ns.array().optional().nullish()});function Ln(e){return{...ri(e.attributeId),name:p.pipe(e.name,p.RA.map(t=>t),p.RA.toArray)}}function is(e){const t=p.pipe(e.attributes??[],p.RA.map(Ln),p.RA.toArray),n=p.pipe(e.choiceValues??[],p.RA.map(o=>({...Ln(o),choiceValueId:o.choiceValueId})),p.RA.toArray);return{attributes:t,choiceValues:n}}const rs=nn("Localization",os,is),ls=rs,Mn=J.z.object({regex:J.z.string(),direction:J.z.enum(["asc","desc"]),mode:J.z.enum(["isMatch","string","numeric"]),description:J.z.string().optional()}),as=J.z.object({defaultRules:Mn.array().optional().nullish(),attributes:J.z.object({attributeId:dt,choiceValues:J.z.string().array(),rules:Mn.array()}).array().optional().nullish()});function ss(e){const t=p.pipe(e.defaultRules??[],p.RA.map(o=>o),p.RA.toArray);return{attributes:p.pipe(e.attributes??[],p.RA.map(o=>({...ri(o.attributeId),choiceValues:p.RA.toArray(o.choiceValues),rules:p.pipe(o.rules,p.RA.map(r=>r),p.RA.toArray)})),p.RA.toArray),defaultRules:t}}const cs=nn("ChoiceValueSorting",as,ss),us=cs,ds=J.z.object({attributeId:dt,decisions:dt.array()}),fs=ds.array(),ps=nn("AttributeRelations",fs,e=>e),hs=ps,ms={wizardAttributeRelations:{title:"Wizard Attribute Relations",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{wizardSteps:{title:"Wizard Steps",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{name:{title:"Name",type:f.ControlType.String},attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:oe}}}}}}}},ai=se(e=>{var D,P,k,E;const{hcaBaseUrl:t,sessionCreation:n,accessToken:o,sessionCreateUrl:r,sessionDeleteUrl:i,deploymentName:l,channel:a,children:s,explainDialogProps:c,explainPopoverProps:C,explainConstraints:m}=e,{activeLocale:b}=f.useLocaleInfo(),u=b.code;if(T.useEffect(()=>{console.info("Current locale code:",u)},[u]),X())return d.jsxs(d.Fragment,{children:[s,d.jsx(ct,{singletonId:"Configuration",children:d.jsx(sn,{})})]});const w=hs((D=e.attributeRelations)==null?void 0:D.jsonDefinition),g=T.useMemo(()=>p.pipe(w,p.O.fromEither,p.O.toNullable),[w]),y=us((P=e.choiceValueSorting)==null?void 0:P.jsonDefinition),v=T.useMemo(()=>p.pipe(y,p.E.orElse(()=>p.pipe(e.choiceValueSorting,p.E.fromNullable(null))),p.E.getOrElse(()=>({attributes:[],defaultRules:[]}))),[y,e.choiceValueSorting]),V=ls((k=e.localization)==null?void 0:k.jsonDefinition),S=T.useMemo(()=>p.pipe(V,p.E.getOrElse(()=>({attributes:[],choiceValues:[]}))),[V]),R=p.pipe((E=e.wizardAttributeRelations)==null?void 0:E.wizardSteps,p.O.fromNullable,p.O.filter(p.RA.isNonEmpty),p.O.map(p.RA.map(N=>({attributes:p.pipe(N.attributes,p.RA.map(Z))}))),p.O.toNullable),I=T.useMemo(()=>({apiBaseUrl:Li(t,"api","engine"),sessionInitialisationOptions:M.match(n).with("client-side",()=>({accessToken:o})).with("server-side",()=>({sessionCreateUrl:r})).exhaustive(),configurationModelSource:{type:h.ConfigurationModelSourceType.Channel,channel:a,deploymentName:l},attributeRelations:g,wizardAttributeRelations:R,allowedInExplain:{rules:{type:h.AllowedRulesInExplainType.all}}}),[t,n,o,r,i,a,l,g]);return d.jsxs(d.Fragment,{children:[d.jsxs(U.Configuration,{sessionContext:I,children:[p.pipe(V,p.E.swap,p.O.fromEither,p.O.toNullable),p.pipe(y,p.E.swap,p.O.fromEither,p.O.toNullable),p.pipe(w,p.E.swap,p.O.fromEither,p.O.toNullable),d.jsx(Zi,{...e}),d.jsx(T.Suspense,{children:d.jsx(ft.Provider,{value:S,children:d.jsxs(Ea,{explainConstraints:m,children:[d.jsx($t.Provider,{value:C,children:d.jsx(ii.Provider,{value:v,children:s})}),d.jsx(wa,{...c})]})})})]}),d.jsx(ct,{singletonId:"Configuration",children:d.jsx(sn,{})})]})}),ys=ai;f.addPropertyControls(ai,{children:{title:"Content",type:f.ControlType.ComponentInstance},channel:{type:f.ControlType.String,title:"Channel",defaultValue:"release"},deploymentName:{type:f.ControlType.String,title:"Deployment Name"},hcaBaseUrl:{title:"HCA Base URL",type:f.ControlType.String,defaultValue:"https://spc.cloud.ceventis.de/hca"},sessionCreation:{title:"Session Creation",type:f.ControlType.Enum,displaySegmentedControl:!0,segmentedControlDirection:"horizontal",defaultValue:"client-side",options:["client-side","server-side"]},accessToken:{title:"HCA Access Token",type:f.ControlType.String,obscured:!0,hidden:e=>e.sessionCreation!=="client-side"},sessionCreateUrl:{title:"Create Session URl",type:f.ControlType.String,hidden:e=>e.sessionCreation!=="server-side"},sessionDeleteUrl:{title:"Close Session URl",type:f.ControlType.String,hidden:e=>e.sessionCreation!=="server-side"},configurationModelNotFoundContent:{title:"Content – Configuration Model not found",type:f.ControlType.ComponentInstance},errorContent:{title:"Content – Error",type:f.ControlType.ComponentInstance},accessTokenInvalidContent:{title:"Content – HCA Access Token invalid",type:f.ControlType.ComponentInstance},accessTokenRestrictionContent:{title:"Content – HCA Access Token restriction",type:f.ControlType.ComponentInstance},explainDialogProps:{title:"Explain Dialog",type:f.ControlType.Object,optional:!1,controls:cr,buttonTitle:"Props…"},explainPopoverProps:{title:"Explain Popover",type:f.ControlType.Object,optional:!1,controls:sr,buttonTitle:"Props…"},explainConstraints:{title:"Explain Constraints",type:f.ControlType.Boolean,defaultValue:!1},attributeRelations:{title:"Attribute Relations",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:f.ControlType.String,displayTextArea:!0}}},...ms,...Oa,...Qa});const si={padding:{type:f.ControlType.FusedNumber,title:"Padding",toggleKey:"isMixedPadding",toggleTitles:["Padding","Padding per Side"],valueKeys:["paddingTop","paddingRight","paddingBottom","paddingLeft"],valueLabels:["Top","Right","Bottom","Left"],min:0,defaultValue:0}},gs=e=>({paddingTop:e.isMixedPadding?e.paddingTop:e.padding,paddingRight:e.isMixedPadding?e.paddingRight:e.padding,paddingBottom:e.isMixedPadding?e.paddingBottom:e.padding,paddingLeft:e.isMixedPadding?e.paddingLeft:e.padding}),bs={radius:{title:"Radius",type:f.ControlType.Number,defaultValue:6},...si,border:{title:"Border",type:f.ControlType.Object,controls:{color:{type:f.ControlType.Color,title:"Color"},width:{type:f.ControlType.FusedNumber,title:"Width",toggleKey:"isMixedWidth",toggleTitles:["Width","Width per Side"],valueKeys:["widthTop","widthRight","widthBottom","widthLeft"],valueLabels:["Top","Right","Bottom","Left"],min:0,defaultValue:0}}}},xs=e=>{var t,n,o,r,i,l,a,s,c,C,m,b,u;return{borderRadius:e.radius,borderColor:(t=e.border)==null?void 0:t.color,borderTopWidth:(n=e.border)!=null&&n.isMixedWidth?(o=e.border)==null?void 0:o.widthTop:(r=e.border)==null?void 0:r.width,borderRightWidth:(i=e.border)!=null&&i.isMixedWidth?(l=e.border)==null?void 0:l.widthRight:(a=e.border)==null?void 0:a.width,borderBottomWidth:(s=e.border)!=null&&s.isMixedWidth?(c=e.border)==null?void 0:c.widthBottom:(C=e.border)==null?void 0:C.width,borderLeftWidth:(m=e.border)!=null&&m.isMixedWidth?(b=e.border)==null?void 0:b.widthLeft:(u=e.border)==null?void 0:u.width}},Cs={fill:{title:"Fill",type:f.ControlType.Color,defaultValue:"#EBEBEB"},...si,...bs},vs=e=>({...gs(e),...xs(e),backgroundColor:e.fill}),ws={color:{title:"Color",type:f.ControlType.Color,defaultValue:"black"},text:{title:"Text",type:f.ControlType.Font,controls:"basic",displayTextAlignment:!0,displayFontSize:!0}},Ss=e=>({...e.text,color:e.color}),Le={explain:{title:"Explain",type:f.ControlType.Enum,defaultValue:"popover",options:["popover","dialog","disabled"]}},Mt={type:f.ControlType.Object,optional:!0,controls:{fill:{title:"Fill",type:f.ControlType.Color,optional:!0},color:{title:"Color",type:f.ControlType.Color,optional:!0},borderColor:{title:"Border Color",type:f.ControlType.Color,optional:!0}}},ci={...oe,...ws,...Cs,implicitLabelPrefix:{title:"Implicit Label Prefix",type:f.ControlType.String,defaultValue:"Implicit: "},unsatisfiedColors:{...Mt,title:"Unsatisfied Colors"},implicitSelectedColors:{...Mt,title:"Implicit Selected Colors"},...Le},Bt=(e,t,n)=>{var i,l,a,s,c,C;const o=vs(e),r=Ss(e);return{...o,...r,backgroundColor:M.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedFill:(i=e.unsatisfiedColors)==null?void 0:i.fill,implicitSelectedFill:(l=e.implicitSelectedColors)==null?void 0:l.fill}).with({isSatisfied:!1,unsatisfiedFill:M.P.string.minLength(1)},m=>m.unsatisfiedFill).with({isImplicitSelected:!0,implicitSelectedFill:M.P.string.minLength(1)},m=>m.implicitSelectedFill).otherwise(()=>o.backgroundColor),borderColor:M.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedBorderColor:(a=e.unsatisfiedColors)==null?void 0:a.borderColor,implicitSelectedBorderColor:(s=e.implicitSelectedColors)==null?void 0:s.borderColor}).with({isSatisfied:!1,unsatisfiedBorderColor:M.P.string.minLength(1)},m=>m.unsatisfiedBorderColor).with({isImplicitSelected:!0,implicitSelectedBorderColor:M.P.string.minLength(1)},m=>m.implicitSelectedBorderColor).otherwise(()=>o.borderColor),color:M.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedColor:(c=e.unsatisfiedColors)==null?void 0:c.color,implicitSelectedColor:(C=e.implicitSelectedColors)==null?void 0:C.color}).with({isSatisfied:!1,unsatisfiedColor:M.P.string.minLength(1)},m=>m.unsatisfiedColor).with({isImplicitSelected:!0,implicitSelectedColor:M.P.string.minLength(1)},m=>m.implicitSelectedColor).otherwise(()=>r.color),...e.style}},on={...ci,resetLabel:{title:"Reset Label",type:f.ControlType.String,defaultValue:"Reset"},blockedLabel:{title:"Blocked Label",type:f.ControlType.String,defaultValue:"Blocked"},appearance:{title:"Appearance",type:f.ControlType.Enum,defaultValue:"auto",displaySegmentedControl:!0,segmentedControlDirection:"horizontal",options:["auto","none"]}},Ne=(e,t,n)=>({...Bt(e,t,n),appearance:e.appearance});function fe(){const{explain:e,handleExplainAnswer:t}=T.useContext(Ke);return{explain:e,handleExplainAnswer:t}}function Ts(e={}){const{initialOpen:t=!1,placement:n="top",modal:o=!1,open:r,onOpenChange:i,arrow:l}=e,[a,s]=T.useState(t),c=r??a,C=i??s,m=Uo({placement:n,open:c,onOpenChange:C,whileElementsMounted:pl,middleware:[Yr(((l==null?void 0:l.height)??0)+5),ml({crossAxis:n.includes("-"),fallbackAxisSideDirection:"end",padding:5}),hl({padding:5}),...l?[gl(l)]:[]]}),b=m.context,u=_o(b,{enabled:r==null}),x=Ho(b),w=Qo([u,x]);return T.useMemo(()=>({open:c,setOpen:C,...w,...m,modal:o,arrow:l}),[c,C,w,m,o,l])}const ui=T.createContext(null),Ge=()=>{const e=T.useContext(ui);if(e==null)throw new Error("Popover components must be wrapped in <Popover />");return e};function As({children:e,...t}){const n=Ts(t);return d.jsx(ui.Provider,{value:n,children:e})}const Es=T.forwardRef(function(t,n){const o=T.Children.toArray(t.children)[0],r=Ge(),i=t.children.ref,l=Xt([r.refs.setReference,n,i]);return T.isValidElement(o)?T.cloneElement(o,r.getReferenceProps({ref:l,...t,...o.props,"data-state":r.open?"open":"closed"})):d.jsx("span",{children:"Not valid children for PopoverTrigger"})}),Rs=Es,Is=O.div`
304
+ `+i.toString()))),p.E.map(n),p.E.mapLeft(r=>d.jsx(ro,{type:"warning",title:e+" definition is invalid and was ignored",message:r}))))),[o])}const li=J.z.object({attributeId:dt,name:J.z.array(J.z.object({localeCode:J.z.string(),translation:J.z.string()}))}),os=li.extend({choiceValueId:J.z.string()}),is=J.z.object({attributes:li.array().optional().nullish(),choiceValues:os.array().optional().nullish()});function Ln(e){return{...ri(e.attributeId),name:p.pipe(e.name,p.RA.map(t=>t),p.RA.toArray)}}function rs(e){const t=p.pipe(e.attributes??[],p.RA.map(Ln),p.RA.toArray),n=p.pipe(e.choiceValues??[],p.RA.map(o=>({...Ln(o),choiceValueId:o.choiceValueId})),p.RA.toArray);return{attributes:t,choiceValues:n}}const ls=nn("Localization",is,rs),as=ls,Mn=J.z.object({regex:J.z.string(),direction:J.z.enum(["asc","desc"]),mode:J.z.enum(["isMatch","string","numeric"]),description:J.z.string().optional()}),ss=J.z.object({defaultRules:Mn.array().optional().nullish(),attributes:J.z.object({attributeId:dt,choiceValues:J.z.string().array(),rules:Mn.array()}).array().optional().nullish()});function cs(e){const t=p.pipe(e.defaultRules??[],p.RA.map(o=>o),p.RA.toArray);return{attributes:p.pipe(e.attributes??[],p.RA.map(o=>({...ri(o.attributeId),choiceValues:p.RA.toArray(o.choiceValues),rules:p.pipe(o.rules,p.RA.map(r=>r),p.RA.toArray)})),p.RA.toArray),defaultRules:t}}const us=nn("ChoiceValueSorting",ss,cs),ds=us,fs=J.z.object({attributeId:dt,decisions:dt.array()}),ps=fs.array(),hs=nn("AttributeRelations",ps,e=>e),ms=hs,ys={wizardAttributeRelations:{title:"Wizard Attribute Relations",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{wizardSteps:{title:"Wizard Steps",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{name:{title:"Name",type:f.ControlType.String},attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:oe}}}}}}}},ai=se(e=>{var D,P,k,A;const{hcaBaseUrl:t,sessionCreation:n,accessToken:o,sessionCreateUrl:r,sessionDeleteUrl:i,deploymentName:l,channel:a,children:s,explainDialogProps:c,explainPopoverProps:C,explainConstraints:m}=e,{activeLocale:b}=f.useLocaleInfo(),u=b.code;if(S.useEffect(()=>{console.info("Current locale code:",u)},[u]),Y())return d.jsxs(d.Fragment,{children:[s,d.jsx(ct,{singletonId:"Configuration",children:d.jsx(sn,{})})]});const w=ms((D=e.attributeRelations)==null?void 0:D.jsonDefinition),g=S.useMemo(()=>p.pipe(w,p.O.fromEither,p.O.toNullable),[w]),y=ds((P=e.choiceValueSorting)==null?void 0:P.jsonDefinition),v=S.useMemo(()=>p.pipe(y,p.E.orElse(()=>p.pipe(e.choiceValueSorting,p.E.fromNullable(null))),p.E.getOrElse(()=>({attributes:[],defaultRules:[]}))),[y,e.choiceValueSorting]),V=as((k=e.localization)==null?void 0:k.jsonDefinition),T=S.useMemo(()=>p.pipe(V,p.E.getOrElse(()=>({attributes:[],choiceValues:[]}))),[V]),R=p.pipe((A=e.wizardAttributeRelations)==null?void 0:A.wizardSteps,p.O.fromNullable,p.O.filter(p.RA.isNonEmpty),p.O.map(p.RA.map(N=>({attributes:p.pipe(N.attributes,p.RA.map(Z))}))),p.O.toNullable),I=S.useMemo(()=>({apiBaseUrl:Mi(t,"api","engine"),sessionInitialisationOptions:M.match(n).with("client-side",()=>({accessToken:o})).with("server-side",()=>({sessionCreateUrl:r})).exhaustive(),configurationModelSource:{type:h.ConfigurationModelSourceType.Channel,channel:a,deploymentName:l},attributeRelations:g,wizardAttributeRelations:R,allowedInExplain:{rules:{type:h.AllowedRulesInExplainType.all}}}),[t,n,o,r,i,a,l,g]);return d.jsxs(d.Fragment,{children:[d.jsxs(U.Configuration,{sessionContext:I,children:[p.pipe(V,p.E.swap,p.O.fromEither,p.O.toNullable),p.pipe(y,p.E.swap,p.O.fromEither,p.O.toNullable),p.pipe(w,p.E.swap,p.O.fromEither,p.O.toNullable),d.jsx(er,{...e}),d.jsx(S.Suspense,{children:d.jsx(ft.Provider,{value:T,children:d.jsxs(Ra,{explainConstraints:m,children:[d.jsx($t.Provider,{value:C,children:d.jsx(ii.Provider,{value:v,children:s})}),d.jsx(Sa,{...c})]})})})]}),d.jsx(ct,{singletonId:"Configuration",children:d.jsx(sn,{})})]})}),gs=ai;f.addPropertyControls(ai,{children:{title:"Content",type:f.ControlType.ComponentInstance},channel:{type:f.ControlType.String,title:"Channel",defaultValue:"release"},deploymentName:{type:f.ControlType.String,title:"Deployment Name"},hcaBaseUrl:{title:"HCA Base URL",type:f.ControlType.String,defaultValue:"https://spc.cloud.ceventis.de/hca"},sessionCreation:{title:"Session Creation",type:f.ControlType.Enum,displaySegmentedControl:!0,segmentedControlDirection:"horizontal",defaultValue:"client-side",options:["client-side","server-side"]},accessToken:{title:"HCA Access Token",type:f.ControlType.String,obscured:!0,hidden:e=>e.sessionCreation!=="client-side"},sessionCreateUrl:{title:"Create Session URl",type:f.ControlType.String,hidden:e=>e.sessionCreation!=="server-side"},sessionDeleteUrl:{title:"Close Session URl",type:f.ControlType.String,hidden:e=>e.sessionCreation!=="server-side"},configurationModelNotFoundContent:{title:"Content – Configuration Model not found",type:f.ControlType.ComponentInstance},errorContent:{title:"Content – Error",type:f.ControlType.ComponentInstance},accessTokenInvalidContent:{title:"Content – HCA Access Token invalid",type:f.ControlType.ComponentInstance},accessTokenRestrictionContent:{title:"Content – HCA Access Token restriction",type:f.ControlType.ComponentInstance},explainDialogProps:{title:"Explain Dialog",type:f.ControlType.Object,optional:!1,controls:ur,buttonTitle:"Props…"},explainPopoverProps:{title:"Explain Popover",type:f.ControlType.Object,optional:!1,controls:cr,buttonTitle:"Props…"},explainConstraints:{title:"Explain Constraints",type:f.ControlType.Boolean,defaultValue:!1},attributeRelations:{title:"Attribute Relations",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:f.ControlType.String,displayTextArea:!0}}},...ys,...ja,...Ga});const si={padding:{type:f.ControlType.FusedNumber,title:"Padding",toggleKey:"isMixedPadding",toggleTitles:["Padding","Padding per Side"],valueKeys:["paddingTop","paddingRight","paddingBottom","paddingLeft"],valueLabels:["Top","Right","Bottom","Left"],min:0,defaultValue:0}},bs=e=>({paddingTop:e.isMixedPadding?e.paddingTop:e.padding,paddingRight:e.isMixedPadding?e.paddingRight:e.padding,paddingBottom:e.isMixedPadding?e.paddingBottom:e.padding,paddingLeft:e.isMixedPadding?e.paddingLeft:e.padding}),xs={radius:{title:"Radius",type:f.ControlType.Number,defaultValue:6},...si,border:{title:"Border",type:f.ControlType.Object,controls:{color:{type:f.ControlType.Color,title:"Color"},width:{type:f.ControlType.FusedNumber,title:"Width",toggleKey:"isMixedWidth",toggleTitles:["Width","Width per Side"],valueKeys:["widthTop","widthRight","widthBottom","widthLeft"],valueLabels:["Top","Right","Bottom","Left"],min:0,defaultValue:0}}}},Cs=e=>{var t,n,o,r,i,l,a,s,c,C,m,b,u;return{borderRadius:e.radius,borderColor:(t=e.border)==null?void 0:t.color,borderTopWidth:(n=e.border)!=null&&n.isMixedWidth?(o=e.border)==null?void 0:o.widthTop:(r=e.border)==null?void 0:r.width,borderRightWidth:(i=e.border)!=null&&i.isMixedWidth?(l=e.border)==null?void 0:l.widthRight:(a=e.border)==null?void 0:a.width,borderBottomWidth:(s=e.border)!=null&&s.isMixedWidth?(c=e.border)==null?void 0:c.widthBottom:(C=e.border)==null?void 0:C.width,borderLeftWidth:(m=e.border)!=null&&m.isMixedWidth?(b=e.border)==null?void 0:b.widthLeft:(u=e.border)==null?void 0:u.width}},vs={fill:{title:"Fill",type:f.ControlType.Color,defaultValue:"#EBEBEB"},...si,...xs},ws=e=>({...bs(e),...Cs(e),backgroundColor:e.fill}),Ss={color:{title:"Color",type:f.ControlType.Color,defaultValue:"black"},text:{title:"Text",type:f.ControlType.Font,controls:"basic",displayTextAlignment:!0,displayFontSize:!0}},Ts=e=>({...e.text,color:e.color}),Le={explain:{title:"Explain",type:f.ControlType.Enum,defaultValue:"popover",options:["popover","dialog","disabled"]}},Mt={type:f.ControlType.Object,optional:!0,controls:{fill:{title:"Fill",type:f.ControlType.Color,optional:!0},color:{title:"Color",type:f.ControlType.Color,optional:!0},borderColor:{title:"Border Color",type:f.ControlType.Color,optional:!0}}},ci={...oe,...Ss,...vs,implicitLabelPrefix:{title:"Implicit Label Prefix",type:f.ControlType.String,defaultValue:"Implicit: "},unsatisfiedColors:{...Mt,title:"Unsatisfied Colors"},implicitSelectedColors:{...Mt,title:"Implicit Selected Colors"},...Le},Bt=(e,t,n)=>{var i,l,a,s,c,C;const o=ws(e),r=Ts(e);return{...o,...r,backgroundColor:M.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedFill:(i=e.unsatisfiedColors)==null?void 0:i.fill,implicitSelectedFill:(l=e.implicitSelectedColors)==null?void 0:l.fill}).with({isSatisfied:!1,unsatisfiedFill:M.P.string.minLength(1)},m=>m.unsatisfiedFill).with({isImplicitSelected:!0,implicitSelectedFill:M.P.string.minLength(1)},m=>m.implicitSelectedFill).otherwise(()=>o.backgroundColor),borderColor:M.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedBorderColor:(a=e.unsatisfiedColors)==null?void 0:a.borderColor,implicitSelectedBorderColor:(s=e.implicitSelectedColors)==null?void 0:s.borderColor}).with({isSatisfied:!1,unsatisfiedBorderColor:M.P.string.minLength(1)},m=>m.unsatisfiedBorderColor).with({isImplicitSelected:!0,implicitSelectedBorderColor:M.P.string.minLength(1)},m=>m.implicitSelectedBorderColor).otherwise(()=>o.borderColor),color:M.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedColor:(c=e.unsatisfiedColors)==null?void 0:c.color,implicitSelectedColor:(C=e.implicitSelectedColors)==null?void 0:C.color}).with({isSatisfied:!1,unsatisfiedColor:M.P.string.minLength(1)},m=>m.unsatisfiedColor).with({isImplicitSelected:!0,implicitSelectedColor:M.P.string.minLength(1)},m=>m.implicitSelectedColor).otherwise(()=>r.color),...e.style}},on={...ci,resetLabel:{title:"Reset Label",type:f.ControlType.String,defaultValue:"Reset"},blockedLabel:{title:"Blocked Label",type:f.ControlType.String,defaultValue:"Blocked"},appearance:{title:"Appearance",type:f.ControlType.Enum,defaultValue:"auto",displaySegmentedControl:!0,segmentedControlDirection:"horizontal",options:["auto","none"]}},Ne=(e,t,n)=>({...Bt(e,t,n),appearance:e.appearance});function fe(){const{explain:e,handleExplainAnswer:t}=S.useContext(Ke);return{explain:e,handleExplainAnswer:t}}function Es(e={}){const{initialOpen:t=!1,placement:n="top",modal:o=!1,open:r,onOpenChange:i,arrow:l}=e,[a,s]=S.useState(t),c=r??a,C=i??s,m=Uo({placement:n,open:c,onOpenChange:C,whileElementsMounted:hl,middleware:[Xr(((l==null?void 0:l.height)??0)+5),yl({crossAxis:n.includes("-"),fallbackAxisSideDirection:"end",padding:5}),ml({padding:5}),...l?[bl(l)]:[]]}),b=m.context,u=_o(b,{enabled:r==null}),x=Ho(b),w=Qo([u,x]);return S.useMemo(()=>({open:c,setOpen:C,...w,...m,modal:o,arrow:l}),[c,C,w,m,o,l])}const ui=S.createContext(null),Ge=()=>{const e=S.useContext(ui);if(e==null)throw new Error("Popover components must be wrapped in <Popover />");return e};function As({children:e,...t}){const n=Es(t);return d.jsx(ui.Provider,{value:n,children:e})}const Rs=S.forwardRef(function(t,n){const o=S.Children.toArray(t.children)[0],r=Ge(),i=t.children.ref,l=Xt([r.refs.setReference,n,i]);return S.isValidElement(o)?S.cloneElement(o,r.getReferenceProps({ref:l,...t,...o.props,"data-state":r.open?"open":"closed"})):d.jsx("span",{children:"Not valid children for PopoverTrigger"})}),Is=Rs,Ps=O.div`
305
305
  display: flex;
306
306
  justify-content: center;
307
307
 
@@ -310,7 +310,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
310
310
  @container explain-actions (min-width: 300px) {
311
311
  justify-content: start;
312
312
  }
313
- `,Ps=O.button`
313
+ `,Vs=O.button`
314
314
  color: inherit;
315
315
  font-size: 0.9em;
316
316
  font-family: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
@@ -327,7 +327,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
327
327
  outline: 2px solid var(--color-explain-popover-show-more-button-outline);
328
328
  outline-offset: 1px;
329
329
  }
330
- `;function Vs(){const{decisionExplanations:e,switchMode:t}=ge(),{showConstraintsButtonCaption:n,showMoreButtonCaption:o}=zt(),r=e.length-1,i=T.useMemo(()=>r>0&&Ki.render(o,{amount:r}),[o,r]);return d.jsx(Is,{children:d.jsxs(Ps,{onClick:()=>t("dialog"),children:[r>0&&d.jsx("span",{children:i}),r===0&&d.jsx("span",{children:n})]})})}const Ds=O.div`
330
+ `;function Ds(){const{decisionExplanations:e,switchMode:t}=ge(),{showConstraintsButtonCaption:n,showMoreButtonCaption:o}=zt(),r=e.length-1,i=S.useMemo(()=>r>0&&Wi.render(o,{amount:r}),[o,r]);return d.jsx(Ps,{children:d.jsxs(Vs,{onClick:()=>t("dialog"),children:[r>0&&d.jsx("span",{children:i}),r===0&&d.jsx("span",{children:n})]})})}const Os=O.div`
331
331
  font-weight: 500;
332
332
  font-family: var(--font-heading);
333
333
  margin-bottom: var(--space-xs);
@@ -340,9 +340,9 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
340
340
  @media only screen and (min-resolution: 2dppx) {
341
341
  height: 0.5px;
342
342
  }
343
- `,Os=O.div`
343
+ `,js=O.div`
344
344
  container: explain-actions / inline-size;
345
- `,js=O(fo)`
345
+ `,ks=O(fo)`
346
346
  display: grid;
347
347
  grid-template-columns: [name] minmax(100px, auto) [values] minmax(100px, 1fr);
348
348
  gap: var(--space-sm);
@@ -352,7 +352,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
352
352
  margin-right: -1.1em;
353
353
  overflow: auto;
354
354
  max-height: 200px;
355
- `,ks=O(lo)`
355
+ `,Fs=O(lo)`
356
356
  border-radius: 360px;
357
357
  background-color: var(--color-explain-popover-apply-solution-button-fill);
358
358
  color: var(--color-explain-popover-apply-solution-button-color);
@@ -375,10 +375,10 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
375
375
  @container explain-actions (min-width: 300px) {
376
376
  width: auto;
377
377
  }
378
- `,Et=O(ho)`
378
+ `,At=O(ho)`
379
379
  width: min-content;
380
380
  min-width: 300px;
381
- `;function Fs(){const{decisionExplanations:e,constraintExplanations:t,hasError:n}=ge(),{solutionTitle:o,applySolutionButtonCaption:r}=zt();if(n)return d.jsx(Et,{variant:"failedToExplain"});const i=e[0];if(!i)return d.jsx(Et,{variant:"noExplanationFound"});if(!i.solution)return d.jsx(Et,{variant:"noSolutionFound"});const l=i.solution.decisions.filter(a=>a.state!=null);return d.jsxs(d.Fragment,{children:[d.jsx(Ds,{children:o}),d.jsx(Bn,{}),d.jsx(js,{blockingDecisions:i.causedByDecisions,desiredDecisions:l}),d.jsx(Bn,{}),d.jsxs(Os,{children:[d.jsx(ks,{explanation:i,children:r}),(e.length>1||t.length>0)&&d.jsx(Vs,{})]})]})}const di=T.createContext(null),ce=()=>T.useContext(di);function rn(e){return T.forwardRef((t,n)=>{const o=T.useId();return d.jsx(di.Provider,{value:o,children:d.jsx(e,{...t,ref:n})})})}const Ns=T.forwardRef((e,t)=>{const{style:n,children:o,...r}=e,i=Ge(),l=Xt([i.refs.setFloating,t]);return d.jsx(zo,{children:d.jsx(Wo,{context:i.context,modal:i.modal,children:d.jsx("div",{ref:l,style:{...i.floatingStyles,...n},...i.getFloatingProps(r),children:o})})})}),Ls=Ns,Ms=T.forwardRef((e,t)=>{const{setOpen:n}=Ge();return d.jsx("button",{type:"button",ref:t,...e,onClick:o=>{var r;(r=e.onClick)==null||r.call(e,o),n(!1)}})}),Bs=Ms,$s=O.div`
381
+ `;function Ns(){const{decisionExplanations:e,constraintExplanations:t,hasError:n}=ge(),{solutionTitle:o,applySolutionButtonCaption:r}=zt();if(n)return d.jsx(At,{variant:"failedToExplain"});const i=e[0];if(!i)return d.jsx(At,{variant:"noExplanationFound"});if(!i.solution)return d.jsx(At,{variant:"noSolutionFound"});const l=i.solution.decisions.filter(a=>a.state!=null);return d.jsxs(d.Fragment,{children:[d.jsx(Os,{children:o}),d.jsx(Bn,{}),d.jsx(ks,{blockingDecisions:i.causedByDecisions,desiredDecisions:l}),d.jsx(Bn,{}),d.jsxs(js,{children:[d.jsx(Fs,{explanation:i,children:r}),(e.length>1||t.length>0)&&d.jsx(Ds,{})]})]})}const di=S.createContext(null),ce=()=>S.useContext(di);function rn(e){return S.forwardRef((t,n)=>{const o=S.useId();return d.jsx(di.Provider,{value:o,children:d.jsx(e,{...t,ref:n})})})}const Ls=S.forwardRef((e,t)=>{const{style:n,children:o,...r}=e,i=Ge(),l=Xt([i.refs.setFloating,t]);return d.jsx(zo,{children:d.jsx(Wo,{context:i.context,modal:i.modal,children:d.jsx("div",{ref:l,style:{...i.floatingStyles,...n},...i.getFloatingProps(r),children:o})})})}),Ms=Ls,Bs=S.forwardRef((e,t)=>{const{setOpen:n}=Ge();return d.jsx("button",{type:"button",ref:t,...e,onClick:o=>{var r;(r=e.onClick)==null||r.call(e,o),n(!1)}})}),$s=Bs,zs=O.div`
382
382
  position: relative;
383
383
  background-color: var(--color-explain-popover-fill);
384
384
  color: var(--color-explain-popover-color);
@@ -389,7 +389,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
389
389
  font-family: var(--font-primary);
390
390
  min-width: 300px;
391
391
  max-width: 500px;
392
- `,zs=O(Bs)`
392
+ `,Ks=O($s)`
393
393
  position: absolute;
394
394
  right: var(--space-sm-fixed);
395
395
  top: var(--space-sm-fixed);
@@ -404,7 +404,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
404
404
  outline: 2px solid var(--color-explain-popover-close-button-outline);
405
405
  outline-offset: 1px;
406
406
  }
407
- `,Ks=O(Zo)`
407
+ `,Ws=O(Zo)`
408
408
  font-size: var(--text-md);
409
409
  font-weight: 500;
410
410
  font-family: var(--font-heading);
@@ -414,7 +414,7 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
414
414
  white-space: nowrap;
415
415
  text-overflow: ellipsis;
416
416
  margin-right: var(--space-md);
417
- `;function Ws(e){return d.jsxs($s,{children:[d.jsx(Ks,{}),e.children,d.jsx(zs,{children:d.jsx(tt.FontAwesomeIcon,{icon:et.faXmark})})]})}const qs=O(Ls)`
417
+ `;function qs(e){return d.jsxs(zs,{children:[d.jsx(Ws,{}),e.children,d.jsx(Ks,{children:d.jsx(tt.FontAwesomeIcon,{icon:et.faXmark})})]})}const _s=O(Ms)`
418
418
  --color-explain-attribute-value-fill: ${e=>e.attributeValueFill};
419
419
  --color-explain-attribute-value-add-fill: ${e=>e.attributeValueAddFill};
420
420
  --color-explain-attribute-value-add-color: ${e=>e.attributeValueAddColor};
@@ -436,31 +436,31 @@ ${c}`);case h.ConfiguratorErrorType.SessionParametersInvalid:return o(`Configura
436
436
  &:focus {
437
437
  outline: none;
438
438
  }
439
- `,_s=O(Kl)`
439
+ `,Hs=O(Wl)`
440
440
  fill: var(--color-explain-popover-fill);
441
- `,Hs={initial:{opacity:0,scale:0},open:{opacity:1,scale:1,transition:{type:"spring",stiffness:600,damping:40}},close:{opacity:0,scale:0,transition:{duration:.2,ease:"cubicInOut"}}};function Us(e){const t=ge(),n=ce(),o=(t==null?void 0:t.displayMode)==="popover"&&(t==null?void 0:t.controlId)===n,r=T.useRef(null);return d.jsxs(As,{open:o,onOpenChange:i=>!i&&o&&(t==null?void 0:t.dismiss()),arrow:{width:20,height:10,padding:10,element:r},children:[d.jsx(Rs,{children:e.children}),d.jsxs(Qs,{isOpen:o,children:[T.Children.toArray(e.content)[0]??d.jsx(Ws,{children:d.jsx(Fs,{})}),d.jsx(Gs,{})]})]})}function Qs(e){var b,u;const t=zt(),{middlewareData:n,arrow:o,placement:r}=Ge(),i=((b=n.arrow)==null?void 0:b.x)??0,l=((u=n.arrow)==null?void 0:u.y)??0,a=(o==null?void 0:o.height)??0,s=(o==null?void 0:o.width)??0,c=i+s/2,C=l+a,m=M.match(r).with("top",()=>`${c}px calc(100% + ${a+5}px)`).with("bottom",()=>`${c}px ${-a-5}px`).with("left",()=>`calc(100% + ${a}px) ${C}px`).with("right",()=>`${-a}px ${C}px`).otherwise(()=>"");return d.jsx(f.AnimatePresence,{initial:!1,children:e.isOpen&&d.jsx(qs,{...t,children:d.jsx(f.motion.div,{variants:Hs,initial:"initial",animate:"open",exit:"close",style:{transformOrigin:m},children:d.jsx(Jo,{children:e.children})})})})}function Gs(){const{context:e,arrow:t}=Ge();return d.jsx(_s,{ref:t.element,context:e,width:t.width,height:t.height})}function Ys(e){return T.forwardRef((t,n)=>{const o=X();return t.explain!=="popover"||o?d.jsx(e,{...t}):d.jsx(Us,{children:d.jsx(e,{...t,ref:n})})})}function pe(e){return se(rn(Ys(T.forwardRef(e))))}function de(){alert(`Failed to apply your selection.
442
- Please check your internet connection and try again.`)}function Xs(){alert(`Failed to reset your configuration.
441
+ `,Us={initial:{opacity:0,scale:0},open:{opacity:1,scale:1,transition:{type:"spring",stiffness:600,damping:40}},close:{opacity:0,scale:0,transition:{duration:.2,ease:"cubicInOut"}}};function Qs(e){const t=ge(),n=ce(),o=(t==null?void 0:t.displayMode)==="popover"&&(t==null?void 0:t.controlId)===n,r=S.useRef(null);return d.jsxs(As,{open:o,onOpenChange:i=>!i&&o&&(t==null?void 0:t.dismiss()),arrow:{width:20,height:10,padding:10,element:r},children:[d.jsx(Is,{children:e.children}),d.jsxs(Gs,{isOpen:o,children:[S.Children.toArray(e.content)[0]??d.jsx(qs,{children:d.jsx(Ns,{})}),d.jsx(Ys,{})]})]})}function Gs(e){var b,u;const t=zt(),{middlewareData:n,arrow:o,placement:r}=Ge(),i=((b=n.arrow)==null?void 0:b.x)??0,l=((u=n.arrow)==null?void 0:u.y)??0,a=(o==null?void 0:o.height)??0,s=(o==null?void 0:o.width)??0,c=i+s/2,C=l+a,m=M.match(r).with("top",()=>`${c}px calc(100% + ${a+5}px)`).with("bottom",()=>`${c}px ${-a-5}px`).with("left",()=>`calc(100% + ${a}px) ${C}px`).with("right",()=>`${-a}px ${C}px`).otherwise(()=>"");return d.jsx(f.AnimatePresence,{initial:!1,children:e.isOpen&&d.jsx(_s,{...t,children:d.jsx(f.motion.div,{variants:Us,initial:"initial",animate:"open",exit:"close",style:{transformOrigin:m},children:d.jsx(Jo,{children:e.children})})})})}function Ys(){const{context:e,arrow:t}=Ge();return d.jsx(Hs,{ref:t.element,context:e,width:t.width,height:t.height})}function Xs(e){return S.forwardRef((t,n)=>{const o=Y();return t.explain!=="popover"||o?d.jsx(e,{...t}):d.jsx(Qs,{children:d.jsx(e,{...t,ref:n})})})}function pe(e){return se(rn(Xs(S.forwardRef(e))))}function de(){alert(`Failed to apply your selection.
442
+ Please check your internet connection and try again.`)}function Js(){alert(`Failed to reset your configuration.
443
443
  Please check your internet connection and try again.`)}const $n=O.select`
444
444
  color: inherit;
445
445
  cursor: inherit;
446
- `,zn="<reset>",Kn="<nothing>",fi=pe((e,t)=>{if(X()){const E=Ne(e,!0,!1);return d.jsx($n,{style:E})}const o=ce(),r=Z(e),i=U.useChoiceAttribute(r);if(!i)return d.jsx("span",{children:"Choice Attribute not found"});const{explain:l}=fe(),a=_e(r),{attribute:s,makeDecision:c,clearDecisions:C,isMultiSelect:m,getIncludedChoiceValues:b,getBlockedChoiceValues:u,getAllowedChoiceValues:x}=i,w=ut(r,x()),g=ut(r,u()),y=b(),v=y.map(E=>E.id),V=v[0]??Kn,S=y.some(E=>{var N;return((N=E.decision)==null?void 0:N.kind)===h.DecisionKind.Explicit}),R=v.length>=1,I=y.some(E=>{var N;return((N=E.decision)==null?void 0:N.kind)===h.DecisionKind.Implicit}),D=w.length===0,P=async E=>{const N=e.explain,B=N!=="disabled"&&(()=>l(K=>K.whyIsStateNotPossible.choice(s.id).choiceValue(E).state(h.ChoiceValueDecisionState.Included),N,o));if(E===zn)try{await C()}catch{de()}else if(w.some(K=>K.id===E)){const K=v.some(_=>_===E)?void 0:h.ChoiceValueDecisionState.Included;try{await c(E,K)}catch(_){if(_.type===h.ConfiguratorErrorType.ConflictWithConsequence&&B){await B();return}de()}}else g.some(K=>K.id===E)&&B&&await B()},k=ec(e,s.isSatisfied,I,D);return d.jsxs($n,{ref:t,value:m()?v:V,multiple:m(),onChange:E=>P(E.currentTarget.value),style:k,children:[!R&&!m()&&d.jsx("option",{value:Kn}),S&&d.jsx("option",{value:zn,children:e.resetLabel}),w.map(E=>{var N;return d.jsxs("option",{value:E.id,children:[((N=E.decision)==null?void 0:N.kind)===h.DecisionKind.Implicit?e.implicitLabelPrefix:"",a.get(E.id)??E.id]},E.id)}),g.length>0&&d.jsx("optgroup",{label:e.blockedLabel,children:g.map(E=>d.jsx("option",{value:E.id,children:a.get(E.id)??E.id},E.id))})]})}),Js=fi,Zs={...on,noOptionsAvailableColors:{...Mt,title:"No Options Available Colors"}};f.addPropertyControls(fi,Zs);const ec=(e,t,n,o)=>{var i,l,a;const r=Ne(e,t,n);return{...r,backgroundColor:M.match({noOptionsAvailable:o,noOptionsAvailableFill:(i=e.noOptionsAvailableColors)==null?void 0:i.fill}).with({noOptionsAvailable:!0,noOptionsAvailableFill:M.P.string.minLength(1)},s=>s.noOptionsAvailableFill).otherwise(()=>r.backgroundColor),borderColor:M.match({noOptionsAvailable:o,noOptionsAvailableBorderColor:(l=e.noOptionsAvailableColors)==null?void 0:l.borderColor}).with({noOptionsAvailable:!0,noOptionsAvailableBorderColor:M.P.string.minLength(1)},s=>s.noOptionsAvailableBorderColor).otherwise(()=>r.borderColor),color:M.match({noOptionsAvailable:o,noOptionsAvailableColor:(a=e.noOptionsAvailableColors)==null?void 0:a.color}).with({noOptionsAvailable:!0,noOptionsAvailableColor:M.P.string.minLength(1)},s=>s.noOptionsAvailableColor).otherwise(()=>r.color)}},Wn=O.select`
446
+ `,zn="<reset>",Kn="<nothing>",fi=pe((e,t)=>{if(Y()){const A=Ne(e,!0,!1);return d.jsx($n,{style:A})}const o=ce(),r=Z(e),i=U.useChoiceAttribute(r);if(!i)return d.jsx("span",{children:"Choice Attribute not found"});const{explain:l}=fe(),a=_e(r),{attribute:s,makeDecision:c,clearDecisions:C,isMultiSelect:m,getIncludedChoiceValues:b,getBlockedChoiceValues:u,getAllowedChoiceValues:x}=i,w=ut(r,x()),g=ut(r,u()),y=b(),v=y.map(A=>A.id),V=v[0]??Kn,T=y.some(A=>{var N;return((N=A.decision)==null?void 0:N.kind)===h.DecisionKind.Explicit}),R=v.length>=1,I=y.some(A=>{var N;return((N=A.decision)==null?void 0:N.kind)===h.DecisionKind.Implicit}),D=w.length===0,P=async A=>{const N=e.explain,B=N!=="disabled"&&(()=>l(K=>K.whyIsStateNotPossible.choice(s.id).choiceValue(A).state(h.ChoiceValueDecisionState.Included),N,o));if(A===zn)try{await C()}catch{de()}else if(w.some(K=>K.id===A)){const K=v.some(_=>_===A)?void 0:h.ChoiceValueDecisionState.Included;try{await c(A,K)}catch(_){if(_.type===h.ConfiguratorErrorType.ConflictWithConsequence&&B){await B();return}de()}}else g.some(K=>K.id===A)&&B&&await B()},k=tc(e,s.isSatisfied,I,D);return d.jsxs($n,{ref:t,value:m()?v:V,multiple:m(),onChange:A=>P(A.currentTarget.value),style:k,children:[!R&&!m()&&d.jsx("option",{value:Kn}),T&&d.jsx("option",{value:zn,children:e.resetLabel}),w.map(A=>{var N;return d.jsxs("option",{value:A.id,children:[((N=A.decision)==null?void 0:N.kind)===h.DecisionKind.Implicit?e.implicitLabelPrefix:"",a.get(A.id)??A.id]},A.id)}),g.length>0&&d.jsx("optgroup",{label:e.blockedLabel,children:g.map(A=>d.jsx("option",{value:A.id,children:a.get(A.id)??A.id},A.id))})]})}),Zs=fi,ec={...on,noOptionsAvailableColors:{...Mt,title:"No Options Available Colors"}};f.addPropertyControls(fi,ec);const tc=(e,t,n,o)=>{var i,l,a;const r=Ne(e,t,n);return{...r,backgroundColor:M.match({noOptionsAvailable:o,noOptionsAvailableFill:(i=e.noOptionsAvailableColors)==null?void 0:i.fill}).with({noOptionsAvailable:!0,noOptionsAvailableFill:M.P.string.minLength(1)},s=>s.noOptionsAvailableFill).otherwise(()=>r.backgroundColor),borderColor:M.match({noOptionsAvailable:o,noOptionsAvailableBorderColor:(l=e.noOptionsAvailableColors)==null?void 0:l.borderColor}).with({noOptionsAvailable:!0,noOptionsAvailableBorderColor:M.P.string.minLength(1)},s=>s.noOptionsAvailableBorderColor).otherwise(()=>r.borderColor),color:M.match({noOptionsAvailable:o,noOptionsAvailableColor:(a=e.noOptionsAvailableColors)==null?void 0:a.color}).with({noOptionsAvailable:!0,noOptionsAvailableColor:M.P.string.minLength(1)},s=>s.noOptionsAvailableColor).otherwise(()=>r.color)}},Wn=O.select`
447
447
  color: inherit;
448
448
  cursor: inherit;
449
- `,qn="<reset>",Rt="<nothing>",It="yes",_n="no",pi=pe((e,t)=>{var v,V,S;if(X()){const R=Ne(e,!0,!1);return d.jsx(Wn,{style:R})}const o=ce(),r=Z(e),i=U.useBooleanAttribute(r),{explain:l}=fe();if(!i)return d.jsx("span",{children:"Boolean Attribute not found"});const{attribute:a,makeDecision:s}=i,c=async R=>{var D;const I=((D=a.decision)==null?void 0:D.kind)===h.DecisionKind.Explicit;if(R===qn&&I)try{await s(void 0)}catch{de()}else{const P=R===It,k=a.possibleDecisionStates.includes(P),E=e.explain,N=E!=="disabled"&&(()=>l(B=>B.whyIsStateNotPossible.boolean(a.id).state(P),E,o));if(k)try{await s(P)}catch(B){if(B.type===h.ConfiguratorErrorType.ConflictWithConsequence&&N){await N();return}de()}else N&&await N()}},C=M.match((v=a.decision)==null?void 0:v.state).with(!0,()=>It).with(!1,()=>_n).otherwise(()=>Rt),m=((V=a.decision)==null?void 0:V.kind)===h.DecisionKind.Explicit,b=((S=a.decision)==null?void 0:S.kind)===h.DecisionKind.Implicit,u=Ne(e,a.isSatisfied,b),x=a.possibleDecisionStates.includes(!0),w=a.possibleDecisionStates.includes(!1),g=d.jsxs("option",{value:It,children:[Hn(a,!0,e.implicitLabelPrefix),e.trueLabel]}),y=d.jsxs("option",{value:_n,children:[Hn(a,!1,e.implicitLabelPrefix),e.falseLabel]});return d.jsxs(Wn,{ref:t,value:C,onChange:R=>c(R.currentTarget.value),style:u,children:[C===Rt&&d.jsx("option",{value:Rt}),m&&d.jsx("option",{value:qn,children:e.resetLabel}),x&&g,w&&y,(!x||!w)&&d.jsxs("optgroup",{label:e.blockedLabel,children:[!x&&g,!w&&y]})]})}),tc=pi,Hn=(e,t,n)=>{var o,r;return((o=e.decision)==null?void 0:o.kind)===h.DecisionKind.Implicit&&((r=e.decision)==null?void 0:r.state)===t?n:""},nc={...on,trueLabel:{title:"True Label",type:f.ControlType.String,defaultValue:"Yes"},falseLabel:{title:"False Label",type:f.ControlType.String,defaultValue:"No"}};f.addPropertyControls(pi,nc);const Un=O.select`
449
+ `,qn="<reset>",Rt="<nothing>",It="yes",_n="no",pi=pe((e,t)=>{var v,V,T;if(Y()){const R=Ne(e,!0,!1);return d.jsx(Wn,{style:R})}const o=ce(),r=Z(e),i=U.useBooleanAttribute(r),{explain:l}=fe();if(!i)return d.jsx("span",{children:"Boolean Attribute not found"});const{attribute:a,makeDecision:s}=i,c=async R=>{var D;const I=((D=a.decision)==null?void 0:D.kind)===h.DecisionKind.Explicit;if(R===qn&&I)try{await s(void 0)}catch{de()}else{const P=R===It,k=a.possibleDecisionStates.includes(P),A=e.explain,N=A!=="disabled"&&(()=>l(B=>B.whyIsStateNotPossible.boolean(a.id).state(P),A,o));if(k)try{await s(P)}catch(B){if(B.type===h.ConfiguratorErrorType.ConflictWithConsequence&&N){await N();return}de()}else N&&await N()}},C=M.match((v=a.decision)==null?void 0:v.state).with(!0,()=>It).with(!1,()=>_n).otherwise(()=>Rt),m=((V=a.decision)==null?void 0:V.kind)===h.DecisionKind.Explicit,b=((T=a.decision)==null?void 0:T.kind)===h.DecisionKind.Implicit,u=Ne(e,a.isSatisfied,b),x=a.possibleDecisionStates.includes(!0),w=a.possibleDecisionStates.includes(!1),g=d.jsxs("option",{value:It,children:[Hn(a,!0,e.implicitLabelPrefix),e.trueLabel]}),y=d.jsxs("option",{value:_n,children:[Hn(a,!1,e.implicitLabelPrefix),e.falseLabel]});return d.jsxs(Wn,{ref:t,value:C,onChange:R=>c(R.currentTarget.value),style:u,children:[C===Rt&&d.jsx("option",{value:Rt}),m&&d.jsx("option",{value:qn,children:e.resetLabel}),x&&g,w&&y,(!x||!w)&&d.jsxs("optgroup",{label:e.blockedLabel,children:[!x&&g,!w&&y]})]})}),nc=pi,Hn=(e,t,n)=>{var o,r;return((o=e.decision)==null?void 0:o.kind)===h.DecisionKind.Implicit&&((r=e.decision)==null?void 0:r.state)===t?n:""},oc={...on,trueLabel:{title:"True Label",type:f.ControlType.String,defaultValue:"Yes"},falseLabel:{title:"False Label",type:f.ControlType.String,defaultValue:"No"}};f.addPropertyControls(pi,oc);const Un=O.select`
450
450
  color: inherit;
451
451
  cursor: inherit;
452
- `,Qn="<reset>",Pt="<nothing>",Vt="included",Dt="excluded",hi=pe((e,t)=>{var V,S,R;if(X()){const I=Ne(e,!0,!1);return d.jsx(Un,{style:I})}const o=ce(),r=Z(e),i=U.useComponentAttribute(r),{explain:l}=fe();if(!i)return d.jsx("span",{children:"Component Attribute not found"});const{attribute:a,makeDecision:s}=i,c=async I=>{const D=a.possibleDecisionStates.includes(I),P=e.explain,k=P!=="disabled"&&(()=>l(E=>E.whyIsStateNotPossible.component(a.id).state(I),P,o));if(D)try{await s(I)}catch(E){if(E.type===h.ConfiguratorErrorType.ConflictWithConsequence&&k){await k();return}de()}else k&&await k()},C=async I=>{var P;const D=((P=a.decision)==null?void 0:P.kind)===h.DecisionKind.Explicit;I===Qn&&D?await s(void 0):I===Vt?await c(h.ComponentDecisionState.Included):I===Dt&&await c(h.ComponentDecisionState.Excluded)},m=M.match((V=a.decision)==null?void 0:V.state).with(h.ComponentDecisionState.Included,()=>Vt).with(h.ComponentDecisionState.Excluded,()=>Dt).otherwise(()=>Pt),b=((S=a.decision)==null?void 0:S.kind)===h.DecisionKind.Explicit,u=((R=a.decision)==null?void 0:R.kind)===h.DecisionKind.Implicit,x=Ne(e,a.isSatisfied,u),w=a.possibleDecisionStates.includes(h.ComponentDecisionState.Included),g=a.possibleDecisionStates.includes(h.ComponentDecisionState.Excluded),y=d.jsxs("option",{value:Vt,children:[Gn(a,h.ComponentDecisionState.Included,e.implicitLabelPrefix),e.includedLabel]}),v=d.jsxs("option",{value:Dt,children:[Gn(a,h.ComponentDecisionState.Excluded,e.implicitLabelPrefix),e.excludedLabel]});return d.jsxs(Un,{ref:t,value:m,onChange:I=>C(I.currentTarget.value),style:x,children:[m===Pt&&d.jsx("option",{value:Pt}),b&&d.jsx("option",{value:Qn,children:e.resetLabel}),w&&y,g&&v,(!w||!g)&&d.jsxs("optgroup",{label:e.blockedLabel,children:[!w&&y,!g&&v]})]})}),oc=hi,Gn=(e,t,n)=>{var o,r;return((o=e.decision)==null?void 0:o.kind)===h.DecisionKind.Implicit&&((r=e.decision)==null?void 0:r.state)===t?n:""},ic={...on,includedLabel:{title:"Included Label",type:f.ControlType.String,defaultValue:"Included"},excludedLabel:{title:"Excluded Label",type:f.ControlType.String,defaultValue:"Excluded"}};f.addPropertyControls(hi,ic);function mi(e,t,n,o,r=1e3){const[i]=_i.useForceUpdate(),l=qi.useDebouncedCallback(b=>{t(b),i()},r),a=T.useRef(n),s=T.useRef(e),c=l.isPending(),C=T.useRef(c);T.useEffect(()=>{e!==s.current&&(s.current=e,c&&(l.cancel(),i()),e!==n&&o(e)),n!==a.current&&(a.current=n,n!==e?(l(n),i()):c&&(l.cancel(),i())),c!==C.current&&(C.current=c,!c&&e!==n&&o(e))},[e,n,l,c]);const m=T.useCallback(()=>{l.isPending()&&l.flush()},[l]);return T.useEffect(()=>()=>m(),[m]),{flush:m}}const Yn=O(Wi)`
452
+ `,Qn="<reset>",Pt="<nothing>",Vt="included",Dt="excluded",hi=pe((e,t)=>{var V,T,R;if(Y()){const I=Ne(e,!0,!1);return d.jsx(Un,{style:I})}const o=ce(),r=Z(e),i=U.useComponentAttribute(r),{explain:l}=fe();if(!i)return d.jsx("span",{children:"Component Attribute not found"});const{attribute:a,makeDecision:s}=i,c=async I=>{const D=a.possibleDecisionStates.includes(I),P=e.explain,k=P!=="disabled"&&(()=>l(A=>A.whyIsStateNotPossible.component(a.id).state(I),P,o));if(D)try{await s(I)}catch(A){if(A.type===h.ConfiguratorErrorType.ConflictWithConsequence&&k){await k();return}de()}else k&&await k()},C=async I=>{var P;const D=((P=a.decision)==null?void 0:P.kind)===h.DecisionKind.Explicit;I===Qn&&D?await s(void 0):I===Vt?await c(h.ComponentDecisionState.Included):I===Dt&&await c(h.ComponentDecisionState.Excluded)},m=M.match((V=a.decision)==null?void 0:V.state).with(h.ComponentDecisionState.Included,()=>Vt).with(h.ComponentDecisionState.Excluded,()=>Dt).otherwise(()=>Pt),b=((T=a.decision)==null?void 0:T.kind)===h.DecisionKind.Explicit,u=((R=a.decision)==null?void 0:R.kind)===h.DecisionKind.Implicit,x=Ne(e,a.isSatisfied,u),w=a.possibleDecisionStates.includes(h.ComponentDecisionState.Included),g=a.possibleDecisionStates.includes(h.ComponentDecisionState.Excluded),y=d.jsxs("option",{value:Vt,children:[Gn(a,h.ComponentDecisionState.Included,e.implicitLabelPrefix),e.includedLabel]}),v=d.jsxs("option",{value:Dt,children:[Gn(a,h.ComponentDecisionState.Excluded,e.implicitLabelPrefix),e.excludedLabel]});return d.jsxs(Un,{ref:t,value:m,onChange:I=>C(I.currentTarget.value),style:x,children:[m===Pt&&d.jsx("option",{value:Pt}),b&&d.jsx("option",{value:Qn,children:e.resetLabel}),w&&y,g&&v,(!w||!g)&&d.jsxs("optgroup",{label:e.blockedLabel,children:[!w&&y,!g&&v]})]})}),ic=hi,Gn=(e,t,n)=>{var o,r;return((o=e.decision)==null?void 0:o.kind)===h.DecisionKind.Implicit&&((r=e.decision)==null?void 0:r.state)===t?n:""},rc={...on,includedLabel:{title:"Included Label",type:f.ControlType.String,defaultValue:"Included"},excludedLabel:{title:"Excluded Label",type:f.ControlType.String,defaultValue:"Excluded"}};f.addPropertyControls(hi,rc);function mi(e,t,n,o,r=1e3){const[i]=Hi.useForceUpdate(),l=_i.useDebouncedCallback(b=>{t(b),i()},r),a=S.useRef(n),s=S.useRef(e),c=l.isPending(),C=S.useRef(c);S.useEffect(()=>{e!==s.current&&(s.current=e,c&&(l.cancel(),i()),e!==n&&o(e)),n!==a.current&&(a.current=n,n!==e?(l(n),i()):c&&(l.cancel(),i())),c!==C.current&&(C.current=c,!c&&e!==n&&o(e))},[e,n,l,c]);const m=S.useCallback(()=>{l.isPending()&&l.flush()},[l]);return S.useEffect(()=>()=>m(),[m]),{flush:m}}const Yn=O(qi)`
453
453
  color: inherit;
454
- `,yi=pe((e,t)=>{var v,V;if(X()){const S=Bt(e,!0,!1);return d.jsx(Yn,{style:S})}const o=ce(),r=Z(e),i=U.useNumericAttribute(r),{explain:l}=fe();if(!i)return d.jsx("span",{children:"Numeric Attribute not found"});const{attribute:a,makeDecision:s}=i,c=((v=a.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit,C=Bt(e,a.isSatisfied,c),m=(V=a.decision)==null?void 0:V.state,[b,u]=T.useState(m),{min:x,max:w}=a.range,y=mi(m,async S=>{if(S<x){alert(`The value must be smaller than or equal to ${x}.`);return}if(S>w){alert(`The value must be greater than or equal to ${w}.`);return}try{await s(S)}catch(R){R.type===h.ConfiguratorErrorType.SetDecisionConflict?e.explain!=="disabled"&&await l(P=>P.whyIsStateNotPossible.numeric(a.id).state(S),e.explain,o):de()}},b,S=>u(S),e.wait);return d.jsx(Yn,{getInputRef:t,thousandsGroupStyle:"thousand",decimalSeparator:e.decimalSeparator,thousandSeparator:e.thousandSeparator,allowNegative:!0,fixedDecimalScale:!0,decimalScale:a.decimalPlaces,allowEmptyFormatting:!1,displayType:"input",placeholder:e.placeholder,prefix:lc(a,e.implicitLabelPrefix),onBlur:()=>{y.flush()},onKeyPress:S=>{S.key==="Enter"&&y.flush()},onValueChange:S=>u(S.floatValue),value:b??"",style:C})}),rc=yi,lc=(e,t)=>{var n;return((n=e.decision)==null?void 0:n.kind)===h.DecisionKind.Implicit?t:""},ac={...ci,wait:{title:"Debounce Delay",type:f.ControlType.Number,defaultValue:2e3,min:0,unit:"ms"},decimalSeparator:{title:"Decimal Separator",type:f.ControlType.String,defaultValue:",",maxLength:1},thousandSeparator:{title:"Thousand Separator",type:f.ControlType.String,defaultValue:".",maxLength:1},placeholder:{title:"Placeholder",type:f.ControlType.String,defaultValue:""}};f.addPropertyControls(yi,ac);const Me={choiceValueId:{title:"Choice Value Id",type:f.ControlType.String}};function he(e,t){return T.Children.map(e,n=>{if(T.isValidElement(n)){const o=oo(n.props,t);return T.cloneElement(n,o)}return n})}const gi=pe((e,t)=>{if(X())return e.children;const o=ce(),{makeDecision:r}=U.useMakeDecision(),i=Z(e),l=e.choiceValueId??"",a=l.length>0,s=U.useAttributes([i],!1)[0],{explain:c}=fe();if(!s)return d.jsx("span",{children:"Attribute not found"});const C=s.type===h.AttributeType.Choice,m=s.type===h.AttributeType.Numeric,b=s.type===h.AttributeType.Boolean,u=s.type===h.AttributeType.Component;if(!C&&a)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});if(m)return d.jsx("span",{children:"Numeric Attribute is not supported"});let x=C?s.values.get(l):null;if(a&&x==null)return d.jsx("span",{children:"Choice Value not found"});const w=V=>M.match({state:V,attribute:s}).with({attribute:{type:h.AttributeType.Choice},state:"undefined"},()=>x.decision==null).with({attribute:{type:h.AttributeType.Choice},state:"included"},()=>{var S,R;return((S=x.decision)==null?void 0:S.state)===h.ChoiceValueDecisionState.Included&&((R=x.decision)==null?void 0:R.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Choice},state:"excluded"},()=>{var S,R;return((S=x.decision)==null?void 0:S.state)===h.ChoiceValueDecisionState.Excluded&&((R=x.decision)==null?void 0:R.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Boolean},state:"undefined"},{attribute:{type:h.AttributeType.Component},state:"undefined"},({attribute:S})=>S.decision==null).with({attribute:{type:h.AttributeType.Boolean},state:"true"},({attribute:S})=>{var R,I;return((R=S.decision)==null?void 0:R.state)===!0&&((I=S.decision)==null?void 0:I.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Boolean},state:"false"},({attribute:S})=>{var R,I;return((R=S.decision)==null?void 0:R.state)===!1&&((I=S.decision)==null?void 0:I.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Component},state:"included"},({attribute:S})=>{var R,I;return((R=S.decision)==null?void 0:R.state)===h.ComponentDecisionState.Included&&((I=S.decision)==null?void 0:I.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Component},state:"excluded"},({attribute:S})=>{var R,I;return((R=S.decision)==null?void 0:R.state)===h.ComponentDecisionState.Excluded&&((I=S.decision)==null?void 0:I.kind)===h.DecisionKind.Explicit}).otherwise(()=>!1),g=V=>M.match({isChoiceAttribute:C,isBooleanAttribute:b,isComponentAttribute:u,state:V}).with({isChoiceAttribute:!0,state:"included"},()=>h.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,state:"excluded"},()=>h.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>h.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>h.ComponentDecisionState.Excluded).otherwise(()=>null);w(e.toggleFrom);const y=w(e.toggleTo),v=async()=>{const V=y?e.toggleFrom:e.toggleTo,S=g(V),R=u?s.possibleDecisionStates.includes(S):!1,I=b?s.possibleDecisionStates.includes(S):!1,P=(C?x.possibleDecisionStates.includes(S):!1)||I||R,k=e.explain,E=k!=="disabled"&&(async()=>{const N=M.match({isComponentAttribute:u,isBooleanAttribute:b,isChoiceAttribute:C}).returnType().with({isChoiceAttribute:!0},()=>h.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>h.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>h.ExplainQuestionSubject.component).otherwise(()=>null);N&&await c({question:h.ExplainQuestionType.whyIsStateNotPossible,subject:N,attributeId:i,choiceValueId:l,state:S},k,o)});if(P||S==null)try{await r({type:s.type,attributeId:i,choiceValueId:l,state:S})}catch(N){if(N.type===h.ConfiguratorErrorType.ConflictWithConsequence&&E){await E();return}de()}else E&&await E()};return he(e.children,{onClick:v,ref:t})}),sc=gi,cc={...oe,...Me,children:{title:"Content",type:f.ControlType.ComponentInstance},toggleFrom:{title:"Toggle From",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false"]},toggleTo:{title:"Toggle To",type:f.ControlType.Enum,defaultValue:"included",options:["undefined","included","excluded","true","false"]},...Le};f.addPropertyControls(gi,cc);const bi=pe((e,t)=>{if(X())return e.children;const o=ce(),{makeDecision:r}=U.useMakeDecision(),i=Z(e),l=e.choiceValueId??"",a=l.length>0,s=U.useAttributes([i],!1)[0],c=U.useChoiceAttribute(i),{explain:C}=fe();if(!s)return d.jsx("span",{children:"Attribute not found"});const m=s.type===h.AttributeType.Choice,b=s.type===h.AttributeType.Numeric,u=s.type===h.AttributeType.Boolean,x=s.type===h.AttributeType.Component;if(!m&&a)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});let w=m?s.values.get(l):null;if(a&&w==null)return d.jsx("span",{children:"Choice Value not found"});const g=()=>M.match({isChoiceAttribute:m,isBooleanAttribute:u,isComponentAttribute:x,isNumericAttribute:b,hasChoiceValueId:a,state:e.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>h.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>h.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>h.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>h.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>e.numericValue).otherwise(()=>null),y=async()=>{if(m&&!a&&e.setSelection==="undefined")try{await c.clearDecisions()}catch{de()}else{const v=g(),V=x?s.possibleDecisionStates.includes(v):!1,S=u?s.possibleDecisionStates.includes(v):!1,I=(m?w.possibleDecisionStates.includes(v):!1)||S||V,D=e.explain,P=D!=="disabled"&&(async()=>{const k=M.match({isComponentAttribute:x,isBooleanAttribute:u,isChoiceAttribute:m,isNumericAttribute:b}).returnType().with({isChoiceAttribute:!0},()=>h.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>h.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>h.ExplainQuestionSubject.component).with({isNumericAttribute:!0},()=>h.ExplainQuestionSubject.numeric).otherwise(()=>null);k&&await C({question:h.ExplainQuestionType.whyIsStateNotPossible,subject:k,attributeId:i,choiceValueId:l,state:v},D,o)});if(b||I||v==null)try{await r({type:s.type,attributeId:i,choiceValueId:l,state:v})}catch(k){const E=k;if((E.type===h.ConfiguratorErrorType.ConflictWithConsequence||E.type===h.ConfiguratorErrorType.SetDecisionConflict)&&P){await P();return}de()}else P&&await P()}};return he(e.children,{onClick:y,ref:t})}),uc=bi,dc={...oe,...Me,children:{title:"Content",type:f.ControlType.ComponentInstance},setSelection:{title:"Set Selection To",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},numericValue:{title:"Numeric Value",type:f.ControlType.Number,defaultValue:0},...Le};f.addPropertyControls(bi,dc);const xi=pe((e,t)=>{var m;if(X())return e.children;const o=ce(),{makeManyDecisions:r}=U.useMakeDecision(),{handleExplainAnswer:i}=fe(),l=e.attributes.map(Z),a=U.useAttributes(l,!1).map((b,u)=>{if(!b)return{error:d.jsx("span",{children:"Attribute not found"})};const x=e.attributes[u],w=x.choiceValueId??"",g=w.length>0,y=b.type===h.AttributeType.Choice,v=b.type===h.AttributeType.Numeric,V=b.type===h.AttributeType.Boolean,S=b.type===h.AttributeType.Component;if(!y&&g)return{error:d.jsx("span",{children:"Attribute is not a Choice Attribute"})};let R=y?b.values.get(w):null;if(g&&R==null)return{error:d.jsx("span",{children:"Choice Value not found"})};const I=()=>M.match({isChoiceAttribute:y,isBooleanAttribute:V,isComponentAttribute:S,isNumericAttribute:v,hasChoiceValueId:g,state:x.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>h.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>h.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>h.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>h.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>x.numericValue).otherwise(()=>null);return{getDecisions:()=>y&&!g&&x.setSelection==="undefined"?[...b.values.values()].filter(D=>{var P;return((P=D.decision)==null?void 0:P.kind)===h.DecisionKind.Explicit}).map(D=>({type:b.type,attributeId:b.id,choiceValueId:D.id,state:null})):[{type:b.type,attributeId:b.id,choiceValueId:w,state:I()}]}}),s=(m=a.find(b=>b.error))==null?void 0:m.error;if(s)return s;const c=async()=>{const b=a.reduce((x,w)=>[...x,...w.getDecisions()],new Array),u=M.match(e.existingSelections).with("keep",()=>({type:"KeepExistingDecisions"})).with("drop",()=>({type:"DropExistingDecisions",conflictHandling:M.match(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()})).exhaustive();try{await r(b,u)}catch(x){const w=x;if(console.debug("SetMany failed",w),(w==null?void 0:w.type)===h.ConfiguratorErrorType.MakeManyDecisionsConflict&&w.decisionExplanations){e.explain!=="disabled"&&await i(w,e.explain,o);return}de();return}},C=()=>{e.trigger==="click"&&c()};return T.useEffect(()=>{e.trigger==="auto"&&c()},[]),he(e.children,{onClick:C,ref:t})}),fc=xi,pc={children:{title:"Content",type:f.ControlType.ComponentInstance},attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...oe,...Me,setSelection:{title:"Set Selection To",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},numericValue:{title:"Numeric Value",type:f.ControlType.Number,defaultValue:0}}}},existingSelections:{title:"Existing Selections",type:f.ControlType.Enum,defaultValue:"keep",options:["keep","drop"]},autoResolveConflicts:{title:"Auto Resolve Conflicts",type:f.ControlType.Boolean,defaultValue:!0,hidden:e=>e.existingSelections!=="drop"},trigger:{title:"Trigger",type:f.ControlType.Enum,defaultValue:"click",options:["click","auto"],displaySegmentedControl:!0,segmentedControlDirection:"horizontal"},...Le};f.addPropertyControls(xi,pc);const Ci=se(e=>{if(X())return e.enabledChildren;const{canResetConfiguration:n,resetConfiguration:o}=U.useConfigurationReset(),r=async()=>{if(n)try{await o()}catch{Xs()}},i=n?e.enabledChildren:e.disabledChildren;return he(i,{onClick:r})}),hc=Ci,mc={enabledChildren:{title:"Content – Enabled",type:f.ControlType.ComponentInstance},disabledChildren:{title:"Content – Disabled",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Ci,mc);const vi=pe((e,t)=>{if(X())return e.unsatisfiedChildren;const o=ce(),{isSatisfied:r}=U.useConfigurationSatisfaction(),{explain:i}=fe(),a=[...e.attributeId.length>0?[Z(e)]:[],...e.attributes.map(Z)],s=()=>{var u;const m=U.useAttributes(a,!1).map(x=>x?{isSatisfied:x.isSatisfied}:{error:d.jsx("span",{children:"Attribute not found"})}),b=(u=m.find(x=>x.error))==null?void 0:u.error;return b||m.every(x=>x.isSatisfied)},c=async()=>{e.explain!=="disabled"&&(a.length===0?await i(m=>m.whyIsNotSatisfied.configuration,e.explain,o):a.length===1&&await i(m=>m.whyIsNotSatisfied.attribute(a[0]),e.explain,o))};return(a.length>0?s():r)?e.satisfiedChildren:he(e.unsatisfiedChildren,{onClick:c,ref:t})}),yc=vi,gc={satisfiedChildren:{title:"Content – Satisfied",type:f.ControlType.ComponentInstance},unsatisfiedChildren:{title:"Content – Unsatisfied",type:f.ControlType.ComponentInstance},...oe,attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...oe}}},...Le};f.addPropertyControls(vi,gc);const wi=se(T.forwardRef(function(t,n){const o=x=>M.match(x).with(1,()=>t.content1).with(2,()=>t.content2).with(3,()=>t.content3).with(4,()=>t.content4).with(5,()=>t.content5).with(6,()=>t.content6).with(7,()=>t.content7).with(8,()=>t.content8).with(9,()=>t.content9).with(10,()=>t.content10).otherwise(()=>null),r=t.variants.find(x=>x.useInDesignTime)||t.variants[0];if(X())return r&&o(r.content);const l=Z(t),a=t.choiceValueId??"",s=a.length>0,c=U.useAttributes([l],!1)[0];if(!c)return d.jsx("span",{children:"Attribute not found"});const C=c.type===h.AttributeType.Choice;if(!C&&s)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});const m=C&&s?c.values.get(a):null;if(s&&m==null)return d.jsx("span",{children:"Choice Value not found"});const b=x=>()=>m?x(m):[...c.values.values()].some(x),u=[...t.variants].find(({selection:x,condition:w})=>M.match({selection:x,condition:w,attribute:c}).with({attribute:{type:h.AttributeType.Choice},selection:"included",condition:"blocked"},b(g=>!g.possibleDecisionStates.includes(h.ChoiceValueDecisionState.Included))).with({attribute:{type:h.AttributeType.Choice},selection:"included",condition:"implicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit})).with({attribute:{type:h.AttributeType.Choice},selection:"included",condition:"explicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit})).with({attribute:{type:h.AttributeType.Choice},selection:"included",condition:"none"},b(g=>{var y;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Included})).with({attribute:{type:h.AttributeType.Choice},selection:"excluded",condition:"blocked"},b(g=>!g.possibleDecisionStates.includes(h.ChoiceValueDecisionState.Excluded))).with({attribute:{type:h.AttributeType.Choice},selection:"excluded",condition:"implicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit})).with({attribute:{type:h.AttributeType.Choice},selection:"excluded",condition:"explicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit})).with({attribute:{type:h.AttributeType.Choice},selection:"excluded",condition:"none"},b(g=>{var y;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Excluded})).with({attribute:{type:h.AttributeType.Boolean},selection:"true",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(!0)).with({attribute:{type:h.AttributeType.Boolean},selection:"true",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===!0&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Boolean},selection:"true",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===!0&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Boolean},selection:"true",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===!0}).with({attribute:{type:h.AttributeType.Boolean},selection:"false",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(!1)).with({attribute:{type:h.AttributeType.Boolean},selection:"false",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===!1&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Boolean},selection:"false",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===!1&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Boolean},selection:"false",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===!1}).with({attribute:{type:h.AttributeType.Component},selection:"included",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(h.ComponentDecisionState.Included)).with({attribute:{type:h.AttributeType.Component},selection:"included",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Component},selection:"included",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Component},selection:"included",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Included}).with({attribute:{type:h.AttributeType.Component},selection:"excluded",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(h.ComponentDecisionState.Excluded)).with({attribute:{type:h.AttributeType.Component},selection:"excluded",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Component},selection:"excluded",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Component},selection:"excluded",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Excluded}).with({attribute:{type:h.AttributeType.Numeric},selection:"numeric",condition:"implicit"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Numeric},selection:"numeric",condition:"explicit"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Numeric},selection:"numeric",condition:"none"},({attribute:g})=>g.decision!=null).with({attribute:{type:h.AttributeType.Choice},selection:"undefined"},()=>m.decision==null).with({attribute:{type:h.AttributeType.Boolean},selection:"undefined"},{attribute:{type:h.AttributeType.Component},selection:"undefined"},{attribute:{type:h.AttributeType.Numeric},selection:"undefined"},({attribute:g})=>g.decision==null).otherwise(()=>!1));return u&&he(o(u.content),{ref:n})})),bc=wi,xc={...oe,...Me,variants:{title:"Variants",type:f.ControlType.Array,maxCount:10,control:{type:f.ControlType.Object,controls:{selection:{title:"Selection",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},condition:{title:"Condition",type:f.ControlType.Enum,defaultValue:"none",options:["none","explicit","implicit","blocked"]},content:{title:"Content",type:f.ControlType.Enum,defaultValue:1,options:[1,2,3,4,5,6,7,8,9,10]},useInDesignTime:{title:"Design Time",type:f.ControlType.Boolean,defaultValue:!1}}}},content1:{title:"Content 1",type:f.ControlType.ComponentInstance},content2:{title:"Content 2",type:f.ControlType.ComponentInstance},content3:{title:"Content 3",type:f.ControlType.ComponentInstance},content4:{title:"Content 4",type:f.ControlType.ComponentInstance},content5:{title:"Content 5",type:f.ControlType.ComponentInstance},content6:{title:"Content 6",type:f.ControlType.ComponentInstance},content7:{title:"Content 7",type:f.ControlType.ComponentInstance},content8:{title:"Content 8",type:f.ControlType.ComponentInstance},content9:{title:"Content 9",type:f.ControlType.ComponentInstance},content10:{title:"Content 10",type:f.ControlType.ComponentInstance}};f.addPropertyControls(wi,xc);const Si=se(e=>{const t=T.useRef(),[n,o]=T.useState(null),r=T.useRef(n),i=T.useMemo(()=>e.color.startsWith("var"),[e.color]),l=i?n:e.color,a=T.useMemo(()=>{if(!l)return;const s=Ui(l);return Hi.hexToCSSFilter(`#${s}`,{acceptanceLossPercentage:1,maxChecks:30}).filter.replace(";","")},[l]);return T.useLayoutEffect(()=>{if(i){const s=t.current&&getComputedStyle(t.current).color;s!=r.current&&(r.current=s,o(s))}}),d.jsx("div",{ref:t,style:{...e.style,color:e.color,filter:a},children:e.children})}),Cc=Si,vc={children:{title:"Content",type:f.ControlType.ComponentInstance},color:{title:"Color",type:f.ControlType.Color,defaultValue:"#0000ff"}};f.addPropertyControls(Si,vc);const Ti=se(e=>{if(X())return e.children;const{error:n}=U.useConfigurationInitialization();return n?he(e.children,{onClick:n.retry}):null}),wc=Ti,Sc={children:{title:"Content",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Ti,Sc);function Tc(e){return T.forwardRef((t,n)=>{const o={...t.style,width:"100%",height:"100%"};return d.jsx(e,{...t,ref:n,style:o})})}const Ac=O.div`
454
+ `,yi=pe((e,t)=>{var v,V;if(Y()){const T=Bt(e,!0,!1);return d.jsx(Yn,{style:T})}const o=ce(),r=Z(e),i=U.useNumericAttribute(r),{explain:l}=fe();if(!i)return d.jsx("span",{children:"Numeric Attribute not found"});const{attribute:a,makeDecision:s}=i,c=((v=a.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit,C=Bt(e,a.isSatisfied,c),m=(V=a.decision)==null?void 0:V.state,[b,u]=S.useState(m),{min:x,max:w}=a.range,y=mi(m,async T=>{if(T<x){alert(`The value must be smaller than or equal to ${x}.`);return}if(T>w){alert(`The value must be greater than or equal to ${w}.`);return}try{await s(T)}catch(R){R.type===h.ConfiguratorErrorType.SetDecisionConflict?e.explain!=="disabled"&&await l(P=>P.whyIsStateNotPossible.numeric(a.id).state(T),e.explain,o):de()}},b,T=>u(T),e.wait);return d.jsx(Yn,{getInputRef:t,thousandsGroupStyle:"thousand",decimalSeparator:e.decimalSeparator,thousandSeparator:e.thousandSeparator,allowNegative:!0,fixedDecimalScale:!0,decimalScale:a.decimalPlaces,allowEmptyFormatting:!1,displayType:"input",placeholder:e.placeholder,prefix:ac(a,e.implicitLabelPrefix),onBlur:()=>{y.flush()},onKeyPress:T=>{T.key==="Enter"&&y.flush()},onValueChange:T=>u(T.floatValue),value:b??"",style:C})}),lc=yi,ac=(e,t)=>{var n;return((n=e.decision)==null?void 0:n.kind)===h.DecisionKind.Implicit?t:""},sc={...ci,wait:{title:"Debounce Delay",type:f.ControlType.Number,defaultValue:2e3,min:0,unit:"ms"},decimalSeparator:{title:"Decimal Separator",type:f.ControlType.String,defaultValue:",",maxLength:1},thousandSeparator:{title:"Thousand Separator",type:f.ControlType.String,defaultValue:".",maxLength:1},placeholder:{title:"Placeholder",type:f.ControlType.String,defaultValue:""}};f.addPropertyControls(yi,sc);const Me={choiceValueId:{title:"Choice Value Id",type:f.ControlType.String}};function he(e,t){return S.Children.map(e,n=>{if(S.isValidElement(n)){const o=oo(n.props,t);return S.cloneElement(n,o)}return n})}const gi=pe((e,t)=>{if(Y())return e.children;const o=ce(),{makeDecision:r}=U.useMakeDecision(),i=Z(e),l=e.choiceValueId??"",a=l.length>0,s=U.useAttributes([i],!1)[0],{explain:c}=fe();if(!s)return d.jsx("span",{children:"Attribute not found"});const C=s.type===h.AttributeType.Choice,m=s.type===h.AttributeType.Numeric,b=s.type===h.AttributeType.Boolean,u=s.type===h.AttributeType.Component;if(!C&&a)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});if(m)return d.jsx("span",{children:"Numeric Attribute is not supported"});let x=C?s.values.get(l):null;if(a&&x==null)return d.jsx("span",{children:"Choice Value not found"});const w=V=>M.match({state:V,attribute:s}).with({attribute:{type:h.AttributeType.Choice},state:"undefined"},()=>x.decision==null).with({attribute:{type:h.AttributeType.Choice},state:"included"},()=>{var T,R;return((T=x.decision)==null?void 0:T.state)===h.ChoiceValueDecisionState.Included&&((R=x.decision)==null?void 0:R.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Choice},state:"excluded"},()=>{var T,R;return((T=x.decision)==null?void 0:T.state)===h.ChoiceValueDecisionState.Excluded&&((R=x.decision)==null?void 0:R.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Boolean},state:"undefined"},{attribute:{type:h.AttributeType.Component},state:"undefined"},({attribute:T})=>T.decision==null).with({attribute:{type:h.AttributeType.Boolean},state:"true"},({attribute:T})=>{var R,I;return((R=T.decision)==null?void 0:R.state)===!0&&((I=T.decision)==null?void 0:I.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Boolean},state:"false"},({attribute:T})=>{var R,I;return((R=T.decision)==null?void 0:R.state)===!1&&((I=T.decision)==null?void 0:I.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Component},state:"included"},({attribute:T})=>{var R,I;return((R=T.decision)==null?void 0:R.state)===h.ComponentDecisionState.Included&&((I=T.decision)==null?void 0:I.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Component},state:"excluded"},({attribute:T})=>{var R,I;return((R=T.decision)==null?void 0:R.state)===h.ComponentDecisionState.Excluded&&((I=T.decision)==null?void 0:I.kind)===h.DecisionKind.Explicit}).otherwise(()=>!1),g=V=>M.match({isChoiceAttribute:C,isBooleanAttribute:b,isComponentAttribute:u,state:V}).with({isChoiceAttribute:!0,state:"included"},()=>h.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,state:"excluded"},()=>h.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>h.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>h.ComponentDecisionState.Excluded).otherwise(()=>null);w(e.toggleFrom);const y=w(e.toggleTo),v=async()=>{const V=y?e.toggleFrom:e.toggleTo,T=g(V),R=u?s.possibleDecisionStates.includes(T):!1,I=b?s.possibleDecisionStates.includes(T):!1,P=(C?x.possibleDecisionStates.includes(T):!1)||I||R,k=e.explain,A=k!=="disabled"&&(async()=>{const N=M.match({isComponentAttribute:u,isBooleanAttribute:b,isChoiceAttribute:C}).returnType().with({isChoiceAttribute:!0},()=>h.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>h.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>h.ExplainQuestionSubject.component).otherwise(()=>null);N&&await c({question:h.ExplainQuestionType.whyIsStateNotPossible,subject:N,attributeId:i,choiceValueId:l,state:T},k,o)});if(P||T==null)try{await r({type:s.type,attributeId:i,choiceValueId:l,state:T})}catch(N){if(N.type===h.ConfiguratorErrorType.ConflictWithConsequence&&A){await A();return}de()}else A&&await A()};return he(e.children,{onClick:v,ref:t})}),cc=gi,uc={...oe,...Me,children:{title:"Content",type:f.ControlType.ComponentInstance},toggleFrom:{title:"Toggle From",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false"]},toggleTo:{title:"Toggle To",type:f.ControlType.Enum,defaultValue:"included",options:["undefined","included","excluded","true","false"]},...Le};f.addPropertyControls(gi,uc);const bi=pe((e,t)=>{if(Y())return e.children;const o=ce(),{makeDecision:r}=U.useMakeDecision(),i=Z(e),l=e.choiceValueId??"",a=l.length>0,s=U.useAttributes([i],!1)[0],c=U.useChoiceAttribute(i),{explain:C}=fe();if(!s)return d.jsx("span",{children:"Attribute not found"});const m=s.type===h.AttributeType.Choice,b=s.type===h.AttributeType.Numeric,u=s.type===h.AttributeType.Boolean,x=s.type===h.AttributeType.Component;if(!m&&a)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});let w=m?s.values.get(l):null;if(a&&w==null)return d.jsx("span",{children:"Choice Value not found"});const g=()=>M.match({isChoiceAttribute:m,isBooleanAttribute:u,isComponentAttribute:x,isNumericAttribute:b,hasChoiceValueId:a,state:e.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>h.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>h.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>h.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>h.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>e.numericValue).otherwise(()=>null),y=async()=>{if(m&&!a&&e.setSelection==="undefined")try{await c.clearDecisions()}catch{de()}else{const v=g(),V=x?s.possibleDecisionStates.includes(v):!1,T=u?s.possibleDecisionStates.includes(v):!1,I=(m?w.possibleDecisionStates.includes(v):!1)||T||V,D=e.explain,P=D!=="disabled"&&(async()=>{const k=M.match({isComponentAttribute:x,isBooleanAttribute:u,isChoiceAttribute:m,isNumericAttribute:b}).returnType().with({isChoiceAttribute:!0},()=>h.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>h.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>h.ExplainQuestionSubject.component).with({isNumericAttribute:!0},()=>h.ExplainQuestionSubject.numeric).otherwise(()=>null);k&&await C({question:h.ExplainQuestionType.whyIsStateNotPossible,subject:k,attributeId:i,choiceValueId:l,state:v},D,o)});if(b||I||v==null)try{await r({type:s.type,attributeId:i,choiceValueId:l,state:v})}catch(k){const A=k;if((A.type===h.ConfiguratorErrorType.ConflictWithConsequence||A.type===h.ConfiguratorErrorType.SetDecisionConflict)&&P){await P();return}de()}else P&&await P()}};return he(e.children,{onClick:y,ref:t})}),dc=bi,fc={...oe,...Me,children:{title:"Content",type:f.ControlType.ComponentInstance},setSelection:{title:"Set Selection To",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},numericValue:{title:"Numeric Value",type:f.ControlType.Number,defaultValue:0},...Le};f.addPropertyControls(bi,fc);const xi=pe((e,t)=>{var m;if(Y())return e.children;const o=ce(),{makeManyDecisions:r}=U.useMakeDecision(),{handleExplainAnswer:i}=fe(),l=e.attributes.map(Z),a=U.useAttributes(l,!1).map((b,u)=>{if(!b)return{error:d.jsx("span",{children:"Attribute not found"})};const x=e.attributes[u],w=x.choiceValueId??"",g=w.length>0,y=b.type===h.AttributeType.Choice,v=b.type===h.AttributeType.Numeric,V=b.type===h.AttributeType.Boolean,T=b.type===h.AttributeType.Component;if(!y&&g)return{error:d.jsx("span",{children:"Attribute is not a Choice Attribute"})};let R=y?b.values.get(w):null;if(g&&R==null)return{error:d.jsx("span",{children:"Choice Value not found"})};const I=()=>M.match({isChoiceAttribute:y,isBooleanAttribute:V,isComponentAttribute:T,isNumericAttribute:v,hasChoiceValueId:g,state:x.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>h.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>h.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>h.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>h.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>x.numericValue).otherwise(()=>null);return{getDecisions:()=>y&&!g&&x.setSelection==="undefined"?[...b.values.values()].filter(D=>{var P;return((P=D.decision)==null?void 0:P.kind)===h.DecisionKind.Explicit}).map(D=>({type:b.type,attributeId:b.id,choiceValueId:D.id,state:null})):[{type:b.type,attributeId:b.id,choiceValueId:w,state:I()}]}}),s=(m=a.find(b=>b.error))==null?void 0:m.error;if(s)return s;const c=async()=>{const b=a.reduce((x,w)=>[...x,...w.getDecisions()],new Array),u=M.match(e.existingSelections).with("keep",()=>({type:"KeepExistingDecisions"})).with("drop",()=>({type:"DropExistingDecisions",conflictHandling:M.match(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()})).exhaustive();try{await r(b,u)}catch(x){const w=x;if(console.debug("SetMany failed",w),(w==null?void 0:w.type)===h.ConfiguratorErrorType.MakeManyDecisionsConflict&&w.decisionExplanations){e.explain!=="disabled"&&await i(w,e.explain,o);return}de();return}},C=()=>{e.trigger==="click"&&c()};return S.useEffect(()=>{e.trigger==="auto"&&c()},[]),he(e.children,{onClick:C,ref:t})}),pc=xi,hc={children:{title:"Content",type:f.ControlType.ComponentInstance},attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...oe,...Me,setSelection:{title:"Set Selection To",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},numericValue:{title:"Numeric Value",type:f.ControlType.Number,defaultValue:0}}}},existingSelections:{title:"Existing Selections",type:f.ControlType.Enum,defaultValue:"keep",options:["keep","drop"]},autoResolveConflicts:{title:"Auto Resolve Conflicts",type:f.ControlType.Boolean,defaultValue:!0,hidden:e=>e.existingSelections!=="drop"},trigger:{title:"Trigger",type:f.ControlType.Enum,defaultValue:"click",options:["click","auto"],displaySegmentedControl:!0,segmentedControlDirection:"horizontal"},...Le};f.addPropertyControls(xi,hc);const Ci=se(e=>{if(Y())return e.enabledChildren;const{canResetConfiguration:n,resetConfiguration:o}=U.useConfigurationReset(),r=async()=>{if(n)try{await o()}catch{Js()}},i=n?e.enabledChildren:e.disabledChildren;return he(i,{onClick:r})}),mc=Ci,yc={enabledChildren:{title:"Content – Enabled",type:f.ControlType.ComponentInstance},disabledChildren:{title:"Content – Disabled",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Ci,yc);const vi=pe((e,t)=>{if(Y())return e.unsatisfiedChildren;const o=ce(),{isSatisfied:r}=U.useConfigurationSatisfaction(),{explain:i}=fe(),a=[...e.attributeId.length>0?[Z(e)]:[],...e.attributes.map(Z)],s=()=>{var u;const m=U.useAttributes(a,!1).map(x=>x?{isSatisfied:x.isSatisfied}:{error:d.jsx("span",{children:"Attribute not found"})}),b=(u=m.find(x=>x.error))==null?void 0:u.error;return b||m.every(x=>x.isSatisfied)},c=async()=>{e.explain!=="disabled"&&(a.length===0?await i(m=>m.whyIsNotSatisfied.configuration,e.explain,o):a.length===1&&await i(m=>m.whyIsNotSatisfied.attribute(a[0]),e.explain,o))};return(a.length>0?s():r)?e.satisfiedChildren:he(e.unsatisfiedChildren,{onClick:c,ref:t})}),gc=vi,bc={satisfiedChildren:{title:"Content – Satisfied",type:f.ControlType.ComponentInstance},unsatisfiedChildren:{title:"Content – Unsatisfied",type:f.ControlType.ComponentInstance},...oe,attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...oe}}},...Le};f.addPropertyControls(vi,bc);const wi=se(S.forwardRef(function(t,n){const o=x=>M.match(x).with(1,()=>t.content1).with(2,()=>t.content2).with(3,()=>t.content3).with(4,()=>t.content4).with(5,()=>t.content5).with(6,()=>t.content6).with(7,()=>t.content7).with(8,()=>t.content8).with(9,()=>t.content9).with(10,()=>t.content10).otherwise(()=>null),r=t.variants.find(x=>x.useInDesignTime)||t.variants[0];if(Y())return r&&o(r.content);const l=Z(t),a=t.choiceValueId??"",s=a.length>0,c=U.useAttributes([l],!1)[0];if(!c)return d.jsx("span",{children:"Attribute not found"});const C=c.type===h.AttributeType.Choice;if(!C&&s)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});const m=C&&s?c.values.get(a):null;if(s&&m==null)return d.jsx("span",{children:"Choice Value not found"});const b=x=>()=>m?x(m):[...c.values.values()].some(x),u=[...t.variants].find(({selection:x,condition:w})=>M.match({selection:x,condition:w,attribute:c}).with({attribute:{type:h.AttributeType.Choice},selection:"included",condition:"blocked"},b(g=>!g.possibleDecisionStates.includes(h.ChoiceValueDecisionState.Included))).with({attribute:{type:h.AttributeType.Choice},selection:"included",condition:"implicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit})).with({attribute:{type:h.AttributeType.Choice},selection:"included",condition:"explicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit})).with({attribute:{type:h.AttributeType.Choice},selection:"included",condition:"none"},b(g=>{var y;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Included})).with({attribute:{type:h.AttributeType.Choice},selection:"excluded",condition:"blocked"},b(g=>!g.possibleDecisionStates.includes(h.ChoiceValueDecisionState.Excluded))).with({attribute:{type:h.AttributeType.Choice},selection:"excluded",condition:"implicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit})).with({attribute:{type:h.AttributeType.Choice},selection:"excluded",condition:"explicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit})).with({attribute:{type:h.AttributeType.Choice},selection:"excluded",condition:"none"},b(g=>{var y;return((y=g.decision)==null?void 0:y.state)===h.ChoiceValueDecisionState.Excluded})).with({attribute:{type:h.AttributeType.Boolean},selection:"true",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(!0)).with({attribute:{type:h.AttributeType.Boolean},selection:"true",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===!0&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Boolean},selection:"true",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===!0&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Boolean},selection:"true",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===!0}).with({attribute:{type:h.AttributeType.Boolean},selection:"false",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(!1)).with({attribute:{type:h.AttributeType.Boolean},selection:"false",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===!1&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Boolean},selection:"false",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===!1&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Boolean},selection:"false",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===!1}).with({attribute:{type:h.AttributeType.Component},selection:"included",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(h.ComponentDecisionState.Included)).with({attribute:{type:h.AttributeType.Component},selection:"included",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Component},selection:"included",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Component},selection:"included",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Included}).with({attribute:{type:h.AttributeType.Component},selection:"excluded",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(h.ComponentDecisionState.Excluded)).with({attribute:{type:h.AttributeType.Component},selection:"excluded",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Component},selection:"excluded",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Component},selection:"excluded",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===h.ComponentDecisionState.Excluded}).with({attribute:{type:h.AttributeType.Numeric},selection:"numeric",condition:"implicit"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.kind)===h.DecisionKind.Implicit}).with({attribute:{type:h.AttributeType.Numeric},selection:"numeric",condition:"explicit"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.kind)===h.DecisionKind.Explicit}).with({attribute:{type:h.AttributeType.Numeric},selection:"numeric",condition:"none"},({attribute:g})=>g.decision!=null).with({attribute:{type:h.AttributeType.Choice},selection:"undefined"},()=>m.decision==null).with({attribute:{type:h.AttributeType.Boolean},selection:"undefined"},{attribute:{type:h.AttributeType.Component},selection:"undefined"},{attribute:{type:h.AttributeType.Numeric},selection:"undefined"},({attribute:g})=>g.decision==null).otherwise(()=>!1));return u&&he(o(u.content),{ref:n})})),xc=wi,Cc={...oe,...Me,variants:{title:"Variants",type:f.ControlType.Array,maxCount:10,control:{type:f.ControlType.Object,controls:{selection:{title:"Selection",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},condition:{title:"Condition",type:f.ControlType.Enum,defaultValue:"none",options:["none","explicit","implicit","blocked"]},content:{title:"Content",type:f.ControlType.Enum,defaultValue:1,options:[1,2,3,4,5,6,7,8,9,10]},useInDesignTime:{title:"Design Time",type:f.ControlType.Boolean,defaultValue:!1}}}},content1:{title:"Content 1",type:f.ControlType.ComponentInstance},content2:{title:"Content 2",type:f.ControlType.ComponentInstance},content3:{title:"Content 3",type:f.ControlType.ComponentInstance},content4:{title:"Content 4",type:f.ControlType.ComponentInstance},content5:{title:"Content 5",type:f.ControlType.ComponentInstance},content6:{title:"Content 6",type:f.ControlType.ComponentInstance},content7:{title:"Content 7",type:f.ControlType.ComponentInstance},content8:{title:"Content 8",type:f.ControlType.ComponentInstance},content9:{title:"Content 9",type:f.ControlType.ComponentInstance},content10:{title:"Content 10",type:f.ControlType.ComponentInstance}};f.addPropertyControls(wi,Cc);const Si=se(e=>{const t=S.useRef(),[n,o]=S.useState(null),r=S.useRef(n),i=S.useMemo(()=>e.color.startsWith("var"),[e.color]),l=i?n:e.color,a=S.useMemo(()=>{if(!l)return;const s=Qi(l);return Ui.hexToCSSFilter(`#${s}`,{acceptanceLossPercentage:1,maxChecks:30}).filter.replace(";","")},[l]);return S.useLayoutEffect(()=>{if(i){const s=t.current&&getComputedStyle(t.current).color;s!=r.current&&(r.current=s,o(s))}}),d.jsx("div",{ref:t,style:{...e.style,color:e.color,filter:a},children:e.children})}),vc=Si,wc={children:{title:"Content",type:f.ControlType.ComponentInstance},color:{title:"Color",type:f.ControlType.Color,defaultValue:"#0000ff"}};f.addPropertyControls(Si,wc);const Ti=se(e=>{if(Y())return e.children;const{error:n}=U.useConfigurationInitialization();return n?he(e.children,{onClick:n.retry}):null}),Sc=Ti,Tc={children:{title:"Content",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Ti,Tc);function Ec(e){return S.forwardRef((t,n)=>{const o={...t.style,width:"100%",height:"100%"};return d.jsx(e,{...t,ref:n,style:o})})}const Ac=O.div`
455
455
  width: 10px;
456
456
  height: 10px;
457
457
  background-color: greenyellow;
458
- `;function Ai(e){const t=T.useRef(null);return T.useEffect(()=>{if(!t.current)return;const n=setTimeout(()=>{t.current.scrollIntoView()},e.delay);return()=>clearTimeout(n)},[t.current]),d.jsx(Ac,{ref:t})}const Ec={delay:{title:"Delay",type:f.ControlType.Number,min:0,unit:"ms",defaultValue:0,step:1}};f.addPropertyControls(Ai,Ec);const Ei=O.div`
458
+ `;function Ei(e){const t=S.useRef(null);return S.useEffect(()=>{if(!t.current)return;const n=setTimeout(()=>{t.current.scrollIntoView()},e.delay);return()=>clearTimeout(n)},[t.current]),d.jsx(Ac,{ref:t})}const Rc={delay:{title:"Delay",type:f.ControlType.Number,min:0,unit:"ms",defaultValue:0,step:1}};f.addPropertyControls(Ei,Rc);const Ai=O.div`
459
459
  display: contents;
460
- `,Rc=O.createGlobalStyle`
460
+ `,Ic=O.createGlobalStyle`
461
461
  :root {
462
- *:has(> ${Ei}) {
462
+ *:has(> ${Ai}) {
463
463
  display: contents !important;
464
464
  }
465
465
  }
466
- `,Ri=se(rn(e=>{const t=ce(),n=X(),r=(()=>{const u=x=>{var y;const w=T.Children.toArray(x)[0],g=(y=w.props)==null?void 0:y.children;return g?u(g):w};return u(e.itemTemplate)})();if(!r)return d.jsx("span",{children:"Choice Value Template not defined"});const i=(u,x)=>u.map(w=>T.cloneElement(r,{key:w,layoutId:`${t}_${w}`,attributeId:e.attributeId,componentPath:e.componentPath,sharedConfigurationModel:e.sharedConfigurationModel,choiceValueId:w,choiceValueName:x.get(w)??w}));if(n)return d.jsx(Xn,{...e,children:i(["Choice Value 1","Choice Value 2","Choice Value 3"],p.RM.empty)});const l=Z(e),a=U.useChoiceAttribute(l);if(!a)return d.jsx("span",{children:"Choice Attribute not found"});const s=_e(l),c=e.filter??new Array,C=[...a.attribute.values.values()].filter(u=>c.length===0||c.some(({selection:x,condition:w})=>M.match({selection:x,condition:w}).with({selection:"included",condition:"blocked"},()=>!u.possibleDecisionStates.includes(h.ChoiceValueDecisionState.Included)).with({selection:"included",condition:"implicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Included&&((y=u.decision)==null?void 0:y.kind)===h.DecisionKind.Implicit}).with({selection:"included",condition:"explicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Included&&((y=u.decision)==null?void 0:y.kind)===h.DecisionKind.Explicit}).with({selection:"included",condition:"none"},()=>{var g;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Included}).with({selection:"excluded",condition:"blocked"},()=>!u.possibleDecisionStates.includes(h.ChoiceValueDecisionState.Excluded)).with({selection:"excluded",condition:"implicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Excluded&&((y=u.decision)==null?void 0:y.kind)===h.DecisionKind.Implicit}).with({selection:"excluded",condition:"explicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Excluded&&((y=u.decision)==null?void 0:y.kind)===h.DecisionKind.Explicit}).with({selection:"excluded",condition:"none"},()=>{var g;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Excluded}).with({selection:"undefined"},()=>u.decision==null).otherwise(()=>!1))),b=ut(l,C).map(u=>u.id);return d.jsx(Xn,{...e,children:i(b,s)})}));function Xn(e){return d.jsxs(d.Fragment,{children:[d.jsx(ct,{singletonId:"ChoiceValueListRenderer",children:d.jsx(Rc,{})}),d.jsx(Ei,{style:e.style,children:e.children})]})}const Ic=Ri,Pc={...oe,itemTemplate:{title:"Choice Value Template",type:f.ControlType.ComponentInstance},filter:{title:"Filter",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{selection:{title:"Selection",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded"]},condition:{title:"Condition",type:f.ControlType.Enum,defaultValue:"none",options:["none","explicit","implicit","blocked"]}}}}};f.addPropertyControls(Ri,Pc);const{isValidElement:Jn,cloneElement:Zn}=A;function Vc(e,t){return t?(Array.isArray(t)&&(t=t.map((n,o)=>Jn(n)&&typeof n.props=="object"?Zn(n,{...n.props,key:o}):n)),!e||Array.isArray(e)?t:Jn(e)?Zn(e,{...e.props,children:t}):e):e}const{isValidElement:Dc}=A;function Ii(e,t,n){function o(i,l){return t.visit(i,n,l)}function r(i,l){return Ii(i,t,l||n)}if(Dc(e)){if(typeof e.type=="function")return"prototype"in e.type&&e.type.prototype.isReactComponent?e=new e.type(e.props).render():e=e.type(e.props),r(e);if(e.props&&"children"in e.props){const i=e.props.children;return o(e,a=>Array.isArray(i)?i.map(s=>r(s,a)):r(i,a))}}else if(Array.isArray(e)){const i=e;return o(e,a=>i.map(s=>r(s,a)))}return o(e)}const{isValidElement:eo}=A;function Oc(e,t){let n;const{replace:o,updateState:r}=t;return"matchElement"in t?n=i=>eo(i)&&i.type===t.matchElement:"matchLiteral"in t?n=i=>!Array.isArray(i)&&!eo(i)&&t.matchLiteral(i):n=t.match,Ii(e,{visit(i,l,a){const s=r?r(l):l,c=a?a(s):void 0,C=Vc(i,c);return n(C,s)?o(C,s):C}},t.initialState)}function to(e){return d.jsx(d.Fragment,{children:Oc(e.children,e)})}function jc(e){return p.pipe(e,p.Str.replace(/[\s\u2013]/g,"-"),Qi)}const kc=se(e=>{const{children:t,mode:n,replaceString:o,propName:r,elementName:i,text:l}=e;return n==="replace"?d.jsx(to,{match:a=>typeof a=="string",replace:a=>a===o?l:a,children:t}):n==="set-prop"?d.jsx(to,{match:a=>{var s;return((s=a.type)==null?void 0:s.displayName)===i},replace:a=>T.cloneElement(a,{[jc(r)]:l}),children:t}):t}),gt=kc,ln=e=>({children:{title:"Content",type:f.ControlType.ComponentInstance},mode:{title:"Mode",type:f.ControlType.Enum,defaultValue:"replace",options:["replace","set-prop"],displaySegmentedControl:!0},replaceString:{title:"Replace Text",type:f.ControlType.String,defaultValue:e,hidden:t=>t.mode!=="replace"},elementName:{title:"Element Name",type:f.ControlType.String,hidden:t=>t.mode!=="set-prop"},propName:{title:"Property Name",type:f.ControlType.String,hidden:t=>t.mode!=="set-prop"}}),Pi=se(e=>{const{attributeId:t,children:n,customName:o}=e,r=Z(e),i=(o==null?void 0:o.length)>0,l=X(),s=i?o:l?t:(()=>U.useAttributes([r],!1)[0]?pt(r)??t:"Attribute not found")();return d.jsx(gt,{...e,text:s})}),Fc=Pi,Nc={...oe,customName:{title:"Custom Name",type:f.ControlType.String},...ln("<AttributeName>")};f.addPropertyControls(Pi,Nc);const Vi=se(e=>{const{choiceValueId:t,children:n,customName:o,mode:r,replaceString:i,propName:l,elementName:a}=e,s=Z(e),c=o.length>0,C=t.length>0,m=X(),u=c?o:m?t.length>0?t:"Choice Value":(()=>{const x=U.useChoiceAttribute(s);return x?C?x.attribute.values.get(t)==null?"Choice Value not found":uo(s,t)??t:"Choice Value Id missing":"Choice Attribute not found"})();return d.jsx(gt,{...e,text:u})}),Lc=Vi,Mc={...oe,...Me,customName:{title:"Custom Name",type:f.ControlType.String},...ln("<ChoiceValueName>")};f.addPropertyControls(Vi,Mc);function Di(e){return e.children}const Bc={children:{title:"Content",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Di,Bc);function Oi(e){const{children:t,fileExtension:n,fileName:o,target:r}=e;if(X())return t;const{storeConfiguration:l}=U.useConfigurationStoring();return he(t,{onClick:async()=>{const c={type:"spc-stored-configuration",storedConfiguration:await l()};r==="file"?zc(c,`${o}.${n}`):r==="clipboard"&&Kc(c)}})}const $c={children:{title:"Content",type:f.ControlType.ComponentInstance},target:{title:"Target",type:f.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileName:{title:"File Name",type:f.ControlType.String,defaultValue:"configuration",hidden:e=>e.target!=="file"},fileExtension:{title:"File Extension",type:f.ControlType.String,defaultValue:"json",hidden:e=>e.target!=="file"}};f.addPropertyControls(Oi,$c);function zc(e,t){const n=JSON.stringify(e),o=new Blob([n],{type:"application/json"}),r=window.URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}function Kc(e){const t=JSON.stringify(e);navigator.clipboard.writeText(t).catch(n=>{alert("Failed to copy the configuration to clipboard: "+n)})}var ji=(e=>(e[e.parseError=0]="parseError",e[e.noConfiguration=1]="noConfiguration",e[e.noFileSelected=2]="noFileSelected",e[e.fileReadError=3]="fileReadError",e[e.noClipboardData=4]="noClipboardData",e[e.clipboardReadError=5]="clipboardReadError",e))(ji||{});const ki=pe((e,t)=>{const{children:n,fileExtension:o,source:r}=e;if(X())return n;const l=ce(),{restoreConfiguration:a}=U.useConfigurationStoring(),{handleExplainAnswer:s}=fe();return he(n,{onClick:async()=>{const C=p.pipe(await Uc(r,o),p.O.toNullable);if(!C)return;const m={type:"DropExistingDecisions",conflictHandling:M.match(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()};try{await a(C,m)}catch(b){const u=b;if(console.debug("Failed to restore stored configuration",u),u.type===h.ConfiguratorErrorType.StoredConfigurationInvalid){alert("The specific configuration is not supported. Maybe the configuration was created with new application version than the current one.");return}if((u==null?void 0:u.type)===h.ConfiguratorErrorType.MakeManyDecisionsConflict&&u.decisionExplanations){e.explain!=="disabled"&&await s(u,e.explain,l);return}alert("Failed to restore your configuration.");return}},ref:t})}),Wc=ki,qc={children:{title:"Content",type:f.ControlType.ComponentInstance},source:{title:"Source",type:f.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileExtension:{title:"File Extension",type:f.ControlType.String,defaultValue:"json",hidden:e=>e.source!=="file"},autoResolveConflicts:{title:"Auto Resolve Conflicts",type:f.ControlType.Boolean,defaultValue:!0},...Le};f.addPropertyControls(ki,qc);function _c(e){return()=>new Promise(t=>{const n=document.createElement("input");n.type="file",n.accept=`.${e}`,n.onchange=o=>{const r=o.target;if(!r.files||r.files.length===0){t(p.left(2));return}const i=r.files[0],l=new FileReader;l.onload=()=>{t(p.right(l.result))},l.onerror=()=>{t(p.left(3))},l.readAsText(i)},n.oncancel=()=>{t(p.left(2))},n.click()})}function Hc(){return()=>navigator.clipboard.readText().then(e=>e?p.right(e):p.left(4)).catch(()=>p.left(5))}function Uc(e,t){return p.pipe(e==="file"?_c(t):Hc(),p.TE.chainEitherK(n=>p.E.tryCatch(()=>JSON.parse(n),()=>0)),p.TE.filterOrElse(n=>n.type==="spc-stored-configuration",()=>1),p.TE.map(n=>n.storedConfiguration),p.TE.doIfLeft(n=>()=>{console.debug(`Failed to load stored configuration: ${ji[n]}`),n==3?alert("Failed to read the selected file. Maybe it is damaged."):n==1||n==0?e==="file"?alert("The selected file doesn't contain a valid configuration."):e==="clipboard"&&alert("The clipboard doesn't contain a valid configuration."):n==5?alert("Can't read the clipboard. Make to give a permission for reading the clipboard."):n==4&&alert("The clipboard doesn't contain a configuration.")}),p.TO.fromTaskEither)()}const Fi=se(e=>{const{fallback:t}=e,n=Z(e),i=X()?"0.0":(()=>{var s;const l=U.useNumericAttribute(n);if(!l)return"Numeric Attribute not found";const a=(s=l.attribute.decision)==null?void 0:s.state;return a!=null?a.toLocaleString():t})();return d.jsx(gt,{...e,text:i})}),Qc=Fi,Gc={...oe,fallback:{title:"Unselected Text",type:f.ControlType.String,defaultValue:""},...ln("<NumericValue>")};f.addPropertyControls(Fi,Gc);exports.AttributeName=Fc;exports.BooleanSelect=tc;exports.ChoiceSelect=Js;exports.ChoiceValueListRenderer=Ic;exports.ChoiceValueName=Lc;exports.Colorize=Cc;exports.ComponentSelect=oc;exports.Configuration=ys;exports.InitializationRetry=wc;exports.NumericInput=rc;exports.ReplaceText=gt;exports.ResetConfiguration=hc;exports.RestoreConfiguration=Wc;exports.SatisfactionIndicator=yc;exports.ScrollIntoView=Ai;exports.SelectedNumericValue=Qc;exports.SelectionIndicator=bc;exports.SelectionToggle=sc;exports.SetSelection=uc;exports.SetSelections=fc;exports.Singleton=ct;exports.Slot=Di;exports.StoreConfiguration=Oi;exports.attributeIdPropertyControls=oe;exports.choiceValueIdPropertyControls=Me;exports.cloneChildrenWithProps=he;exports.explainableComponent=pe;exports.parseGlobalAttributeId=Z;exports.useAttributeName=pt;exports.useChoiceValueName=uo;exports.useChoiceValueNames=_e;exports.useControlId=ce;exports.useDebounceValue=mi;exports.useExplain=fe;exports.useExplainProcess=ge;exports.useRenderPlaceholder=X;exports.useSortedChoiceValues=ut;exports.withControlId=rn;exports.withErrorBoundary=se;exports.withFullSize=Tc;
466
+ `,Ri=se(rn(e=>{const t=ce(),n=Y(),r=(()=>{const u=x=>{var y;const w=S.Children.toArray(x)[0],g=(y=w.props)==null?void 0:y.children;return g?u(g):w};return u(e.itemTemplate)})();if(!r)return d.jsx("span",{children:"Choice Value Template not defined"});const i=(u,x)=>u.map(w=>S.cloneElement(r,{key:w,layoutId:`${t}_${w}`,attributeId:e.attributeId,componentPath:e.componentPath,sharedConfigurationModel:e.sharedConfigurationModel,choiceValueId:w,choiceValueName:x.get(w)??w}));if(n)return d.jsx(Xn,{...e,children:i(["Choice Value 1","Choice Value 2","Choice Value 3"],p.RM.empty)});const l=Z(e),a=U.useChoiceAttribute(l);if(!a)return d.jsx("span",{children:"Choice Attribute not found"});const s=_e(l),c=e.filter??new Array,C=[...a.attribute.values.values()].filter(u=>c.length===0||c.some(({selection:x,condition:w})=>M.match({selection:x,condition:w}).with({selection:"included",condition:"blocked"},()=>!u.possibleDecisionStates.includes(h.ChoiceValueDecisionState.Included)).with({selection:"included",condition:"implicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Included&&((y=u.decision)==null?void 0:y.kind)===h.DecisionKind.Implicit}).with({selection:"included",condition:"explicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Included&&((y=u.decision)==null?void 0:y.kind)===h.DecisionKind.Explicit}).with({selection:"included",condition:"none"},()=>{var g;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Included}).with({selection:"excluded",condition:"blocked"},()=>!u.possibleDecisionStates.includes(h.ChoiceValueDecisionState.Excluded)).with({selection:"excluded",condition:"implicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Excluded&&((y=u.decision)==null?void 0:y.kind)===h.DecisionKind.Implicit}).with({selection:"excluded",condition:"explicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Excluded&&((y=u.decision)==null?void 0:y.kind)===h.DecisionKind.Explicit}).with({selection:"excluded",condition:"none"},()=>{var g;return((g=u.decision)==null?void 0:g.state)===h.ChoiceValueDecisionState.Excluded}).with({selection:"undefined"},()=>u.decision==null).otherwise(()=>!1))),b=ut(l,C).map(u=>u.id);return d.jsx(Xn,{...e,children:i(b,s)})}));function Xn(e){return d.jsxs(d.Fragment,{children:[d.jsx(ct,{singletonId:"ChoiceValueListRenderer",children:d.jsx(Ic,{})}),d.jsx(Ai,{style:e.style,children:e.children})]})}const Pc=Ri,Vc={...oe,itemTemplate:{title:"Choice Value Template",type:f.ControlType.ComponentInstance},filter:{title:"Filter",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{selection:{title:"Selection",type:f.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded"]},condition:{title:"Condition",type:f.ControlType.Enum,defaultValue:"none",options:["none","explicit","implicit","blocked"]}}}}};f.addPropertyControls(Ri,Vc);const{isValidElement:Jn,cloneElement:Zn}=E;function Dc(e,t){return t?(Array.isArray(t)&&(t=t.map((n,o)=>Jn(n)&&typeof n.props=="object"?Zn(n,{...n.props,key:o}):n)),!e||Array.isArray(e)?t:Jn(e)?Zn(e,{...e.props,children:t}):e):e}const{isValidElement:Oc}=E;function Ii(e,t,n){function o(i,l){return t.visit(i,n,l)}function r(i,l){return Ii(i,t,l||n)}if(Oc(e)){if(typeof e.type=="function")return"prototype"in e.type&&e.type.prototype.isReactComponent?e=new e.type(e.props).render():e=e.type(e.props),r(e);if(e.props&&"children"in e.props){const i=e.props.children;return o(e,a=>Array.isArray(i)?i.map(s=>r(s,a)):r(i,a))}}else if(Array.isArray(e)){const i=e;return o(e,a=>i.map(s=>r(s,a)))}return o(e)}const{isValidElement:eo}=E;function jc(e,t){let n;const{replace:o,updateState:r}=t;return"matchElement"in t?n=i=>eo(i)&&i.type===t.matchElement:"matchLiteral"in t?n=i=>!Array.isArray(i)&&!eo(i)&&t.matchLiteral(i):n=t.match,Ii(e,{visit(i,l,a){const s=r?r(l):l,c=a?a(s):void 0,C=Dc(i,c);return n(C,s)?o(C,s):C}},t.initialState)}function to(e){return d.jsx(d.Fragment,{children:jc(e.children,e)})}function kc(e){return p.pipe(e,p.Str.replace(/[\s\u2013]/g,"-"),Gi)}const Fc=se(e=>{const{children:t,mode:n,replaceString:o,propName:r,elementName:i,text:l}=e;return n==="replace"?d.jsx(to,{match:a=>typeof a=="string",replace:a=>a===o?l:a,children:t}):n==="set-prop"?d.jsx(to,{match:a=>{var s;return((s=a.type)==null?void 0:s.displayName)===i},replace:a=>S.cloneElement(a,{[kc(r)]:l}),children:t}):t}),gt=Fc,ln=e=>({children:{title:"Content",type:f.ControlType.ComponentInstance},mode:{title:"Mode",type:f.ControlType.Enum,defaultValue:"replace",options:["replace","set-prop"],displaySegmentedControl:!0},replaceString:{title:"Replace Text",type:f.ControlType.String,defaultValue:e,hidden:t=>t.mode!=="replace"},elementName:{title:"Element Name",type:f.ControlType.String,hidden:t=>t.mode!=="set-prop"},propName:{title:"Property Name",type:f.ControlType.String,hidden:t=>t.mode!=="set-prop"}}),Pi=se(e=>{const{attributeId:t,children:n,customName:o}=e,r=Z(e),i=(o==null?void 0:o.length)>0,l=Y(),s=i?o:l?t:(()=>U.useAttributes([r],!1)[0]?pt(r)??t:"Attribute not found")();return d.jsx(gt,{...e,text:s})}),Nc=Pi,Lc={...oe,customName:{title:"Custom Name",type:f.ControlType.String},...ln("<AttributeName>")};f.addPropertyControls(Pi,Lc);const Vi=se(e=>{const{choiceValueId:t,children:n,customName:o,mode:r,replaceString:i,propName:l,elementName:a}=e,s=Z(e),c=o.length>0,C=t.length>0,m=Y(),u=c?o:m?t.length>0?t:"Choice Value":(()=>{const x=U.useChoiceAttribute(s);return x?C?x.attribute.values.get(t)==null?"Choice Value not found":uo(s,t)??t:"Choice Value Id missing":"Choice Attribute not found"})();return d.jsx(gt,{...e,text:u})}),Mc=Vi,Bc={...oe,...Me,customName:{title:"Custom Name",type:f.ControlType.String},...ln("<ChoiceValueName>")};f.addPropertyControls(Vi,Bc);function Di(e){return e.children}const $c={children:{title:"Content",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Di,$c);function Oi(e){const{children:t,fileExtension:n,fileName:o,target:r}=e;if(Y())return t;const{storeConfiguration:l}=U.useConfigurationStoring();return he(t,{onClick:async()=>{const c={type:"spc-stored-configuration",storedConfiguration:await l()};r==="file"?Kc(c,`${o}.${n}`):r==="clipboard"&&Wc(c)}})}const zc={children:{title:"Content",type:f.ControlType.ComponentInstance},target:{title:"Target",type:f.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileName:{title:"File Name",type:f.ControlType.String,defaultValue:"configuration",hidden:e=>e.target!=="file"},fileExtension:{title:"File Extension",type:f.ControlType.String,defaultValue:"json",hidden:e=>e.target!=="file"}};f.addPropertyControls(Oi,zc);function Kc(e,t){const n=JSON.stringify(e),o=new Blob([n],{type:"application/json"}),r=window.URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}function Wc(e){const t=JSON.stringify(e);navigator.clipboard.writeText(t).catch(n=>{alert("Failed to copy the configuration to clipboard: "+n)})}var ji=(e=>(e[e.parseError=0]="parseError",e[e.noConfiguration=1]="noConfiguration",e[e.noFileSelected=2]="noFileSelected",e[e.fileReadError=3]="fileReadError",e[e.noClipboardData=4]="noClipboardData",e[e.clipboardReadError=5]="clipboardReadError",e))(ji||{});const ki=pe((e,t)=>{const{children:n,fileExtension:o,source:r}=e;if(Y())return n;const l=ce(),{restoreConfiguration:a}=U.useConfigurationStoring(),{handleExplainAnswer:s}=fe();return he(n,{onClick:async()=>{const C=p.pipe(await Qc(r,o),p.O.toNullable);if(!C)return;const m={type:"DropExistingDecisions",conflictHandling:M.match(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()};try{await a(C,m)}catch(b){const u=b;if(console.debug("Failed to restore stored configuration",u),u.type===h.ConfiguratorErrorType.StoredConfigurationInvalid){alert("The specific configuration is not supported. Maybe the configuration was created with new application version than the current one.");return}if((u==null?void 0:u.type)===h.ConfiguratorErrorType.MakeManyDecisionsConflict&&u.decisionExplanations){e.explain!=="disabled"&&await s(u,e.explain,l);return}alert("Failed to restore your configuration.");return}},ref:t})}),qc=ki,_c={children:{title:"Content",type:f.ControlType.ComponentInstance},source:{title:"Source",type:f.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileExtension:{title:"File Extension",type:f.ControlType.String,defaultValue:"json",hidden:e=>e.source!=="file"},autoResolveConflicts:{title:"Auto Resolve Conflicts",type:f.ControlType.Boolean,defaultValue:!0},...Le};f.addPropertyControls(ki,_c);function Hc(e){return()=>new Promise(t=>{const n=document.createElement("input");n.type="file",n.accept=`.${e}`,n.onchange=o=>{const r=o.target;if(!r.files||r.files.length===0){t(p.left(2));return}const i=r.files[0],l=new FileReader;l.onload=()=>{t(p.right(l.result))},l.onerror=()=>{t(p.left(3))},l.readAsText(i)},n.oncancel=()=>{t(p.left(2))},n.click()})}function Uc(){return()=>navigator.clipboard.readText().then(e=>e?p.right(e):p.left(4)).catch(()=>p.left(5))}function Qc(e,t){return p.pipe(e==="file"?Hc(t):Uc(),p.TE.chainEitherK(n=>p.E.tryCatch(()=>JSON.parse(n),()=>0)),p.TE.filterOrElse(n=>n.type==="spc-stored-configuration",()=>1),p.TE.map(n=>n.storedConfiguration),p.TE.doIfLeft(n=>()=>{console.debug(`Failed to load stored configuration: ${ji[n]}`),n==3?alert("Failed to read the selected file. Maybe it is damaged."):n==1||n==0?e==="file"?alert("The selected file doesn't contain a valid configuration."):e==="clipboard"&&alert("The clipboard doesn't contain a valid configuration."):n==5?alert("Can't read the clipboard. Make to give a permission for reading the clipboard."):n==4&&alert("The clipboard doesn't contain a configuration.")}),p.TO.fromTaskEither)()}const Fi=se(e=>{const{fallback:t}=e,n=Z(e),i=Y()?"0.0":(()=>{var s;const l=U.useNumericAttribute(n);if(!l)return"Numeric Attribute not found";const a=(s=l.attribute.decision)==null?void 0:s.state;return a!=null?a.toLocaleString():t})();return d.jsx(gt,{...e,text:i})}),Gc=Fi,Yc={...oe,fallback:{title:"Unselected Text",type:f.ControlType.String,defaultValue:""},...ln("<NumericValue>")};f.addPropertyControls(Fi,Yc);function Ni(e){if(Y())return d.jsx("div",{style:{width:"100%"},children:e.children});const n=S.useRef(0),[o,r]=S.useState(null),i=a=>{window.parent.postMessage({type:"spc.configurator.height",height:a},"*")};function l(a=o){if(!a)return;const s=a.offsetHeight;s!==n.current&&(n.current=s,i(s))}return S.useEffect(()=>{const a=o;if(!a)return;l(a);const s=new ResizeObserver(()=>{l(a)});return s.observe(a),()=>{s.disconnect()}},[o]),d.jsx("div",{ref:r,style:{width:"100%"},children:e.children})}f.addPropertyControls(Ni,{children:{title:"Content",type:f.ControlType.ComponentInstance}});exports.AttributeName=Nc;exports.BooleanSelect=nc;exports.ChoiceSelect=Zs;exports.ChoiceValueListRenderer=Pc;exports.ChoiceValueName=Mc;exports.Colorize=vc;exports.ComponentSelect=ic;exports.Configuration=gs;exports.InitializationRetry=Sc;exports.NumericInput=lc;exports.PropagateHeight=Ni;exports.ReplaceText=gt;exports.ResetConfiguration=mc;exports.RestoreConfiguration=qc;exports.SatisfactionIndicator=gc;exports.ScrollIntoView=Ei;exports.SelectedNumericValue=Gc;exports.SelectionIndicator=xc;exports.SelectionToggle=cc;exports.SetSelection=dc;exports.SetSelections=pc;exports.Singleton=ct;exports.Slot=Di;exports.StoreConfiguration=Oi;exports.attributeIdPropertyControls=oe;exports.choiceValueIdPropertyControls=Me;exports.cloneChildrenWithProps=he;exports.explainableComponent=pe;exports.parseGlobalAttributeId=Z;exports.useAttributeName=pt;exports.useChoiceValueName=uo;exports.useChoiceValueNames=_e;exports.useControlId=ce;exports.useDebounceValue=mi;exports.useExplain=fe;exports.useExplainProcess=ge;exports.useRenderPlaceholder=Y;exports.useSortedChoiceValues=ut;exports.withControlId=rn;exports.withErrorBoundary=se;exports.withFullSize=Ec;