@viamedici-spc/configurator-framer 2.0.0 → 2.1.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 +43 -39
- package/dist/index.d.ts +14 -7
- package/dist/index.js +1090 -1044
- package/package.json +2 -2
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"),
|
|
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`
|
|
2
2
|
padding: var(--space-md);
|
|
3
3
|
margin: var(--space-md);
|
|
4
4
|
border-radius: var(--shape-border-radius-sm);
|
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
margin: 0 0 var(--space-xs);
|
|
18
18
|
`,Ji=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){if(X())return null;const{error:n}=U.useConfigurationInitialization();if(!n)return null;const o=
|
|
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}
|
|
21
|
+
|
|
22
|
+
${a}
|
|
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`
|
|
21
25
|
:root {
|
|
22
26
|
--font-primary: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
|
|
23
27
|
--font-heading: "Inter-Medium", "Inter", "Inter Placeholder", sans-serif;
|
|
@@ -75,7 +79,7 @@
|
|
|
75
79
|
13.9px 23.6px 54.7px rgba(0, 0, 0, 0.061),
|
|
76
80
|
40px 68px 96px rgba(0, 0, 0, 0.1);
|
|
77
81
|
}
|
|
78
|
-
`,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:
|
|
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`
|
|
79
83
|
display: flex;
|
|
80
84
|
gap: var(--space-xs);
|
|
81
85
|
align-items: center;
|
|
@@ -108,7 +112,7 @@
|
|
|
108
112
|
white-space: nowrap;
|
|
109
113
|
overflow: hidden;
|
|
110
114
|
text-overflow: ellipsis;
|
|
111
|
-
`;function hr(e){const{decision:t,choiceValuesNames:n}=e,o=t.intention,r=
|
|
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`
|
|
112
116
|
display: grid;
|
|
113
117
|
grid-template-columns: subgrid;
|
|
114
118
|
grid-column: span 2;
|
|
@@ -124,7 +128,7 @@
|
|
|
124
128
|
flex-wrap: wrap;
|
|
125
129
|
min-width: 0;
|
|
126
130
|
gap: var(--space-xxs);
|
|
127
|
-
`;function br(e){const{decisions:t}=e,n=t[0].attributeId,o=_e(n),r=pt(n),i=
|
|
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`
|
|
128
132
|
background-color: var(--color-explain-dialog-explanation-card);
|
|
129
133
|
padding: var(--space-sm-fixed);
|
|
130
134
|
box-shadow: 2px 1px 10px -5px rgba(0, 0, 0, 0.4);
|
|
@@ -150,13 +154,13 @@
|
|
|
150
154
|
outline: 2px solid var(--color-explain-dialog-apply-solution-button-outline);
|
|
151
155
|
outline-offset: 1px;
|
|
152
156
|
}
|
|
153
|
-
`;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
|
|
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)`
|
|
154
158
|
ul {
|
|
155
159
|
margin: 0;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
line-height: 1.5em;
|
|
159
|
-
`,
|
|
163
|
+
`,Er=O.ul`
|
|
160
164
|
list-style-type: none;
|
|
161
165
|
margin-inline-start: 0;
|
|
162
166
|
padding-inline-start: 0;
|
|
@@ -168,7 +172,7 @@
|
|
|
168
172
|
font-size: 0.9em;
|
|
169
173
|
font-family: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
|
|
170
174
|
font-weight: 500;
|
|
171
|
-
`;function Rr(e){const{explanation:t}=e,n=t.causedByCardinalities,o=
|
|
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`
|
|
172
176
|
font-weight: 500;
|
|
173
177
|
font-family: var(--font-heading);
|
|
174
178
|
margin-bottom: var(--space-xs);
|
|
@@ -185,23 +189,23 @@
|
|
|
185
189
|
width: min-content;
|
|
186
190
|
min-width: 400px;
|
|
187
191
|
margin: var(--space-sm-fixed) var(--space-md-fixed) var(--space-sm-fixed) var(--space-sm-fixed);
|
|
188
|
-
`;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(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 ie(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 ie(e).Node}function Y(e){return e instanceof Element||e instanceof ie(e).Element}function ne(e){return e instanceof HTMLElement||e instanceof ie(e).HTMLElement}function Ot(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ie(e).ShadowRoot}function He(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=re(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function Pr(e){return["table","td","th"].includes(ye(e))}function _t(e){const t=Ht(),n=re(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 re(e){return ie(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=ie(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 oe(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 Ve(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 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 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 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 Wr(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=>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=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 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:P,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=P??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,P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(P))?await(i.getScale==null?void 0:i.getScale(P))||{x:1,y:1}:{x:1,y:1},R=it(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:P,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",P=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[P]:0;(!D||!await(l.isElement==null?void 0:l.isElement(I)))&&(D=a.floating[P]||i.floating[x]);const V=S/2-R/2,F=D/2-w[x]/2-1,A=je(m[y],F),N=je(m[v],F),B=A,K=D-w[x]-N,_=D/2-w[x]/2+V,k=kt(B,_,K),$=!s.arrow&&Qe(r)!=null&&_!==k&&i.reference[x]/2-(_<B?A:N)-w[x]/2<0,j=$?_<B?_-B:_-K:0;return{[u]:b[u]+j,data:{[u]:k,centerOffset:_-k-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=Ee(r),v=Ee(a)===a,P=await(s.isRTL==null?void 0:s.isRTL(c.floating)),S=b||(v||!w?[ot(a)]:Kr(a));!b&&x!=="none"&&S.push(...Wr(a,w,x,P));const R=[a,...S],I=await So(t,g),D=[];let V=((o=i.flip)==null?void 0:o.overflows)||[];if(C&&D.push(I[y]),m){const B=zr(r,l,P);D.push(I[B[0]],I[B[1]])}if(V=[...V,{placement:r,overflows:D}],!D.every(B=>B<=0)){var F,A;const B=(((F=i.flip)==null?void 0:F.index)||0)+1,K=R[B];if(K)return{data:{index:B,overflows:V},reset:{placement:K}};let _=(A=V.filter(k=>k.overflows[0]<=0).sort((k,$)=>k.overflows[1]-$.overflows[1])[0])==null?void 0:A.placement;if(!_)switch(u){case"bestFit":{var N;const k=(N=V.map($=>[$.placement,$.overflows.filter(j=>j>0).reduce((j,L)=>j+L,0)]).sort(($,j)=>$[1]-j[1])[0])==null?void 0:N[0];k&&(_=k);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=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 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(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],P=u-C[y];u=kt(v,u,P)}if(l){const g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",v=x+C[g],P=x-C[y];x=kt(v,x,P)}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=re(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 Eo(e){const t=ie(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!==ie(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?Y(o)&&(l=De(o)):l=De(e));const a=Zr(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=ie(i),u=o&&Y(o)?ie(o):o;let x=b.frameElement;for(;x&&o&&u!==b;){const w=De(x),g=x.getBoundingClientRect(),y=re(x),v=g.left+(x.clientLeft+parseFloat(y.paddingLeft))*w.x,P=g.top+(x.clientTop+parseFloat(y.paddingTop))*w.y;s*=w.x,c*=w.y,C*=w.x,m*=w.y,s+=v,c+=P,x=ie(x).frameElement}}return it({width:C,height:m,x:s,y:c})}const el=[":popover-open",":modal"];function Ao(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?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 nl(e){return Array.from(e.getClientRects())}function Ro(e){return Ae(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 re(o).direction==="rtl"&&(l+=Se(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:a}}function il(e,t){const n=ie(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=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=il(e,n);else if(t==="document")o=ol(be(e));else if(Y(t))o=rl(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||!Y(n)||Oe(n)?!1:re(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=re(e).position==="fixed";let l=i?Te(e):e;for(;Y(l)&&!Oe(l);){const a=re(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=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)||re(e).position==="fixed"?null:t?t(e):e.offsetParent}function Vo(e,t){const n=ie(e);if(!ne(e))return n;let o=gn(e,t);for(;o&&Pr(o)&&re(o).position==="static";)o=gn(o,t);return o&&(ye(o)==="html"||ye(o)==="body"&&re(o).position==="static"&&!_t(o))?n:o||yo(e)||n}const ul=async function(e){const t=this.getOffsetParent||Vo,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 re(e).direction==="rtl"}const Po={convertOffsetParentRelativeRectToViewportRelativeRect:tl,getDocumentElement:be,getClippingRect:al,getOffsetParent:Vo,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 P=!0;function S(R){const I=R[0].intersectionRatio;if(I!==s){if(!P)return l();I?l(!1,I):o=setTimeout(()=>{l(!1,1e-7)},100)}P=!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 P;(P=u)==null||P.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 hl=Xr,ml=Qr,bn=Ur,yl=(e,t,n)=>{const o=new Map,r={platform:Po,...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=E.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]=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))},[]),P=E.useCallback(j=>{j!==D.current&&(D.current=j,y(j))},[]),S=i||x,R=l||g,I=E.useRef(null),D=E.useRef(null),V=E.useRef(C),F=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),yl(I.current,D.current,j).then(L=>{const te={...L,isPositioned:!0};K.current&&!rt(V.current,te)&&(V.current=te,Gi.flushSync(()=>{m(te)}))})},[b,t,n,N]);Ze(()=>{c===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,m(j=>({...j,isPositioned:!1})))},[c]);const K=E.useRef(!1);Ze(()=>(K.current=!0,()=>{K.current=!1}),[]),Ze(()=>{if(S&&(I.current=S),R&&(D.current=R),S&&R){if(A.current)return A.current(S,R,B);B()}},[S,R,B,A,F]);const _=E.useMemo(()=>({reference:I,floating:D,setReference:v,setFloating:P}),[v,P]),k=E.useMemo(()=>({reference:S,floating:R}),[S,R]),$=E.useMemo(()=>{const j={position:n,left:0,top:0};if(!k.floating)return j;const L=xn(k.floating,C.x),te=xn(k.floating,C.y);return a?{...j,transform:"translate("+L+"px, "+te+"px)",...Do(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:te}},[n,a,k.floating,C.x,C.y]);return E.useMemo(()=>({...C,update:B,refs:_,elements:k,floatingStyles:$}),[C,B,_,k,$])}/*!
|
|
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,$])}/*!
|
|
189
193
|
* tabbable 6.2.0
|
|
190
194
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
191
|
-
*/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",qe=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&&qe.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=qe.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"},El=function(t){return Fo(t)&&t.type==="hidden"},Al=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},Vl=function(t){return Fo(t)&&t.type==="radio"},Pl=function(t){return Vl(t)&&!Il(t)},Dl=function(t){var n,o=t&<(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=qe.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(qe.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 qe.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}return!1},kl=function(t,n){return!(n.disabled||at(n)||El(n)||Ol(n,t)||Al(n)||jl(n))},wn=function(t,n){return!(Pl(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 E.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})},e)}const Ll=E["useInsertionEffect".toString()],Ml=Ll||(e=>e());function Pe(e){const t=E.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Ml(()=>{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"?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]=E.useState(()=>Ct?Tn():void 0);return ae(()=>{e==null&&t(Tn())},[]),E.useEffect(()=>{Ct||(Ct=!0)},[]),e}const zl=E["useId".toString()],yt=zl||$l,Kl=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),P=a/2*s/4,[S,R]=o.split("-"),I=Po.isRTL(r),D=!!b,V=S==="top"||S==="bottom",F=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-P))+(" Q"+l/2+","+a+" "+v+","+(a-P))+" Z",_={top:D?"rotate(180deg)":"",left:D?"rotate(90deg)":"rotate(-90deg)",bottom:D?"":"rotate(180deg)",right:D?"rotate(-90deg)":"rotate(90deg)"}[S];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,[F]:B,[S]:V||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 Wl=E.createContext(null),_l=E.createContext(null),Hl=()=>{var e;return((e=E.useContext(Wl))==null?void 0:e.id)||null},Jt=()=>E.useContext(_l);function We(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 En(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||!oe(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 An(e){e.key==="Tab"&&(e.target,clearTimeout(Zl))}const st=E.forwardRef(function(t,n){const[o,r]=E.useState();ae(()=>(jr()&&r("button"),document.addEventListener("keydown",An),()=>{document.removeEventListener("keydown",An)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[We("focus-guard")]:"",style:en};return E.createElement("span",ke({},t,i))}),$o=E.createContext(null),Rn=We("portal");function ea(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&&!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]=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"?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]),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 Vn(){return we.slice().reverse().find(e=>e.isConnected)}const ta=E.forwardRef(function(t,n){return E.createElement("button",ke({},t,{type:"button",ref:n,tabIndex:-1,style:en}))});function qo(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,P=typeof l=="number"&&l<0,S=Mr(y)&&P,R=Ql()?i:!0,I=vt(r),D=vt(l),V=vt(a),F=Jt(),A=Ko(),N=E.useRef(null),B=E.useRef(null),K=E.useRef(!1),_=E.useRef(!1),k=A!=null,$=E.useCallback(function(W){return W===void 0&&(W=v),W?Yt(W,Zt()):[]},[v]),j=E.useCallback(W=>{const q=$(W);return I.current.map(z=>y&&z==="reference"?y:v&&z==="floating"?v:q).filter(Boolean).flat()},[y,v,I,$]);E.useEffect(()=>{if(o||!s)return;function W(z){if(z.key==="Tab"){oe(v,Ie(me(v)))&&$().length===0&&!S&&xt(z);const H=j(),Q=Ve(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 q=me(v);return q.addEventListener("keydown",W),()=>{q.removeEventListener("keydown",W)}},[o,y,v,s,I,S,$,j]),E.useEffect(()=>{if(o||!C)return;function W(){_.current=!0,setTimeout(()=>{_.current=!1})}function q(z){const H=z.relatedTarget;queueMicrotask(()=>{const Q=!(oe(y,H)||oe(v,H)||oe(H,v)||oe(A==null?void 0:A.portalNode,H)||H!=null&&H.hasAttribute(We("focus-guard"))||F&&($e(F.nodesRef.current,u).find(G=>{var ee,ue;return oe((ee=G.context)==null?void 0:ee.elements.floating,H)||oe((ue=G.context)==null?void 0:ue.elements.domReference,H)})||Ul(F.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!==Vn()&&(K.current=!0,x(!1,z))})}if(v&&ne(y))return y.addEventListener("focusout",q),y.addEventListener("pointerdown",W),!s&&v.addEventListener("focusout",q),()=>{y.removeEventListener("focusout",q),y.removeEventListener("pointerdown",W),!s&&v.removeEventListener("focusout",q)}},[o,y,v,s,u,F,A,x,C]),E.useEffect(()=>{var W;if(o)return;const q=Array.from((A==null||(W=A.portalNode)==null?void 0:W.querySelectorAll("["+We("portal")+"]"))||[]);if(v){const z=[v,...q,N.current,B.current,I.current.includes("reference")||S?y:null].filter(Q=>Q!=null),H=s||S?En(z,R,!R):En(z);return()=>{H()}}},[o,y,v,s,I,A,S,R]),ae(()=>{if(o||!v)return;const W=me(v),q=Ie(W);queueMicrotask(()=>{const z=j(v),H=D.current,Q=(typeof H=="number"?z[H]:H.current)||v,G=oe(v,q);!P&&!G&&m&&ve(Q,{preventScroll:Q===v})})},[o,m,v,P,j,D]),ae(()=>{if(o||!v)return;let W=!1;const q=me(v),z=Ie(q),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,W=!0):K.current=!(Dr(ue)||Or(ue)))}return w.on("openchange",Q),()=>{w.off("openchange",Q);const G=Ie(q),ee=oe(v,G)||F&&$e(F.nodesRef.current,u).some(Ni=>{var an;return oe((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=Vn();V.current&&!K.current&&ne(Be)&&(!(Be!==G&&G!==q.body)||ee)&&ve(Be,{cancelPrevious:!1,preventScroll:W})}},[o,v,V,g,b,w,F,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"||P)return;const W=()=>{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")};W();const q=new MutationObserver(W);return q.observe(v,{childList:!0,subtree:!0,attributes:!0}),()=>{q.disconnect()}},[o,v,b,I,$,P]);function L(W){return o||!c||!s?null:E.createElement(ta,{ref:W==="start"?N:B,onClick:q=>x(!1,q.nativeEvent)},typeof c=="string"?c:"Dismiss")}const te=!o&&R&&(k||s);return E.createElement(E.Fragment,null,te&&E.createElement(st,{"data-type":"inside",ref:A==null?void 0:A.beforeInsideRef,onFocus:W=>{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(W,A.portalNode)){const z=Mo()||y;z==null||z.focus()}else{var q;(q=A.beforeOutsideRef.current)==null||q.focus()}}}),!S&&L("start"),n,L("end"),te&&E.createElement(st,{"data-type":"inside",ref:A==null?void 0:A.afterInsideRef,onFocus:W=>{if(s)ve(j()[0]);else if(A!=null&&A.preserveTabOrder&&A.portalNode)if(C&&(K.current=!0),ze(W,A.portalNode)){const z=Bo()||y;z==null||z.focus()}else{var q;(q=A.afterOutsideRef.current)==null||q.focus()}}}))}const Tt=new Set,Wo=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 Pn(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||Pn(u))&&(u.key===" "&&!Dn(i)&&(u.preventDefault(),b.current=!0),u.key==="Enter"&&o(!(n&&s),u.nativeEvent,"click"))},onKeyUp(u){u.defaultPrevented||!C||Pn(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(),P=Pe(typeof m=="function"?m:()=>!1),S=typeof m=="function"?P:m,R=E.useRef(!1),I=E.useRef(!1),{escapeKey:D,outsidePress:V}=On(g),{escapeKey:F,outsidePress:A}=On(y),N=Pe(k=>{if(!n||!c||!C||k.key!=="Escape")return;const $=v?$e(v.nodesRef.current,r):[];if(!D&&(k.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(k)?k.nativeEvent:k,"escape-key")}),B=Pe(k=>{var $;const j=()=>{var L;N(k),(L=Ve(k))==null||L.removeEventListener("keydown",j)};($=Ve(k))==null||$.addEventListener("keydown",j)}),K=Pe(k=>{const $=R.current;R.current=!1;const j=I.current;if(I.current=!1,b==="click"&&j||$||typeof S=="function"&&!S(k))return;const L=Ve(k),te="["+We("inert")+"]",W=me(a).querySelectorAll(te);let q=Y(L)?L:null;for(;q&&!Oe(q);){const Q=Te(q);if(Oe(Q)||!Y(Q))break;q=Q}if(W.length&&Y(L)&&!Nr(L)&&!oe(L,a)&&Array.from(W).every(Q=>!oe(q,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&&k.offsetX>L.clientWidth;if(G&&re(L).direction==="rtl"&&(ee=k.offsetX<=L.offsetWidth-L.clientWidth),ee||Q&&k.offsetY>L.clientHeight)return}const z=v&&$e(v.nodesRef.current,r).some(Q=>{var G;return bt(k,(G=Q.context)==null?void 0:G.elements.floating)});if(bt(k,a)||bt(k,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,k,"outside-press")}),_=Pe(k=>{var $;const j=()=>{var L;K(k),(L=Ve(k))==null||L.removeEventListener(b,j)};($=Ve(k))==null||$.addEventListener(b,j)});return E.useEffect(()=>{if(!n||!c)return;s.current.__escapeKeyBubbles=D,s.current.__outsidePressBubbles=V;function k(L){o(!1,L,"ancestor-scroll")}const $=me(a);C&&$.addEventListener("keydown",F?B:N,F),S&&$.addEventListener(b,A?_:K,A);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",k,{passive:!0})}),()=>{C&&$.removeEventListener("keydown",F?B:N,F),S&&$.removeEventListener(b,A?_:K,A),j.forEach(L=>{L.removeEventListener("scroll",k)})}},[s,a,l,i,C,S,b,n,o,w,c,D,V,N,F,B,K,A,_]),E.useEffect(()=>{R.current=!1},[S,b]),E.useMemo(()=>c?{reference:{onKeyDown:N,[na[x]]:k=>{u&&o(!1,k.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 V="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(V))){var a;(a=Lt)==null||a.add(V),console.error(V)}}}const[s,c]=E.useState(null),C=((t=e.elements)==null?void 0:t.reference)||s,m=bl(e),b=Jt(),u=Hl()!=null,x=Pe((V,F,A)=>{V&&(g.current.openEvent=F),y.emit("openchange",{open:V,event:F,reason:A,nested:u}),o==null||o(V,F,A)}),w=E.useRef(null),g=E.useRef({}),y=E.useState(()=>ql())[0],v=yt(),P=E.useCallback(V=>{const F=Y(V)?{getBoundingClientRect:()=>V.getBoundingClientRect(),contextElement:V}:V;m.refs.setReference(F)},[m.refs]),S=E.useCallback(V=>{(Y(V)||V===null)&&(w.current=V,c(V)),(Y(m.refs.reference.current)||m.refs.reference.current===null||V!==null&&!Y(V))&&m.refs.setReference(V)},[m.refs]),R=E.useMemo(()=>({...m.refs,setReference:S,setPositionReference:P,domReference:w}),[m.refs,S,P]),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 V=b==null?void 0:b.nodesRef.current.find(F=>F.id===r);V&&(V.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 ia(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 ra({children:e,...t}){const n=ia(t);return d.jsx(Go.Provider,{value:n,children:e})}const Xo=O.css`
|
|
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&<(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`
|
|
192
196
|
display: flex;
|
|
193
197
|
justify-content: center;
|
|
194
198
|
align-items: center;
|
|
195
199
|
z-index: 100;
|
|
196
200
|
padding: var(--space-md-fixed);
|
|
197
|
-
`,la=O(
|
|
201
|
+
`,la=O(qo)`
|
|
198
202
|
${Xo};
|
|
199
|
-
`,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(
|
|
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`
|
|
200
204
|
color: var(--color-explain-header-value-color);
|
|
201
205
|
overflow: hidden;
|
|
202
206
|
white-space: nowrap;
|
|
203
207
|
text-overflow: ellipsis;
|
|
204
|
-
`;function Zo(e){const{explainQuestion:t}=ge(),{configurationSubjectTitle:n,componentDecisionStateIncludedLabel:o,componentDecisionStateExcludedLabel:r,booleanDecisionStateFalseLabel:i,booleanDecisionStateTrueLabel:l,isBlockedSuffix:a,isNotSatisfiedSuffix:s,generalConflictTitle:c}=
|
|
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)[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`
|
|
205
209
|
position: sticky;
|
|
206
210
|
top: 0;
|
|
207
211
|
transition: all 0.1s;
|
|
@@ -292,12 +296,12 @@
|
|
|
292
296
|
&:focus {
|
|
293
297
|
outline: none;
|
|
294
298
|
}
|
|
295
|
-
`;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(
|
|
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))`
|
|
296
300
|
${Xo}
|
|
297
|
-
`;function
|
|
298
|
-
`+r.toString()),
|
|
299
|
-
- `})),
|
|
300
|
-
`+i.toString()))),h.E.map(n),h.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:h.pipe(e.name,h.RA.map(t=>t),h.RA.toArray)}}function is(e){const t=h.pipe(e.attributes??[],h.RA.map(Ln),h.RA.toArray),n=h.pipe(e.choiceValues??[],h.RA.map(o=>({...Ln(o),choiceValueId:o.choiceValueId})),h.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=h.pipe(e.defaultRules??[],h.RA.map(o=>o),h.RA.toArray);return{attributes:h.pipe(e.attributes??[],h.RA.map(o=>({...ri(o.attributeId),choiceValues:h.RA.toArray(o.choiceValues),rules:h.pipe(o.rules,h.RA.map(r=>r),h.RA.toArray)})),h.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,ai=se(e=>{var I,D,V;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((I=e.attributeRelations)==null?void 0:I.jsonDefinition),g=T.useMemo(()=>h.pipe(w,h.O.fromEither,h.O.toNullable),[w]),y=us((D=e.choiceValueSorting)==null?void 0:D.jsonDefinition),v=T.useMemo(()=>h.pipe(y,h.E.orElse(()=>h.pipe(e.choiceValueSorting,h.E.fromNullable(null))),h.E.getOrElse(()=>({attributes:[],defaultRules:[]}))),[y,e.choiceValueSorting]),P=ls((V=e.localization)==null?void 0:V.jsonDefinition),S=T.useMemo(()=>h.pipe(P,h.E.getOrElse(()=>({attributes:[],choiceValues:[]}))),[P]),R=T.useMemo(()=>({apiBaseUrl:Li(t,"api","engine"),sessionInitialisationOptions:M.match(n).with("client-side",()=>({accessToken:o})).with("server-side",()=>({sessionCreateUrl:r})).exhaustive(),configurationModelSource:{type:p.ConfigurationModelSourceType.Channel,channel:a,deploymentName:l},attributeRelations:g,allowedInExplain:{rules:{type:p.AllowedRulesInExplainType.all}}}),[t,n,o,r,i,a,l,g]);return d.jsxs(d.Fragment,{children:[d.jsxs(U.Configuration,{sessionContext:R,children:[h.pipe(P,h.E.swap,h.O.fromEither,h.O.toNullable),h.pipe(y,h.E.swap,h.O.fromEither,h.O.toNullable),h.pipe(w,h.E.swap,h.O.fromEither,h.O.toNullable),d.jsx(Zi,{...e}),d.jsx(T.Suspense,{children:d.jsx(ft.Provider,{value:S,children:d.jsxs(Aa,{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,{})})]})}),ms=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}}},...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}},ys=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}),gs={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}}}},bs=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}},xs={fill:{title:"Fill",type:f.ControlType.Color,defaultValue:"#EBEBEB"},...si,...gs},Cs=e=>({...ys(e),...bs(e),backgroundColor:e.fill}),vs={color:{title:"Color",type:f.ControlType.Color,defaultValue:"black"},text:{title:"Text",type:f.ControlType.Font,controls:"basic",displayTextAlignment:!0,displayFontSize:!0}},ws=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={...le,...vs,...xs,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=Cs(e),r=ws(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 Ss(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 Ts({children:e,...t}){const n=Ss(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"})}),As=Es,Rs=O.div`
|
|
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:`
|
|
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`
|
|
301
305
|
display: flex;
|
|
302
306
|
justify-content: center;
|
|
303
307
|
|
|
@@ -306,7 +310,7 @@
|
|
|
306
310
|
@container explain-actions (min-width: 300px) {
|
|
307
311
|
justify-content: start;
|
|
308
312
|
}
|
|
309
|
-
`,
|
|
313
|
+
`,Ps=O.button`
|
|
310
314
|
color: inherit;
|
|
311
315
|
font-size: 0.9em;
|
|
312
316
|
font-family: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
|
|
@@ -323,7 +327,7 @@
|
|
|
323
327
|
outline: 2px solid var(--color-explain-popover-show-more-button-outline);
|
|
324
328
|
outline-offset: 1px;
|
|
325
329
|
}
|
|
326
|
-
`;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(
|
|
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`
|
|
327
331
|
font-weight: 500;
|
|
328
332
|
font-family: var(--font-heading);
|
|
329
333
|
margin-bottom: var(--space-xs);
|
|
@@ -336,9 +340,9 @@
|
|
|
336
340
|
@media only screen and (min-resolution: 2dppx) {
|
|
337
341
|
height: 0.5px;
|
|
338
342
|
}
|
|
339
|
-
`,
|
|
343
|
+
`,Os=O.div`
|
|
340
344
|
container: explain-actions / inline-size;
|
|
341
|
-
`,
|
|
345
|
+
`,js=O(fo)`
|
|
342
346
|
display: grid;
|
|
343
347
|
grid-template-columns: [name] minmax(100px, auto) [values] minmax(100px, 1fr);
|
|
344
348
|
gap: var(--space-sm);
|
|
@@ -348,7 +352,7 @@
|
|
|
348
352
|
margin-right: -1.1em;
|
|
349
353
|
overflow: auto;
|
|
350
354
|
max-height: 200px;
|
|
351
|
-
`,
|
|
355
|
+
`,ks=O(lo)`
|
|
352
356
|
border-radius: 360px;
|
|
353
357
|
background-color: var(--color-explain-popover-apply-solution-button-fill);
|
|
354
358
|
color: var(--color-explain-popover-apply-solution-button-color);
|
|
@@ -371,10 +375,10 @@
|
|
|
371
375
|
@container explain-actions (min-width: 300px) {
|
|
372
376
|
width: auto;
|
|
373
377
|
}
|
|
374
|
-
`,
|
|
378
|
+
`,Et=O(ho)`
|
|
375
379
|
width: min-content;
|
|
376
380
|
min-width: 300px;
|
|
377
|
-
`;function
|
|
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`
|
|
378
382
|
position: relative;
|
|
379
383
|
background-color: var(--color-explain-popover-fill);
|
|
380
384
|
color: var(--color-explain-popover-color);
|
|
@@ -385,7 +389,7 @@
|
|
|
385
389
|
font-family: var(--font-primary);
|
|
386
390
|
min-width: 300px;
|
|
387
391
|
max-width: 500px;
|
|
388
|
-
|
|
392
|
+
`,zs=O(Bs)`
|
|
389
393
|
position: absolute;
|
|
390
394
|
right: var(--space-sm-fixed);
|
|
391
395
|
top: var(--space-sm-fixed);
|
|
@@ -400,7 +404,7 @@
|
|
|
400
404
|
outline: 2px solid var(--color-explain-popover-close-button-outline);
|
|
401
405
|
outline-offset: 1px;
|
|
402
406
|
}
|
|
403
|
-
`,
|
|
407
|
+
`,Ks=O(Zo)`
|
|
404
408
|
font-size: var(--text-md);
|
|
405
409
|
font-weight: 500;
|
|
406
410
|
font-family: var(--font-heading);
|
|
@@ -410,7 +414,7 @@
|
|
|
410
414
|
white-space: nowrap;
|
|
411
415
|
text-overflow: ellipsis;
|
|
412
416
|
margin-right: var(--space-md);
|
|
413
|
-
`;function
|
|
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)`
|
|
414
418
|
--color-explain-attribute-value-fill: ${e=>e.attributeValueFill};
|
|
415
419
|
--color-explain-attribute-value-add-fill: ${e=>e.attributeValueAddFill};
|
|
416
420
|
--color-explain-attribute-value-add-color: ${e=>e.attributeValueAddColor};
|
|
@@ -432,31 +436,31 @@
|
|
|
432
436
|
&:focus {
|
|
433
437
|
outline: none;
|
|
434
438
|
}
|
|
435
|
-
`,
|
|
439
|
+
`,_s=O(Kl)`
|
|
436
440
|
fill: var(--color-explain-popover-fill);
|
|
437
|
-
`,
|
|
438
|
-
Please check your internet connection and try again.`)}function
|
|
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.
|
|
439
443
|
Please check your internet connection and try again.`)}const $n=O.select`
|
|
440
444
|
color: inherit;
|
|
441
445
|
cursor: inherit;
|
|
442
|
-
`,zn="<reset>",Kn="<nothing>",fi=pe((e,t)=>{if(X()){const
|
|
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`
|
|
443
447
|
color: inherit;
|
|
444
448
|
cursor: inherit;
|
|
445
|
-
`,
|
|
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`
|
|
446
450
|
color: inherit;
|
|
447
451
|
cursor: inherit;
|
|
448
|
-
`,Qn="<reset>",
|
|
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)`
|
|
449
453
|
color: inherit;
|
|
450
|
-
`,yi=pe((e,t)=>{var v,P;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)===p.DecisionKind.Implicit,C=Bt(e,a.isSatisfied,c),m=(P=a.decision)==null?void 0:P.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===p.ConfiguratorErrorType.SetDecisionConflict?e.explain!=="disabled"&&await l(V=>V.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:rc(a,e.implicitLabelPrefix),onBlur:()=>{y.flush()},onKeyPress:S=>{S.key==="Enter"&&y.flush()},onValueChange:S=>u(S.floatValue),value:b??"",style:C})}),ic=yi,rc=(e,t)=>{var n;return((n=e.decision)==null?void 0:n.kind)===p.DecisionKind.Implicit?t:""},lc={...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,lc);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===p.AttributeType.Choice,m=s.type===p.AttributeType.Numeric,b=s.type===p.AttributeType.Boolean,u=s.type===p.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=P=>M.match({state:P,attribute:s}).with({attribute:{type:p.AttributeType.Choice},state:"undefined"},()=>x.decision==null).with({attribute:{type:p.AttributeType.Choice},state:"included"},()=>{var S,R;return((S=x.decision)==null?void 0:S.state)===p.ChoiceValueDecisionState.Included&&((R=x.decision)==null?void 0:R.kind)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Choice},state:"excluded"},()=>{var S,R;return((S=x.decision)==null?void 0:S.state)===p.ChoiceValueDecisionState.Excluded&&((R=x.decision)==null?void 0:R.kind)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Boolean},state:"undefined"},{attribute:{type:p.AttributeType.Component},state:"undefined"},({attribute:S})=>S.decision==null).with({attribute:{type:p.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)===p.DecisionKind.Explicit}).with({attribute:{type:p.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)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Component},state:"included"},({attribute:S})=>{var R,I;return((R=S.decision)==null?void 0:R.state)===p.ComponentDecisionState.Included&&((I=S.decision)==null?void 0:I.kind)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Component},state:"excluded"},({attribute:S})=>{var R,I;return((R=S.decision)==null?void 0:R.state)===p.ComponentDecisionState.Excluded&&((I=S.decision)==null?void 0:I.kind)===p.DecisionKind.Explicit}).otherwise(()=>!1),g=P=>M.match({isChoiceAttribute:C,isBooleanAttribute:b,isComponentAttribute:u,state:P}).with({isChoiceAttribute:!0,state:"included"},()=>p.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,state:"excluded"},()=>p.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>p.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>p.ComponentDecisionState.Excluded).otherwise(()=>null);w(e.toggleFrom);const y=w(e.toggleTo),v=async()=>{const P=y?e.toggleFrom:e.toggleTo,S=g(P),R=u?s.possibleDecisionStates.includes(S):!1,I=b?s.possibleDecisionStates.includes(S):!1,V=(C?x.possibleDecisionStates.includes(S):!1)||I||R,F=e.explain,A=F!=="disabled"&&(async()=>{const N=M.match({isComponentAttribute:u,isBooleanAttribute:b,isChoiceAttribute:C}).returnType().with({isChoiceAttribute:!0},()=>p.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>p.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>p.ExplainQuestionSubject.component).otherwise(()=>null);N&&await c({question:p.ExplainQuestionType.whyIsStateNotPossible,subject:N,attributeId:i,choiceValueId:l,state:S},F,o)});if(V||S==null)try{await r({type:s.type,attributeId:i,choiceValueId:l,state:S})}catch(N){if(N.type===p.ConfiguratorErrorType.ConflictWithConsequence&&A){await A();return}de()}else A&&await A()};return he(e.children,{onClick:v,ref:t})}),ac=gi,sc={...le,...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,sc);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===p.AttributeType.Choice,b=s.type===p.AttributeType.Numeric,u=s.type===p.AttributeType.Boolean,x=s.type===p.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"},()=>p.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>p.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>p.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>p.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(),P=x?s.possibleDecisionStates.includes(v):!1,S=u?s.possibleDecisionStates.includes(v):!1,I=(m?w.possibleDecisionStates.includes(v):!1)||S||P,D=e.explain,V=D!=="disabled"&&(async()=>{const F=M.match({isComponentAttribute:x,isBooleanAttribute:u,isChoiceAttribute:m,isNumericAttribute:b}).returnType().with({isChoiceAttribute:!0},()=>p.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>p.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>p.ExplainQuestionSubject.component).with({isNumericAttribute:!0},()=>p.ExplainQuestionSubject.numeric).otherwise(()=>null);F&&await C({question:p.ExplainQuestionType.whyIsStateNotPossible,subject:F,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(F){const A=F;if((A.type===p.ConfiguratorErrorType.ConflictWithConsequence||A.type===p.ConfiguratorErrorType.SetDecisionConflict)&&V){await V();return}de()}else V&&await V()}};return he(e.children,{onClick:y,ref:t})}),cc=bi,uc={...le,...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,uc);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===p.AttributeType.Choice,v=b.type===p.AttributeType.Numeric,P=b.type===p.AttributeType.Boolean,S=b.type===p.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:P,isComponentAttribute:S,isNumericAttribute:v,hasChoiceValueId:g,state:x.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>p.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>p.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>p.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>p.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>x.numericValue).otherwise(()=>null);return{getDecisions:()=>y&&!g&&x.setSelection==="undefined"?[...b.values.values()].filter(D=>{var V;return((V=D.decision)==null?void 0:V.kind)===p.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)===p.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})}),dc=xi,fc={children:{title:"Content",type:f.ControlType.ComponentInstance},attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...le,...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,fc);const Ci=se(e=>{if(X())return e.enabledChildren;const{canResetConfiguration:n,resetConfiguration:o}=U.useConfigurationReset(),r=async()=>{if(n)try{await o()}catch{Ys()}},i=n?e.enabledChildren:e.disabledChildren;return he(i,{onClick:r})}),pc=Ci,hc={enabledChildren:{title:"Content – Enabled",type:f.ControlType.ComponentInstance},disabledChildren:{title:"Content – Disabled",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Ci,hc);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})}),mc=vi,yc={satisfiedChildren:{title:"Content – Satisfied",type:f.ControlType.ComponentInstance},unsatisfiedChildren:{title:"Content – Unsatisfied",type:f.ControlType.ComponentInstance},...le,attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...le}}},...Le};f.addPropertyControls(vi,yc);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===p.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:p.AttributeType.Choice},selection:"included",condition:"blocked"},b(g=>!g.possibleDecisionStates.includes(p.ChoiceValueDecisionState.Included))).with({attribute:{type:p.AttributeType.Choice},selection:"included",condition:"implicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===p.ChoiceValueDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===p.DecisionKind.Implicit})).with({attribute:{type:p.AttributeType.Choice},selection:"included",condition:"explicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===p.ChoiceValueDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===p.DecisionKind.Explicit})).with({attribute:{type:p.AttributeType.Choice},selection:"included",condition:"none"},b(g=>{var y;return((y=g.decision)==null?void 0:y.state)===p.ChoiceValueDecisionState.Included})).with({attribute:{type:p.AttributeType.Choice},selection:"excluded",condition:"blocked"},b(g=>!g.possibleDecisionStates.includes(p.ChoiceValueDecisionState.Excluded))).with({attribute:{type:p.AttributeType.Choice},selection:"excluded",condition:"implicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===p.ChoiceValueDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===p.DecisionKind.Implicit})).with({attribute:{type:p.AttributeType.Choice},selection:"excluded",condition:"explicit"},b(g=>{var y,v;return((y=g.decision)==null?void 0:y.state)===p.ChoiceValueDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===p.DecisionKind.Explicit})).with({attribute:{type:p.AttributeType.Choice},selection:"excluded",condition:"none"},b(g=>{var y;return((y=g.decision)==null?void 0:y.state)===p.ChoiceValueDecisionState.Excluded})).with({attribute:{type:p.AttributeType.Boolean},selection:"true",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(!0)).with({attribute:{type:p.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)===p.DecisionKind.Implicit}).with({attribute:{type:p.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)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Boolean},selection:"true",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===!0}).with({attribute:{type:p.AttributeType.Boolean},selection:"false",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(!1)).with({attribute:{type:p.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)===p.DecisionKind.Implicit}).with({attribute:{type:p.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)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Boolean},selection:"false",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===!1}).with({attribute:{type:p.AttributeType.Component},selection:"included",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(p.ComponentDecisionState.Included)).with({attribute:{type:p.AttributeType.Component},selection:"included",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===p.ComponentDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===p.DecisionKind.Implicit}).with({attribute:{type:p.AttributeType.Component},selection:"included",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===p.ComponentDecisionState.Included&&((v=g.decision)==null?void 0:v.kind)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Component},selection:"included",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===p.ComponentDecisionState.Included}).with({attribute:{type:p.AttributeType.Component},selection:"excluded",condition:"blocked"},({attribute:g})=>!g.possibleDecisionStates.includes(p.ComponentDecisionState.Excluded)).with({attribute:{type:p.AttributeType.Component},selection:"excluded",condition:"implicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===p.ComponentDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===p.DecisionKind.Implicit}).with({attribute:{type:p.AttributeType.Component},selection:"excluded",condition:"explicit"},({attribute:g})=>{var y,v;return((y=g.decision)==null?void 0:y.state)===p.ComponentDecisionState.Excluded&&((v=g.decision)==null?void 0:v.kind)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Component},selection:"excluded",condition:"none"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.state)===p.ComponentDecisionState.Excluded}).with({attribute:{type:p.AttributeType.Numeric},selection:"numeric",condition:"implicit"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.kind)===p.DecisionKind.Implicit}).with({attribute:{type:p.AttributeType.Numeric},selection:"numeric",condition:"explicit"},({attribute:g})=>{var y;return((y=g.decision)==null?void 0:y.kind)===p.DecisionKind.Explicit}).with({attribute:{type:p.AttributeType.Numeric},selection:"numeric",condition:"none"},({attribute:g})=>g.decision!=null).with({attribute:{type:p.AttributeType.Choice},selection:"undefined"},()=>m.decision==null).with({attribute:{type:p.AttributeType.Boolean},selection:"undefined"},{attribute:{type:p.AttributeType.Component},selection:"undefined"},{attribute:{type:p.AttributeType.Numeric},selection:"undefined"},({attribute:g})=>g.decision==null).otherwise(()=>!1));return u&&he(o(u.content),{ref:n})})),gc=wi,bc={...le,...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,bc);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})}),xc=Si,Cc={children:{title:"Content",type:f.ControlType.ComponentInstance},color:{title:"Color",type:f.ControlType.Color,defaultValue:"#0000ff"}};f.addPropertyControls(Si,Cc);const Ti=se(e=>{if(X())return e.children;const{error:n}=U.useConfigurationInitialization();return n?he(e.children,{onClick:n.retry}):null}),vc=Ti,wc={children:{title:"Content",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Ti,wc);function Sc(e){return T.forwardRef((t,n)=>{const o={...t.style,width:"100%",height:"100%"};return d.jsx(e,{...t,ref:n,style:o})})}const Tc=O.div`
|
|
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`
|
|
451
455
|
width: 10px;
|
|
452
456
|
height: 10px;
|
|
453
457
|
background-color: greenyellow;
|
|
454
|
-
`;function
|
|
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`
|
|
455
459
|
display: contents;
|
|
456
|
-
`,
|
|
460
|
+
`,Rc=O.createGlobalStyle`
|
|
457
461
|
:root {
|
|
458
|
-
*:has(> ${
|
|
462
|
+
*:has(> ${Ei}) {
|
|
459
463
|
display: contents !important;
|
|
460
464
|
}
|
|
461
465
|
}
|
|
462
|
-
`,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"],h.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(p.ChoiceValueDecisionState.Included)).with({selection:"included",condition:"implicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===p.ChoiceValueDecisionState.Included&&((y=u.decision)==null?void 0:y.kind)===p.DecisionKind.Implicit}).with({selection:"included",condition:"explicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===p.ChoiceValueDecisionState.Included&&((y=u.decision)==null?void 0:y.kind)===p.DecisionKind.Explicit}).with({selection:"included",condition:"none"},()=>{var g;return((g=u.decision)==null?void 0:g.state)===p.ChoiceValueDecisionState.Included}).with({selection:"excluded",condition:"blocked"},()=>!u.possibleDecisionStates.includes(p.ChoiceValueDecisionState.Excluded)).with({selection:"excluded",condition:"implicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===p.ChoiceValueDecisionState.Excluded&&((y=u.decision)==null?void 0:y.kind)===p.DecisionKind.Implicit}).with({selection:"excluded",condition:"explicit"},()=>{var g,y;return((g=u.decision)==null?void 0:g.state)===p.ChoiceValueDecisionState.Excluded&&((y=u.decision)==null?void 0:y.kind)===p.DecisionKind.Explicit}).with({selection:"excluded",condition:"none"},()=>{var g;return((g=u.decision)==null?void 0:g.state)===p.ChoiceValueDecisionState.Excluded}).with({selection:"undefined"},()=>u.decision==null).otherwise(()=>!1))),b=ut(l,s,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(Ac,{})}),d.jsx(Ai,{style:e.style,children:e.children})]})}const Rc=Ri,Ic={...le,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,Ic);const{isValidElement:Jn,cloneElement:Zn}=E;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:Pc}=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(Pc(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 Dc(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:Dc(e.children,e)})}function Oc(e){return h.pipe(e,h.Str.replace(/[\s\u2013]/g,"-"),Qi)}const jc=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,{[Oc(r)]:l}),children:t}):t}),gt=jc,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"}}),Vi=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})}),kc=Vi,Fc={...le,customName:{title:"Custom Name",type:f.ControlType.String},...ln("<AttributeName>")};f.addPropertyControls(Vi,Fc);const Pi=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})}),Nc=Pi,Lc={...le,...Me,customName:{title:"Custom Name",type:f.ControlType.String},...ln("<ChoiceValueName>")};f.addPropertyControls(Pi,Lc);function Di(e){return e.children}const Mc={children:{title:"Content",type:f.ControlType.ComponentInstance}};f.addPropertyControls(Di,Mc);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"?$c(c,`${o}.${n}`):r==="clipboard"&&zc(c)}})}const Bc={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,Bc);function $c(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 zc(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=h.pipe(await Hc(r,o),h.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===p.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)===p.ConfiguratorErrorType.MakeManyDecisionsConflict&&u.decisionExplanations){e.explain!=="disabled"&&await s(u,e.explain,l);return}alert("Failed to restore your configuration.");return}},ref:t})}),Kc=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 Wc(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(h.left(2));return}const i=r.files[0],l=new FileReader;l.onload=()=>{t(h.right(l.result))},l.onerror=()=>{t(h.left(3))},l.readAsText(i)},n.oncancel=()=>{t(h.left(2))},n.click()})}function _c(){return()=>navigator.clipboard.readText().then(e=>e?h.right(e):h.left(4)).catch(()=>h.left(5))}function Hc(e,t){return h.pipe(e==="file"?Wc(t):_c(),h.TE.chainEitherK(n=>h.E.tryCatch(()=>JSON.parse(n),()=>0)),h.TE.filterOrElse(n=>n.type==="spc-stored-configuration",()=>1),h.TE.map(n=>n.storedConfiguration),h.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.")}),h.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})}),Uc=Fi,Qc={...le,fallback:{title:"Unselected Text",type:f.ControlType.String,defaultValue:""},...ln("<NumericValue>")};f.addPropertyControls(Fi,Qc);exports.AttributeName=kc;exports.BooleanSelect=ec;exports.ChoiceSelect=Xs;exports.ChoiceValueListRenderer=Rc;exports.ChoiceValueName=Nc;exports.Colorize=xc;exports.ComponentSelect=nc;exports.Configuration=ms;exports.InitializationRetry=vc;exports.NumericInput=ic;exports.ReplaceText=gt;exports.ResetConfiguration=pc;exports.RestoreConfiguration=Kc;exports.SatisfactionIndicator=mc;exports.ScrollIntoView=Ei;exports.SelectedNumericValue=Uc;exports.SelectionIndicator=gc;exports.SelectionToggle=ac;exports.SetSelection=cc;exports.SetSelections=dc;exports.Singleton=ct;exports.Slot=Di;exports.StoreConfiguration=Oi;exports.attributeIdPropertyControls=le;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=Sc;
|
|
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;
|