@viamedici-spc/configurator-framer 1.2.0 → 1.3.0-alpha0004
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 +46 -46
- package/dist/index.d.ts +119 -7
- package/dist/index.js +843 -834
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),p=require("framer"),c=require("@viamedici-spc/configurator-ts"),W=require("@viamedici-spc/configurator-react"),T=require("react"),F=require("ts-pattern"),Pi=require("react-error-boundary"),O=require("styled-components"),C=require("@viamedici-spc/fp-ts-extensions"),Ze=require("@fortawesome/free-solid-svg-icons"),et=require("@fortawesome/react-fontawesome"),Gn=require("react-dom"),Vi=require("clsx"),Jn=require("merge-props"),Di=require("dyna-guid"),Oi=require("mustache"),ki=require("react-number-format"),ji=require("use-debounce"),Fi=require("framer-motion"),Ni=require("hex-to-css-filter"),Bi=require("rgb-hex"),Li=require("camelcase");function Zn(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=Zn(T),Mi=Zn(Gn);function $i(e){var t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<e.length;o++){var i=e[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<e.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),t.push(i))}var r=t.join("/");r=r.replace(/\/(\?|&|#[^!])/g,"$1");var l=r.split("?");return r=l.shift()+(l.length>0?"?":"")+l.join("&"),r}function Ki(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),$i(e)}function G(){return p.RenderTarget.current()!==p.RenderTarget.preview}function zi(e){if(G())return null;const{error:n}=W.useConfigurationInitialization();if(!n)return null;switch(n.type){case c.FailureType.ConfigurationModelNotFound:return T.Children.toArray(e.configurationModelNotFoundContent).length>0?e.configurationModelNotFoundContent:f.jsx("span",{children:"Configuration Model not found for the specified deployment name."});case c.FailureType.ConfigurationUnauthenticated:return T.Children.toArray(e.accessTokenInvalidContent).length>0?e.accessTokenInvalidContent:f.jsx("span",{children:"The HCA access token is invalid."});case c.FailureType.SpecifiedDeploymentForbidden:return T.Children.toArray(e.accessTokenRestrictionContent).length>0?e.accessTokenRestrictionContent:f.jsx("span",{children:"The HCA access token does not permit using the specified Configuration Model."});case c.FailureType.DecisionsToRespectInvalid:return f.jsx("span",{children:"The definition of Attribute Relations is invalid."});default:return T.Children.toArray(e.errorContent).length>0?e.errorContent:f.jsx("span",{children:"An error occurred while initializing the configuration."})}}function se(e){return T.forwardRef((t,n)=>f.jsx(Pi.ErrorBoundary,{fallbackRender:()=>f.jsx("span",{children:"Component crashed"}),children:f.jsx(e,{...t,ref:n})}))}const Wi=O.createGlobalStyle`
|
|
2
2
|
:root {
|
|
3
3
|
--font-primary: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
|
|
4
4
|
--font-heading: "Inter-Medium", "Inter", "Inter Placeholder", sans-serif;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
--text-xxl: calc(1em * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
|
|
18
18
|
--text-xxxl: calc(1em * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
|
|
19
19
|
}
|
|
20
|
-
`,Wi
|
|
20
|
+
`,qi=Wi,Hi=O.createGlobalStyle`
|
|
21
21
|
:root {
|
|
22
22
|
--space-unit: 1em;
|
|
23
23
|
--space-xxs: calc(0.25 * var(--space-unit));
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
--space-xl-fixed: calc(3.25 * var(--space-unit-fixed));
|
|
38
38
|
--space-xxl-fixed: calc(5.25 * var(--space-unit-fixed));
|
|
39
39
|
}
|
|
40
|
-
`,Hi
|
|
40
|
+
`,Ui=Hi,_i=O.createGlobalStyle`
|
|
41
41
|
:root {
|
|
42
42
|
--shape-border-radius-xs: 5px;
|
|
43
43
|
--shape-border-radius-sm: 7px;
|
|
44
44
|
--shape-border-radius-md: 12px;
|
|
45
45
|
--shape-border-radius-lg: 20px;
|
|
46
46
|
}
|
|
47
|
-
`,_i
|
|
47
|
+
`,Qi=_i,Yi=O.createGlobalStyle`
|
|
48
48
|
:root {
|
|
49
49
|
--shadows-popover: drop-shadow(5px 5px 10px rgba(0, 0, 0, 0.4));
|
|
50
50
|
--shadows-dialog: 0.2px 0.4px 2.3px rgba(0, 0, 0, 0.02),
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
13.9px 23.6px 54.7px rgba(0, 0, 0, 0.061),
|
|
57
57
|
40px 68px 96px rgba(0, 0, 0, 0.1);
|
|
58
58
|
}
|
|
59
|
-
`,Yi
|
|
59
|
+
`,Xi=Yi;function rn(){return f.jsxs(f.Fragment,{children:[f.jsx(Xi,{}),f.jsx(Qi,{}),f.jsx(Ui,{}),f.jsx(qi,{})]})}const Ke=T.createContext(null);function ye(){const{process:e,switchMode:t,applySolution:n,dismiss:o}=T.useContext(Ke);return e?{...e,switchMode:t,applySolution:n,dismiss:o}:null}function eo(e){const{explanation:t,...n}=e,o=ye();return f.jsx("button",{...n,onClick:()=>o.applySolution(t.solution),children:e.children})}function to(e,t,n){return F.match(e).returnType().with({type:c.AttributeType.Choice},o=>t[o.choiceValueId]??o.choiceValueId).with({type:c.AttributeType.Boolean,state:!0},()=>n.booleanDecisionStateTrueLabel).with({type:c.AttributeType.Boolean,state:!1},()=>n.booleanDecisionStateFalseLabel).with({type:c.AttributeType.Component,state:c.ComponentDecisionState.Included},()=>n.componentDecisionStateIncludedLabel).with({type:c.AttributeType.Component,state:c.ComponentDecisionState.Excluded},()=>n.componentDecisionStateExcludedLabel).with({type:c.AttributeType.Numeric},o=>o.state.toString()).exhaustive()}const no={applySolutionButtonCaption:{title:"Apply Solution Button Caption",type:p.ControlType.String,defaultValue:"Apply Solution"},configurationSubjectTitle:{title:"Configuration Subject Title",type:p.ControlType.String,defaultValue:"Configuration"},generalConflictTitle:{title:"General Conflict Title",type:p.ControlType.String,defaultValue:"Conflict"},componentDecisionStateIncludedLabel:{title:"Component Decision State Included Label",type:p.ControlType.String,defaultValue:"Included"},componentDecisionStateExcludedLabel:{title:"Component Decision State Excluded Label",type:p.ControlType.String,defaultValue:"Excluded"},booleanDecisionStateTrueLabel:{title:"Boolean Decision State True Label",type:p.ControlType.String,defaultValue:"Yes"},booleanDecisionStateFalseLabel:{title:"Boolean Decision State False Label",type:p.ControlType.String,defaultValue:"No"},isBlockedSuffix:{title:"Is Blocked Suffix",type:p.ControlType.String,defaultValue:"is blocked"},isNotSatisfiedSuffix:{title:"Is Not Satisfied Suffix",type:p.ControlType.String,defaultValue:"is not satisfied"}},Gi={fill:{title:"Fill",type:p.ControlType.Color,defaultValue:"#002134"},color:{title:"Color",type:p.ControlType.Color,defaultValue:"white"},attributeValueFill:{title:"Attribute Value Fill",type:p.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.2)"},attributeValueAddFill:{title:"Attribute Value Add Fill",type:p.ControlType.Color,defaultValue:"rgba(47, 255, 0, 0.2)"},attributeValueAddColor:{title:"Attribute Value Add Color",type:p.ControlType.Color,defaultValue:"#63e446"},attributeValueRemoveFill:{title:"Attribute Value Remove Fill",type:p.ControlType.Color,defaultValue:"#ff00004a"},attributeValueRemoveColor:{title:"Attribute Value Remove Color",type:p.ControlType.Color,defaultValue:"#ff6060"},headerValueColor:{title:"Header Value Color",type:p.ControlType.Color,defaultValue:"rgb(0, 161, 230)"},closeButtonOutline:{title:"Close Button Outline",type:p.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},listSeparator:{title:"List Separator",type:p.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.3)"},applySolutionButtonFill:{title:"Apply Solution Button Fill",type:p.ControlType.Color,defaultValue:"rgb(0, 161, 230)"},applySolutionButtonColor:{title:"Apply Solution Button Color",type:p.ControlType.Color,defaultValue:"white"},applySolutionButtonOutline:{title:"Apply Solution Button Outline",type:p.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},showMoreButtonOutline:{title:"Show More Button Outline",type:p.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.8)"},solutionTitle:{title:"Solution Title",type:p.ControlType.String,defaultValue:"Solution"},showMoreButtonCaption:{title:"Show More Button Caption",type:p.ControlType.String,defaultValue:"Show more ({{amount}})"},showConstraintsButtonCaption:{title:"Show Constraints Button Caption",type:p.ControlType.String,defaultValue:"Show Constraints"},...no},Lt=T.createContext(null),Mt=()=>T.useContext(Lt),Ji={fill:{title:"Fill",type:p.ControlType.Color,defaultValue:"rgba(255, 255, 255, 0.7)"},color:{title:"Color",type:p.ControlType.Color,defaultValue:"#171717"},attributeValueFill:{title:"Attribute Value Fill",type:p.ControlType.Color,defaultValue:"#efefef"},attributeValueAddFill:{title:"Attribute Value Add Fill",type:p.ControlType.Color,defaultValue:"#cfefc7"},attributeValueAddColor:{title:"Attribute Value Add Color",type:p.ControlType.Color,defaultValue:"#48c52b"},attributeValueRemoveFill:{title:"Attribute Value Remove Fill",type:p.ControlType.Color,defaultValue:"#ffdada"},attributeValueRemoveColor:{title:"Attribute Value Remove Color",type:p.ControlType.Color,defaultValue:"#c52b2b"},headerValueColor:{title:"Header Value Color",type:p.ControlType.Color,defaultValue:"#00a1e6"},closeButtonOutline:{title:"Close Button Outline",type:p.ControlType.Color,defaultValue:"#00a1e6"},applySolutionButtonFill:{title:"Apply Solution Button Fill",type:p.ControlType.Color,defaultValue:"#F2F2F2"},applySolutionButtonColor:{title:"Apply Solution Button Color",type:p.ControlType.Color,defaultValue:"#171717"},applySolutionButtonOutline:{title:"Apply Solution Button Outline",type:p.ControlType.Color,defaultValue:"#00a1e6"},explanationCard:{title:"Explanation Card",type:p.ControlType.Color,defaultValue:"white"},scrollShadowBorder:{title:"Scroll Shadow Border",type:p.ControlType.Color,defaultValue:"rgba(0, 0, 0, 0.3)"},backdropFilter:{title:"Backdrop Filter",type:p.ControlType.String,defaultValue:"blur(10px) saturate(200%)"},decisionExplanationSolutionsTitle:{title:"Decision Explanation Solutions Title",type:p.ControlType.String,defaultValue:"Solutions"},constraintExplanationSolutionsTitle:{title:"Constraint Explanation Solutions Title",type:p.ControlType.String,defaultValue:"Constraint Explanations"},...no},$t=T.createContext(null),oo=()=>T.useContext($t),Zi=()=>T.useContext(Lt)||T.useContext($t),Kt=Zi,er=O.div`
|
|
60
60
|
display: flex;
|
|
61
61
|
gap: var(--space-xs);
|
|
62
62
|
align-items: center;
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
font-family: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
|
|
68
68
|
font-weight: 500;
|
|
69
69
|
min-width: 0;
|
|
70
|
-
`,
|
|
70
|
+
`,tr=O.div`
|
|
71
71
|
display: grid;
|
|
72
72
|
place-content: center;
|
|
73
73
|
border-top-left-radius: 360px;
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
background-color: var(--color-explain-attribute-value-remove-fill);
|
|
86
86
|
color: var(--color-explain-attribute-value-remove-color);
|
|
87
87
|
}
|
|
88
|
-
`,
|
|
88
|
+
`,nr=O.div`
|
|
89
89
|
white-space: nowrap;
|
|
90
90
|
overflow: hidden;
|
|
91
91
|
text-overflow: ellipsis;
|
|
92
|
-
`;function
|
|
92
|
+
`;function or(e){const{decision:t,choiceValuesNames:n}=e,o=t.intention,i=Kt(),r=to(t,n,i);return f.jsxs(er,{children:[f.jsxs(tr,{className:`mode-${o}`,children:[o==="remove"&&f.jsx(et.FontAwesomeIcon,{icon:Ze.faMinus}),o==="add"&&f.jsx(et.FontAwesomeIcon,{icon:Ze.faPlus})]}),f.jsx(nr,{children:r})]})}function J(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 ut=T.createContext(null);function dt(e){const{attributes:t}=T.useContext(ut),{activeLocale:n}=p.useLocaleInfo(),o=n.code;return T.useMemo(()=>C.pipe(t,C.RA.findFirst(i=>c.globalAttributeIdEquals(J(i),e)),C.O.map(i=>i.name),C.RA.fromOption,C.RA.flatten,zt(o),C.O.toUndefined),[t,o,e.localId,e.componentPath,e.sharedConfigurationModelId])}function qe(e){const{choiceValues:t}=T.useContext(ut),{activeLocale:n}=p.useLocaleInfo(),o=W.useChoiceAttribute(e);if(!o)return{};const i=T.useMemo(()=>C.pipe(t,C.RA.filter(s=>c.globalAttributeIdEquals(J(s),e))),[t,e.localId,e.componentPath,e.sharedConfigurationModelId]),r=n.code,l=o.attribute.values;return T.useMemo(()=>C.pipe(l,C.RA.map(s=>C.pipe(i,C.RA.findFirst(a=>a.choiceValueId===s.id),C.O.map(a=>a.name),C.RA.fromOption,C.RA.flatten,zt(r),C.O.map(a=>[s.id,a]))),C.RA.compact,C.RR.fromEntries),[l,i,r])}function io(e,t){const{choiceValues:n}=T.useContext(ut),{activeLocale:o}=p.useLocaleInfo(),i=o.code;return T.useMemo(()=>C.pipe(n,C.RA.findFirst(r=>c.globalAttributeIdEquals(J(r),e)&&r.choiceValueId===t),C.O.map(r=>r.name),C.RA.fromOption,C.RA.flatten,zt(i),C.O.toUndefined),[n,i,e.localId,e.componentPath,e.sharedConfigurationModelId,t])}function zt(e){return C.flow(C.RA.findFirst(t=>t.localeCode.localeCompare(e,void 0,{sensitivity:"accent"})===0),C.O.map(t=>t.translation))}const ir=O.div`
|
|
93
93
|
display: grid;
|
|
94
94
|
grid-template-columns: subgrid;
|
|
95
95
|
grid-column: span 2;
|
|
@@ -105,16 +105,16 @@
|
|
|
105
105
|
flex-wrap: wrap;
|
|
106
106
|
min-width: 0;
|
|
107
107
|
gap: var(--space-xxs);
|
|
108
|
-
`;function sr(e){const{decisions:t}=e,n=t[0].attributeId,o=
|
|
108
|
+
`;function sr(e){const{decisions:t}=e,n=t[0].attributeId,o=qe(n),i=dt(n),r=Kt(),l=C.pipe(C.Str.Ord,C.Ord.contramap(a=>to(a,o,r))),s=C.pipe(t,C.RA.sort(l));return f.jsxs(ir,{children:[f.jsx(rr,{children:i??n.localId}),f.jsx(lr,{children:s.map((a,u)=>f.jsx(or,{decision:a,choiceValuesNames:o},u))})]})}function ar(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=C.pipe(C.Str.Ord,C.Ord.contramap(e=>e.attributeId.localId));function ro(e){const{blockingDecisions:t,desiredDecisions:n,...o}=e,i=C.pipe([...n.map(r=>({...r,intention:"add"})),...t.map(r=>({...r,intention:"remove"}))],C.RNEA.groupBy(r=>ar(r.attributeId)),C.RR.collect(C.Ord.trivial)((r,l)=>({key:r,attributeId:C.RNEA.head(l).attributeId,decisions:l})),C.RA.sort(cr));return f.jsx("div",{...o,children:i.map(r=>f.jsx(sr,{decisions:r.decisions},r.key))})}const ur=O.div`
|
|
109
109
|
background-color: var(--color-explain-dialog-explanation-card);
|
|
110
110
|
padding: var(--space-sm-fixed);
|
|
111
111
|
box-shadow: 2px 1px 10px -5px rgba(0, 0, 0, 0.4);
|
|
112
112
|
border-radius: var(--shape-border-radius-sm);
|
|
113
|
-
`,
|
|
113
|
+
`,lo=ur,dr=O(ro)`
|
|
114
114
|
display: grid;
|
|
115
115
|
grid-template-columns: [name] minmax(150px, auto) [values] minmax(0px, 1fr);
|
|
116
116
|
gap: var(--space-sm);
|
|
117
|
-
`,fr=O(
|
|
117
|
+
`,fr=O(eo)`
|
|
118
118
|
border-radius: var(--shape-border-radius-sm);
|
|
119
119
|
background-color: var(--color-explain-dialog-apply-solution-button-fill);
|
|
120
120
|
color: var(--color-explain-dialog-apply-solution-button-color);
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
outline: 2px solid var(--color-explain-dialog-apply-solution-button-outline);
|
|
132
132
|
outline-offset: 1px;
|
|
133
133
|
}
|
|
134
|
-
`;function pr(e){const{explanation:t}=e,{applySolutionButtonCaption:n}=
|
|
134
|
+
`;function pr(e){const{explanation:t}=e,{applySolutionButtonCaption:n}=oo(),o=t.solution.decisions.filter(i=>i.state!=null);return f.jsxs(lo,{children:[f.jsx(dr,{blockingDecisions:t.causedByDecisions,desiredDecisions:o}),f.jsx(fr,{explanation:t,children:n})]})}const hr=O(lo)`
|
|
135
135
|
ul {
|
|
136
136
|
margin: 0;
|
|
137
137
|
}
|
|
@@ -141,20 +141,20 @@
|
|
|
141
141
|
list-style-type: none;
|
|
142
142
|
margin-inline-start: 0;
|
|
143
143
|
padding-inline-start: 0;
|
|
144
|
-
`,
|
|
144
|
+
`,ln=O.ul`
|
|
145
145
|
list-style-type: disc;
|
|
146
146
|
margin-inline-start: 0;
|
|
147
147
|
padding-inline-start: var(--space-lg);
|
|
148
|
-
`,
|
|
148
|
+
`,sn=O.li`
|
|
149
149
|
font-size: 0.9em;
|
|
150
150
|
font-family: var(--framer-font-family, "Inter", "Inter Placeholder", sans-serif);
|
|
151
151
|
font-weight: 500;
|
|
152
|
-
`;function yr(e){const{explanation:t}=e,n=t.causedByCardinalities,o=
|
|
152
|
+
`;function yr(e){const{explanation:t}=e,n=t.causedByCardinalities,o=C.pipe(t.causedByRules,C.RNEA.groupBy(i=>i.configurationModelId),C.RR.collect(C.Str.Ord)((i,r)=>({configurationModelId:i,rules:C.pipe(r,C.RA.map(l=>l.localId),C.RA.sort(C.Str.Ord))})));return f.jsx(hr,{children:f.jsxs(mr,{children:[o.map(i=>f.jsxs("li",{children:[f.jsx("span",{children:i.configurationModelId}),f.jsx(ln,{children:i.rules.map(r=>f.jsx(sn,{children:r}))})]})),n.length>0&&f.jsxs("li",{children:[f.jsx("span",{children:"Cardinality"}),f.jsx(ln,{children:n.map(i=>f.jsx(sn,{children:i.localId}))})]})]})})}function so(e){const{variant:t,...n}=e,{explainQuestion:o}=ye(),i=F.match(o).returnType().with({question:c.ExplainQuestionType.whyIsStateNotPossible},()=>"why your selection is not possible").with({question:c.ExplainQuestionType.whyIsNotSatisfied,subject:c.ExplainQuestionSubject.configuration},()=>"why your configuration is not satisfied").with({question:c.ExplainQuestionType.whyIsNotSatisfied,subject:c.ExplainQuestionSubject.attribute},()=>"why your attribute is not satisfied").with(F.P.nullish,()=>"why your selections are not possible").exhaustive(),r=F.match(t).returnType().with("failedToExplain",()=>f.jsxs(f.Fragment,{children:["Failed to explain ",i,".",f.jsx("br",{}),"Please check your internet connection and try again."]})).with("noExplanationFound",()=>f.jsxs(f.Fragment,{children:["There was no explanation found for ",i,"."]})).with("noSolutionFound",()=>f.jsxs(f.Fragment,{children:["There was no solution found for ",i,"."]})).exhaustive();return f.jsx("div",{...n,children:r})}const an=O.div`
|
|
153
153
|
font-weight: 500;
|
|
154
154
|
font-family: var(--font-heading);
|
|
155
155
|
margin-bottom: var(--space-xs);
|
|
156
156
|
margin-left: var(--space-sm-fixed);
|
|
157
|
-
`,
|
|
157
|
+
`,cn=O.div`
|
|
158
158
|
display: flex;
|
|
159
159
|
flex-direction: column;
|
|
160
160
|
gap: var(--space-xs);
|
|
@@ -162,27 +162,27 @@
|
|
|
162
162
|
display: flex;
|
|
163
163
|
flex-direction: column;
|
|
164
164
|
gap: var(--space-md);
|
|
165
|
-
`,
|
|
165
|
+
`,un=O(so)`
|
|
166
166
|
width: min-content;
|
|
167
167
|
min-width: 400px;
|
|
168
168
|
margin: var(--space-sm-fixed) var(--space-md-fixed) var(--space-sm-fixed) var(--space-sm-fixed);
|
|
169
|
-
`;function gr(){const{decisionExplanations:e,constraintExplanations:t,hasError:n}=xe(),{decisionExplanationSolutionsTitle:o,constraintExplanationSolutionsTitle:i}=no();return n?d.jsx(cn,{variant:"failedToExplain"}):e.length===0&&t.length===0?d.jsx(cn,{variant:"noExplanationFound"}):d.jsxs(br,{children:[e.length>0&&d.jsxs("div",{children:[d.jsx(sn,{children:o}),d.jsx(an,{children:e.map(r=>d.jsx(pr,{explanation:r},e.indexOf(r)))})]}),t.length>0&&d.jsxs("div",{children:[d.jsx(sn,{children:i}),d.jsx(an,{children:t.map(r=>d.jsx(yr,{explanation:r},t.indexOf(r)))})]})]})}function fe(e){return lo(e)?(e.nodeName||"").toLowerCase():"#document"}function oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pe(e){var t;return(t=(lo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lo(e){return e instanceof Node||e instanceof oe(e).Node}function X(e){return e instanceof Element||e instanceof oe(e).Element}function te(e){return e instanceof HTMLElement||e instanceof oe(e).HTMLElement}function Rt(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof oe(e).ShadowRoot}function We(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=ie(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(i)}function xr(e){return["table","td","th"].includes(fe(e))}function zt(e){const t=Wt(),n=ie(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 so(e){let t=Se(e);for(;te(t)&&!De(t);){if(zt(t))return t;t=Se(t)}return null}function Wt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function De(e){return["html","body","#document"].includes(fe(e))}function ie(e){return oe(e).getComputedStyle(e)}function dt(e){return X(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Se(e){if(fe(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Rt(e)&&e.host||pe(e);return Rt(t)?t.host:t}function ao(e){const t=Se(e);return De(t)?e.ownerDocument?e.ownerDocument.body:e.body:te(t)&&We(t)?t:ao(t)}function be(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=ao(e),r=i===((o=e.ownerDocument)==null?void 0:o.body),l=oe(i);return r?t.concat(l,l.visualViewport||[],We(i)?i:[],l.frameElement&&n?be(l.frameElement):[]):t.concat(i,be(i,[],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 ne(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Rt(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function co(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function uo(){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 Cr(e){return e.mozInputSource===0&&e.isTrusted?!0:Pt()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function vr(e){return Sr()?!1:!Pt()&&e.width===0&&e.height===0||Pt()&&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 wr(){return/apple/i.test(navigator.vendor)}function Pt(){const e=/android/i;return e.test(co())||e.test(uo())}function Sr(){return uo().includes("jsdom/")}function un(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Tr(e){return"nativeEvent"in e}function Ar(e){return e.matches("html,body")}function de(e){return(e==null?void 0:e.ownerDocument)||document}function ht(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 Re(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Er="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function fo(e){return te(e)&&e.matches(Er)}function mt(e){e.preventDefault(),e.stopPropagation()}function Ir(e){return e?e.getAttribute("role")==="combobox"&&fo(e):!1}const Oe=Math.min,we=Math.max,et=Math.round,Qe=Math.floor,ge=e=>({x:e,y:e}),Rr={left:"right",right:"left",bottom:"top",top:"bottom"},Pr={start:"end",end:"start"};function Vt(e,t,n){return we(e,Oe(t,n))}function qe(e,t){return typeof e=="function"?e(t):e}function Te(e){return e.split("-")[0]}function He(e){return e.split("-")[1]}function po(e){return e==="x"?"y":"x"}function qt(e){return e==="y"?"height":"width"}function ft(e){return["top","bottom"].includes(Te(e))?"y":"x"}function Ht(e){return po(ft(e))}function Vr(e,t,n){n===void 0&&(n=!1);const o=He(e),i=Ht(e),r=qt(i);let l=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(l=tt(l)),[l,tt(l)]}function Dr(e){const t=tt(e);return[Dt(e),t,Dt(t)]}function Dt(e){return e.replace(/start|end/g,t=>Pr[t])}function Or(e,t,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:o:t?o:i;case"left":case"right":return t?r:l;default:return[]}}function kr(e,t,n,o){const i=He(e);let r=Or(Te(e),n==="start",o);return i&&(r=r.map(l=>l+"-"+i),t&&(r=r.concat(r.map(Dt)))),r}function tt(e){return e.replace(/left|right|bottom|top/g,t=>Rr[t])}function jr(e){return{top:0,right:0,bottom:0,left:0,...e}}function ho(e){return typeof e!="number"?jr(e):{top:e,right:e,bottom:e,left:e}}function nt(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function dn(e,t,n){let{reference:o,floating:i}=e;const r=ft(t),l=Ht(t),s=qt(l),a=Te(t),u=r==="y",g=o.x+o.width/2-i.width/2,h=o.y+o.height/2-i.height/2,b=o[s]/2-i[s]/2;let p;switch(a){case"top":p={x:g,y:o.y-i.height};break;case"bottom":p={x:g,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:h};break;case"left":p={x:o.x-i.width,y:h};break;default:p={x:o.x,y:o.y}}switch(He(t)){case"start":p[l]-=b*(n&&u?-1:1);break;case"end":p[l]+=b*(n&&u?-1:1);break}return p}const Fr=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(t));let u=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:g,y:h}=dn(u,o,a),b=o,p={},m=0;for(let w=0;w<s.length;w++){const{name:C,fn:y}=s[w],{x,y:P,data:S,reset:E}=await y({x:g,y:h,initialPlacement:o,placement:b,strategy:i,middlewareData:p,rects:u,platform:l,elements:{reference:e,floating:t}});g=x??g,h=P??h,p={...p,[C]:{...p[C],...S}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(b=E.placement),E.rects&&(u=E.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:i}):E.rects),{x:g,y:h}=dn(u,b,a)),w=-1)}return{x:g,y:h,placement:b,strategy:i,middlewareData:p}};async function mo(e,t){var n;t===void 0&&(t={});const{x:o,y:i,platform:r,rects:l,elements:s,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:g="viewport",elementContext:h="floating",altBoundary:b=!1,padding:p=0}=qe(t,e),m=ho(p),C=s[b?h==="floating"?"reference":"floating":h],y=nt(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(C)))==null||n?C:C.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(s.floating)),boundary:u,rootBoundary:g,strategy:a})),x=h==="floating"?{...l.floating,x:o,y:i}:l.reference,P=await(r.getOffsetParent==null?void 0:r.getOffsetParent(s.floating)),S=await(r.isElement==null?void 0:r.isElement(P))?await(r.getScale==null?void 0:r.getScale(P))||{x:1,y:1}:{x:1,y:1},E=nt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:x,offsetParent:P,strategy:a}):x);return{top:(y.top-E.top+m.top)/S.y,bottom:(E.bottom-y.bottom+m.bottom)/S.y,left:(y.left-E.left+m.left)/S.x,right:(E.right-y.right+m.right)/S.x}}const Nr=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:l,elements:s,middlewareData:a}=t,{element:u,padding:g=0}=qe(e,t)||{};if(u==null)return{};const h=ho(g),b={x:n,y:o},p=Ht(i),m=qt(p),w=await l.getDimensions(u),C=p==="y",y=C?"top":"left",x=C?"bottom":"right",P=C?"clientHeight":"clientWidth",S=r.reference[m]+r.reference[p]-b[p]-r.floating[m],E=b[p]-r.reference[p],R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let I=R?R[P]:0;(!I||!await(l.isElement==null?void 0:l.isElement(R)))&&(I=s.floating[P]||r.floating[m]);const V=S/2-E/2,L=I/2-w[m]/2-1,k=Oe(h[y],L),Y=Oe(h[x],L),q=k,U=I-w[m]-Y,H=I/2-w[m]/2+V,j=Vt(q,H,U),B=!a.arrow&&He(i)!=null&&H!==j&&r.reference[m]/2-(H<q?k:Y)-w[m]/2<0,D=B?H<q?H-q:H-U:0;return{[p]:b[p]+D,data:{[p]:j,centerOffset:H-j-D,...B&&{alignmentOffset:D}},reset:B}}}),Lr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:r,rects:l,initialPlacement:s,platform:a,elements:u}=t,{mainAxis:g=!0,crossAxis:h=!0,fallbackPlacements:b,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:w=!0,...C}=qe(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const y=Te(i),x=Te(s)===s,P=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=b||(x||!w?[tt(s)]:Dr(s));!b&&m!=="none"&&S.push(...kr(s,w,m,P));const E=[s,...S],R=await mo(t,C),I=[];let V=((o=r.flip)==null?void 0:o.overflows)||[];if(g&&I.push(R[y]),h){const q=Vr(i,l,P);I.push(R[q[0]],R[q[1]])}if(V=[...V,{placement:i,overflows:I}],!I.every(q=>q<=0)){var L,k;const q=(((L=r.flip)==null?void 0:L.index)||0)+1,U=E[q];if(U)return{data:{index:q,overflows:V},reset:{placement:U}};let H=(k=V.filter(j=>j.overflows[0]<=0).sort((j,B)=>j.overflows[1]-B.overflows[1])[0])==null?void 0:k.placement;if(!H)switch(p){case"bestFit":{var Y;const j=(Y=V.map(B=>[B.placement,B.overflows.filter(D=>D>0).reduce((D,N)=>D+N,0)]).sort((B,D)=>B[1]-D[1])[0])==null?void 0:Y[0];j&&(H=j);break}case"initialPlacement":H=s;break}if(i!==H)return{reset:{placement:H}}}return{}}}};async function Br(e,t){const{placement:n,platform:o,elements:i}=e,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),l=Te(n),s=He(n),a=ft(n)==="y",u=["left","top"].includes(l)?-1:1,g=r&&a?-1:1,h=qe(t,e);let{mainAxis:b,crossAxis:p,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return s&&typeof m=="number"&&(p=s==="end"?m*-1:m),a?{x:p*g,y:b*u}:{x:b*u,y:p*g}}const Mr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:l,middlewareData:s}=t,a=await Br(t,e);return l===((n=s.offset)==null?void 0:n.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:l}}}}},$r=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:s={fn:C=>{let{x:y,y:x}=C;return{x:y,y:x}}},...a}=qe(e,t),u={x:n,y:o},g=await mo(t,a),h=ft(Te(i)),b=po(h);let p=u[b],m=u[h];if(r){const C=b==="y"?"top":"left",y=b==="y"?"bottom":"right",x=p+g[C],P=p-g[y];p=Vt(x,p,P)}if(l){const C=h==="y"?"top":"left",y=h==="y"?"bottom":"right",x=m+g[C],P=m-g[y];m=Vt(x,m,P)}const w=s.fn({...t,[b]:p,[h]:m});return{...w,data:{x:w.x-n,y:w.y-o}}}}};function yo(e){const t=ie(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=te(e),r=i?e.offsetWidth:n,l=i?e.offsetHeight:o,s=et(n)!==r||et(o)!==l;return s&&(n=r,o=l),{width:n,height:o,$:s}}function Ut(e){return X(e)?e:e.contextElement}function Ve(e){const t=Ut(e);if(!te(t))return ge(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=yo(t);let l=(r?et(n.width):n.width)/o,s=(r?et(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const Kr=ge(0);function bo(e){const t=oe(e);return!Wt()||!t.visualViewport?Kr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==oe(e)?!1:t}function Ae(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),r=Ut(e);let l=ge(1);t&&(o?X(o)&&(l=Ve(o)):l=Ve(e));const s=zr(r,n,o)?bo(r):ge(0);let a=(i.left+s.x)/l.x,u=(i.top+s.y)/l.y,g=i.width/l.x,h=i.height/l.y;if(r){const b=oe(r),p=o&&X(o)?oe(o):o;let m=b.frameElement;for(;m&&o&&p!==b;){const w=Ve(m),C=m.getBoundingClientRect(),y=ie(m),x=C.left+(m.clientLeft+parseFloat(y.paddingLeft))*w.x,P=C.top+(m.clientTop+parseFloat(y.paddingTop))*w.y;a*=w.x,u*=w.y,g*=w.x,h*=w.y,a+=x,u+=P,m=oe(m).frameElement}}return nt({width:g,height:h,x:a,y:u})}const Wr=[":popover-open",":modal"];function go(e){let t=!1,n=0,o=0;function i(r){try{t=t||e.matches(r)}catch{}}if(Wr.forEach(r=>{i(r)}),t){const r=so(e);if(r){const l=r.getBoundingClientRect();n=l.x,o=l.y}}return[t,n,o]}function qr(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r=pe(o),[l]=t?go(t.floating):[!1];if(o===r||l)return n;let s={scrollLeft:0,scrollTop:0},a=ge(1);const u=ge(0),g=te(o);if((g||!g&&i!=="fixed")&&((fe(o)!=="body"||We(r))&&(s=dt(o)),te(o))){const h=Ae(o);a=Ve(o),u.x=h.x+o.clientLeft,u.y=h.y+o.clientTop}return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-s.scrollLeft*a.x+u.x,y:n.y*a.y-s.scrollTop*a.y+u.y}}function Hr(e){return Array.from(e.getClientRects())}function xo(e){return Ae(pe(e)).left+dt(e).scrollLeft}function Ur(e){const t=pe(e),n=dt(e),o=e.ownerDocument.body,i=we(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=we(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+xo(e);const s=-n.scrollTop;return ie(o).direction==="rtl"&&(l+=we(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:l,y:s}}function _r(e,t){const n=oe(e),o=pe(e),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,a=0;if(i){r=i.width,l=i.height;const u=Wt();(!u||u&&t==="fixed")&&(s=i.offsetLeft,a=i.offsetTop)}return{width:r,height:l,x:s,y:a}}function Qr(e,t){const n=Ae(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=te(e)?Ve(e):ge(1),l=e.clientWidth*r.x,s=e.clientHeight*r.y,a=i*r.x,u=o*r.y;return{width:l,height:s,x:a,y:u}}function fn(e,t,n){let o;if(t==="viewport")o=_r(e,n);else if(t==="document")o=Ur(pe(e));else if(X(t))o=Qr(t,n);else{const i=bo(e);o={...t,x:t.x-i.x,y:t.y-i.y}}return nt(o)}function Co(e,t){const n=Se(e);return n===t||!X(n)||De(n)?!1:ie(n).position==="fixed"||Co(n,t)}function Yr(e,t){const n=t.get(e);if(n)return n;let o=be(e,[],!1).filter(s=>X(s)&&fe(s)!=="body"),i=null;const r=ie(e).position==="fixed";let l=r?Se(e):e;for(;X(l)&&!De(l);){const s=ie(l),a=zt(l);!a&&s.position==="fixed"&&(i=null),(r?!a&&!i:!a&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||We(l)&&!a&&Co(e,l))?o=o.filter(g=>g!==l):i=s,l=Se(l)}return t.set(e,o),o}function Xr(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const l=[...n==="clippingAncestors"?Yr(t,this._c):[].concat(n),o],s=l[0],a=l.reduce((u,g)=>{const h=fn(t,g,i);return u.top=we(h.top,u.top),u.right=Oe(h.right,u.right),u.bottom=Oe(h.bottom,u.bottom),u.left=we(h.left,u.left),u},fn(t,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Gr(e){const{width:t,height:n}=yo(e);return{width:t,height:n}}function Jr(e,t,n,o){const i=te(t),r=pe(t),l=n==="fixed",s=Ae(e,!0,l,t);let a={scrollLeft:0,scrollTop:0};const u=ge(0);if(i||!i&&!l)if((fe(t)!=="body"||We(r))&&(a=dt(t)),i){const w=Ae(t,!0,l,t);u.x=w.x+t.clientLeft,u.y=w.y+t.clientTop}else r&&(u.x=xo(r));let g=s.left+a.scrollLeft-u.x,h=s.top+a.scrollTop-u.y;const[b,p,m]=go(o);return b&&(g+=p,h+=m,i&&(g+=t.clientLeft,h+=t.clientTop)),{x:g,y:h,width:s.width,height:s.height}}function pn(e,t){return!te(e)||ie(e).position==="fixed"?null:t?t(e):e.offsetParent}function vo(e,t){const n=oe(e);if(!te(e))return n;let o=pn(e,t);for(;o&&xr(o)&&ie(o).position==="static";)o=pn(o,t);return o&&(fe(o)==="html"||fe(o)==="body"&&ie(o).position==="static"&&!zt(o))?n:o||so(e)||n}const Zr=async function(e){const t=this.getOffsetParent||vo,n=this.getDimensions;return{reference:Jr(e.reference,await t(e.floating),e.strategy,e.floating),floating:{x:0,y:0,...await n(e.floating)}}};function el(e){return ie(e).direction==="rtl"}const wo={convertOffsetParentRelativeRectToViewportRelativeRect:qr,getDocumentElement:pe,getClippingRect:Xr,getOffsetParent:vo,getElementRects:Zr,getClientRects:Hr,getDimensions:Gr,getScale:Ve,isElement:X,isRTL:el};function tl(e,t){let n=null,o;const i=pe(e);function r(){var s;clearTimeout(o),(s=n)==null||s.disconnect(),n=null}function l(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),r();const{left:u,top:g,width:h,height:b}=e.getBoundingClientRect();if(s||t(),!h||!b)return;const p=Qe(g),m=Qe(i.clientWidth-(u+h)),w=Qe(i.clientHeight-(g+b)),C=Qe(u),x={rootMargin:-p+"px "+-m+"px "+-w+"px "+-C+"px",threshold:we(0,Oe(1,a))||1};let P=!0;function S(E){const R=E[0].intersectionRatio;if(R!==a){if(!P)return l();R?l(!1,R):o=setTimeout(()=>{l(!1,1e-7)},100)}P=!1}try{n=new IntersectionObserver(S,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return l(!0),r}function nl(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,u=Ut(e),g=i||r?[...u?be(u):[],...be(t)]:[];g.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),r&&y.addEventListener("resize",n)});const h=u&&s?tl(u,n):null;let b=-1,p=null;l&&(p=new ResizeObserver(y=>{let[x]=y;x&&x.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var P;(P=p)==null||P.observe(t)})),n()}),u&&!a&&p.observe(u),p.observe(t));let m,w=a?Ae(e):null;a&&C();function C(){const y=Ae(e);w&&(y.x!==w.x||y.y!==w.y||y.width!==w.width||y.height!==w.height)&&n(),w=y,m=requestAnimationFrame(C)}return n(),()=>{var y;g.forEach(x=>{i&&x.removeEventListener("scroll",n),r&&x.removeEventListener("resize",n)}),h==null||h(),(y=p)==null||y.disconnect(),p=null,a&&cancelAnimationFrame(m)}}const ol=$r,il=Lr,hn=Nr,rl=(e,t,n)=>{const o=new Map,i={platform:wo,...n},r={...i.platform,_c:o};return Fr(e,t,{...i,platform:r})},ll=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:i}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?hn({element:o.current,padding:i}).fn(n):{}:o?hn({element:o,padding:i}).fn(n):{}}}};var Ge=typeof document<"u"?T.useLayoutEffect:T.useEffect;function ot(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,i;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(!ot(e[o],t[o]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,i[o]))return!1;for(o=n;o--!==0;){const r=i[o];if(!(r==="_owner"&&e.$$typeof)&&!ot(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function So(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function mn(e,t){const n=So(e);return Math.round(t*n)/n}function yn(e){const t=A.useRef(e);return Ge(()=>{t.current=e}),t}function sl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:r,floating:l}={},transform:s=!0,whileElementsMounted:a,open:u}=e,[g,h]=A.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,p]=A.useState(o);ot(b,o)||p(o);const[m,w]=A.useState(null),[C,y]=A.useState(null),x=A.useCallback(D=>{D!==R.current&&(R.current=D,w(D))},[]),P=A.useCallback(D=>{D!==I.current&&(I.current=D,y(D))},[]),S=r||m,E=l||C,R=A.useRef(null),I=A.useRef(null),V=A.useRef(g),L=a!=null,k=yn(a),Y=yn(i),q=A.useCallback(()=>{if(!R.current||!I.current)return;const D={placement:t,strategy:n,middleware:b};Y.current&&(D.platform=Y.current),rl(R.current,I.current,D).then(N=>{const ee={...N,isPositioned:!0};U.current&&!ot(V.current,ee)&&(V.current=ee,Bi.flushSync(()=>{h(ee)}))})},[b,t,n,Y]);Ge(()=>{u===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,h(D=>({...D,isPositioned:!1})))},[u]);const U=A.useRef(!1);Ge(()=>(U.current=!0,()=>{U.current=!1}),[]),Ge(()=>{if(S&&(R.current=S),E&&(I.current=E),S&&E){if(k.current)return k.current(S,E,q);q()}},[S,E,q,k,L]);const H=A.useMemo(()=>({reference:R,floating:I,setReference:x,setFloating:P}),[x,P]),j=A.useMemo(()=>({reference:S,floating:E}),[S,E]),B=A.useMemo(()=>{const D={position:n,left:0,top:0};if(!j.floating)return D;const N=mn(j.floating,g.x),ee=mn(j.floating,g.y);return s?{...D,transform:"translate("+N+"px, "+ee+"px)",...So(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:ee}},[n,s,j.floating,g.x,g.y]);return A.useMemo(()=>({...g,update:q,refs:H,elements:j,floatingStyles:B}),[g,q,H,j,B])}/*!
|
|
169
|
+
`;function gr(){const{decisionExplanations:e,constraintExplanations:t,hasError:n}=ye(),{decisionExplanationSolutionsTitle:o,constraintExplanationSolutionsTitle:i}=oo();return n?f.jsx(un,{variant:"failedToExplain"}):e.length===0&&t.length===0?f.jsx(un,{variant:"noExplanationFound"}):f.jsxs(br,{children:[e.length>0&&f.jsxs("div",{children:[f.jsx(an,{children:o}),f.jsx(cn,{children:e.map(r=>f.jsx(pr,{explanation:r},e.indexOf(r)))})]}),t.length>0&&f.jsxs("div",{children:[f.jsx(an,{children:i}),f.jsx(cn,{children:t.map(r=>f.jsx(yr,{explanation:r},t.indexOf(r)))})]})]})}function me(e){return ao(e)?(e.nodeName||"").toLowerCase():"#document"}function oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function be(e){var t;return(t=(ao(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ao(e){return e instanceof Node||e instanceof oe(e).Node}function X(e){return e instanceof Element||e instanceof oe(e).Element}function te(e){return e instanceof HTMLElement||e instanceof oe(e).HTMLElement}function Vt(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof oe(e).ShadowRoot}function He(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=ie(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(i)}function xr(e){return["table","td","th"].includes(me(e))}function Wt(e){const t=qt(),n=ie(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 co(e){let t=Se(e);for(;te(t)&&!De(t);){if(Wt(t))return t;t=Se(t)}return null}function qt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function De(e){return["html","body","#document"].includes(me(e))}function ie(e){return oe(e).getComputedStyle(e)}function ft(e){return X(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Se(e){if(me(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vt(e)&&e.host||be(e);return Vt(t)?t.host:t}function uo(e){const t=Se(e);return De(t)?e.ownerDocument?e.ownerDocument.body:e.body:te(t)&&He(t)?t:uo(t)}function ge(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=uo(e),r=i===((o=e.ownerDocument)==null?void 0:o.body),l=oe(i);return r?t.concat(l,l.visualViewport||[],He(i)?i:[],l.frameElement&&n?ge(l.frameElement):[]):t.concat(i,ge(i,[],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 ne(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Vt(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function fo(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function po(){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 Cr(e){return e.mozInputSource===0&&e.isTrusted?!0:Dt()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function vr(e){return Sr()?!1:!Dt()&&e.width===0&&e.height===0||Dt()&&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 wr(){return/apple/i.test(navigator.vendor)}function Dt(){const e=/android/i;return e.test(fo())||e.test(po())}function Sr(){return po().includes("jsdom/")}function dn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Tr(e){return"nativeEvent"in e}function Ar(e){return e.matches("html,body")}function he(e){return(e==null?void 0:e.ownerDocument)||document}function yt(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 Re(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Er="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ho(e){return te(e)&&e.matches(Er)}function bt(e){e.preventDefault(),e.stopPropagation()}function Ir(e){return e?e.getAttribute("role")==="combobox"&&ho(e):!1}const Oe=Math.min,we=Math.max,tt=Math.round,Ye=Math.floor,xe=e=>({x:e,y:e}),Rr={left:"right",right:"left",bottom:"top",top:"bottom"},Pr={start:"end",end:"start"};function Ot(e,t,n){return we(e,Oe(t,n))}function Ue(e,t){return typeof e=="function"?e(t):e}function Te(e){return e.split("-")[0]}function _e(e){return e.split("-")[1]}function mo(e){return e==="x"?"y":"x"}function Ht(e){return e==="y"?"height":"width"}function pt(e){return["top","bottom"].includes(Te(e))?"y":"x"}function Ut(e){return mo(pt(e))}function Vr(e,t,n){n===void 0&&(n=!1);const o=_e(e),i=Ut(e),r=Ht(i);let l=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(l=nt(l)),[l,nt(l)]}function Dr(e){const t=nt(e);return[kt(e),t,kt(t)]}function kt(e){return e.replace(/start|end/g,t=>Pr[t])}function Or(e,t,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:o:t?o:i;case"left":case"right":return t?r:l;default:return[]}}function kr(e,t,n,o){const i=_e(e);let r=Or(Te(e),n==="start",o);return i&&(r=r.map(l=>l+"-"+i),t&&(r=r.concat(r.map(kt)))),r}function nt(e){return e.replace(/left|right|bottom|top/g,t=>Rr[t])}function jr(e){return{top:0,right:0,bottom:0,left:0,...e}}function yo(e){return typeof e!="number"?jr(e):{top:e,right:e,bottom:e,left:e}}function ot(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function fn(e,t,n){let{reference:o,floating:i}=e;const r=pt(t),l=Ut(t),s=Ht(l),a=Te(t),u=r==="y",x=o.x+o.width/2-i.width/2,h=o.y+o.height/2-i.height/2,y=o[s]/2-i[s]/2;let d;switch(a){case"top":d={x,y:o.y-i.height};break;case"bottom":d={x,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:h};break;case"left":d={x:o.x-i.width,y:h};break;default:d={x:o.x,y:o.y}}switch(_e(t)){case"start":d[l]-=y*(n&&u?-1:1);break;case"end":d[l]+=y*(n&&u?-1:1);break}return d}const Fr=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(t));let u=await l.getElementRects({reference:e,floating:t,strategy:i}),{x,y:h}=fn(u,o,a),y=o,d={},b=0;for(let w=0;w<s.length;w++){const{name:m,fn:g}=s[w],{x:v,y:P,data:S,reset:E}=await g({x,y:h,initialPlacement:o,placement:y,strategy:i,middlewareData:d,rects:u,platform:l,elements:{reference:e,floating:t}});x=v??x,h=P??h,d={...d,[m]:{...d[m],...S}},E&&b<=50&&(b++,typeof E=="object"&&(E.placement&&(y=E.placement),E.rects&&(u=E.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:i}):E.rects),{x,y:h}=fn(u,y,a)),w=-1)}return{x,y:h,placement:y,strategy:i,middlewareData:d}};async function bo(e,t){var n;t===void 0&&(t={});const{x:o,y:i,platform:r,rects:l,elements:s,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:x="viewport",elementContext:h="floating",altBoundary:y=!1,padding:d=0}=Ue(t,e),b=yo(d),m=s[y?h==="floating"?"reference":"floating":h],g=ot(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(m)))==null||n?m:m.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(s.floating)),boundary:u,rootBoundary:x,strategy:a})),v=h==="floating"?{...l.floating,x:o,y:i}:l.reference,P=await(r.getOffsetParent==null?void 0:r.getOffsetParent(s.floating)),S=await(r.isElement==null?void 0:r.isElement(P))?await(r.getScale==null?void 0:r.getScale(P))||{x:1,y:1}:{x:1,y:1},E=ot(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:P,strategy:a}):v);return{top:(g.top-E.top+b.top)/S.y,bottom:(E.bottom-g.bottom+b.bottom)/S.y,left:(g.left-E.left+b.left)/S.x,right:(E.right-g.right+b.right)/S.x}}const Nr=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:l,elements:s,middlewareData:a}=t,{element:u,padding:x=0}=Ue(e,t)||{};if(u==null)return{};const h=yo(x),y={x:n,y:o},d=Ut(i),b=Ht(d),w=await l.getDimensions(u),m=d==="y",g=m?"top":"left",v=m?"bottom":"right",P=m?"clientHeight":"clientWidth",S=r.reference[b]+r.reference[d]-y[d]-r.floating[b],E=y[d]-r.reference[d],R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let I=R?R[P]:0;(!I||!await(l.isElement==null?void 0:l.isElement(R)))&&(I=s.floating[P]||r.floating[b]);const V=S/2-E/2,B=I/2-w[b]/2-1,k=Oe(h[g],B),Y=Oe(h[v],B),q=k,U=I-w[b]-Y,H=I/2-w[b]/2+V,j=Ot(q,H,U),L=!a.arrow&&_e(i)!=null&&H!==j&&r.reference[b]/2-(H<q?k:Y)-w[b]/2<0,D=L?H<q?H-q:H-U:0;return{[d]:y[d]+D,data:{[d]:j,centerOffset:H-j-D,...L&&{alignmentOffset:D}},reset:L}}}),Br=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:r,rects:l,initialPlacement:s,platform:a,elements:u}=t,{mainAxis:x=!0,crossAxis:h=!0,fallbackPlacements:y,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...m}=Ue(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const g=Te(i),v=Te(s)===s,P=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=y||(v||!w?[nt(s)]:Dr(s));!y&&b!=="none"&&S.push(...kr(s,w,b,P));const E=[s,...S],R=await bo(t,m),I=[];let V=((o=r.flip)==null?void 0:o.overflows)||[];if(x&&I.push(R[g]),h){const q=Vr(i,l,P);I.push(R[q[0]],R[q[1]])}if(V=[...V,{placement:i,overflows:I}],!I.every(q=>q<=0)){var B,k;const q=(((B=r.flip)==null?void 0:B.index)||0)+1,U=E[q];if(U)return{data:{index:q,overflows:V},reset:{placement:U}};let H=(k=V.filter(j=>j.overflows[0]<=0).sort((j,L)=>j.overflows[1]-L.overflows[1])[0])==null?void 0:k.placement;if(!H)switch(d){case"bestFit":{var Y;const j=(Y=V.map(L=>[L.placement,L.overflows.filter(D=>D>0).reduce((D,N)=>D+N,0)]).sort((L,D)=>L[1]-D[1])[0])==null?void 0:Y[0];j&&(H=j);break}case"initialPlacement":H=s;break}if(i!==H)return{reset:{placement:H}}}return{}}}};async function Lr(e,t){const{placement:n,platform:o,elements:i}=e,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),l=Te(n),s=_e(n),a=pt(n)==="y",u=["left","top"].includes(l)?-1:1,x=r&&a?-1:1,h=Ue(t,e);let{mainAxis:y,crossAxis:d,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return s&&typeof b=="number"&&(d=s==="end"?b*-1:b),a?{x:d*x,y:y*u}:{x:y*u,y:d*x}}const Mr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:l,middlewareData:s}=t,a=await Lr(t,e);return l===((n=s.offset)==null?void 0:n.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:l}}}}},$r=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:s={fn:m=>{let{x:g,y:v}=m;return{x:g,y:v}}},...a}=Ue(e,t),u={x:n,y:o},x=await bo(t,a),h=pt(Te(i)),y=mo(h);let d=u[y],b=u[h];if(r){const m=y==="y"?"top":"left",g=y==="y"?"bottom":"right",v=d+x[m],P=d-x[g];d=Ot(v,d,P)}if(l){const m=h==="y"?"top":"left",g=h==="y"?"bottom":"right",v=b+x[m],P=b-x[g];b=Ot(v,b,P)}const w=s.fn({...t,[y]:d,[h]:b});return{...w,data:{x:w.x-n,y:w.y-o}}}}};function go(e){const t=ie(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=te(e),r=i?e.offsetWidth:n,l=i?e.offsetHeight:o,s=tt(n)!==r||tt(o)!==l;return s&&(n=r,o=l),{width:n,height:o,$:s}}function _t(e){return X(e)?e:e.contextElement}function Ve(e){const t=_t(e);if(!te(t))return xe(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=go(t);let l=(r?tt(n.width):n.width)/o,s=(r?tt(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const Kr=xe(0);function xo(e){const t=oe(e);return!qt()||!t.visualViewport?Kr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==oe(e)?!1:t}function Ae(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),r=_t(e);let l=xe(1);t&&(o?X(o)&&(l=Ve(o)):l=Ve(e));const s=zr(r,n,o)?xo(r):xe(0);let a=(i.left+s.x)/l.x,u=(i.top+s.y)/l.y,x=i.width/l.x,h=i.height/l.y;if(r){const y=oe(r),d=o&&X(o)?oe(o):o;let b=y.frameElement;for(;b&&o&&d!==y;){const w=Ve(b),m=b.getBoundingClientRect(),g=ie(b),v=m.left+(b.clientLeft+parseFloat(g.paddingLeft))*w.x,P=m.top+(b.clientTop+parseFloat(g.paddingTop))*w.y;a*=w.x,u*=w.y,x*=w.x,h*=w.y,a+=v,u+=P,b=oe(b).frameElement}}return ot({width:x,height:h,x:a,y:u})}const Wr=[":popover-open",":modal"];function Co(e){let t=!1,n=0,o=0;function i(r){try{t=t||e.matches(r)}catch{}}if(Wr.forEach(r=>{i(r)}),t){const r=co(e);if(r){const l=r.getBoundingClientRect();n=l.x,o=l.y}}return[t,n,o]}function qr(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r=be(o),[l]=t?Co(t.floating):[!1];if(o===r||l)return n;let s={scrollLeft:0,scrollTop:0},a=xe(1);const u=xe(0),x=te(o);if((x||!x&&i!=="fixed")&&((me(o)!=="body"||He(r))&&(s=ft(o)),te(o))){const h=Ae(o);a=Ve(o),u.x=h.x+o.clientLeft,u.y=h.y+o.clientTop}return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-s.scrollLeft*a.x+u.x,y:n.y*a.y-s.scrollTop*a.y+u.y}}function Hr(e){return Array.from(e.getClientRects())}function vo(e){return Ae(be(e)).left+ft(e).scrollLeft}function Ur(e){const t=be(e),n=ft(e),o=e.ownerDocument.body,i=we(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=we(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+vo(e);const s=-n.scrollTop;return ie(o).direction==="rtl"&&(l+=we(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:l,y:s}}function _r(e,t){const n=oe(e),o=be(e),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,a=0;if(i){r=i.width,l=i.height;const u=qt();(!u||u&&t==="fixed")&&(s=i.offsetLeft,a=i.offsetTop)}return{width:r,height:l,x:s,y:a}}function Qr(e,t){const n=Ae(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=te(e)?Ve(e):xe(1),l=e.clientWidth*r.x,s=e.clientHeight*r.y,a=i*r.x,u=o*r.y;return{width:l,height:s,x:a,y:u}}function pn(e,t,n){let o;if(t==="viewport")o=_r(e,n);else if(t==="document")o=Ur(be(e));else if(X(t))o=Qr(t,n);else{const i=xo(e);o={...t,x:t.x-i.x,y:t.y-i.y}}return ot(o)}function wo(e,t){const n=Se(e);return n===t||!X(n)||De(n)?!1:ie(n).position==="fixed"||wo(n,t)}function Yr(e,t){const n=t.get(e);if(n)return n;let o=ge(e,[],!1).filter(s=>X(s)&&me(s)!=="body"),i=null;const r=ie(e).position==="fixed";let l=r?Se(e):e;for(;X(l)&&!De(l);){const s=ie(l),a=Wt(l);!a&&s.position==="fixed"&&(i=null),(r?!a&&!i:!a&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||He(l)&&!a&&wo(e,l))?o=o.filter(x=>x!==l):i=s,l=Se(l)}return t.set(e,o),o}function Xr(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const l=[...n==="clippingAncestors"?Yr(t,this._c):[].concat(n),o],s=l[0],a=l.reduce((u,x)=>{const h=pn(t,x,i);return u.top=we(h.top,u.top),u.right=Oe(h.right,u.right),u.bottom=Oe(h.bottom,u.bottom),u.left=we(h.left,u.left),u},pn(t,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Gr(e){const{width:t,height:n}=go(e);return{width:t,height:n}}function Jr(e,t,n,o){const i=te(t),r=be(t),l=n==="fixed",s=Ae(e,!0,l,t);let a={scrollLeft:0,scrollTop:0};const u=xe(0);if(i||!i&&!l)if((me(t)!=="body"||He(r))&&(a=ft(t)),i){const w=Ae(t,!0,l,t);u.x=w.x+t.clientLeft,u.y=w.y+t.clientTop}else r&&(u.x=vo(r));let x=s.left+a.scrollLeft-u.x,h=s.top+a.scrollTop-u.y;const[y,d,b]=Co(o);return y&&(x+=d,h+=b,i&&(x+=t.clientLeft,h+=t.clientTop)),{x,y:h,width:s.width,height:s.height}}function hn(e,t){return!te(e)||ie(e).position==="fixed"?null:t?t(e):e.offsetParent}function So(e,t){const n=oe(e);if(!te(e))return n;let o=hn(e,t);for(;o&&xr(o)&&ie(o).position==="static";)o=hn(o,t);return o&&(me(o)==="html"||me(o)==="body"&&ie(o).position==="static"&&!Wt(o))?n:o||co(e)||n}const Zr=async function(e){const t=this.getOffsetParent||So,n=this.getDimensions;return{reference:Jr(e.reference,await t(e.floating),e.strategy,e.floating),floating:{x:0,y:0,...await n(e.floating)}}};function el(e){return ie(e).direction==="rtl"}const To={convertOffsetParentRelativeRectToViewportRelativeRect:qr,getDocumentElement:be,getClippingRect:Xr,getOffsetParent:So,getElementRects:Zr,getClientRects:Hr,getDimensions:Gr,getScale:Ve,isElement:X,isRTL:el};function tl(e,t){let n=null,o;const i=be(e);function r(){var s;clearTimeout(o),(s=n)==null||s.disconnect(),n=null}function l(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),r();const{left:u,top:x,width:h,height:y}=e.getBoundingClientRect();if(s||t(),!h||!y)return;const d=Ye(x),b=Ye(i.clientWidth-(u+h)),w=Ye(i.clientHeight-(x+y)),m=Ye(u),v={rootMargin:-d+"px "+-b+"px "+-w+"px "+-m+"px",threshold:we(0,Oe(1,a))||1};let P=!0;function S(E){const R=E[0].intersectionRatio;if(R!==a){if(!P)return l();R?l(!1,R):o=setTimeout(()=>{l(!1,1e-7)},100)}P=!1}try{n=new IntersectionObserver(S,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,v)}n.observe(e)}return l(!0),r}function nl(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,u=_t(e),x=i||r?[...u?ge(u):[],...ge(t)]:[];x.forEach(g=>{i&&g.addEventListener("scroll",n,{passive:!0}),r&&g.addEventListener("resize",n)});const h=u&&s?tl(u,n):null;let y=-1,d=null;l&&(d=new ResizeObserver(g=>{let[v]=g;v&&v.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var P;(P=d)==null||P.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let b,w=a?Ae(e):null;a&&m();function m(){const g=Ae(e);w&&(g.x!==w.x||g.y!==w.y||g.width!==w.width||g.height!==w.height)&&n(),w=g,b=requestAnimationFrame(m)}return n(),()=>{var g;x.forEach(v=>{i&&v.removeEventListener("scroll",n),r&&v.removeEventListener("resize",n)}),h==null||h(),(g=d)==null||g.disconnect(),d=null,a&&cancelAnimationFrame(b)}}const ol=$r,il=Br,mn=Nr,rl=(e,t,n)=>{const o=new Map,i={platform:To,...n},r={...i.platform,_c:o};return Fr(e,t,{...i,platform:r})},ll=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:i}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?mn({element:o.current,padding:i}).fn(n):{}:o?mn({element:o,padding:i}).fn(n):{}}}};var Je=typeof document<"u"?T.useLayoutEffect:T.useEffect;function it(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,i;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(!it(e[o],t[o]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,i[o]))return!1;for(o=n;o--!==0;){const r=i[o];if(!(r==="_owner"&&e.$$typeof)&&!it(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function Ao(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yn(e,t){const n=Ao(e);return Math.round(t*n)/n}function bn(e){const t=A.useRef(e);return Je(()=>{t.current=e}),t}function sl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:r,floating:l}={},transform:s=!0,whileElementsMounted:a,open:u}=e,[x,h]=A.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,d]=A.useState(o);it(y,o)||d(o);const[b,w]=A.useState(null),[m,g]=A.useState(null),v=A.useCallback(D=>{D!==R.current&&(R.current=D,w(D))},[]),P=A.useCallback(D=>{D!==I.current&&(I.current=D,g(D))},[]),S=r||b,E=l||m,R=A.useRef(null),I=A.useRef(null),V=A.useRef(x),B=a!=null,k=bn(a),Y=bn(i),q=A.useCallback(()=>{if(!R.current||!I.current)return;const D={placement:t,strategy:n,middleware:y};Y.current&&(D.platform=Y.current),rl(R.current,I.current,D).then(N=>{const ee={...N,isPositioned:!0};U.current&&!it(V.current,ee)&&(V.current=ee,Mi.flushSync(()=>{h(ee)}))})},[y,t,n,Y]);Je(()=>{u===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,h(D=>({...D,isPositioned:!1})))},[u]);const U=A.useRef(!1);Je(()=>(U.current=!0,()=>{U.current=!1}),[]),Je(()=>{if(S&&(R.current=S),E&&(I.current=E),S&&E){if(k.current)return k.current(S,E,q);q()}},[S,E,q,k,B]);const H=A.useMemo(()=>({reference:R,floating:I,setReference:v,setFloating:P}),[v,P]),j=A.useMemo(()=>({reference:S,floating:E}),[S,E]),L=A.useMemo(()=>{const D={position:n,left:0,top:0};if(!j.floating)return D;const N=yn(j.floating,x.x),ee=yn(j.floating,x.y);return s?{...D,transform:"translate("+N+"px, "+ee+"px)",...Ao(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:ee}},[n,s,j.floating,x.x,x.y]);return A.useMemo(()=>({...x,update:q,refs:H,elements:j,floatingStyles:L}),[x,q,H,j,L])}/*!
|
|
170
170
|
* tabbable 6.2.0
|
|
171
171
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
172
|
-
*/var al=["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])"],Ot=al.join(","),To=typeof Element>"u",Ke=To?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,it=!To&&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},rt=function e(t,n){var o;n===void 0&&(n=!0);var i=t==null||(o=t.getAttribute)===null||o===void 0?void 0:o.call(t,"inert"),r=i===""||i==="true",l=r||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"},ul=function(t,n,o){if(rt(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(Ot));return n&&Ke.call(t,Ot)&&i.unshift(t),i=i.filter(o),i},dl=function e(t,n,o){for(var i=[],r=Array.from(t);r.length;){var l=r.shift();if(!rt(l,!1))if(l.tagName==="SLOT"){var s=l.assignedElements(),a=s.length?s:l.children,u=e(a,!0,o);o.flatten?i.push.apply(i,u):i.push({scopeParent:l,candidates:u})}else{var g=Ke.call(l,Ot);g&&o.filter(l)&&(n||!t.includes(l))&&i.push(l);var h=l.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(l),b=!rt(h,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(l));if(h&&b){var p=e(h===!0?l.children:h.children,!0,o);o.flatten?i.push.apply(i,p):i.push({scopeParent:l,candidates:p})}else r.unshift.apply(r,l.children)}}return i},Ao=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Eo=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||cl(t))&&!Ao(t)?0:t.tabIndex},fl=function(t,n){var o=Eo(t);return o<0&&n&&!Ao(t)?0:o},pl=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Io=function(t){return t.tagName==="INPUT"},hl=function(t){return Io(t)&&t.type==="hidden"},ml=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(o){return o.tagName==="SUMMARY"});return n},yl=function(t,n){for(var o=0;o<t.length;o++)if(t[o].checked&&t[o].form===n)return t[o]},bl=function(t){if(!t.name)return!0;var n=t.form||it(t),o=function(s){return n.querySelectorAll('input[type="radio"][name="'+s+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=o(window.CSS.escape(t.name));else try{i=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 r=yl(i,t.form);return!r||r===t},gl=function(t){return Io(t)&&t.type==="radio"},xl=function(t){return gl(t)&&!bl(t)},Cl=function(t){var n,o=t&&it(t),i=(n=o)===null||n===void 0?void 0:n.host,r=!1;if(o&&o!==t){var l,s,a;for(r=!!((l=i)!==null&&l!==void 0&&(s=l.ownerDocument)!==null&&s!==void 0&&s.contains(i)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!r&&i;){var u,g,h;o=it(i),i=(u=o)===null||u===void 0?void 0:u.host,r=!!((g=i)!==null&&g!==void 0&&(h=g.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return r},bn=function(t){var n=t.getBoundingClientRect(),o=n.width,i=n.height;return o===0&&i===0},vl=function(t,n){var o=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var r=Ke.call(t,"details>summary:first-of-type"),l=r?t.parentElement:t;if(Ke.call(l,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="legacy-full"){if(typeof i=="function"){for(var s=t;t;){var a=t.parentElement,u=it(t);if(a&&!a.shadowRoot&&i(a)===!0)return bn(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=s}if(Cl(t))return!t.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return bn(t);return!1},wl=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 i=n.children.item(o);if(i.tagName==="LEGEND")return Ke.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},Sl=function(t,n){return!(n.disabled||rt(n)||hl(n)||vl(n,t)||ml(n)||wl(n))},gn=function(t,n){return!(xl(n)||Eo(n)<0||!Sl(t,n))},Tl=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Al=function e(t){var n=[],o=[];return t.forEach(function(i,r){var l=!!i.scopeParent,s=l?i.scopeParent:i,a=fl(s,l),u=l?e(i.candidates):s;a===0?l?n.push.apply(n,u):n.push(s):o.push({documentOrder:r,tabIndex:a,item:i,isScope:l,content:u})}),o.sort(pl).reduce(function(i,r){return r.isScope?i.push.apply(i,r.content):i.push(r.content),i},[]).concat(n)},_t=function(t,n){n=n||{};var o;return n.getShadowRoot?o=dl([t],n.includeContainer,{filter:gn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Tl}):o=ul(t,n.includeContainer,gn.bind(null,n)),Al(o)};function Qt(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 El=A["useInsertionEffect".toString()],Il=El||(e=>e());function Pe(e){const t=A.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Il(()=>{t.current=e}),A.useCallback(function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return t.current==null?void 0:t.current(...o)},[])}let xn=0;function Ce(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:o=!0,sync:i=!1}=t;o&&cancelAnimationFrame(xn);const r=()=>e==null?void 0:e.focus({preventScroll:n});i?r():xn=requestAnimationFrame(r)}var re=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 yt=!1,Rl=0;const Cn=()=>"floating-ui-"+Rl++;function Pl(){const[e,t]=A.useState(()=>yt?Cn():void 0);return re(()=>{e==null&&t(Cn())},[]),A.useEffect(()=>{yt||(yt=!0)},[]),e}const Vl=A["useId".toString()],pt=Vl||Pl,Dl=A.forwardRef(function(t,n){let{context:{placement:o,elements:{floating:i},middlewareData:{arrow:r}},width:l=14,height:s=7,tipRadius:a=0,strokeWidth:u=0,staticOffset:g,stroke:h,d:b,style:{transform:p,...m}={},...w}=t;process.env.NODE_ENV!=="production"&&(n||console.warn("Floating UI: The `ref` prop is required for the `FloatingArrow`","component."));const C=pt();if(!i)return null;u*=2;const y=u/2,x=l/2*(a/-8+1),P=s/2*a/4,[S,E]=o.split("-"),R=wo.isRTL(i),I=!!b,V=S==="top"||S==="bottom",L=g&&E==="end"?"bottom":"top";let k=g&&E==="end"?"right":"left";g&&R&&(k=E==="end"?"left":"right");const Y=(r==null?void 0:r.x)!=null?g||r.x:"",q=(r==null?void 0:r.y)!=null?g||r.y:"",U=b||"M0,0"+(" H"+l)+(" L"+(l-x)+","+(s-P))+(" Q"+l/2+","+s+" "+x+","+(s-P))+" Z",H={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[S];return A.createElement("svg",ke({},w,{"aria-hidden":!0,ref:n,width:I?l:l+u,height:l,viewBox:"0 0 "+l+" "+(s>l?s:l),style:{position:"absolute",pointerEvents:"none",[k]:Y,[L]:q,[S]:V||I?"100%":"calc(100% - "+u/2+"px)",transform:""+H+(p??""),...m}}),u>0&&A.createElement("path",{clipPath:"url(#"+C+")",fill:"none",stroke:h,strokeWidth:u+(b?0:1),d:U}),A.createElement("path",{stroke:u&&!b?w.fill:"none",d:U}),A.createElement("clipPath",{id:C},A.createElement("rect",{x:-y,y:y*(I?-1:1),width:l+u,height:l})))});function Ol(){const e=new Map;return{emit(t,n){var o;(o=e.get(t))==null||o.forEach(i=>i(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(i=>i!==n))||[])}}}const kl=A.createContext(null),jl=A.createContext(null),Fl=()=>{var e;return((e=A.useContext(kl))==null?void 0:e.id)||null},Yt=()=>A.useContext(jl);function ze(e){return"data-floating-ui-"+e}function bt(e){const t=T.useRef(e);return re(()=>{t.current=e}),t}function Nl(e,t){var n;let o=[],i=(n=e.find(r=>r.id===t))==null?void 0:n.parentId;for(;i;){const r=e.find(l=>l.id===i);i=r==null?void 0:r.parentId,r&&(o=o.concat(r))}return o}function Be(e,t){let n=e.filter(i=>{var r;return i.parentId===t&&((r=i.context)==null?void 0:r.open)}),o=n;for(;o.length;)o=e.filter(i=>{var r;return(r=o)==null?void 0:r.some(l=>{var s;return i.parentId===l.id&&((s=i.context)==null?void 0:s.open)})}),n=n.concat(o);return n}let Ee=new WeakMap,Ye=new WeakSet,Xe={},gt=0;const Ll=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,Ro=e=>e&&(e.host||Ro(e.parentNode)),Bl=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=Ro(n);return e.contains(o)?o:null}).filter(n=>n!=null);function Ml(e,t,n,o){const i="data-floating-ui-inert",r=o?"inert":n?"aria-hidden":null,l=Bl(t,e),s=new Set,a=new Set(l),u=[];Xe[i]||(Xe[i]=new WeakMap);const g=Xe[i];l.forEach(h),b(t),s.clear();function h(p){!p||s.has(p)||(s.add(p),p.parentNode&&h(p.parentNode))}function b(p){!p||a.has(p)||Array.prototype.forEach.call(p.children,m=>{if(s.has(m))b(m);else{const w=r?m.getAttribute(r):null,C=w!==null&&w!=="false",y=(Ee.get(m)||0)+1,x=(g.get(m)||0)+1;Ee.set(m,y),g.set(m,x),u.push(m),y===1&&C&&Ye.add(m),x===1&&m.setAttribute(i,""),!C&&r&&m.setAttribute(r,"true")}})}return gt++,()=>{u.forEach(p=>{const m=(Ee.get(p)||0)-1,w=(g.get(p)||0)-1;Ee.set(p,m),g.set(p,w),m||(!Ye.has(p)&&r&&p.removeAttribute(r),Ye.delete(p)),w||p.removeAttribute(i)}),gt--,gt||(Ee=new WeakMap,Ee=new WeakMap,Ye=new WeakSet,Xe={})}}function vn(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=de(e[0]).body;return Ml(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const Xt=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Po(e,t){const n=_t(e,Xt());t==="prev"&&n.reverse();const o=n.indexOf(Ie(de(e)));return n.slice(o+1)[0]}function Vo(){return Po(document.body,"next")}function Do(){return Po(document.body,"prev")}function Me(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!ne(n,o)}function $l(e){_t(e,Xt()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Kl(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 Gt={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 wn(e){e.key==="Tab"&&(e.target,clearTimeout(zl))}const lt=A.forwardRef(function(t,n){const[o,i]=A.useState();re(()=>(wr()&&i("button"),document.addEventListener("keydown",wn),()=>{document.removeEventListener("keydown",wn)}),[]);const r={ref:n,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[ze("focus-guard")]:"",style:Gt};return A.createElement("span",ke({},t,r))}),Oo=A.createContext(null),Sn=ze("portal");function Wl(e){let{id:t,root:n}=e===void 0?{}:e;const[o,i]=A.useState(null),r=pt(),l=jo(),s=A.useRef(null);return re(()=>()=>{o==null||o.remove(),queueMicrotask(()=>{s.current=null})},[o]),re(()=>{if(s.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(Sn,""),a.appendChild(u),s.current=u,i(u)},[t,r]),re(()=>{if(s.current)return;let a=n||(l==null?void 0:l.portalNode);a&&!X(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const g=document.createElement("div");g.id=r,g.setAttribute(Sn,""),a=u||a,a.appendChild(g),s.current=g,i(g)},[t,n,r,l]),o}function ko(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const r=Wl({id:n,root:o}),[l,s]=A.useState(null),a=A.useRef(null),u=A.useRef(null),g=A.useRef(null),h=A.useRef(null),b=!!l&&!l.modal&&l.open&&i&&!!(o||r);return A.useEffect(()=>{if(!r||!i||l!=null&&l.modal)return;function p(m){r&&Me(m)&&(m.type==="focusin"?Kl:$l)(r)}return r.addEventListener("focusin",p,!0),r.addEventListener("focusout",p,!0),()=>{r.removeEventListener("focusin",p,!0),r.removeEventListener("focusout",p,!0)}},[r,i,l==null?void 0:l.modal]),A.createElement(Oo.Provider,{value:A.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:g,afterInsideRef:h,portalNode:r,setFocusManagerState:s}),[i,r])},b&&r&&A.createElement(lt,{"data-type":"outside",ref:a,onFocus:p=>{if(Me(p,r)){var m;(m=g.current)==null||m.focus()}else{const w=Do()||(l==null?void 0:l.refs.domReference.current);w==null||w.focus()}}}),b&&r&&A.createElement("span",{"aria-owns":r.id,style:Gt}),r&&Xn.createPortal(t,r),b&&r&&A.createElement(lt,{"data-type":"outside",ref:u,onFocus:p=>{if(Me(p,r)){var m;(m=h.current)==null||m.focus()}else{const w=Vo()||(l==null?void 0:l.refs.domReference.current);w==null||w.focus(),l!=null&&l.closeOnFocusOut&&(l==null||l.onOpenChange(!1,p.nativeEvent))}}}))}const jo=()=>A.useContext(Oo),Tn=20;let ve=[];function xt(e){ve=ve.filter(t=>t.isConnected),e&&fe(e)!=="body"&&(ve.push(e),ve.length>Tn&&(ve=ve.slice(-Tn)))}function An(){return ve.slice().reverse().find(e=>e.isConnected)}const ql=A.forwardRef(function(t,n){return A.createElement("button",ke({},t,{type:"button",ref:n,tabIndex:-1,style:Gt}))});function Fo(e){const{context:t,children:n,disabled:o=!1,order:i=["content"],guards:r=!0,initialFocus:l=0,returnFocus:s=!0,modal:a=!0,visuallyHiddenDismiss:u=!1,closeOnFocusOut:g=!0}=e,{open:h,refs:b,nodeId:p,onOpenChange:m,events:w,dataRef:C,elements:{domReference:y,floating:x}}=t,P=typeof l=="number"&&l<0,S=Ir(y)&&P,E=Ll()?r:!0,R=bt(i),I=bt(l),V=bt(s),L=Yt(),k=jo(),Y=A.useRef(null),q=A.useRef(null),U=A.useRef(!1),H=A.useRef(!1),j=k!=null,B=A.useCallback(function(K){return K===void 0&&(K=x),K?_t(K,Xt()):[]},[x]),D=A.useCallback(K=>{const $=B(K);return R.current.map(M=>y&&M==="reference"?y:x&&M==="floating"?x:$).filter(Boolean).flat()},[y,x,R,B]);A.useEffect(()=>{if(o||!a)return;function K(M){if(M.key==="Tab"){ne(x,Ie(de(x)))&&B().length===0&&!S&&mt(M);const z=D(),_=Re(M);R.current[0]==="reference"&&_===y&&(mt(M),M.shiftKey?Ce(z[z.length-1]):Ce(z[1])),R.current[1]==="floating"&&_===x&&M.shiftKey&&(mt(M),Ce(z[0]))}}const $=de(x);return $.addEventListener("keydown",K),()=>{$.removeEventListener("keydown",K)}},[o,y,x,a,R,S,B,D]),A.useEffect(()=>{if(o||!g)return;function K(){H.current=!0,setTimeout(()=>{H.current=!1})}function $(M){const z=M.relatedTarget;queueMicrotask(()=>{const _=!(ne(y,z)||ne(x,z)||ne(z,x)||ne(k==null?void 0:k.portalNode,z)||z!=null&&z.hasAttribute(ze("focus-guard"))||L&&(Be(L.nodesRef.current,p).find(Q=>{var J,se;return ne((J=Q.context)==null?void 0:J.elements.floating,z)||ne((se=Q.context)==null?void 0:se.elements.domReference,z)})||Nl(L.nodesRef.current,p).find(Q=>{var J,se;return((J=Q.context)==null?void 0:J.elements.floating)===z||((se=Q.context)==null?void 0:se.elements.domReference)===z})));z&&_&&!H.current&&z!==An()&&(U.current=!0,m(!1,M))})}if(x&&te(y))return y.addEventListener("focusout",$),y.addEventListener("pointerdown",K),!a&&x.addEventListener("focusout",$),()=>{y.removeEventListener("focusout",$),y.removeEventListener("pointerdown",K),!a&&x.removeEventListener("focusout",$)}},[o,y,x,a,p,L,k,m,g]),A.useEffect(()=>{var K;if(o)return;const $=Array.from((k==null||(K=k.portalNode)==null?void 0:K.querySelectorAll("["+ze("portal")+"]"))||[]);if(x){const M=[x,...$,Y.current,q.current,R.current.includes("reference")||S?y:null].filter(_=>_!=null),z=a||S?vn(M,E,!E):vn(M);return()=>{z()}}},[o,y,x,a,R,k,S,E]),re(()=>{if(o||!x)return;const K=de(x),$=Ie(K);queueMicrotask(()=>{const M=D(x),z=I.current,_=(typeof z=="number"?M[z]:z.current)||x,Q=ne(x,$);!P&&!Q&&h&&Ce(_,{preventScroll:_===x})})},[o,h,x,P,D,I]),re(()=>{if(o||!x)return;let K=!1;const $=de(x),M=Ie($),z=C.current;xt(M);function _(Q){let{reason:J,event:se,nested:Le}=Q;J==="escape-key"&&b.domReference.current&&xt(b.domReference.current),J==="hover"&&se.type==="mouseleave"&&(U.current=!0),J==="outside-press"&&(Le?(U.current=!1,K=!0):U.current=!(Cr(se)||vr(se)))}return w.on("openchange",_),()=>{w.off("openchange",_);const Q=Ie($),J=ne(x,Q)||L&&Be(L.nodesRef.current,p).some(Ii=>{var nn;return ne((nn=Ii.context)==null?void 0:nn.elements.floating,Q)});(J||z.openEvent&&["click","mousedown"].includes(z.openEvent.type))&&b.domReference.current&&xt(b.domReference.current);const Le=An();V.current&&!U.current&&te(Le)&&(!(Le!==Q&&Q!==$.body)||J)&&Ce(Le,{cancelPrevious:!1,preventScroll:K})}},[o,x,V,C,b,w,L,p]),re(()=>{if(!(o||!k))return k.setFocusManagerState({modal:a,closeOnFocusOut:g,open:h,onOpenChange:m,refs:b}),()=>{k.setFocusManagerState(null)}},[o,k,a,h,m,b,g]),re(()=>{if(o||!x||typeof MutationObserver!="function"||P)return;const K=()=>{const M=x.getAttribute("tabindex");R.current.includes("floating")||Ie(de(x))!==b.domReference.current&&B().length===0?M!=="0"&&x.setAttribute("tabindex","0"):M!=="-1"&&x.setAttribute("tabindex","-1")};K();const $=new MutationObserver(K);return $.observe(x,{childList:!0,subtree:!0,attributes:!0}),()=>{$.disconnect()}},[o,x,b,R,B,P]);function N(K){return o||!u||!a?null:A.createElement(ql,{ref:K==="start"?Y:q,onClick:$=>m(!1,$.nativeEvent)},typeof u=="string"?u:"Dismiss")}const ee=!o&&E&&(j||a);return A.createElement(A.Fragment,null,ee&&A.createElement(lt,{"data-type":"inside",ref:k==null?void 0:k.beforeInsideRef,onFocus:K=>{if(a){const M=D();Ce(i[0]==="reference"?M[0]:M[M.length-1])}else if(k!=null&&k.preserveTabOrder&&k.portalNode)if(U.current=!1,Me(K,k.portalNode)){const M=Vo()||y;M==null||M.focus()}else{var $;($=k.beforeOutsideRef.current)==null||$.focus()}}}),!S&&N("start"),n,N("end"),ee&&A.createElement(lt,{"data-type":"inside",ref:k==null?void 0:k.afterInsideRef,onFocus:K=>{if(a)Ce(D()[0]);else if(k!=null&&k.preserveTabOrder&&k.portalNode)if(g&&(U.current=!0),Me(K,k.portalNode)){const M=Do()||y;M==null||M.focus()}else{var $;($=k.afterOutsideRef.current)==null||$.focus()}}}))}const Ct=new Set,No=A.forwardRef(function(t,n){let{lockScroll:o=!1,...i}=t;const r=pt();return re(()=>{if(!o)return;Ct.add(r);const l=/iP(hone|ad|od)|iOS/.test(co()),s=document.body.style,u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",g=window.innerWidth-document.documentElement.clientWidth,h=s.left?parseFloat(s.left):window.pageXOffset,b=s.top?parseFloat(s.top):window.pageYOffset;if(s.overflow="hidden",g&&(s[u]=g+"px"),l){var p,m;const w=((p=window.visualViewport)==null?void 0:p.offsetLeft)||0,C=((m=window.visualViewport)==null?void 0:m.offsetTop)||0;Object.assign(s,{position:"fixed",top:-(b-Math.floor(C))+"px",left:-(h-Math.floor(w))+"px",right:"0"})}return()=>{Ct.delete(r),Ct.size===0&&(Object.assign(s,{overflow:"",[u]:""}),l&&(Object.assign(s,{position:"",top:"",left:"",right:""}),window.scrollTo(h,b)))}},[r,o]),A.createElement("div",ke({ref:n},i,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...i.style}}))});function En(e){return te(e.target)&&e.target.tagName==="BUTTON"}function In(e){return fo(e)}function Lo(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,dataRef:i,elements:{domReference:r}}=e,{enabled:l=!0,event:s="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:g=!0}=t,h=A.useRef(),b=A.useRef(!1);return A.useMemo(()=>l?{reference:{onPointerDown(p){h.current=p.pointerType},onMouseDown(p){p.button===0&&(un(h.current,!0)&&u||s!=="click"&&(n&&a&&(!i.current.openEvent||i.current.openEvent.type==="mousedown")?o(!1,p.nativeEvent,"click"):(p.preventDefault(),o(!0,p.nativeEvent,"click"))))},onClick(p){if(s==="mousedown"&&h.current){h.current=void 0;return}un(h.current,!0)&&u||(n&&a&&(!i.current.openEvent||i.current.openEvent.type==="click")?o(!1,p.nativeEvent,"click"):o(!0,p.nativeEvent,"click"))},onKeyDown(p){h.current=void 0,!(p.defaultPrevented||!g||En(p))&&(p.key===" "&&!In(r)&&(p.preventDefault(),b.current=!0),p.key==="Enter"&&o(!(n&&a),p.nativeEvent,"click"))},onKeyUp(p){p.defaultPrevented||!g||En(p)||In(r)||p.key===" "&&b.current&&(b.current=!1,o(!(n&&a),p.nativeEvent,"click"))}}}:{},[l,i,s,u,g,r,a,n,o])}const Hl={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ul={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Rn=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 Bo(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,nodeId:i,elements:{reference:r,domReference:l,floating:s},dataRef:a}=e,{enabled:u=!0,escapeKey:g=!0,outsidePress:h=!0,outsidePressEvent:b="pointerdown",referencePress:p=!1,referencePressEvent:m="pointerdown",ancestorScroll:w=!1,bubbles:C,capture:y}=t,x=Yt(),P=Pe(typeof h=="function"?h:()=>!1),S=typeof h=="function"?P:h,E=A.useRef(!1),R=A.useRef(!1),{escapeKey:I,outsidePress:V}=Rn(C),{escapeKey:L,outsidePress:k}=Rn(y),Y=Pe(j=>{if(!n||!u||!g||j.key!=="Escape")return;const B=x?Be(x.nodesRef.current,i):[];if(!I&&(j.stopPropagation(),B.length>0)){let D=!0;if(B.forEach(N=>{var ee;if((ee=N.context)!=null&&ee.open&&!N.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}o(!1,Tr(j)?j.nativeEvent:j,"escape-key")}),q=Pe(j=>{var B;const D=()=>{var N;Y(j),(N=Re(j))==null||N.removeEventListener("keydown",D)};(B=Re(j))==null||B.addEventListener("keydown",D)}),U=Pe(j=>{const B=E.current;E.current=!1;const D=R.current;if(R.current=!1,b==="click"&&D||B||typeof S=="function"&&!S(j))return;const N=Re(j),ee="["+ze("inert")+"]",K=de(s).querySelectorAll(ee);let $=X(N)?N:null;for(;$&&!De($);){const _=Se($);if(De(_)||!X(_))break;$=_}if(K.length&&X(N)&&!Ar(N)&&!ne(N,s)&&Array.from(K).every(_=>!ne($,_)))return;if(te(N)&&s){const _=N.clientWidth>0&&N.scrollWidth>N.clientWidth,Q=N.clientHeight>0&&N.scrollHeight>N.clientHeight;let J=Q&&j.offsetX>N.clientWidth;if(Q&&ie(N).direction==="rtl"&&(J=j.offsetX<=N.offsetWidth-N.clientWidth),J||_&&j.offsetY>N.clientHeight)return}const M=x&&Be(x.nodesRef.current,i).some(_=>{var Q;return ht(j,(Q=_.context)==null?void 0:Q.elements.floating)});if(ht(j,s)||ht(j,l)||M)return;const z=x?Be(x.nodesRef.current,i):[];if(z.length>0){let _=!0;if(z.forEach(Q=>{var J;if((J=Q.context)!=null&&J.open&&!Q.context.dataRef.current.__outsidePressBubbles){_=!1;return}}),!_)return}o(!1,j,"outside-press")}),H=Pe(j=>{var B;const D=()=>{var N;U(j),(N=Re(j))==null||N.removeEventListener(b,D)};(B=Re(j))==null||B.addEventListener(b,D)});return A.useEffect(()=>{if(!n||!u)return;a.current.__escapeKeyBubbles=I,a.current.__outsidePressBubbles=V;function j(N){o(!1,N,"ancestor-scroll")}const B=de(s);g&&B.addEventListener("keydown",L?q:Y,L),S&&B.addEventListener(b,k?H:U,k);let D=[];return w&&(X(l)&&(D=be(l)),X(s)&&(D=D.concat(be(s))),!X(r)&&r&&r.contextElement&&(D=D.concat(be(r.contextElement)))),D=D.filter(N=>{var ee;return N!==((ee=B.defaultView)==null?void 0:ee.visualViewport)}),D.forEach(N=>{N.addEventListener("scroll",j,{passive:!0})}),()=>{g&&B.removeEventListener("keydown",L?q:Y,L),S&&B.removeEventListener(b,k?H:U,k),D.forEach(N=>{N.removeEventListener("scroll",j)})}},[a,s,l,r,g,S,b,n,o,w,u,I,V,Y,L,q,U,k,H]),A.useEffect(()=>{E.current=!1},[S,b]),A.useMemo(()=>u?{reference:{onKeyDown:Y,[Hl[m]]:j=>{p&&o(!1,j.nativeEvent,"reference-press")}},floating:{onKeyDown:Y,onMouseDown(){R.current=!0},onMouseUp(){R.current=!0},[Ul[b]]:()=>{E.current=!0}}}:{},[u,p,b,m,o,Y])}let kt;process.env.NODE_ENV!=="production"&&(kt=new Set);function Mo(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e;if(process.env.NODE_ENV!=="production"){var r;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((r=e.elements)!=null&&r.reference&&!X(e.elements.reference)){var l;if(!((l=kt)!=null&&l.has(V))){var s;(s=kt)==null||s.add(V),console.error(V)}}}const[a,u]=A.useState(null),g=((t=e.elements)==null?void 0:t.reference)||a,h=sl(e),b=Yt(),p=Fl()!=null,m=Pe((V,L,k)=>{V&&(C.current.openEvent=L),y.emit("openchange",{open:V,event:L,reason:k,nested:p}),o==null||o(V,L,k)}),w=A.useRef(null),C=A.useRef({}),y=A.useState(()=>Ol())[0],x=pt(),P=A.useCallback(V=>{const L=X(V)?{getBoundingClientRect:()=>V.getBoundingClientRect(),contextElement:V}:V;h.refs.setReference(L)},[h.refs]),S=A.useCallback(V=>{(X(V)||V===null)&&(w.current=V,u(V)),(X(h.refs.reference.current)||h.refs.reference.current===null||V!==null&&!X(V))&&h.refs.setReference(V)},[h.refs]),E=A.useMemo(()=>({...h.refs,setReference:S,setPositionReference:P,domReference:w}),[h.refs,S,P]),R=A.useMemo(()=>({...h.elements,domReference:g}),[h.elements,g]),I=A.useMemo(()=>({...h,refs:E,elements:R,dataRef:C,nodeId:i,floatingId:x,events:y,open:n,onOpenChange:m}),[h,i,x,y,n,m,E,R]);return re(()=>{const V=b==null?void 0:b.nodesRef.current.find(L=>L.id===i);V&&(V.context=I)}),A.useMemo(()=>({...h,context:I,refs:E,elements:R}),[h,E,R,I])}const Pn="active",Vn="selected";function vt(e,t,n){const o=new Map,i=n==="item";let r=e;if(i&&e){const{[Pn]:l,[Vn]:s,...a}=e;r=a}return{...n==="floating"&&{tabIndex:-1},...r,...t.map(l=>{const s=l?l[n]:null;return typeof s=="function"?e?s(e):null:s}).concat(e).reduce((l,s)=>(s&&Object.entries(s).forEach(a=>{let[u,g]=a;if(!(i&&[Pn,Vn].includes(u)))if(u.indexOf("on")===0){if(o.has(u)||o.set(u,[]),typeof g=="function"){var h;(h=o.get(u))==null||h.push(g),l[u]=function(){for(var b,p=arguments.length,m=new Array(p),w=0;w<p;w++)m[w]=arguments[w];return(b=o.get(u))==null?void 0:b.map(C=>C(...m)).find(C=>C!==void 0)}}}else l[u]=g}),l),{})}}function $o(e){e===void 0&&(e=[]);const t=e,n=A.useCallback(r=>vt(r,e,"reference"),t),o=A.useCallback(r=>vt(r,e,"floating"),t),i=A.useCallback(r=>vt(r,e,"item"),e.map(r=>r==null?void 0:r.item));return A.useMemo(()=>({getReferenceProps:n,getFloatingProps:o,getItemProps:i}),[n,o,i])}function _l(e={}){const{initialOpen:t=!1,open:n,onOpenChange:o}=e,[i,r]=A.useState(t),l=n??i,s=o??r,a=Mo({open:l,onOpenChange:s}),u=a.context,g=Lo(u,{enabled:n==null}),h=Bo(u,{outsidePressEvent:"mousedown"}),b=$o([g,h]);return A.useMemo(()=>({open:l,setOpen:s,...b,...a}),[l,s,b,a])}const Ko=A.createContext(null),zo=()=>{const e=A.useContext(Ko);if(e==null)throw new Error("Dialog components must be wrapped in <Dialog />");return e};function Ql({children:e,...t}){const n=_l(t);return d.jsx(Ko.Provider,{value:n,children:e})}const Wo=O.css`
|
|
172
|
+
*/var al=["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])"],jt=al.join(","),Eo=typeof Element>"u",ze=Eo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,rt=!Eo&&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},lt=function e(t,n){var o;n===void 0&&(n=!0);var i=t==null||(o=t.getAttribute)===null||o===void 0?void 0:o.call(t,"inert"),r=i===""||i==="true",l=r||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"},ul=function(t,n,o){if(lt(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(jt));return n&&ze.call(t,jt)&&i.unshift(t),i=i.filter(o),i},dl=function e(t,n,o){for(var i=[],r=Array.from(t);r.length;){var l=r.shift();if(!lt(l,!1))if(l.tagName==="SLOT"){var s=l.assignedElements(),a=s.length?s:l.children,u=e(a,!0,o);o.flatten?i.push.apply(i,u):i.push({scopeParent:l,candidates:u})}else{var x=ze.call(l,jt);x&&o.filter(l)&&(n||!t.includes(l))&&i.push(l);var h=l.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(l),y=!lt(h,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(l));if(h&&y){var d=e(h===!0?l.children:h.children,!0,o);o.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else r.unshift.apply(r,l.children)}}return i},Io=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Ro=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||cl(t))&&!Io(t)?0:t.tabIndex},fl=function(t,n){var o=Ro(t);return o<0&&n&&!Io(t)?0:o},pl=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Po=function(t){return t.tagName==="INPUT"},hl=function(t){return Po(t)&&t.type==="hidden"},ml=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(o){return o.tagName==="SUMMARY"});return n},yl=function(t,n){for(var o=0;o<t.length;o++)if(t[o].checked&&t[o].form===n)return t[o]},bl=function(t){if(!t.name)return!0;var n=t.form||rt(t),o=function(s){return n.querySelectorAll('input[type="radio"][name="'+s+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=o(window.CSS.escape(t.name));else try{i=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 r=yl(i,t.form);return!r||r===t},gl=function(t){return Po(t)&&t.type==="radio"},xl=function(t){return gl(t)&&!bl(t)},Cl=function(t){var n,o=t&&rt(t),i=(n=o)===null||n===void 0?void 0:n.host,r=!1;if(o&&o!==t){var l,s,a;for(r=!!((l=i)!==null&&l!==void 0&&(s=l.ownerDocument)!==null&&s!==void 0&&s.contains(i)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!r&&i;){var u,x,h;o=rt(i),i=(u=o)===null||u===void 0?void 0:u.host,r=!!((x=i)!==null&&x!==void 0&&(h=x.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return r},gn=function(t){var n=t.getBoundingClientRect(),o=n.width,i=n.height;return o===0&&i===0},vl=function(t,n){var o=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var r=ze.call(t,"details>summary:first-of-type"),l=r?t.parentElement:t;if(ze.call(l,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="legacy-full"){if(typeof i=="function"){for(var s=t;t;){var a=t.parentElement,u=rt(t);if(a&&!a.shadowRoot&&i(a)===!0)return gn(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=s}if(Cl(t))return!t.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return gn(t);return!1},wl=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 i=n.children.item(o);if(i.tagName==="LEGEND")return ze.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},Sl=function(t,n){return!(n.disabled||lt(n)||hl(n)||vl(n,t)||ml(n)||wl(n))},xn=function(t,n){return!(xl(n)||Ro(n)<0||!Sl(t,n))},Tl=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Al=function e(t){var n=[],o=[];return t.forEach(function(i,r){var l=!!i.scopeParent,s=l?i.scopeParent:i,a=fl(s,l),u=l?e(i.candidates):s;a===0?l?n.push.apply(n,u):n.push(s):o.push({documentOrder:r,tabIndex:a,item:i,isScope:l,content:u})}),o.sort(pl).reduce(function(i,r){return r.isScope?i.push.apply(i,r.content):i.push(r.content),i},[]).concat(n)},Qt=function(t,n){n=n||{};var o;return n.getShadowRoot?o=dl([t],n.includeContainer,{filter:xn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Tl}):o=ul(t,n.includeContainer,xn.bind(null,n)),Al(o)};function Yt(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 El=A["useInsertionEffect".toString()],Il=El||(e=>e());function Pe(e){const t=A.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Il(()=>{t.current=e}),A.useCallback(function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return t.current==null?void 0:t.current(...o)},[])}let Cn=0;function Ce(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:o=!0,sync:i=!1}=t;o&&cancelAnimationFrame(Cn);const r=()=>e==null?void 0:e.focus({preventScroll:n});i?r():Cn=requestAnimationFrame(r)}var le=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 gt=!1,Rl=0;const vn=()=>"floating-ui-"+Rl++;function Pl(){const[e,t]=A.useState(()=>gt?vn():void 0);return le(()=>{e==null&&t(vn())},[]),A.useEffect(()=>{gt||(gt=!0)},[]),e}const Vl=A["useId".toString()],ht=Vl||Pl,Dl=A.forwardRef(function(t,n){let{context:{placement:o,elements:{floating:i},middlewareData:{arrow:r}},width:l=14,height:s=7,tipRadius:a=0,strokeWidth:u=0,staticOffset:x,stroke:h,d:y,style:{transform:d,...b}={},...w}=t;process.env.NODE_ENV!=="production"&&(n||console.warn("Floating UI: The `ref` prop is required for the `FloatingArrow`","component."));const m=ht();if(!i)return null;u*=2;const g=u/2,v=l/2*(a/-8+1),P=s/2*a/4,[S,E]=o.split("-"),R=To.isRTL(i),I=!!y,V=S==="top"||S==="bottom",B=x&&E==="end"?"bottom":"top";let k=x&&E==="end"?"right":"left";x&&R&&(k=E==="end"?"left":"right");const Y=(r==null?void 0:r.x)!=null?x||r.x:"",q=(r==null?void 0:r.y)!=null?x||r.y:"",U=y||"M0,0"+(" H"+l)+(" L"+(l-v)+","+(s-P))+(" Q"+l/2+","+s+" "+v+","+(s-P))+" Z",H={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[S];return A.createElement("svg",ke({},w,{"aria-hidden":!0,ref:n,width:I?l:l+u,height:l,viewBox:"0 0 "+l+" "+(s>l?s:l),style:{position:"absolute",pointerEvents:"none",[k]:Y,[B]:q,[S]:V||I?"100%":"calc(100% - "+u/2+"px)",transform:""+H+(d??""),...b}}),u>0&&A.createElement("path",{clipPath:"url(#"+m+")",fill:"none",stroke:h,strokeWidth:u+(y?0:1),d:U}),A.createElement("path",{stroke:u&&!y?w.fill:"none",d:U}),A.createElement("clipPath",{id:m},A.createElement("rect",{x:-g,y:g*(I?-1:1),width:l+u,height:l})))});function Ol(){const e=new Map;return{emit(t,n){var o;(o=e.get(t))==null||o.forEach(i=>i(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(i=>i!==n))||[])}}}const kl=A.createContext(null),jl=A.createContext(null),Fl=()=>{var e;return((e=A.useContext(kl))==null?void 0:e.id)||null},Xt=()=>A.useContext(jl);function We(e){return"data-floating-ui-"+e}function xt(e){const t=T.useRef(e);return le(()=>{t.current=e}),t}function Nl(e,t){var n;let o=[],i=(n=e.find(r=>r.id===t))==null?void 0:n.parentId;for(;i;){const r=e.find(l=>l.id===i);i=r==null?void 0:r.parentId,r&&(o=o.concat(r))}return o}function Me(e,t){let n=e.filter(i=>{var r;return i.parentId===t&&((r=i.context)==null?void 0:r.open)}),o=n;for(;o.length;)o=e.filter(i=>{var r;return(r=o)==null?void 0:r.some(l=>{var s;return i.parentId===l.id&&((s=i.context)==null?void 0:s.open)})}),n=n.concat(o);return n}let Ee=new WeakMap,Xe=new WeakSet,Ge={},Ct=0;const Bl=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,Vo=e=>e&&(e.host||Vo(e.parentNode)),Ll=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=Vo(n);return e.contains(o)?o:null}).filter(n=>n!=null);function Ml(e,t,n,o){const i="data-floating-ui-inert",r=o?"inert":n?"aria-hidden":null,l=Ll(t,e),s=new Set,a=new Set(l),u=[];Ge[i]||(Ge[i]=new WeakMap);const x=Ge[i];l.forEach(h),y(t),s.clear();function h(d){!d||s.has(d)||(s.add(d),d.parentNode&&h(d.parentNode))}function y(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,b=>{if(s.has(b))y(b);else{const w=r?b.getAttribute(r):null,m=w!==null&&w!=="false",g=(Ee.get(b)||0)+1,v=(x.get(b)||0)+1;Ee.set(b,g),x.set(b,v),u.push(b),g===1&&m&&Xe.add(b),v===1&&b.setAttribute(i,""),!m&&r&&b.setAttribute(r,"true")}})}return Ct++,()=>{u.forEach(d=>{const b=(Ee.get(d)||0)-1,w=(x.get(d)||0)-1;Ee.set(d,b),x.set(d,w),b||(!Xe.has(d)&&r&&d.removeAttribute(r),Xe.delete(d)),w||d.removeAttribute(i)}),Ct--,Ct||(Ee=new WeakMap,Ee=new WeakMap,Xe=new WeakSet,Ge={})}}function wn(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=he(e[0]).body;return Ml(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const Gt=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Do(e,t){const n=Qt(e,Gt());t==="prev"&&n.reverse();const o=n.indexOf(Ie(he(e)));return n.slice(o+1)[0]}function Oo(){return Do(document.body,"next")}function ko(){return Do(document.body,"prev")}function $e(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!ne(n,o)}function $l(e){Qt(e,Gt()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Kl(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 Jt={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 Sn(e){e.key==="Tab"&&(e.target,clearTimeout(zl))}const st=A.forwardRef(function(t,n){const[o,i]=A.useState();le(()=>(wr()&&i("button"),document.addEventListener("keydown",Sn),()=>{document.removeEventListener("keydown",Sn)}),[]);const r={ref:n,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[We("focus-guard")]:"",style:Jt};return A.createElement("span",ke({},t,r))}),jo=A.createContext(null),Tn=We("portal");function Wl(e){let{id:t,root:n}=e===void 0?{}:e;const[o,i]=A.useState(null),r=ht(),l=No(),s=A.useRef(null);return le(()=>()=>{o==null||o.remove(),queueMicrotask(()=>{s.current=null})},[o]),le(()=>{if(s.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(Tn,""),a.appendChild(u),s.current=u,i(u)},[t,r]),le(()=>{if(s.current)return;let a=n||(l==null?void 0:l.portalNode);a&&!X(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const x=document.createElement("div");x.id=r,x.setAttribute(Tn,""),a=u||a,a.appendChild(x),s.current=x,i(x)},[t,n,r,l]),o}function Fo(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const r=Wl({id:n,root:o}),[l,s]=A.useState(null),a=A.useRef(null),u=A.useRef(null),x=A.useRef(null),h=A.useRef(null),y=!!l&&!l.modal&&l.open&&i&&!!(o||r);return A.useEffect(()=>{if(!r||!i||l!=null&&l.modal)return;function d(b){r&&$e(b)&&(b.type==="focusin"?Kl:$l)(r)}return r.addEventListener("focusin",d,!0),r.addEventListener("focusout",d,!0),()=>{r.removeEventListener("focusin",d,!0),r.removeEventListener("focusout",d,!0)}},[r,i,l==null?void 0:l.modal]),A.createElement(jo.Provider,{value:A.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:x,afterInsideRef:h,portalNode:r,setFocusManagerState:s}),[i,r])},y&&r&&A.createElement(st,{"data-type":"outside",ref:a,onFocus:d=>{if($e(d,r)){var b;(b=x.current)==null||b.focus()}else{const w=ko()||(l==null?void 0:l.refs.domReference.current);w==null||w.focus()}}}),y&&r&&A.createElement("span",{"aria-owns":r.id,style:Jt}),r&&Gn.createPortal(t,r),y&&r&&A.createElement(st,{"data-type":"outside",ref:u,onFocus:d=>{if($e(d,r)){var b;(b=h.current)==null||b.focus()}else{const w=Oo()||(l==null?void 0:l.refs.domReference.current);w==null||w.focus(),l!=null&&l.closeOnFocusOut&&(l==null||l.onOpenChange(!1,d.nativeEvent))}}}))}const No=()=>A.useContext(jo),An=20;let ve=[];function vt(e){ve=ve.filter(t=>t.isConnected),e&&me(e)!=="body"&&(ve.push(e),ve.length>An&&(ve=ve.slice(-An)))}function En(){return ve.slice().reverse().find(e=>e.isConnected)}const ql=A.forwardRef(function(t,n){return A.createElement("button",ke({},t,{type:"button",ref:n,tabIndex:-1,style:Jt}))});function Bo(e){const{context:t,children:n,disabled:o=!1,order:i=["content"],guards:r=!0,initialFocus:l=0,returnFocus:s=!0,modal:a=!0,visuallyHiddenDismiss:u=!1,closeOnFocusOut:x=!0}=e,{open:h,refs:y,nodeId:d,onOpenChange:b,events:w,dataRef:m,elements:{domReference:g,floating:v}}=t,P=typeof l=="number"&&l<0,S=Ir(g)&&P,E=Bl()?r:!0,R=xt(i),I=xt(l),V=xt(s),B=Xt(),k=No(),Y=A.useRef(null),q=A.useRef(null),U=A.useRef(!1),H=A.useRef(!1),j=k!=null,L=A.useCallback(function(K){return K===void 0&&(K=v),K?Qt(K,Gt()):[]},[v]),D=A.useCallback(K=>{const $=L(K);return R.current.map(M=>g&&M==="reference"?g:v&&M==="floating"?v:$).filter(Boolean).flat()},[g,v,R,L]);A.useEffect(()=>{if(o||!a)return;function K(M){if(M.key==="Tab"){ne(v,Ie(he(v)))&&L().length===0&&!S&&bt(M);const z=D(),_=Re(M);R.current[0]==="reference"&&_===g&&(bt(M),M.shiftKey?Ce(z[z.length-1]):Ce(z[1])),R.current[1]==="floating"&&_===v&&M.shiftKey&&(bt(M),Ce(z[0]))}}const $=he(v);return $.addEventListener("keydown",K),()=>{$.removeEventListener("keydown",K)}},[o,g,v,a,R,S,L,D]),A.useEffect(()=>{if(o||!x)return;function K(){H.current=!0,setTimeout(()=>{H.current=!1})}function $(M){const z=M.relatedTarget;queueMicrotask(()=>{const _=!(ne(g,z)||ne(v,z)||ne(z,v)||ne(k==null?void 0:k.portalNode,z)||z!=null&&z.hasAttribute(We("focus-guard"))||B&&(Me(B.nodesRef.current,d).find(Q=>{var Z,ce;return ne((Z=Q.context)==null?void 0:Z.elements.floating,z)||ne((ce=Q.context)==null?void 0:ce.elements.domReference,z)})||Nl(B.nodesRef.current,d).find(Q=>{var Z,ce;return((Z=Q.context)==null?void 0:Z.elements.floating)===z||((ce=Q.context)==null?void 0:ce.elements.domReference)===z})));z&&_&&!H.current&&z!==En()&&(U.current=!0,b(!1,M))})}if(v&&te(g))return g.addEventListener("focusout",$),g.addEventListener("pointerdown",K),!a&&v.addEventListener("focusout",$),()=>{g.removeEventListener("focusout",$),g.removeEventListener("pointerdown",K),!a&&v.removeEventListener("focusout",$)}},[o,g,v,a,d,B,k,b,x]),A.useEffect(()=>{var K;if(o)return;const $=Array.from((k==null||(K=k.portalNode)==null?void 0:K.querySelectorAll("["+We("portal")+"]"))||[]);if(v){const M=[v,...$,Y.current,q.current,R.current.includes("reference")||S?g:null].filter(_=>_!=null),z=a||S?wn(M,E,!E):wn(M);return()=>{z()}}},[o,g,v,a,R,k,S,E]),le(()=>{if(o||!v)return;const K=he(v),$=Ie(K);queueMicrotask(()=>{const M=D(v),z=I.current,_=(typeof z=="number"?M[z]:z.current)||v,Q=ne(v,$);!P&&!Q&&h&&Ce(_,{preventScroll:_===v})})},[o,h,v,P,D,I]),le(()=>{if(o||!v)return;let K=!1;const $=he(v),M=Ie($),z=m.current;vt(M);function _(Q){let{reason:Z,event:ce,nested:Le}=Q;Z==="escape-key"&&y.domReference.current&&vt(y.domReference.current),Z==="hover"&&ce.type==="mouseleave"&&(U.current=!0),Z==="outside-press"&&(Le?(U.current=!1,K=!0):U.current=!(Cr(ce)||vr(ce)))}return w.on("openchange",_),()=>{w.off("openchange",_);const Q=Ie($),Z=ne(v,Q)||B&&Me(B.nodesRef.current,d).some(Ri=>{var on;return ne((on=Ri.context)==null?void 0:on.elements.floating,Q)});(Z||z.openEvent&&["click","mousedown"].includes(z.openEvent.type))&&y.domReference.current&&vt(y.domReference.current);const Le=En();V.current&&!U.current&&te(Le)&&(!(Le!==Q&&Q!==$.body)||Z)&&Ce(Le,{cancelPrevious:!1,preventScroll:K})}},[o,v,V,m,y,w,B,d]),le(()=>{if(!(o||!k))return k.setFocusManagerState({modal:a,closeOnFocusOut:x,open:h,onOpenChange:b,refs:y}),()=>{k.setFocusManagerState(null)}},[o,k,a,h,b,y,x]),le(()=>{if(o||!v||typeof MutationObserver!="function"||P)return;const K=()=>{const M=v.getAttribute("tabindex");R.current.includes("floating")||Ie(he(v))!==y.domReference.current&&L().length===0?M!=="0"&&v.setAttribute("tabindex","0"):M!=="-1"&&v.setAttribute("tabindex","-1")};K();const $=new MutationObserver(K);return $.observe(v,{childList:!0,subtree:!0,attributes:!0}),()=>{$.disconnect()}},[o,v,y,R,L,P]);function N(K){return o||!u||!a?null:A.createElement(ql,{ref:K==="start"?Y:q,onClick:$=>b(!1,$.nativeEvent)},typeof u=="string"?u:"Dismiss")}const ee=!o&&E&&(j||a);return A.createElement(A.Fragment,null,ee&&A.createElement(st,{"data-type":"inside",ref:k==null?void 0:k.beforeInsideRef,onFocus:K=>{if(a){const M=D();Ce(i[0]==="reference"?M[0]:M[M.length-1])}else if(k!=null&&k.preserveTabOrder&&k.portalNode)if(U.current=!1,$e(K,k.portalNode)){const M=Oo()||g;M==null||M.focus()}else{var $;($=k.beforeOutsideRef.current)==null||$.focus()}}}),!S&&N("start"),n,N("end"),ee&&A.createElement(st,{"data-type":"inside",ref:k==null?void 0:k.afterInsideRef,onFocus:K=>{if(a)Ce(D()[0]);else if(k!=null&&k.preserveTabOrder&&k.portalNode)if(x&&(U.current=!0),$e(K,k.portalNode)){const M=ko()||g;M==null||M.focus()}else{var $;($=k.afterOutsideRef.current)==null||$.focus()}}}))}const wt=new Set,Lo=A.forwardRef(function(t,n){let{lockScroll:o=!1,...i}=t;const r=ht();return le(()=>{if(!o)return;wt.add(r);const l=/iP(hone|ad|od)|iOS/.test(fo()),s=document.body.style,u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",x=window.innerWidth-document.documentElement.clientWidth,h=s.left?parseFloat(s.left):window.pageXOffset,y=s.top?parseFloat(s.top):window.pageYOffset;if(s.overflow="hidden",x&&(s[u]=x+"px"),l){var d,b;const w=((d=window.visualViewport)==null?void 0:d.offsetLeft)||0,m=((b=window.visualViewport)==null?void 0:b.offsetTop)||0;Object.assign(s,{position:"fixed",top:-(y-Math.floor(m))+"px",left:-(h-Math.floor(w))+"px",right:"0"})}return()=>{wt.delete(r),wt.size===0&&(Object.assign(s,{overflow:"",[u]:""}),l&&(Object.assign(s,{position:"",top:"",left:"",right:""}),window.scrollTo(h,y)))}},[r,o]),A.createElement("div",ke({ref:n},i,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...i.style}}))});function In(e){return te(e.target)&&e.target.tagName==="BUTTON"}function Rn(e){return ho(e)}function Mo(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,dataRef:i,elements:{domReference:r}}=e,{enabled:l=!0,event:s="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:x=!0}=t,h=A.useRef(),y=A.useRef(!1);return A.useMemo(()=>l?{reference:{onPointerDown(d){h.current=d.pointerType},onMouseDown(d){d.button===0&&(dn(h.current,!0)&&u||s!=="click"&&(n&&a&&(!i.current.openEvent||i.current.openEvent.type==="mousedown")?o(!1,d.nativeEvent,"click"):(d.preventDefault(),o(!0,d.nativeEvent,"click"))))},onClick(d){if(s==="mousedown"&&h.current){h.current=void 0;return}dn(h.current,!0)&&u||(n&&a&&(!i.current.openEvent||i.current.openEvent.type==="click")?o(!1,d.nativeEvent,"click"):o(!0,d.nativeEvent,"click"))},onKeyDown(d){h.current=void 0,!(d.defaultPrevented||!x||In(d))&&(d.key===" "&&!Rn(r)&&(d.preventDefault(),y.current=!0),d.key==="Enter"&&o(!(n&&a),d.nativeEvent,"click"))},onKeyUp(d){d.defaultPrevented||!x||In(d)||Rn(r)||d.key===" "&&y.current&&(y.current=!1,o(!(n&&a),d.nativeEvent,"click"))}}}:{},[l,i,s,u,x,r,a,n,o])}const Hl={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ul={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Pn=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 $o(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,nodeId:i,elements:{reference:r,domReference:l,floating:s},dataRef:a}=e,{enabled:u=!0,escapeKey:x=!0,outsidePress:h=!0,outsidePressEvent:y="pointerdown",referencePress:d=!1,referencePressEvent:b="pointerdown",ancestorScroll:w=!1,bubbles:m,capture:g}=t,v=Xt(),P=Pe(typeof h=="function"?h:()=>!1),S=typeof h=="function"?P:h,E=A.useRef(!1),R=A.useRef(!1),{escapeKey:I,outsidePress:V}=Pn(m),{escapeKey:B,outsidePress:k}=Pn(g),Y=Pe(j=>{if(!n||!u||!x||j.key!=="Escape")return;const L=v?Me(v.nodesRef.current,i):[];if(!I&&(j.stopPropagation(),L.length>0)){let D=!0;if(L.forEach(N=>{var ee;if((ee=N.context)!=null&&ee.open&&!N.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}o(!1,Tr(j)?j.nativeEvent:j,"escape-key")}),q=Pe(j=>{var L;const D=()=>{var N;Y(j),(N=Re(j))==null||N.removeEventListener("keydown",D)};(L=Re(j))==null||L.addEventListener("keydown",D)}),U=Pe(j=>{const L=E.current;E.current=!1;const D=R.current;if(R.current=!1,y==="click"&&D||L||typeof S=="function"&&!S(j))return;const N=Re(j),ee="["+We("inert")+"]",K=he(s).querySelectorAll(ee);let $=X(N)?N:null;for(;$&&!De($);){const _=Se($);if(De(_)||!X(_))break;$=_}if(K.length&&X(N)&&!Ar(N)&&!ne(N,s)&&Array.from(K).every(_=>!ne($,_)))return;if(te(N)&&s){const _=N.clientWidth>0&&N.scrollWidth>N.clientWidth,Q=N.clientHeight>0&&N.scrollHeight>N.clientHeight;let Z=Q&&j.offsetX>N.clientWidth;if(Q&&ie(N).direction==="rtl"&&(Z=j.offsetX<=N.offsetWidth-N.clientWidth),Z||_&&j.offsetY>N.clientHeight)return}const M=v&&Me(v.nodesRef.current,i).some(_=>{var Q;return yt(j,(Q=_.context)==null?void 0:Q.elements.floating)});if(yt(j,s)||yt(j,l)||M)return;const z=v?Me(v.nodesRef.current,i):[];if(z.length>0){let _=!0;if(z.forEach(Q=>{var Z;if((Z=Q.context)!=null&&Z.open&&!Q.context.dataRef.current.__outsidePressBubbles){_=!1;return}}),!_)return}o(!1,j,"outside-press")}),H=Pe(j=>{var L;const D=()=>{var N;U(j),(N=Re(j))==null||N.removeEventListener(y,D)};(L=Re(j))==null||L.addEventListener(y,D)});return A.useEffect(()=>{if(!n||!u)return;a.current.__escapeKeyBubbles=I,a.current.__outsidePressBubbles=V;function j(N){o(!1,N,"ancestor-scroll")}const L=he(s);x&&L.addEventListener("keydown",B?q:Y,B),S&&L.addEventListener(y,k?H:U,k);let D=[];return w&&(X(l)&&(D=ge(l)),X(s)&&(D=D.concat(ge(s))),!X(r)&&r&&r.contextElement&&(D=D.concat(ge(r.contextElement)))),D=D.filter(N=>{var ee;return N!==((ee=L.defaultView)==null?void 0:ee.visualViewport)}),D.forEach(N=>{N.addEventListener("scroll",j,{passive:!0})}),()=>{x&&L.removeEventListener("keydown",B?q:Y,B),S&&L.removeEventListener(y,k?H:U,k),D.forEach(N=>{N.removeEventListener("scroll",j)})}},[a,s,l,r,x,S,y,n,o,w,u,I,V,Y,B,q,U,k,H]),A.useEffect(()=>{E.current=!1},[S,y]),A.useMemo(()=>u?{reference:{onKeyDown:Y,[Hl[b]]:j=>{d&&o(!1,j.nativeEvent,"reference-press")}},floating:{onKeyDown:Y,onMouseDown(){R.current=!0},onMouseUp(){R.current=!0},[Ul[y]]:()=>{E.current=!0}}}:{},[u,d,y,b,o,Y])}let Ft;process.env.NODE_ENV!=="production"&&(Ft=new Set);function Ko(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e;if(process.env.NODE_ENV!=="production"){var r;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((r=e.elements)!=null&&r.reference&&!X(e.elements.reference)){var l;if(!((l=Ft)!=null&&l.has(V))){var s;(s=Ft)==null||s.add(V),console.error(V)}}}const[a,u]=A.useState(null),x=((t=e.elements)==null?void 0:t.reference)||a,h=sl(e),y=Xt(),d=Fl()!=null,b=Pe((V,B,k)=>{V&&(m.current.openEvent=B),g.emit("openchange",{open:V,event:B,reason:k,nested:d}),o==null||o(V,B,k)}),w=A.useRef(null),m=A.useRef({}),g=A.useState(()=>Ol())[0],v=ht(),P=A.useCallback(V=>{const B=X(V)?{getBoundingClientRect:()=>V.getBoundingClientRect(),contextElement:V}:V;h.refs.setReference(B)},[h.refs]),S=A.useCallback(V=>{(X(V)||V===null)&&(w.current=V,u(V)),(X(h.refs.reference.current)||h.refs.reference.current===null||V!==null&&!X(V))&&h.refs.setReference(V)},[h.refs]),E=A.useMemo(()=>({...h.refs,setReference:S,setPositionReference:P,domReference:w}),[h.refs,S,P]),R=A.useMemo(()=>({...h.elements,domReference:x}),[h.elements,x]),I=A.useMemo(()=>({...h,refs:E,elements:R,dataRef:m,nodeId:i,floatingId:v,events:g,open:n,onOpenChange:b}),[h,i,v,g,n,b,E,R]);return le(()=>{const V=y==null?void 0:y.nodesRef.current.find(B=>B.id===i);V&&(V.context=I)}),A.useMemo(()=>({...h,context:I,refs:E,elements:R}),[h,E,R,I])}const Vn="active",Dn="selected";function St(e,t,n){const o=new Map,i=n==="item";let r=e;if(i&&e){const{[Vn]:l,[Dn]:s,...a}=e;r=a}return{...n==="floating"&&{tabIndex:-1},...r,...t.map(l=>{const s=l?l[n]:null;return typeof s=="function"?e?s(e):null:s}).concat(e).reduce((l,s)=>(s&&Object.entries(s).forEach(a=>{let[u,x]=a;if(!(i&&[Vn,Dn].includes(u)))if(u.indexOf("on")===0){if(o.has(u)||o.set(u,[]),typeof x=="function"){var h;(h=o.get(u))==null||h.push(x),l[u]=function(){for(var y,d=arguments.length,b=new Array(d),w=0;w<d;w++)b[w]=arguments[w];return(y=o.get(u))==null?void 0:y.map(m=>m(...b)).find(m=>m!==void 0)}}}else l[u]=x}),l),{})}}function zo(e){e===void 0&&(e=[]);const t=e,n=A.useCallback(r=>St(r,e,"reference"),t),o=A.useCallback(r=>St(r,e,"floating"),t),i=A.useCallback(r=>St(r,e,"item"),e.map(r=>r==null?void 0:r.item));return A.useMemo(()=>({getReferenceProps:n,getFloatingProps:o,getItemProps:i}),[n,o,i])}function _l(e={}){const{initialOpen:t=!1,open:n,onOpenChange:o}=e,[i,r]=A.useState(t),l=n??i,s=o??r,a=Ko({open:l,onOpenChange:s}),u=a.context,x=Mo(u,{enabled:n==null}),h=$o(u,{outsidePressEvent:"mousedown"}),y=zo([x,h]);return A.useMemo(()=>({open:l,setOpen:s,...y,...a}),[l,s,y,a])}const Wo=A.createContext(null),qo=()=>{const e=A.useContext(Wo);if(e==null)throw new Error("Dialog components must be wrapped in <Dialog />");return e};function Ql({children:e,...t}){const n=_l(t);return f.jsx(Wo.Provider,{value:n,children:e})}const Ho=O.css`
|
|
173
173
|
display: flex;
|
|
174
174
|
justify-content: center;
|
|
175
175
|
align-items: center;
|
|
176
176
|
z-index: 100;
|
|
177
177
|
padding: var(--space-md-fixed);
|
|
178
|
-
`,Yl=O(
|
|
179
|
-
${
|
|
180
|
-
`,Xl=T.forwardRef((e,t)=>{const{style:n,children:o,components:i,...r}=e,l=
|
|
178
|
+
`,Yl=O(Lo)`
|
|
179
|
+
${Ho};
|
|
180
|
+
`,Xl=T.forwardRef((e,t)=>{const{style:n,children:o,components:i,...r}=e,l=qo(),s=Yt([l.refs.setFloating,t]),a=(i==null?void 0:i.Overlay)??Yl;return f.jsx(Fo,{children:f.jsx(a,{lockScroll:!0,children:f.jsx(Bo,{context:l.context,children:f.jsx("div",{ref:s,...l.getFloatingProps(r),children:o})})})})}),Gl=Xl;function Uo(e){const t=T.useContext(Ke),[n,o]=T.useState(t);return f.jsx(Ke.Provider,{value:n,children:e.children})}const Jl=T.forwardRef((e,t)=>{const{setOpen:n}=qo();return f.jsx("button",{type:"button",...e,ref:t,onClick:o=>{var i;(i=e.onClick)==null||i.call(e,o),n(!1)}})}),Zl=Jl,es=O.span`
|
|
181
181
|
color: var(--color-explain-header-value-color);
|
|
182
182
|
overflow: hidden;
|
|
183
183
|
white-space: nowrap;
|
|
184
184
|
text-overflow: ellipsis;
|
|
185
|
-
`;function
|
|
185
|
+
`;function _o(e){const{explainQuestion:t}=ye(),{configurationSubjectTitle:n,componentDecisionStateIncludedLabel:o,componentDecisionStateExcludedLabel:i,booleanDecisionStateFalseLabel:r,booleanDecisionStateTrueLabel:l,isBlockedSuffix:s,isNotSatisfiedSuffix:a,generalConflictTitle:u}=Kt();if(!t)return f.jsx("div",{...e,children:u});const x=F.match(t).returnType().with({subject:c.ExplainQuestionSubject.configuration},()=>n).with({subject:c.ExplainQuestionSubject.attribute},y=>dt(y.attributeId)??y.attributeId.localId).with({subject:c.ExplainQuestionSubject.choiceValue},y=>qe(y.attributeId)[y.choiceValueId]??y.choiceValueId).with({subject:c.ExplainQuestionSubject.component,state:c.ComponentDecisionState.Included},()=>o).with({subject:c.ExplainQuestionSubject.component,state:c.ComponentDecisionState.Excluded},()=>i).with({subject:c.ExplainQuestionSubject.boolean,state:!0},()=>l).with({subject:c.ExplainQuestionSubject.boolean,state:!1},()=>r).with({subject:c.ExplainQuestionSubject.numeric},y=>y.state.toString()).exhaustive(),h=F.match(t).returnType().with({question:c.ExplainQuestionType.whyIsStateNotPossible},()=>s).with({question:c.ExplainQuestionType.whyIsNotSatisfied},()=>a).exhaustive();return f.jsxs("div",{...e,children:[f.jsx(es,{children:x})," ",h]})}const ts=O.div`
|
|
186
186
|
position: sticky;
|
|
187
187
|
top: 0;
|
|
188
188
|
transition: all 0.1s;
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
@media only screen and (min-resolution: 2dppx) {
|
|
197
197
|
border-top-width: 0.5px;
|
|
198
198
|
}
|
|
199
|
-
`;function ns(e){const[t,n]=T.useState(!1),o=T.useRef(null);return T.useEffect(()=>{const i=new IntersectionObserver(([l])=>n(!l.isIntersecting),{root:null,threshold:1}),r=o.current;return r&&i.observe(r),()=>{r&&i.unobserve(r)}},[]),
|
|
199
|
+
`;function ns(e){const[t,n]=T.useState(!1),o=T.useRef(null);return T.useEffect(()=>{const i=new IntersectionObserver(([l])=>n(!l.isIntersecting),{root:null,threshold:1}),r=o.current;return r&&i.observe(r),()=>{r&&i.unobserve(r)}},[]),f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:o}),f.jsx(ts,{...Jn(e,{className:Vi(t&&"active")})})]})}const os=O(p.motion.div)`
|
|
200
200
|
position: relative;
|
|
201
201
|
background-color: var(--color-explain-dialog-fill);
|
|
202
202
|
backdrop-filter: var(--backdrop-filter-explain-dialog);
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
outline: 2px solid var(--color-explain-dialog-close-button-outline);
|
|
240
240
|
outline-offset: 1px;
|
|
241
241
|
}
|
|
242
|
-
`,ss=O(
|
|
242
|
+
`,ss=O(_o)`
|
|
243
243
|
grid-area: header;
|
|
244
244
|
font-size: var(--text-md);
|
|
245
245
|
font-weight: 500;
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
text-overflow: ellipsis;
|
|
252
252
|
margin-right: var(--space-md);
|
|
253
253
|
margin-left: calc(var(--space-xs-fixed) + var(--space-sm-fixed));
|
|
254
|
-
`,as={initial:{opacity:0,scale:.5},open:{opacity:1,scale:1,transition:{type:"spring",stiffness:600,damping:40}},close:{opacity:0,scale:.7,transition:{duration:.1,ease:"cubicInOut"}}};function cs(e){return
|
|
254
|
+
`,as={initial:{opacity:0,scale:.5},open:{opacity:1,scale:1,transition:{type:"spring",stiffness:600,damping:40}},close:{opacity:0,scale:.7,transition:{duration:.1,ease:"cubicInOut"}}};function cs(e){return f.jsxs(os,{variants:as,initial:"initial",animate:"open",exit:"close",children:[f.jsx(ss,{}),f.jsxs(is,{children:[f.jsx(rs,{}),e.children]}),f.jsx(ls,{children:f.jsx(et.FontAwesomeIcon,{icon:Ze.faXmark})})]})}const us=O(Gl)`
|
|
255
255
|
--color-explain-attribute-value-fill: ${e=>e.attributeValueFill};
|
|
256
256
|
--color-explain-attribute-value-add-fill: ${e=>e.attributeValueAddFill};
|
|
257
257
|
--color-explain-attribute-value-add-color: ${e=>e.attributeValueAddColor};
|
|
@@ -273,9 +273,9 @@
|
|
|
273
273
|
&:focus {
|
|
274
274
|
outline: none;
|
|
275
275
|
}
|
|
276
|
-
`;function ds(e){const t=
|
|
277
|
-
${
|
|
278
|
-
`;function hs(e){return d.jsx(ps,{...e,initial:{backgroundColor:"rgba(0,0,0,0)"},animate:{backgroundColor:"rgba(0,0,0,0.1)"},exit:{backgroundColor:"rgba(0,0,0,0)"}})}function ms(e){const[t,n]=T.useState(null),{explain:o,applySolution:i}=W.useExplain(),r=T.useRef(null),l=T.useCallback(async(p,m,w,C)=>{const y=Vi.guid();r.current=y,n(null);try{const x=await p(),P=x,S=x,E=(P==null?void 0:P.decisionExplanations)??[],R=(S==null?void 0:S.constraintExplanations)??[];y==r.current&&n({controlId:C,displayMode:E.length===0&&R.length>0?"dialog":w,explainQuestion:m,hasError:!1,decisionExplanations:ys(E),constraintExplanations:R})}catch{y==r.current&&n({controlId:C,displayMode:w,explainQuestion:m,hasError:!0,decisionExplanations:null,constraintExplanations:null})}},[]),s=T.useCallback((p,m,w)=>{const C=typeof p=="function"?p(c.explainQuestionBuilder):p;return l(()=>e.explainConstraints?o(C,"full"):o(C,"decisions"),C,m,w)},[e.explainConstraints,o,l]),a=T.useCallback((p,m,w)=>l(()=>Promise.resolve(p),null,m,w),[l]),u=T.useCallback(()=>{n(null)},[]),g=T.useCallback(async p=>{await i(p),u()},[i,u]),h=T.useCallback(p=>{n(m=>m!=null?{...m,displayMode:p}:m)},[]),b=T.useMemo(()=>({process:t,applySolution:g,explain:s,handleExplainAnswer:a,dismiss:u,switchMode:h}),[t,g,s,a,u,h]);return d.jsx($e.Provider,{value:b,children:e.children})}function ys(e){const t=v.pipe(v.Bool.Ord,v.Ord.contramap(o=>o.solution==null)),n=v.pipe(v.Num.Ord,v.Ord.contramap(o=>o.causedByDecisions.length));return v.pipe(e,v.RA.sortBy([t,n]))}const je=new Map;function st(e){const{singletonId:t,children:n}=e,[o,i]=T.useState(!1),r=T.useRef({chose:()=>i(!0)});return T.useEffect(()=>(bs(t,r.current),()=>gs(t,r.current)),[]),o?d.jsx(d.Fragment,{children:n}):null}function bs(e,t){Cs(e).candidates.add(t),Uo(e)}function gs(e,t){let n=je.get(e);n!=null&&(n.candidates.delete(t),n.chosen===t&&(n.chosen=null),xs(e),Uo(e))}function Uo(e){let t=je.get(e);if(t==null||t.chosen!=null)return;const n=t.candidates.values().next().value;n!=null&&(t.chosen=n,n.chose())}function xs(e){let t=je.get(e);t==null||t.candidates.size>0||je.delete(e)}function Cs(e){let t=je.get(e);return t==null&&(t={chosen:null,candidates:new Set},je.set(e,t)),t}const le={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}},Dn={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"]}},vs={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:Dn}},attributes:{title:"Attribute",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...le,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:Dn}}}}},jsonDefinition:{title:"Definition – JSON",type:f.ControlType.String,displayTextArea:!0}}}};function ws(e,t){const n=[],o=(r,l)=>{const s=n.find(u=>e.equals(u.first,r)&&e.equals(u.second,l));if(s)return s.ordering;const a=t.compare(r,l);return n.push({first:r,second:l,ordering:a}),a},i=v.Ord.fromCompare(o);return{cachedOrderings:n,...i}}function Ss(){const e=[];return{getCache:(t,n)=>{const o=e.find(r=>r.eq===t&&r.ord===n);if(o)return o.ordCache;const i=ws(t,n);return e.push({eq:t,ord:n,ordCache:i}),i}}}const _o=v.Ord.getMonoid(),Ts=new Intl.Collator("en",{sensitivity:"base"}),As=new Intl.Collator("en",{sensitivity:"variant"}),Es={regex:".*",direction:"asc",mode:"string"},Is=v.pipe([Ts,As],v.RA.map(Fs),v.MO.concatAll(v.Ord.getMonoid())),Rs=v.pipe(v.Bool.Ord,v.Ord.contramap(e=>v.O.isSome(e))),Ps=v.Num.Ord;function Vs(e,t){return v.pipe((t==null?void 0:t.attributes)??[],v.RA.findFirst(n=>c.globalAttributeIdEquals(Z(n),e)),v.O.map(n=>[Ds(n.choiceValues??[]),On(n.rules??[])]),v.O.getOrElse(()=>[On((t==null?void 0:t.defaultRules)??[])]),v.RA.append(Qo(Es)),v.MO.concatAll(_o))}function Ds(e){return v.pipe(v.Num.Ord,v.Ord.reverse,v.O.getOrd,v.Ord.reverse,v.Ord.contramap(t=>v.pipe(e,v.RA.findIndex(n=>v.Str.Eq.equals(t,n)))))}function On(e){return v.pipe(e,v.RA.map(Qo),v.MO.concatAll(_o))}function Qo(e){const t=v.O.tryCatch(()=>new RegExp(e.regex)),n=F.match(e.mode).returnType().with("string",()=>Os(e.direction)).with("numeric",()=>ks(e.direction)).with("isMatch",()=>js(e.direction)).exhaustive();return v.pipe(n,v.Ord.contramap(o=>v.pipe(t,v.O.chainNullableK(i=>(i.lastIndex=0,i[Symbol.match](o))),v.O.chain(i=>v.pipe(i,v.RA.lookup(1),v.O.alt(()=>v.pipe(i,v.RA.lookup(0))))))))}function Os(e){return v.pipe(Is,Jt(e),Yo)}function ks(e){return v.pipe(Ps,Jt(e),Yo,v.Ord.contramap(v.O.chain(v.Num.parseFloatO)))}function js(e){return v.pipe(Rs,Jt(e))}function Yo(e){return v.pipe(e,v.Ord.reverse,v.O.getOrd,v.Ord.reverse)}function Jt(e){return t=>F.match(e).returnType().with("asc",()=>t).with("desc",()=>v.Ord.reverse(t)).exhaustive()}function Fs(e){return v.Ord.fromCompare((t,n)=>F.match(e.compare(t,n)).returnType().with(F.P.number.gt(0),()=>1).with(F.P.number.lt(0),()=>-1).otherwise(()=>0))}const Ns=Ss(),Xo=T.createContext(null);function at(e,t,n){const o=T.useContext(Xo),i=T.useMemo(()=>v.pipe(Vs(e,o),l=>Ns.getCache(v.Str.Eq,l),v.Ord.contramap(l=>v.pipe(t,v.RR.lookup(l.id),v.O.match(()=>l.id,s=>s)))),[t]),{attribute:r}=W.useChoiceAttribute(e);return v.pipe(n??(r==null?void 0:r.values)??[],v.RA.sort(i))}const Ls={localization:{title:"Localization",type:f.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:f.ControlType.String,displayTextArea:!0}}}},Go=ae(e=>{const{hcaBaseUrl:t,sessionCreation:n,accessToken:o,sessionCreateUrl:i,sessionDeleteUrl:r,deploymentName:l,channel:s,children:a,explainDialogProps:u,explainPopoverProps:g,explainConstraints:h}=e,{activeLocale:b}=f.useLocaleInfo(),p=b.code;if(T.useEffect(()=>{console.info("Current locale code:",p)},[p]),G())return d.jsxs(d.Fragment,{children:[a,d.jsx(st,{singletonId:"Configuration",children:d.jsx(on,{})})]});const w=T.useMemo(()=>c.createClient({hcaEngineBaseUrl:$i(t,"api","engine"),sessionHandler:F.match(n).with("client-side",()=>({accessToken:o})).with("server-side",()=>({sessionCreateUrl:i,sessionDeleteUrl:r})).exhaustive()}),[t,n,o,i,r]),C=T.useMemo(()=>{var P;return v.pipe(v.O.fromNullable((P=e.attributeRelations)==null?void 0:P.jsonDefinition),v.O.filter(S=>S.length>0),v.O.map(S=>JSON.parse(S)),v.O.toNullable)},[e.attributeRelations]),y=T.useMemo(()=>{var P;return v.pipe(v.O.fromNullable((P=e.choiceValueSorting)==null?void 0:P.jsonDefinition),v.O.filter(S=>S.length>0),v.O.map(S=>JSON.parse(S)),v.O.orElse(()=>v.O.fromNullable(e.choiceValueSorting)),v.O.getOrElse(()=>({attributes:[],defaultRules:[]})))},[e.choiceValueSorting]),x=T.useMemo(()=>{var P;return v.pipe(v.O.fromNullable((P=e.localization)==null?void 0:P.jsonDefinition),v.O.filter(S=>S.length>0),v.O.map(S=>JSON.parse(S)),v.O.getOrElse(()=>({attributes:[],choiceValues:[]})))},[e.localization]);return d.jsxs(d.Fragment,{children:[d.jsxs(W.Configuration,{configuratorClient:w,configurationModelSource:{type:c.ConfigurationModelSourceType.Channel,channel:s,deploymentName:l},attributeRelations:C,allowedInExplain:{rules:{type:c.AllowedRulesInExplainType.all}},children:[d.jsx(Ki,{...e}),d.jsx(T.Suspense,{children:d.jsx(W.ConfigurationSuspender,{children:d.jsx(ct.Provider,{value:x,children:d.jsxs(ms,{explainConstraints:h,children:[d.jsx(Nt.Provider,{value:g,children:d.jsx(Xo.Provider,{value:y,children:a})}),d.jsx(ds,{...u})]})})})})]}),d.jsx(st,{singletonId:"Configuration",children:d.jsx(on,{})})]})}),Bs=Go;f.addPropertyControls(Go,{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:Gi,buttonTitle:"Props…"},explainPopoverProps:{title:"Explain Popover",type:f.ControlType.Object,optional:!1,controls:Xi,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}}},...vs,...Ls});const Jo={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}},Ms=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}),$s={radius:{title:"Radius",type:f.ControlType.Number,defaultValue:6},...Jo,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}}}},Ks=e=>{var t,n,o,i,r,l,s,a,u,g,h,b,p;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:(i=e.border)==null?void 0:i.width,borderRightWidth:(r=e.border)!=null&&r.isMixedWidth?(l=e.border)==null?void 0:l.widthRight:(s=e.border)==null?void 0:s.width,borderBottomWidth:(a=e.border)!=null&&a.isMixedWidth?(u=e.border)==null?void 0:u.widthBottom:(g=e.border)==null?void 0:g.width,borderLeftWidth:(h=e.border)!=null&&h.isMixedWidth?(b=e.border)==null?void 0:b.widthLeft:(p=e.border)==null?void 0:p.width}},zs={fill:{title:"Fill",type:f.ControlType.Color,defaultValue:"#EBEBEB"},...Jo,...$s},Ws=e=>({...Ms(e),...Ks(e),backgroundColor:e.fill}),qs={color:{title:"Color",type:f.ControlType.Color,defaultValue:"black"},fontSize:{title:"Font size",type:f.ControlType.Number,defaultValue:16}},Hs=e=>({color:e.color,fontSize:e.fontSize}),Ne={explain:{title:"Explain",type:f.ControlType.Enum,defaultValue:"popover",options:["popover","dialog","disabled"]}},jt={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}}},Zo={...le,...qs,...zs,implicitLabelPrefix:{title:"Implicit Label Prefix",type:f.ControlType.String,defaultValue:"Implicit: "},unsatisfiedColors:{...jt,title:"Unsatisfied Colors"},implicitSelectedColors:{...jt,title:"Implicit Selected Colors"},...Ne},Ft=(e,t,n)=>{var r,l,s,a,u,g;const o=Ws(e),i=Hs(e);return{...o,...i,backgroundColor:F.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedFill:(r=e.unsatisfiedColors)==null?void 0:r.fill,implicitSelectedFill:(l=e.implicitSelectedColors)==null?void 0:l.fill}).with({isSatisfied:!1,unsatisfiedFill:F.P.string.minLength(1)},h=>h.unsatisfiedFill).with({isImplicitSelected:!0,implicitSelectedFill:F.P.string.minLength(1)},h=>h.implicitSelectedFill).otherwise(()=>o.backgroundColor),borderColor:F.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedBorderColor:(s=e.unsatisfiedColors)==null?void 0:s.borderColor,implicitSelectedBorderColor:(a=e.implicitSelectedColors)==null?void 0:a.borderColor}).with({isSatisfied:!1,unsatisfiedBorderColor:F.P.string.minLength(1)},h=>h.unsatisfiedBorderColor).with({isImplicitSelected:!0,implicitSelectedBorderColor:F.P.string.minLength(1)},h=>h.implicitSelectedBorderColor).otherwise(()=>o.borderColor),color:F.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedColor:(u=e.unsatisfiedColors)==null?void 0:u.color,implicitSelectedColor:(g=e.implicitSelectedColors)==null?void 0:g.color}).with({isSatisfied:!1,unsatisfiedColor:F.P.string.minLength(1)},h=>h.unsatisfiedColor).with({isImplicitSelected:!0,implicitSelectedColor:F.P.string.minLength(1)},h=>h.implicitSelectedColor).otherwise(()=>i.color),...e.style}},Zt={...Zo,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"]},textAlign:{title:"Text Align",type:f.ControlType.Enum,defaultValue:"initial",options:["initial","start","center","end"]}},Fe=(e,t,n)=>({...Ft(e,t,n),appearance:e.appearance,textAlign:e.textAlign});function he(){const{explain:e,handleExplainAnswer:t}=T.useContext($e);return{explain:e,handleExplainAnswer:t}}function Us(e={}){const{initialOpen:t=!1,placement:n="top",modal:o=!1,open:i,onOpenChange:r,arrow:l}=e,[s,a]=T.useState(t),u=i??s,g=r??a,h=Mo({placement:n,open:u,onOpenChange:g,whileElementsMounted:nl,middleware:[Mr(((l==null?void 0:l.height)??0)+5),il({crossAxis:n.includes("-"),fallbackAxisSideDirection:"end",padding:5}),ol({padding:5}),...l?[ll(l)]:[]]}),b=h.context,p=Lo(b,{enabled:i==null}),m=Bo(b),w=$o([p,m]);return T.useMemo(()=>({open:u,setOpen:g,...w,...h,modal:o,arrow:l}),[u,g,w,h,o,l])}const ei=T.createContext(null),Ue=()=>{const e=T.useContext(ei);if(e==null)throw new Error("Popover components must be wrapped in <Popover />");return e};function _s({children:e,...t}){const n=Us(t);return d.jsx(ei.Provider,{value:n,children:e})}const Qs=T.forwardRef(function(t,n){const o=T.Children.toArray(t.children)[0],i=Ue(),r=t.children.ref,l=Qt([i.refs.setReference,n,r]);return T.isValidElement(o)?T.cloneElement(o,i.getReferenceProps({ref:l,...t,...o.props,"data-state":i.open?"open":"closed"})):d.jsx("span",{children:"Not valid children for PopoverTrigger"})}),Ys=Qs,Xs=O.div`
|
|
276
|
+
`;function ds(e){const t=ye(),n=(t==null?void 0:t.displayMode)==="dialog";return f.jsx(Ql,{open:n,onOpenChange:o=>!o&&n&&(t==null?void 0:t.dismiss()),children:f.jsx(fs,{...e,isOpen:n,children:T.Children.toArray(e.content)[0]??f.jsx(cs,{children:f.jsx(gr,{})})})})}function fs(e){return f.jsx(p.AnimatePresence,{initial:!1,children:e.isOpen&&f.jsx($t.Provider,{value:e,children:f.jsx(us,{...e,components:{Overlay:hs},children:f.jsx(Uo,{children:e.children})})})})}const ps=O(p.motion(Lo))`
|
|
277
|
+
${Ho}
|
|
278
|
+
`;function hs(e){return f.jsx(ps,{...e,initial:{backgroundColor:"rgba(0,0,0,0)"},animate:{backgroundColor:"rgba(0,0,0,0.1)"},exit:{backgroundColor:"rgba(0,0,0,0)"}})}function ms(e){const[t,n]=T.useState(null),{explain:o,applySolution:i}=W.useExplain(),r=T.useRef(null),l=T.useCallback(async(d,b,w,m)=>{const g=Di.guid();r.current=g,n(null);try{const v=await d(),P=v,S=v,E=(P==null?void 0:P.decisionExplanations)??[],R=(S==null?void 0:S.constraintExplanations)??[];g==r.current&&n({controlId:m,displayMode:E.length===0&&R.length>0?"dialog":w,explainQuestion:b,hasError:!1,decisionExplanations:ys(E),constraintExplanations:R})}catch{g==r.current&&n({controlId:m,displayMode:w,explainQuestion:b,hasError:!0,decisionExplanations:null,constraintExplanations:null})}},[]),s=T.useCallback((d,b,w)=>{const m=typeof d=="function"?d(c.explainQuestionBuilder):d;return l(()=>e.explainConstraints?o(m,"full"):o(m,"decisions"),m,b,w)},[e.explainConstraints,o,l]),a=T.useCallback((d,b,w)=>l(()=>Promise.resolve(d),null,b,w),[l]),u=T.useCallback(()=>{n(null)},[]),x=T.useCallback(async d=>{await i(d),u()},[i,u]),h=T.useCallback(d=>{n(b=>b!=null?{...b,displayMode:d}:b)},[]),y=T.useMemo(()=>({process:t,applySolution:x,explain:s,handleExplainAnswer:a,dismiss:u,switchMode:h}),[t,x,s,a,u,h]);return f.jsx(Ke.Provider,{value:y,children:e.children})}function ys(e){const t=C.pipe(C.Bool.Ord,C.Ord.contramap(o=>o.solution==null)),n=C.pipe(C.Num.Ord,C.Ord.contramap(o=>o.causedByDecisions.length));return C.pipe(e,C.RA.sortBy([t,n]))}const je=new Map;function at(e){const{singletonId:t,children:n}=e,[o,i]=T.useState(!1),r=T.useRef({chose:()=>i(!0)});return T.useEffect(()=>(bs(t,r.current),()=>gs(t,r.current)),[]),o?f.jsx(f.Fragment,{children:n}):null}function bs(e,t){Cs(e).candidates.add(t),Qo(e)}function gs(e,t){let n=je.get(e);n!=null&&(n.candidates.delete(t),n.chosen===t&&(n.chosen=null),xs(e),Qo(e))}function Qo(e){let t=je.get(e);if(t==null||t.chosen!=null)return;const n=t.candidates.values().next().value;n!=null&&(t.chosen=n,n.chose())}function xs(e){let t=je.get(e);t==null||t.candidates.size>0||je.delete(e)}function Cs(e){let t=je.get(e);return t==null&&(t={chosen:null,candidates:new Set},je.set(e,t)),t}const re={attributeId:{title:"Attribute Id",type:p.ControlType.String},componentPath:{title:"Component Path",type:p.ControlType.String},sharedConfigurationModel:{title:"Shared Configuration Model",type:p.ControlType.String}},On={description:{title:"Description",type:p.ControlType.String},regex:{title:"Regex",type:p.ControlType.String},direction:{title:"Direction",type:p.ControlType.Enum,defaultValue:"asc",options:["asc","desc"],displaySegmentedControl:!0},mode:{title:"Mode",type:p.ControlType.Enum,defaultValue:"isMatch",options:["isMatch","string","numeric"]}},vs={choiceValueSorting:{title:"Choice Value Sorting",type:p.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{defaultRules:{title:"Default Rules",type:p.ControlType.Array,control:{type:p.ControlType.Object,controls:On}},attributes:{title:"Attribute",type:p.ControlType.Array,control:{type:p.ControlType.Object,controls:{...re,choiceValues:{title:"Choice Values",type:p.ControlType.Array,control:{type:p.ControlType.String}},rules:{title:"Rules",type:p.ControlType.Array,control:{type:p.ControlType.Object,controls:On}}}}},jsonDefinition:{title:"Definition – JSON",type:p.ControlType.String,displayTextArea:!0}}}};function ws(e,t){const n=[],o=(r,l)=>{const s=n.find(u=>e.equals(u.first,r)&&e.equals(u.second,l));if(s)return s.ordering;const a=t.compare(r,l);return n.push({first:r,second:l,ordering:a}),a},i=C.Ord.fromCompare(o);return{cachedOrderings:n,...i}}function Ss(){const e=[];return{getCache:(t,n)=>{const o=e.find(r=>r.eq===t&&r.ord===n);if(o)return o.ordCache;const i=ws(t,n);return e.push({eq:t,ord:n,ordCache:i}),i}}}const Yo=C.Ord.getMonoid(),Ts=new Intl.Collator("en",{sensitivity:"base"}),As=new Intl.Collator("en",{sensitivity:"variant"}),Es={regex:".*",direction:"asc",mode:"string"},Is=C.pipe([Ts,As],C.RA.map(Fs),C.MO.concatAll(C.Ord.getMonoid())),Rs=C.pipe(C.Bool.Ord,C.Ord.contramap(e=>C.O.isSome(e))),Ps=C.Num.Ord;function Vs(e,t){return C.pipe((t==null?void 0:t.attributes)??[],C.RA.findFirst(n=>c.globalAttributeIdEquals(J(n),e)),C.O.map(n=>[Ds(n.choiceValues??[]),kn(n.rules??[])]),C.O.getOrElse(()=>[kn((t==null?void 0:t.defaultRules)??[])]),C.RA.append(Xo(Es)),C.MO.concatAll(Yo))}function Ds(e){return C.pipe(C.Num.Ord,C.Ord.reverse,C.O.getOrd,C.Ord.reverse,C.Ord.contramap(t=>C.pipe(e,C.RA.findIndex(n=>C.Str.Eq.equals(t,n)))))}function kn(e){return C.pipe(e,C.RA.map(Xo),C.MO.concatAll(Yo))}function Xo(e){const t=C.O.tryCatch(()=>new RegExp(e.regex)),n=F.match(e.mode).returnType().with("string",()=>Os(e.direction)).with("numeric",()=>ks(e.direction)).with("isMatch",()=>js(e.direction)).exhaustive();return C.pipe(n,C.Ord.contramap(o=>C.pipe(t,C.O.chainNullableK(i=>(i.lastIndex=0,i[Symbol.match](o))),C.O.chain(i=>C.pipe(i,C.RA.lookup(1),C.O.alt(()=>C.pipe(i,C.RA.lookup(0))))))))}function Os(e){return C.pipe(Is,Zt(e),Go)}function ks(e){return C.pipe(Ps,Zt(e),Go,C.Ord.contramap(C.O.chain(C.Num.parseFloatO)))}function js(e){return C.pipe(Rs,Zt(e))}function Go(e){return C.pipe(e,C.Ord.reverse,C.O.getOrd,C.Ord.reverse)}function Zt(e){return t=>F.match(e).returnType().with("asc",()=>t).with("desc",()=>C.Ord.reverse(t)).exhaustive()}function Fs(e){return C.Ord.fromCompare((t,n)=>F.match(e.compare(t,n)).returnType().with(F.P.number.gt(0),()=>1).with(F.P.number.lt(0),()=>-1).otherwise(()=>0))}const Ns=Ss(),Jo=T.createContext(null);function ct(e,t,n){const o=T.useContext(Jo),i=T.useMemo(()=>C.pipe(Vs(e,o),l=>Ns.getCache(C.Str.Eq,l),C.Ord.contramap(l=>C.pipe(t,C.RR.lookup(l.id),C.O.match(()=>l.id,s=>s)))),[t]),{attribute:r}=W.useChoiceAttribute(e);return C.pipe(n??(r==null?void 0:r.values)??[],C.RA.sort(i))}const Bs={localization:{title:"Localization",type:p.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:p.ControlType.String,displayTextArea:!0}}}},Zo=se(e=>{const{hcaBaseUrl:t,sessionCreation:n,accessToken:o,sessionCreateUrl:i,sessionDeleteUrl:r,deploymentName:l,channel:s,children:a,explainDialogProps:u,explainPopoverProps:x,explainConstraints:h}=e,{activeLocale:y}=p.useLocaleInfo(),d=y.code;if(T.useEffect(()=>{console.info("Current locale code:",d)},[d]),G())return f.jsxs(f.Fragment,{children:[a,f.jsx(at,{singletonId:"Configuration",children:f.jsx(rn,{})})]});const w=T.useMemo(()=>c.createClient({hcaEngineBaseUrl:Ki(t,"api","engine"),sessionHandler:F.match(n).with("client-side",()=>({accessToken:o})).with("server-side",()=>({sessionCreateUrl:i,sessionDeleteUrl:r})).exhaustive()}),[t,n,o,i,r]),m=T.useMemo(()=>{var P;return C.pipe(C.O.fromNullable((P=e.attributeRelations)==null?void 0:P.jsonDefinition),C.O.filter(S=>S.length>0),C.O.map(S=>JSON.parse(S)),C.O.toNullable)},[e.attributeRelations]),g=T.useMemo(()=>{var P;return C.pipe(C.O.fromNullable((P=e.choiceValueSorting)==null?void 0:P.jsonDefinition),C.O.filter(S=>S.length>0),C.O.map(S=>JSON.parse(S)),C.O.orElse(()=>C.O.fromNullable(e.choiceValueSorting)),C.O.getOrElse(()=>({attributes:[],defaultRules:[]})))},[e.choiceValueSorting]),v=T.useMemo(()=>{var P;return C.pipe(C.O.fromNullable((P=e.localization)==null?void 0:P.jsonDefinition),C.O.filter(S=>S.length>0),C.O.map(S=>JSON.parse(S)),C.O.getOrElse(()=>({attributes:[],choiceValues:[]})))},[e.localization]);return f.jsxs(f.Fragment,{children:[f.jsxs(W.Configuration,{configuratorClient:w,configurationModelSource:{type:c.ConfigurationModelSourceType.Channel,channel:s,deploymentName:l},attributeRelations:m,allowedInExplain:{rules:{type:c.AllowedRulesInExplainType.all}},children:[f.jsx(zi,{...e}),f.jsx(T.Suspense,{children:f.jsx(W.ConfigurationSuspender,{children:f.jsx(ut.Provider,{value:v,children:f.jsxs(ms,{explainConstraints:h,children:[f.jsx(Lt.Provider,{value:x,children:f.jsx(Jo.Provider,{value:g,children:a})}),f.jsx(ds,{...u})]})})})})]}),f.jsx(at,{singletonId:"Configuration",children:f.jsx(rn,{})})]})}),Ls=Zo;p.addPropertyControls(Zo,{children:{title:"Content",type:p.ControlType.ComponentInstance},channel:{type:p.ControlType.String,title:"Channel",defaultValue:"release"},deploymentName:{type:p.ControlType.String,title:"Deployment Name"},hcaBaseUrl:{title:"HCA Base URL",type:p.ControlType.String,defaultValue:"https://spc.cloud.ceventis.de/hca"},sessionCreation:{title:"Session Creation",type:p.ControlType.Enum,displaySegmentedControl:!0,segmentedControlDirection:"horizontal",defaultValue:"client-side",options:["client-side","server-side"]},accessToken:{title:"HCA Access Token",type:p.ControlType.String,obscured:!0,hidden:e=>e.sessionCreation!=="client-side"},sessionCreateUrl:{title:"Create Session URl",type:p.ControlType.String,hidden:e=>e.sessionCreation!=="server-side"},sessionDeleteUrl:{title:"Close Session URl",type:p.ControlType.String,hidden:e=>e.sessionCreation!=="server-side"},configurationModelNotFoundContent:{title:"Content – Configuration Model not found",type:p.ControlType.ComponentInstance},errorContent:{title:"Content – Error",type:p.ControlType.ComponentInstance},accessTokenInvalidContent:{title:"Content – HCA Access Token invalid",type:p.ControlType.ComponentInstance},accessTokenRestrictionContent:{title:"Content – HCA Access Token restriction",type:p.ControlType.ComponentInstance},explainDialogProps:{title:"Explain Dialog",type:p.ControlType.Object,optional:!1,controls:Ji,buttonTitle:"Props…"},explainPopoverProps:{title:"Explain Popover",type:p.ControlType.Object,optional:!1,controls:Gi,buttonTitle:"Props…"},explainConstraints:{title:"Explain Constraints",type:p.ControlType.Boolean,defaultValue:!1},attributeRelations:{title:"Attribute Relations",type:p.ControlType.Object,defaultValue:null,buttonTitle:"Definition…",controls:{jsonDefinition:{title:"Definition – JSON",type:p.ControlType.String,displayTextArea:!0}}},...vs,...Bs});const ei={padding:{type:p.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}},Ms=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}),$s={radius:{title:"Radius",type:p.ControlType.Number,defaultValue:6},...ei,border:{title:"Border",type:p.ControlType.Object,controls:{color:{type:p.ControlType.Color,title:"Color"},width:{type:p.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}}}},Ks=e=>{var t,n,o,i,r,l,s,a,u,x,h,y,d;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:(i=e.border)==null?void 0:i.width,borderRightWidth:(r=e.border)!=null&&r.isMixedWidth?(l=e.border)==null?void 0:l.widthRight:(s=e.border)==null?void 0:s.width,borderBottomWidth:(a=e.border)!=null&&a.isMixedWidth?(u=e.border)==null?void 0:u.widthBottom:(x=e.border)==null?void 0:x.width,borderLeftWidth:(h=e.border)!=null&&h.isMixedWidth?(y=e.border)==null?void 0:y.widthLeft:(d=e.border)==null?void 0:d.width}},zs={fill:{title:"Fill",type:p.ControlType.Color,defaultValue:"#EBEBEB"},...ei,...$s},Ws=e=>({...Ms(e),...Ks(e),backgroundColor:e.fill}),qs={color:{title:"Color",type:p.ControlType.Color,defaultValue:"black"},text:{title:"Text",type:p.ControlType.Font,controls:"basic",displayTextAlignment:!0,displayFontSize:!0}},Hs=e=>({...e.text,color:e.color}),Ne={explain:{title:"Explain",type:p.ControlType.Enum,defaultValue:"popover",options:["popover","dialog","disabled"]}},Nt={type:p.ControlType.Object,optional:!0,controls:{fill:{title:"Fill",type:p.ControlType.Color,optional:!0},color:{title:"Color",type:p.ControlType.Color,optional:!0},borderColor:{title:"Border Color",type:p.ControlType.Color,optional:!0}}},ti={...re,...qs,...zs,implicitLabelPrefix:{title:"Implicit Label Prefix",type:p.ControlType.String,defaultValue:"Implicit: "},unsatisfiedColors:{...Nt,title:"Unsatisfied Colors"},implicitSelectedColors:{...Nt,title:"Implicit Selected Colors"},...Ne},Bt=(e,t,n)=>{var r,l,s,a,u,x;const o=Ws(e),i=Hs(e);return{...o,...i,backgroundColor:F.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedFill:(r=e.unsatisfiedColors)==null?void 0:r.fill,implicitSelectedFill:(l=e.implicitSelectedColors)==null?void 0:l.fill}).with({isSatisfied:!1,unsatisfiedFill:F.P.string.minLength(1)},h=>h.unsatisfiedFill).with({isImplicitSelected:!0,implicitSelectedFill:F.P.string.minLength(1)},h=>h.implicitSelectedFill).otherwise(()=>o.backgroundColor),borderColor:F.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedBorderColor:(s=e.unsatisfiedColors)==null?void 0:s.borderColor,implicitSelectedBorderColor:(a=e.implicitSelectedColors)==null?void 0:a.borderColor}).with({isSatisfied:!1,unsatisfiedBorderColor:F.P.string.minLength(1)},h=>h.unsatisfiedBorderColor).with({isImplicitSelected:!0,implicitSelectedBorderColor:F.P.string.minLength(1)},h=>h.implicitSelectedBorderColor).otherwise(()=>o.borderColor),color:F.match({isSatisfied:t,isImplicitSelected:n,unsatisfiedColor:(u=e.unsatisfiedColors)==null?void 0:u.color,implicitSelectedColor:(x=e.implicitSelectedColors)==null?void 0:x.color}).with({isSatisfied:!1,unsatisfiedColor:F.P.string.minLength(1)},h=>h.unsatisfiedColor).with({isImplicitSelected:!0,implicitSelectedColor:F.P.string.minLength(1)},h=>h.implicitSelectedColor).otherwise(()=>i.color),...e.style}},en={...ti,resetLabel:{title:"Reset Label",type:p.ControlType.String,defaultValue:"Reset"},blockedLabel:{title:"Blocked Label",type:p.ControlType.String,defaultValue:"Blocked"},appearance:{title:"Appearance",type:p.ControlType.Enum,defaultValue:"auto",displaySegmentedControl:!0,segmentedControlDirection:"horizontal",options:["auto","none"]}},Fe=(e,t,n)=>({...Bt(e,t,n),appearance:e.appearance});function de(){const{explain:e,handleExplainAnswer:t}=T.useContext(Ke);return{explain:e,handleExplainAnswer:t}}function Us(e={}){const{initialOpen:t=!1,placement:n="top",modal:o=!1,open:i,onOpenChange:r,arrow:l}=e,[s,a]=T.useState(t),u=i??s,x=r??a,h=Ko({placement:n,open:u,onOpenChange:x,whileElementsMounted:nl,middleware:[Mr(((l==null?void 0:l.height)??0)+5),il({crossAxis:n.includes("-"),fallbackAxisSideDirection:"end",padding:5}),ol({padding:5}),...l?[ll(l)]:[]]}),y=h.context,d=Mo(y,{enabled:i==null}),b=$o(y),w=zo([d,b]);return T.useMemo(()=>({open:u,setOpen:x,...w,...h,modal:o,arrow:l}),[u,x,w,h,o,l])}const ni=T.createContext(null),Qe=()=>{const e=T.useContext(ni);if(e==null)throw new Error("Popover components must be wrapped in <Popover />");return e};function _s({children:e,...t}){const n=Us(t);return f.jsx(ni.Provider,{value:n,children:e})}const Qs=T.forwardRef(function(t,n){const o=T.Children.toArray(t.children)[0],i=Qe(),r=t.children.ref,l=Yt([i.refs.setReference,n,r]);return T.isValidElement(o)?T.cloneElement(o,i.getReferenceProps({ref:l,...t,...o.props,"data-state":i.open?"open":"closed"})):f.jsx("span",{children:"Not valid children for PopoverTrigger"})}),Ys=Qs,Xs=O.div`
|
|
279
279
|
display: flex;
|
|
280
280
|
justify-content: center;
|
|
281
281
|
|
|
@@ -301,11 +301,11 @@
|
|
|
301
301
|
outline: 2px solid var(--color-explain-popover-show-more-button-outline);
|
|
302
302
|
outline-offset: 1px;
|
|
303
303
|
}
|
|
304
|
-
`;function Js(){const{decisionExplanations:e,switchMode:t}=
|
|
304
|
+
`;function Js(){const{decisionExplanations:e,switchMode:t}=ye(),{showConstraintsButtonCaption:n,showMoreButtonCaption:o}=Mt(),i=e.length-1,r=T.useMemo(()=>i>0&&Oi.render(o,{amount:i}),[o,i]);return f.jsx(Xs,{children:f.jsxs(Gs,{onClick:()=>t("dialog"),children:[i>0&&f.jsx("span",{children:r}),i===0&&f.jsx("span",{children:n})]})})}const Zs=O.div`
|
|
305
305
|
font-weight: 500;
|
|
306
306
|
font-family: var(--font-heading);
|
|
307
307
|
margin-bottom: var(--space-xs);
|
|
308
|
-
`,
|
|
308
|
+
`,jn=O.div`
|
|
309
309
|
height: 1px;
|
|
310
310
|
background-color: var(--color-explain-popover-list-separator);
|
|
311
311
|
margin-left: -1.1em;
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
}
|
|
317
317
|
`,ea=O.div`
|
|
318
318
|
container: explain-actions / inline-size;
|
|
319
|
-
`,ta=O(
|
|
319
|
+
`,ta=O(ro)`
|
|
320
320
|
display: grid;
|
|
321
321
|
grid-template-columns: [name] minmax(100px, auto) [values] minmax(100px, 1fr);
|
|
322
322
|
gap: var(--space-sm);
|
|
@@ -326,7 +326,7 @@
|
|
|
326
326
|
margin-right: -1.1em;
|
|
327
327
|
overflow: auto;
|
|
328
328
|
max-height: 200px;
|
|
329
|
-
`,na=O(
|
|
329
|
+
`,na=O(eo)`
|
|
330
330
|
border-radius: 360px;
|
|
331
331
|
background-color: var(--color-explain-popover-apply-solution-button-fill);
|
|
332
332
|
color: var(--color-explain-popover-apply-solution-button-color);
|
|
@@ -349,10 +349,10 @@
|
|
|
349
349
|
@container explain-actions (min-width: 300px) {
|
|
350
350
|
width: auto;
|
|
351
351
|
}
|
|
352
|
-
`,
|
|
352
|
+
`,Tt=O(so)`
|
|
353
353
|
width: min-content;
|
|
354
354
|
min-width: 300px;
|
|
355
|
-
`;function oa(){const{decisionExplanations:e,constraintExplanations:t,hasError:n}=
|
|
355
|
+
`;function oa(){const{decisionExplanations:e,constraintExplanations:t,hasError:n}=ye(),{solutionTitle:o,applySolutionButtonCaption:i}=Mt();if(n)return f.jsx(Tt,{variant:"failedToExplain"});const r=e[0];if(!r)return f.jsx(Tt,{variant:"noExplanationFound"});if(!r.solution)return f.jsx(Tt,{variant:"noSolutionFound"});const l=r.solution.decisions.filter(s=>s.state!=null);return f.jsxs(f.Fragment,{children:[f.jsx(Zs,{children:o}),f.jsx(jn,{}),f.jsx(ta,{blockingDecisions:r.causedByDecisions,desiredDecisions:l}),f.jsx(jn,{}),f.jsxs(ea,{children:[f.jsx(na,{explanation:r,children:i}),(e.length>1||t.length>0)&&f.jsx(Js,{})]})]})}const oi=T.createContext(null),ae=()=>T.useContext(oi);function tn(e){return T.forwardRef((t,n)=>{const o=T.useId();return f.jsx(oi.Provider,{value:o,children:f.jsx(e,{...t,ref:n})})})}const ia=T.forwardRef((e,t)=>{const{style:n,children:o,...i}=e,r=Qe(),l=Yt([r.refs.setFloating,t]);return f.jsx(Fo,{children:f.jsx(Bo,{context:r.context,modal:r.modal,children:f.jsx("div",{ref:l,style:{...r.floatingStyles,...n},...r.getFloatingProps(i),children:o})})})}),ra=ia,la=T.forwardRef((e,t)=>{const{setOpen:n}=Qe();return f.jsx("button",{type:"button",ref:t,...e,onClick:o=>{var i;(i=e.onClick)==null||i.call(e,o),n(!1)}})}),sa=la,aa=O.div`
|
|
356
356
|
position: relative;
|
|
357
357
|
background-color: var(--color-explain-popover-fill);
|
|
358
358
|
color: var(--color-explain-popover-color);
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
outline: 2px solid var(--color-explain-popover-close-button-outline);
|
|
379
379
|
outline-offset: 1px;
|
|
380
380
|
}
|
|
381
|
-
`,ua=O(
|
|
381
|
+
`,ua=O(_o)`
|
|
382
382
|
font-size: var(--text-md);
|
|
383
383
|
font-weight: 500;
|
|
384
384
|
font-family: var(--font-heading);
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
white-space: nowrap;
|
|
389
389
|
text-overflow: ellipsis;
|
|
390
390
|
margin-right: var(--space-md);
|
|
391
|
-
`;function da(e){return
|
|
391
|
+
`;function da(e){return f.jsxs(aa,{children:[f.jsx(ua,{}),e.children,f.jsx(ca,{children:f.jsx(et.FontAwesomeIcon,{icon:Ze.faXmark})})]})}const fa=O(ra)`
|
|
392
392
|
--color-explain-attribute-value-fill: ${e=>e.attributeValueFill};
|
|
393
393
|
--color-explain-attribute-value-add-fill: ${e=>e.attributeValueAddFill};
|
|
394
394
|
--color-explain-attribute-value-add-color: ${e=>e.attributeValueAddColor};
|
|
@@ -412,26 +412,26 @@
|
|
|
412
412
|
}
|
|
413
413
|
`,pa=O(Dl)`
|
|
414
414
|
fill: var(--color-explain-popover-fill);
|
|
415
|
-
`,ha={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 ma(e){const t=
|
|
415
|
+
`,ha={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 ma(e){const t=ye(),n=ae(),o=(t==null?void 0:t.displayMode)==="popover"&&(t==null?void 0:t.controlId)===n,i=T.useRef(null);return f.jsxs(_s,{open:o,onOpenChange:r=>!r&&o&&(t==null?void 0:t.dismiss()),arrow:{width:20,height:10,padding:10,element:i},children:[f.jsx(Ys,{children:e.children}),f.jsxs(ya,{isOpen:o,children:[T.Children.toArray(e.content)[0]??f.jsx(da,{children:f.jsx(oa,{})}),f.jsx(ba,{})]})]})}function ya(e){var y,d;const t=Mt(),{middlewareData:n,arrow:o,placement:i}=Qe(),r=((y=n.arrow)==null?void 0:y.x)??0,l=((d=n.arrow)==null?void 0:d.y)??0,s=(o==null?void 0:o.height)??0,a=(o==null?void 0:o.width)??0,u=r+a/2,x=l+s,h=F.match(i).with("top",()=>`${u}px calc(100% + ${s+5}px)`).with("bottom",()=>`${u}px ${-s-5}px`).with("left",()=>`calc(100% + ${s}px) ${x}px`).with("right",()=>`${-s}px ${x}px`).otherwise(()=>"");return f.jsx(p.AnimatePresence,{initial:!1,children:e.isOpen&&f.jsx(fa,{...t,children:f.jsx(p.motion.div,{variants:ha,initial:"initial",animate:"open",exit:"close",style:{transformOrigin:h},children:f.jsx(Uo,{children:e.children})})})})}function ba(){const{context:e,arrow:t}=Qe();return f.jsx(pa,{ref:t.element,context:e,width:t.width,height:t.height})}function ga(e){return T.forwardRef((t,n)=>{const o=G();return t.explain!=="popover"||o?f.jsx(e,{...t}):f.jsx(ma,{children:f.jsx(e,{...t,ref:n})})})}function fe(e){return se(tn(ga(T.forwardRef(e))))}function ue(){alert(`Failed to apply your selection.
|
|
416
416
|
Please check your internet connection and try again.`)}function xa(){alert(`Failed to reset your configuration.
|
|
417
|
-
Please check your internet connection and try again.`)}const
|
|
417
|
+
Please check your internet connection and try again.`)}const Fn=O.select`
|
|
418
418
|
color: inherit;
|
|
419
|
-
`,
|
|
419
|
+
`,Nn="<reset>",Bn="<nothing>",ii=fe((e,t)=>{if(G()){const I=Fe(e,!0,!1);return f.jsx(Fn,{style:I})}const o=ae(),i=J(e),r=W.useChoiceAttribute(i);if(!r)return f.jsx("span",{children:"Choice Attribute not found"});const{explain:l}=de(),s=qe(i),{attribute:a,makeDecision:u,clearDecisions:x}=r,h=ct(i,s,c.AttributeInterpreter.getAllowedChoiceValues(a)),y=ct(i,s,c.AttributeInterpreter.getBlockedChoiceValues(a)),d=c.AttributeInterpreter.isMultiSelect(a),b=c.AttributeInterpreter.getSelectedChoiceValues(a),w=b.map(I=>I.id),m=w[0]??Bn,g=b.some(I=>{var V;return((V=I.decision)==null?void 0:V.kind)===c.DecisionKind.Explicit}),v=w.length>=1,P=b.some(I=>{var V;return((V=I.decision)==null?void 0:V.kind)===c.DecisionKind.Implicit}),S=h.length===0,E=async I=>{if(I===Nn)try{await x()}catch{ue()}else if(h.some(V=>V.id===I)){const V=w.some(B=>B===I)?void 0:c.ChoiceValueDecisionState.Included;try{await u(I,V)}catch{ue()}}else y.some(V=>V.id===I)&&e.explain!=="disabled"&&await l(V=>V.whyIsStateNotPossible.choice(a.id).choiceValue(I).state(c.ChoiceValueDecisionState.Included),e.explain,o)},R=wa(e,a.isSatisfied,P,S);return f.jsxs(Fn,{ref:t,value:d?w:m,multiple:d,onChange:I=>E(I.currentTarget.value),style:R,children:[!v&&!d&&f.jsx("option",{value:Bn}),g&&f.jsx("option",{value:Nn,children:e.resetLabel}),h.map(I=>{var V;return f.jsxs("option",{value:I.id,children:[((V=I.decision)==null?void 0:V.kind)===c.DecisionKind.Implicit?e.implicitLabelPrefix:"",s[I.id]??I.id]},I.id)}),y.length>0&&f.jsx("optgroup",{label:e.blockedLabel,children:y.map(I=>f.jsx("option",{value:I.id,children:s[I.id]??I.id},I.id))})]})}),Ca=ii,va={...en,noOptionsAvailableColors:{...Nt,title:"No Options Available Colors"}};p.addPropertyControls(ii,va);const wa=(e,t,n,o)=>{var r,l,s;const i=Fe(e,t,n);return{...i,backgroundColor:F.match({noOptionsAvailable:o,noOptionsAvailableFill:(r=e.noOptionsAvailableColors)==null?void 0:r.fill}).with({noOptionsAvailable:!0,noOptionsAvailableFill:F.P.string.minLength(1)},a=>a.noOptionsAvailableFill).otherwise(()=>i.backgroundColor),borderColor:F.match({noOptionsAvailable:o,noOptionsAvailableBorderColor:(l=e.noOptionsAvailableColors)==null?void 0:l.borderColor}).with({noOptionsAvailable:!0,noOptionsAvailableBorderColor:F.P.string.minLength(1)},a=>a.noOptionsAvailableBorderColor).otherwise(()=>i.borderColor),color:F.match({noOptionsAvailable:o,noOptionsAvailableColor:(s=e.noOptionsAvailableColors)==null?void 0:s.color}).with({noOptionsAvailable:!0,noOptionsAvailableColor:F.P.string.minLength(1)},a=>a.noOptionsAvailableColor).otherwise(()=>i.color)}},Ln=O.select`
|
|
420
420
|
color: inherit;
|
|
421
|
-
`,
|
|
421
|
+
`,Mn="<reset>",At="<nothing>",Et="yes",$n="no",ri=fe((e,t)=>{var v,P,S;if(G()){const E=Fe(e,!0,!1);return f.jsx(Ln,{style:E})}const o=ae(),i=J(e),r=W.useBooleanAttribute(i),{explain:l}=de();if(!r)return f.jsx("span",{children:"Boolean Attribute not found"});const{attribute:s,makeDecision:a}=r,u=async E=>{const R=c.AttributeInterpreter.getBooleanDecision(s)!=null;if(E===Mn&&R)try{await a(void 0)}catch{ue()}else{const I=E===Et;if(c.AttributeInterpreter.isBooleanValuePossible(s,I))try{await a(I)}catch{ue()}else e.explain!=="disabled"&&await l(B=>B.whyIsStateNotPossible.boolean(s.id).state(I),e.explain,o)}},x=F.match((v=s.decision)==null?void 0:v.state).with(!0,()=>Et).with(!1,()=>$n).otherwise(()=>At),h=((P=s.decision)==null?void 0:P.kind)===c.DecisionKind.Explicit,y=((S=s.decision)==null?void 0:S.kind)===c.DecisionKind.Implicit,d=Fe(e,s.isSatisfied,y),b=c.AttributeInterpreter.isBooleanValuePossible(s,!0),w=c.AttributeInterpreter.isBooleanValuePossible(s,!1),m=f.jsxs("option",{value:Et,children:[Kn(s,!0,e.implicitLabelPrefix),e.trueLabel]}),g=f.jsxs("option",{value:$n,children:[Kn(s,!1,e.implicitLabelPrefix),e.falseLabel]});return f.jsxs(Ln,{ref:t,value:x,onChange:E=>u(E.currentTarget.value),style:d,children:[x===At&&f.jsx("option",{value:At}),h&&f.jsx("option",{value:Mn,children:e.resetLabel}),b&&m,w&&g,(!b||!w)&&f.jsxs("optgroup",{label:e.blockedLabel,children:[!b&&m,!w&&g]})]})}),Sa=ri,Kn=(e,t,n)=>{var o,i;return((o=e.decision)==null?void 0:o.kind)===c.DecisionKind.Implicit&&((i=e.decision)==null?void 0:i.state)===t?n:""},Ta={...en,trueLabel:{title:"True Label",type:p.ControlType.String,defaultValue:"Yes"},falseLabel:{title:"False Label",type:p.ControlType.String,defaultValue:"No"}};p.addPropertyControls(ri,Ta);const zn=O.select`
|
|
422
422
|
color: inherit;
|
|
423
|
-
`,
|
|
423
|
+
`,Wn="<reset>",It="<nothing>",Rt="included",Pt="excluded",li=fe((e,t)=>{var P,S,E;if(G()){const R=Fe(e,!0,!1);return f.jsx(zn,{style:R})}const o=ae(),i=J(e),r=W.useComponentAttribute(i),{explain:l}=de();if(!r)return f.jsx("span",{children:"Component Attribute not found"});const{attribute:s,makeDecision:a}=r,u=async R=>{if(c.AttributeInterpreter.isComponentStatePossible(s,R))try{await a(R)}catch{ue()}else e.explain!=="disabled"&&await l(V=>V.whyIsStateNotPossible.component(s.id).state(R),e.explain,o)},x=async R=>{var V;const I=((V=s.decision)==null?void 0:V.kind)===c.DecisionKind.Explicit;R===Wn&&I?await a(void 0):R===Rt?await u(c.ComponentDecisionState.Included):R===Pt&&await u(c.ComponentDecisionState.Excluded)},h=F.match((P=s.decision)==null?void 0:P.state).with(c.ComponentDecisionState.Included,()=>Rt).with(c.ComponentDecisionState.Excluded,()=>Pt).otherwise(()=>It),y=((S=s.decision)==null?void 0:S.kind)===c.DecisionKind.Explicit,d=((E=s.decision)==null?void 0:E.kind)===c.DecisionKind.Implicit,b=Fe(e,s.isSatisfied,d),w=c.AttributeInterpreter.isComponentStatePossible(s,c.ComponentDecisionState.Included),m=c.AttributeInterpreter.isComponentStatePossible(s,c.ComponentDecisionState.Excluded),g=f.jsxs("option",{value:Rt,children:[qn(s,c.ComponentDecisionState.Included,e.implicitLabelPrefix),e.includedLabel]}),v=f.jsxs("option",{value:Pt,children:[qn(s,c.ComponentDecisionState.Excluded,e.implicitLabelPrefix),e.excludedLabel]});return f.jsxs(zn,{ref:t,value:h,onChange:R=>x(R.currentTarget.value),style:b,children:[h===It&&f.jsx("option",{value:It}),y&&f.jsx("option",{value:Wn,children:e.resetLabel}),w&&g,m&&v,(!w||!m)&&f.jsxs("optgroup",{label:e.blockedLabel,children:[!w&&g,!m&&v]})]})}),Aa=li,qn=(e,t,n)=>{var o,i;return((o=e.decision)==null?void 0:o.kind)===c.DecisionKind.Implicit&&((i=e.decision)==null?void 0:i.state)===t?n:""},Ea={...en,includedLabel:{title:"Included Label",type:p.ControlType.String,defaultValue:"Included"},excludedLabel:{title:"Excluded Label",type:p.ControlType.String,defaultValue:"Excluded"}};p.addPropertyControls(li,Ea);function si(e,t,n,o,i=1e3){const[r]=Fi.useForceUpdate(),l=ji.useDebouncedCallback(y=>{t(y),r()},i),s=T.useRef(n),a=T.useRef(e),u=l.isPending(),x=T.useRef(u);T.useEffect(()=>{e!==a.current&&(a.current=e,u&&(l.cancel(),r()),e!==n&&o(e)),n!==s.current&&(s.current=n,n!==e?(l(n),r()):u&&(l.cancel(),r())),u!==x.current&&(x.current=u,!u&&e!==n&&o(e))},[e,n,l,u]);const h=T.useCallback(()=>{l.isPending()&&l.flush()},[l]);return T.useEffect(()=>()=>h(),[h]),{flush:h}}const Hn=O(ki)`
|
|
424
424
|
color: inherit;
|
|
425
|
-
`,si=me((e,t)=>{var x,P;if(G()){const S=Ft(e,!0,!1);return d.jsx(qn,{style:S})}const o=ce(),i=Z(e),r=W.useNumericAttribute(i),{explain:l}=he();if(!r)return d.jsx("span",{children:"Numeric Attribute not found"});const{attribute:s,makeDecision:a}=r,u=((x=s.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit,g=Ft(e,s.isSatisfied,u),h=(P=s.decision)==null?void 0:P.state,[b,p]=T.useState(h),{min:m,max:w}=s.range,y=li(h,async S=>{if(S<m){alert(`The value must be smaller than or equal to ${m}.`);return}if(S>w){alert(`The value must be greater than or equal to ${w}.`);return}try{await a(S)}catch(E){const R=E;R.type===c.FailureType.ConfigurationModelNotFeasible||R.type===c.FailureType.ConfigurationConflict?e.explain!=="disabled"&&await l(V=>V.whyIsStateNotPossible.numeric(s.id).state(S),e.explain,o):ue()}},b,S=>p(S),e.wait);return d.jsx(qn,{getInputRef:t,thousandsGroupStyle:"thousand",decimalSeparator:e.decimalSeparator,thousandSeparator:e.thousandSeparator,allowNegative:!0,fixedDecimalScale:!0,decimalScale:s.decimalPlaces,allowEmptyFormatting:!1,displayType:"input",placeholder:e.placeholder,prefix:Ra(s,e.implicitLabelPrefix),onBlur:()=>{y.flush()},onKeyPress:S=>{S.key==="Enter"&&y.flush()},onValueChange:S=>p(S.floatValue),value:b??"",style:g})}),Ia=si,Ra=(e,t)=>{var n;return((n=e.decision)==null?void 0:n.kind)===c.DecisionKind.Implicit?t:""},Pa={...Zo,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(si,Pa);const _e={choiceValueId:{title:"Choice Value Id",type:f.ControlType.String}};function ye(e,t){return T.Children.map(e,n=>{if(T.isValidElement(n)){const o=Gn(n.props,t);return T.cloneElement(n,o)}return n})}const ai=me((e,t)=>{if(G())return e.children;const o=ce(),{makeDecision:i}=W.useDecision(),r=Z(e),l=e.choiceValueId??"",s=l.length>0,a=W.useAttributes([r])[0],{explain:u}=he();if(!a)return d.jsx("span",{children:"Attribute not found"});const g=a.type===c.AttributeType.Choice,h=a.type===c.AttributeType.Numeric,b=a.type===c.AttributeType.Boolean,p=a.type===c.AttributeType.Component;if(!g&&s)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});if(h)return d.jsx("span",{children:"Numeric Attribute is not supported"});let m=g?a.values.find(P=>P.id===l):null;if(s&&m==null)return d.jsx("span",{children:"Choice Value not found"});const w=P=>F.match({state:P,attribute:a}).with({attribute:{type:c.AttributeType.Choice},state:"undefined"},()=>m.decision==null).with({attribute:{type:c.AttributeType.Choice},state:"included"},()=>{var S,E;return((S=m.decision)==null?void 0:S.state)===c.ChoiceValueDecisionState.Included&&((E=m.decision)==null?void 0:E.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Choice},state:"excluded"},()=>{var S,E;return((S=m.decision)==null?void 0:S.state)===c.ChoiceValueDecisionState.Excluded&&((E=m.decision)==null?void 0:E.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Boolean},state:"undefined"},{attribute:{type:c.AttributeType.Component},state:"undefined"},({attribute:S})=>S.decision==null).with({attribute:{type:c.AttributeType.Boolean},state:"true"},({attribute:S})=>{var E,R;return((E=S.decision)==null?void 0:E.state)===!0&&((R=S.decision)==null?void 0:R.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Boolean},state:"false"},({attribute:S})=>{var E,R;return((E=S.decision)==null?void 0:E.state)===!1&&((R=S.decision)==null?void 0:R.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Component},state:"included"},({attribute:S})=>{var E,R;return((E=S.decision)==null?void 0:E.state)===c.ComponentDecisionState.Included&&((R=S.decision)==null?void 0:R.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Component},state:"excluded"},({attribute:S})=>{var E,R;return((E=S.decision)==null?void 0:E.state)===c.ComponentDecisionState.Excluded&&((R=S.decision)==null?void 0:R.kind)===c.DecisionKind.Explicit}).otherwise(()=>!1),C=P=>F.match({isChoiceAttribute:g,isBooleanAttribute:b,isComponentAttribute:p,state:P}).with({isChoiceAttribute:!0,state:"included"},()=>c.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,state:"excluded"},()=>c.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>c.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>c.ComponentDecisionState.Excluded).otherwise(()=>null);w(e.toggleFrom);const y=w(e.toggleTo),x=async()=>{const P=y?e.toggleFrom:e.toggleTo,S=C(P),E=p?c.AttributeInterpreter.isComponentStatePossible(a,S):!1,R=b?c.AttributeInterpreter.isBooleanValuePossible(a,S):!1;if((g?m.possibleDecisionStates.some(L=>L===S):!1)||R||E||S==null)try{await i({type:a.type,attributeId:r,choiceValueId:l,state:S})}catch{ue()}else if(e.explain!=="disabled"){const L=F.match({isComponentAttribute:p,isBooleanAttribute:b,isChoiceAttribute:g}).returnType().with({isChoiceAttribute:!0},()=>c.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>c.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>c.ExplainQuestionSubject.component).otherwise(()=>null);L&&await u({question:c.ExplainQuestionType.whyIsStateNotPossible,subject:L,attributeId:r,choiceValueId:l,state:S},e.explain,o)}};return ye(e.children,{onClick:x,ref:t})}),Va=ai,Da={...le,..._e,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"]},...Ne};f.addPropertyControls(ai,Da);const ci=me((e,t)=>{if(G())return e.children;const o=ce(),{makeDecision:i}=W.useDecision(),r=Z(e),l=e.choiceValueId??"",s=l.length>0,a=W.useAttributes([r])[0],u=W.useChoiceAttribute(r),{explain:g}=he();if(!a)return d.jsx("span",{children:"Attribute not found"});const h=a.type===c.AttributeType.Choice,b=a.type===c.AttributeType.Numeric,p=a.type===c.AttributeType.Boolean,m=a.type===c.AttributeType.Component;if(!h&&s)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});let w=h?a.values.find(x=>x.id===l):null;if(s&&w==null)return d.jsx("span",{children:"Choice Value not found"});const C=()=>F.match({isChoiceAttribute:h,isBooleanAttribute:p,isComponentAttribute:m,isNumericAttribute:b,hasChoiceValueId:s,state:e.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>c.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>c.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>c.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>c.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>e.numericValue).otherwise(()=>null),y=async()=>{if(h&&!s&&e.setSelection==="undefined")try{await u.clearDecisions()}catch{ue()}else{const x=C(),P=m?c.AttributeInterpreter.isComponentStatePossible(a,x):!1,S=p?c.AttributeInterpreter.isBooleanValuePossible(a,x):!1,R=(h?w.possibleDecisionStates.some(I=>I===x):!1)||S||P;if(b||R||x==null)try{await i({type:a.type,attributeId:r,choiceValueId:l,state:x})}catch(I){const V=I;b&&(V.type===c.FailureType.ConfigurationModelNotFeasible||V.type===c.FailureType.ConfigurationConflict)?e.explain!=="disabled"&&await g(k=>k.whyIsStateNotPossible.numeric(a.id).state(x),e.explain,o):ue()}else if(e.explain!=="disabled"){const I=F.match({isComponentAttribute:m,isBooleanAttribute:p,isChoiceAttribute:h}).returnType().with({isChoiceAttribute:!0},()=>c.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>c.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>c.ExplainQuestionSubject.component).otherwise(()=>null);I&&await g({question:c.ExplainQuestionType.whyIsStateNotPossible,subject:I,attributeId:r,choiceValueId:l,state:x},e.explain,o)}}};return ye(e.children,{onClick:y,ref:t})}),Oa=ci,ka={...le,..._e,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},...Ne};f.addPropertyControls(ci,ka);const ui=me((e,t)=>{var h;if(G())return e.children;const o=ce(),{setManyDecision:i}=W.useDecision(),{handleExplainAnswer:r}=he(),l=e.attributes.map(Z),s=W.useAttributes(l).map((b,p)=>{if(!b)return{error:d.jsx("span",{children:"Attribute not found"})};const m=e.attributes[p],w=m.choiceValueId??"",C=w.length>0,y=b.type===c.AttributeType.Choice,x=b.type===c.AttributeType.Numeric,P=b.type===c.AttributeType.Boolean,S=b.type===c.AttributeType.Component;if(!y&&C)return{error:d.jsx("span",{children:"Attribute is not a Choice Attribute"})};let E=y?b.values.find(I=>I.id===w):null;if(C&&E==null)return{error:d.jsx("span",{children:"Choice Value not found"})};const R=()=>F.match({isChoiceAttribute:y,isBooleanAttribute:P,isComponentAttribute:S,isNumericAttribute:x,hasChoiceValueId:C,state:m.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>c.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>c.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>c.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>c.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>m.numericValue).otherwise(()=>null);return{getDecisions:()=>y&&!C&&m.setSelection==="undefined"?b.values.filter(I=>{var V;return((V=I.decision)==null?void 0:V.kind)===c.DecisionKind.Explicit}).map(I=>({type:b.type,attributeId:b.id,choiceValueId:I.id,state:null})):[{type:b.type,attributeId:b.id,choiceValueId:w,state:R()}]}}),a=(h=s.find(b=>b.error))==null?void 0:h.error;if(a)return a;const u=async()=>{const b=s.reduce((m,w)=>[...m,...w.getDecisions()],new Array),p=F.match(e.existingSelections).with("keep",()=>({type:"KeepExistingDecisions"})).with("drop",()=>({type:"DropExistingDecisions",conflictHandling:F.match(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()})).exhaustive();try{await i(b,p)}catch(m){const w=m;if(console.debug("SetMany failed",w),(w==null?void 0:w.type)===c.FailureType.ConfigurationSetManyConflict&&w.decisionExplanations){e.explain!=="disabled"&&await r(w,e.explain,o);return}ue();return}},g=()=>{e.trigger==="click"&&u()};return T.useEffect(()=>{e.trigger==="auto"&&u()},[]),ye(e.children,{onClick:g,ref:t})}),ja=ui,Fa={children:{title:"Content",type:f.ControlType.ComponentInstance},attributes:{title:"Attributes",type:f.ControlType.Array,control:{type:f.ControlType.Object,controls:{...le,..._e,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"},...Ne};f.addPropertyControls(ui,Fa);const di=ae(e=>{if(G())return e.enabledChildren;const{configuration:n}=W.useConfiguration(),{setManyDecision:o}=W.useDecision(),i=n.attributes.some(s=>F.match(s).with({type:c.AttributeType.Choice},a=>a.values.some(u=>{var g;return((g=u.decision)==null?void 0:g.kind)===c.DecisionKind.Explicit})).with({type:c.AttributeType.Boolean},a=>{var u;return((u=a.decision)==null?void 0:u.kind)===c.DecisionKind.Explicit}).with({type:c.AttributeType.Numeric},a=>{var u;return((u=a.decision)==null?void 0:u.kind)===c.DecisionKind.Explicit}).with({type:c.AttributeType.Component},a=>{var u;return((u=a.decision)==null?void 0:u.kind)===c.DecisionKind.Explicit}).exhaustive()),r=()=>{if(i)try{o([],{type:"DropExistingDecisions",conflictHandling:{type:"Manual",includeConstraintsInConflictExplanation:!1}})}catch{xa()}},l=i?e.enabledChildren:e.disabledChildren;return ye(l,{onClick:r})}),Na=di,La={enabledChildren:{title:"Content – Enabled",type:f.ControlType.ComponentInstance},disabledChildren:{title:"Content – Disabled",type:f.ControlType.ComponentInstance}};f.addPropertyControls(di,La);const fi=me((e,t)=>{if(G())return e.unsatisfiedChildren;const o=ce(),{configuration:i}=W.useConfiguration(),{explain:r}=he(),s=[...e.attributeId.length>0?[Z(e)]:[],...e.attributes.map(Z)],a=()=>{var p;const h=W.useAttributes(s).map(m=>m?{isSatisfied:m.isSatisfied}:{error:d.jsx("span",{children:"Attribute not found"})}),b=(p=h.find(m=>m.error))==null?void 0:p.error;return b||h.every(m=>m.isSatisfied)},u=async()=>{e.explain!=="disabled"&&(s.length===0?await r(h=>h.whyIsNotSatisfied.configuration,e.explain,o):s.length===1&&await r(h=>h.whyIsNotSatisfied.attribute(s[0]),e.explain,o))};return(s.length>0?a():i.isSatisfied)?e.satisfiedChildren:ye(e.unsatisfiedChildren,{onClick:u,ref:t})}),Ba=fi,Ma={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}}},...Ne};f.addPropertyControls(fi,Ma);const pi=ae(T.forwardRef(function(t,n){const o=m=>F.match(m).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),i=t.variants.find(m=>m.useInDesignTime)||t.variants[0];if(G())return i&&o(i.content);const l=Z(t),s=t.choiceValueId??"",a=s.length>0,u=W.useAttributes([l])[0];if(!u)return d.jsx("span",{children:"Attribute not found"});const g=u.type===c.AttributeType.Choice;if(!g&&a)return d.jsx("span",{children:"Attribute is not a Choice Attribute"});let h=g&&a?u.values.find(m=>m.id===s):null;if(a&&h==null)return d.jsx("span",{children:"Choice Value not found"});const b=m=>()=>h?m(h):u.values.some(m),p=[...t.variants].find(({selection:m,condition:w})=>F.match({selection:m,condition:w,attribute:u}).with({attribute:{type:c.AttributeType.Choice},selection:"included",condition:"blocked"},b(C=>!C.possibleDecisionStates.includes(c.ChoiceValueDecisionState.Included))).with({attribute:{type:c.AttributeType.Choice},selection:"included",condition:"implicit"},b(C=>{var y,x;return((y=C.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Included&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit})).with({attribute:{type:c.AttributeType.Choice},selection:"included",condition:"explicit"},b(C=>{var y,x;return((y=C.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Included&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit})).with({attribute:{type:c.AttributeType.Choice},selection:"included",condition:"none"},b(C=>{var y;return((y=C.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Included})).with({attribute:{type:c.AttributeType.Choice},selection:"excluded",condition:"blocked"},b(C=>!C.possibleDecisionStates.includes(c.ChoiceValueDecisionState.Excluded))).with({attribute:{type:c.AttributeType.Choice},selection:"excluded",condition:"implicit"},b(C=>{var y,x;return((y=C.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Excluded&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit})).with({attribute:{type:c.AttributeType.Choice},selection:"excluded",condition:"explicit"},b(C=>{var y,x;return((y=C.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Excluded&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit})).with({attribute:{type:c.AttributeType.Choice},selection:"excluded",condition:"none"},b(C=>{var y;return((y=C.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Excluded})).with({attribute:{type:c.AttributeType.Boolean},selection:"true",condition:"blocked"},({attribute:C})=>!C.possibleDecisionStates.includes(!0)).with({attribute:{type:c.AttributeType.Boolean},selection:"true",condition:"implicit"},({attribute:C})=>{var y,x;return((y=C.decision)==null?void 0:y.state)===!0&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Boolean},selection:"true",condition:"explicit"},({attribute:C})=>{var y,x;return((y=C.decision)==null?void 0:y.state)===!0&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Boolean},selection:"true",condition:"none"},({attribute:C})=>{var y;return((y=C.decision)==null?void 0:y.state)===!0}).with({attribute:{type:c.AttributeType.Boolean},selection:"false",condition:"blocked"},({attribute:C})=>!C.possibleDecisionStates.includes(!1)).with({attribute:{type:c.AttributeType.Boolean},selection:"false",condition:"implicit"},({attribute:C})=>{var y,x;return((y=C.decision)==null?void 0:y.state)===!1&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Boolean},selection:"false",condition:"explicit"},({attribute:C})=>{var y,x;return((y=C.decision)==null?void 0:y.state)===!1&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Boolean},selection:"false",condition:"none"},({attribute:C})=>{var y;return((y=C.decision)==null?void 0:y.state)===!1}).with({attribute:{type:c.AttributeType.Component},selection:"included",condition:"blocked"},({attribute:C})=>!C.possibleDecisionStates.includes(c.ComponentDecisionState.Included)).with({attribute:{type:c.AttributeType.Component},selection:"included",condition:"implicit"},({attribute:C})=>{var y,x;return((y=C.decision)==null?void 0:y.state)===c.ComponentDecisionState.Included&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Component},selection:"included",condition:"explicit"},({attribute:C})=>{var y,x;return((y=C.decision)==null?void 0:y.state)===c.ComponentDecisionState.Included&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Component},selection:"included",condition:"none"},({attribute:C})=>{var y;return((y=C.decision)==null?void 0:y.state)===c.ComponentDecisionState.Included}).with({attribute:{type:c.AttributeType.Component},selection:"excluded",condition:"blocked"},({attribute:C})=>!C.possibleDecisionStates.includes(c.ComponentDecisionState.Excluded)).with({attribute:{type:c.AttributeType.Component},selection:"excluded",condition:"implicit"},({attribute:C})=>{var y,x;return((y=C.decision)==null?void 0:y.state)===c.ComponentDecisionState.Excluded&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Component},selection:"excluded",condition:"explicit"},({attribute:C})=>{var y,x;return((y=C.decision)==null?void 0:y.state)===c.ComponentDecisionState.Excluded&&((x=C.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Component},selection:"excluded",condition:"none"},({attribute:C})=>{var y;return((y=C.decision)==null?void 0:y.state)===c.ComponentDecisionState.Excluded}).with({attribute:{type:c.AttributeType.Numeric},selection:"numeric",condition:"implicit"},({attribute:C})=>{var y;return((y=C.decision)==null?void 0:y.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Numeric},selection:"numeric",condition:"explicit"},({attribute:C})=>{var y;return((y=C.decision)==null?void 0:y.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Numeric},selection:"numeric",condition:"none"},({attribute:C})=>C.decision!=null).with({attribute:{type:c.AttributeType.Choice},selection:"undefined"},()=>h.decision==null).with({attribute:{type:c.AttributeType.Boolean},selection:"undefined"},{attribute:{type:c.AttributeType.Component},selection:"undefined"},{attribute:{type:c.AttributeType.Numeric},selection:"undefined"},({attribute:C})=>C.decision==null).otherwise(()=>!1));return p&&ye(o(p.content),{ref:n})})),$a=pi,Ka={...le,..._e,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(pi,Ka);const hi=ae(e=>{const t=T.useRef(),[n,o]=T.useState(null),i=T.useRef(n),r=T.useMemo(()=>e.color.startsWith("var"),[e.color]),l=r?n:e.color,s=T.useMemo(()=>{if(!l)return;const a=Ni(l);return Fi.hexToCSSFilter(`#${a}`,{acceptanceLossPercentage:1,maxChecks:30}).filter.replace(";","")},[l]);return T.useLayoutEffect(()=>{if(r){const a=t.current&&getComputedStyle(t.current).color;a!=i.current&&(i.current=a,o(a))}}),d.jsx("div",{ref:t,style:{...e.style,color:e.color,filter:s},children:e.children})}),za=hi,Wa={children:{title:"Content",type:f.ControlType.ComponentInstance},color:{title:"Color",type:f.ControlType.Color,defaultValue:"#0000ff"}};f.addPropertyControls(hi,Wa);const mi=ae(e=>{if(G())return e.children;const{error:n}=W.useConfigurationInitialization();return n?ye(e.children,{onClick:n.retry}):null}),qa=mi,Ha={children:{title:"Content",type:f.ControlType.ComponentInstance}};f.addPropertyControls(mi,Ha);function Ua(e){return T.forwardRef((t,n)=>{const o={...t.style,width:"100%",height:"100%"};return d.jsx(e,{...t,ref:n,style:o})})}const _a=O.div`
|
|
425
|
+
`,ai=fe((e,t)=>{var v,P;if(G()){const S=Bt(e,!0,!1);return f.jsx(Hn,{style:S})}const o=ae(),i=J(e),r=W.useNumericAttribute(i),{explain:l}=de();if(!r)return f.jsx("span",{children:"Numeric Attribute not found"});const{attribute:s,makeDecision:a}=r,u=((v=s.decision)==null?void 0:v.kind)===c.DecisionKind.Implicit,x=Bt(e,s.isSatisfied,u),h=(P=s.decision)==null?void 0:P.state,[y,d]=T.useState(h),{min:b,max:w}=s.range,g=si(h,async S=>{if(S<b){alert(`The value must be smaller than or equal to ${b}.`);return}if(S>w){alert(`The value must be greater than or equal to ${w}.`);return}try{await a(S)}catch(E){const R=E;R.type===c.FailureType.ConfigurationModelNotFeasible||R.type===c.FailureType.ConfigurationConflict?e.explain!=="disabled"&&await l(V=>V.whyIsStateNotPossible.numeric(s.id).state(S),e.explain,o):ue()}},y,S=>d(S),e.wait);return f.jsx(Hn,{getInputRef:t,thousandsGroupStyle:"thousand",decimalSeparator:e.decimalSeparator,thousandSeparator:e.thousandSeparator,allowNegative:!0,fixedDecimalScale:!0,decimalScale:s.decimalPlaces,allowEmptyFormatting:!1,displayType:"input",placeholder:e.placeholder,prefix:Ra(s,e.implicitLabelPrefix),onBlur:()=>{g.flush()},onKeyPress:S=>{S.key==="Enter"&&g.flush()},onValueChange:S=>d(S.floatValue),value:y??"",style:x})}),Ia=ai,Ra=(e,t)=>{var n;return((n=e.decision)==null?void 0:n.kind)===c.DecisionKind.Implicit?t:""},Pa={...ti,wait:{title:"Debounce Delay",type:p.ControlType.Number,defaultValue:2e3,min:0,unit:"ms"},decimalSeparator:{title:"Decimal Separator",type:p.ControlType.String,defaultValue:",",maxLength:1},thousandSeparator:{title:"Thousand Separator",type:p.ControlType.String,defaultValue:".",maxLength:1},placeholder:{title:"Placeholder",type:p.ControlType.String,defaultValue:""}};p.addPropertyControls(ai,Pa);const Be={choiceValueId:{title:"Choice Value Id",type:p.ControlType.String}};function pe(e,t){return T.Children.map(e,n=>{if(T.isValidElement(n)){const o=Jn(n.props,t);return T.cloneElement(n,o)}return n})}const ci=fe((e,t)=>{if(G())return e.children;const o=ae(),{makeDecision:i}=W.useDecision(),r=J(e),l=e.choiceValueId??"",s=l.length>0,a=W.useAttributes([r])[0],{explain:u}=de();if(!a)return f.jsx("span",{children:"Attribute not found"});const x=a.type===c.AttributeType.Choice,h=a.type===c.AttributeType.Numeric,y=a.type===c.AttributeType.Boolean,d=a.type===c.AttributeType.Component;if(!x&&s)return f.jsx("span",{children:"Attribute is not a Choice Attribute"});if(h)return f.jsx("span",{children:"Numeric Attribute is not supported"});let b=x?a.values.find(P=>P.id===l):null;if(s&&b==null)return f.jsx("span",{children:"Choice Value not found"});const w=P=>F.match({state:P,attribute:a}).with({attribute:{type:c.AttributeType.Choice},state:"undefined"},()=>b.decision==null).with({attribute:{type:c.AttributeType.Choice},state:"included"},()=>{var S,E;return((S=b.decision)==null?void 0:S.state)===c.ChoiceValueDecisionState.Included&&((E=b.decision)==null?void 0:E.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Choice},state:"excluded"},()=>{var S,E;return((S=b.decision)==null?void 0:S.state)===c.ChoiceValueDecisionState.Excluded&&((E=b.decision)==null?void 0:E.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Boolean},state:"undefined"},{attribute:{type:c.AttributeType.Component},state:"undefined"},({attribute:S})=>S.decision==null).with({attribute:{type:c.AttributeType.Boolean},state:"true"},({attribute:S})=>{var E,R;return((E=S.decision)==null?void 0:E.state)===!0&&((R=S.decision)==null?void 0:R.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Boolean},state:"false"},({attribute:S})=>{var E,R;return((E=S.decision)==null?void 0:E.state)===!1&&((R=S.decision)==null?void 0:R.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Component},state:"included"},({attribute:S})=>{var E,R;return((E=S.decision)==null?void 0:E.state)===c.ComponentDecisionState.Included&&((R=S.decision)==null?void 0:R.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Component},state:"excluded"},({attribute:S})=>{var E,R;return((E=S.decision)==null?void 0:E.state)===c.ComponentDecisionState.Excluded&&((R=S.decision)==null?void 0:R.kind)===c.DecisionKind.Explicit}).otherwise(()=>!1),m=P=>F.match({isChoiceAttribute:x,isBooleanAttribute:y,isComponentAttribute:d,state:P}).with({isChoiceAttribute:!0,state:"included"},()=>c.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,state:"excluded"},()=>c.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>c.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>c.ComponentDecisionState.Excluded).otherwise(()=>null);w(e.toggleFrom);const g=w(e.toggleTo),v=async()=>{const P=g?e.toggleFrom:e.toggleTo,S=m(P),E=d?c.AttributeInterpreter.isComponentStatePossible(a,S):!1,R=y?c.AttributeInterpreter.isBooleanValuePossible(a,S):!1;if((x?b.possibleDecisionStates.some(B=>B===S):!1)||R||E||S==null)try{await i({type:a.type,attributeId:r,choiceValueId:l,state:S})}catch{ue()}else if(e.explain!=="disabled"){const B=F.match({isComponentAttribute:d,isBooleanAttribute:y,isChoiceAttribute:x}).returnType().with({isChoiceAttribute:!0},()=>c.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>c.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>c.ExplainQuestionSubject.component).otherwise(()=>null);B&&await u({question:c.ExplainQuestionType.whyIsStateNotPossible,subject:B,attributeId:r,choiceValueId:l,state:S},e.explain,o)}};return pe(e.children,{onClick:v,ref:t})}),Va=ci,Da={...re,...Be,children:{title:"Content",type:p.ControlType.ComponentInstance},toggleFrom:{title:"Toggle From",type:p.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false"]},toggleTo:{title:"Toggle To",type:p.ControlType.Enum,defaultValue:"included",options:["undefined","included","excluded","true","false"]},...Ne};p.addPropertyControls(ci,Da);const ui=fe((e,t)=>{if(G())return e.children;const o=ae(),{makeDecision:i}=W.useDecision(),r=J(e),l=e.choiceValueId??"",s=l.length>0,a=W.useAttributes([r])[0],u=W.useChoiceAttribute(r),{explain:x}=de();if(!a)return f.jsx("span",{children:"Attribute not found"});const h=a.type===c.AttributeType.Choice,y=a.type===c.AttributeType.Numeric,d=a.type===c.AttributeType.Boolean,b=a.type===c.AttributeType.Component;if(!h&&s)return f.jsx("span",{children:"Attribute is not a Choice Attribute"});let w=h?a.values.find(v=>v.id===l):null;if(s&&w==null)return f.jsx("span",{children:"Choice Value not found"});const m=()=>F.match({isChoiceAttribute:h,isBooleanAttribute:d,isComponentAttribute:b,isNumericAttribute:y,hasChoiceValueId:s,state:e.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>c.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>c.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>c.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>c.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>e.numericValue).otherwise(()=>null),g=async()=>{if(h&&!s&&e.setSelection==="undefined")try{await u.clearDecisions()}catch{ue()}else{const v=m(),P=b?c.AttributeInterpreter.isComponentStatePossible(a,v):!1,S=d?c.AttributeInterpreter.isBooleanValuePossible(a,v):!1,R=(h?w.possibleDecisionStates.some(I=>I===v):!1)||S||P;if(y||R||v==null)try{await i({type:a.type,attributeId:r,choiceValueId:l,state:v})}catch(I){const V=I;y&&(V.type===c.FailureType.ConfigurationModelNotFeasible||V.type===c.FailureType.ConfigurationConflict)?e.explain!=="disabled"&&await x(k=>k.whyIsStateNotPossible.numeric(a.id).state(v),e.explain,o):ue()}else if(e.explain!=="disabled"){const I=F.match({isComponentAttribute:b,isBooleanAttribute:d,isChoiceAttribute:h}).returnType().with({isChoiceAttribute:!0},()=>c.ExplainQuestionSubject.choiceValue).with({isBooleanAttribute:!0},()=>c.ExplainQuestionSubject.boolean).with({isComponentAttribute:!0},()=>c.ExplainQuestionSubject.component).otherwise(()=>null);I&&await x({question:c.ExplainQuestionType.whyIsStateNotPossible,subject:I,attributeId:r,choiceValueId:l,state:v},e.explain,o)}}};return pe(e.children,{onClick:g,ref:t})}),Oa=ui,ka={...re,...Be,children:{title:"Content",type:p.ControlType.ComponentInstance},setSelection:{title:"Set Selection To",type:p.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},numericValue:{title:"Numeric Value",type:p.ControlType.Number,defaultValue:0},...Ne};p.addPropertyControls(ui,ka);const di=fe((e,t)=>{var h;if(G())return e.children;const o=ae(),{setManyDecision:i}=W.useDecision(),{handleExplainAnswer:r}=de(),l=e.attributes.map(J),s=W.useAttributes(l).map((y,d)=>{if(!y)return{error:f.jsx("span",{children:"Attribute not found"})};const b=e.attributes[d],w=b.choiceValueId??"",m=w.length>0,g=y.type===c.AttributeType.Choice,v=y.type===c.AttributeType.Numeric,P=y.type===c.AttributeType.Boolean,S=y.type===c.AttributeType.Component;if(!g&&m)return{error:f.jsx("span",{children:"Attribute is not a Choice Attribute"})};let E=g?y.values.find(I=>I.id===w):null;if(m&&E==null)return{error:f.jsx("span",{children:"Choice Value not found"})};const R=()=>F.match({isChoiceAttribute:g,isBooleanAttribute:P,isComponentAttribute:S,isNumericAttribute:v,hasChoiceValueId:m,state:b.setSelection}).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"included"},()=>c.ChoiceValueDecisionState.Included).with({isChoiceAttribute:!0,hasChoiceValueId:!0,state:"excluded"},()=>c.ChoiceValueDecisionState.Excluded).with({isBooleanAttribute:!0,state:"true"},()=>!0).with({isBooleanAttribute:!0,state:"false"},()=>!1).with({isComponentAttribute:!0,state:"included"},()=>c.ComponentDecisionState.Included).with({isComponentAttribute:!0,state:"excluded"},()=>c.ComponentDecisionState.Excluded).with({isNumericAttribute:!0,state:"numeric"},()=>b.numericValue).otherwise(()=>null);return{getDecisions:()=>g&&!m&&b.setSelection==="undefined"?y.values.filter(I=>{var V;return((V=I.decision)==null?void 0:V.kind)===c.DecisionKind.Explicit}).map(I=>({type:y.type,attributeId:y.id,choiceValueId:I.id,state:null})):[{type:y.type,attributeId:y.id,choiceValueId:w,state:R()}]}}),a=(h=s.find(y=>y.error))==null?void 0:h.error;if(a)return a;const u=async()=>{const y=s.reduce((b,w)=>[...b,...w.getDecisions()],new Array),d=F.match(e.existingSelections).with("keep",()=>({type:"KeepExistingDecisions"})).with("drop",()=>({type:"DropExistingDecisions",conflictHandling:F.match(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()})).exhaustive();try{await i(y,d)}catch(b){const w=b;if(console.debug("SetMany failed",w),(w==null?void 0:w.type)===c.FailureType.ConfigurationSetManyConflict&&w.decisionExplanations){e.explain!=="disabled"&&await r(w,e.explain,o);return}ue();return}},x=()=>{e.trigger==="click"&&u()};return T.useEffect(()=>{e.trigger==="auto"&&u()},[]),pe(e.children,{onClick:x,ref:t})}),ja=di,Fa={children:{title:"Content",type:p.ControlType.ComponentInstance},attributes:{title:"Attributes",type:p.ControlType.Array,control:{type:p.ControlType.Object,controls:{...re,...Be,setSelection:{title:"Set Selection To",type:p.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},numericValue:{title:"Numeric Value",type:p.ControlType.Number,defaultValue:0}}}},existingSelections:{title:"Existing Selections",type:p.ControlType.Enum,defaultValue:"keep",options:["keep","drop"]},autoResolveConflicts:{title:"Auto Resolve Conflicts",type:p.ControlType.Boolean,defaultValue:!0,hidden:e=>e.existingSelections!=="drop"},trigger:{title:"Trigger",type:p.ControlType.Enum,defaultValue:"click",options:["click","auto"],displaySegmentedControl:!0,segmentedControlDirection:"horizontal"},...Ne};p.addPropertyControls(di,Fa);const fi=se(e=>{if(G())return e.enabledChildren;const{configuration:n}=W.useConfiguration(),{setManyDecision:o}=W.useDecision(),i=n.attributes.some(s=>F.match(s).with({type:c.AttributeType.Choice},a=>a.values.some(u=>{var x;return((x=u.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit})).with({type:c.AttributeType.Boolean},a=>{var u;return((u=a.decision)==null?void 0:u.kind)===c.DecisionKind.Explicit}).with({type:c.AttributeType.Numeric},a=>{var u;return((u=a.decision)==null?void 0:u.kind)===c.DecisionKind.Explicit}).with({type:c.AttributeType.Component},a=>{var u;return((u=a.decision)==null?void 0:u.kind)===c.DecisionKind.Explicit}).exhaustive()),r=()=>{if(i)try{o([],{type:"DropExistingDecisions",conflictHandling:{type:"Manual",includeConstraintsInConflictExplanation:!1}})}catch{xa()}},l=i?e.enabledChildren:e.disabledChildren;return pe(l,{onClick:r})}),Na=fi,Ba={enabledChildren:{title:"Content – Enabled",type:p.ControlType.ComponentInstance},disabledChildren:{title:"Content – Disabled",type:p.ControlType.ComponentInstance}};p.addPropertyControls(fi,Ba);const pi=fe((e,t)=>{if(G())return e.unsatisfiedChildren;const o=ae(),{configuration:i}=W.useConfiguration(),{explain:r}=de(),s=[...e.attributeId.length>0?[J(e)]:[],...e.attributes.map(J)],a=()=>{var d;const h=W.useAttributes(s).map(b=>b?{isSatisfied:b.isSatisfied}:{error:f.jsx("span",{children:"Attribute not found"})}),y=(d=h.find(b=>b.error))==null?void 0:d.error;return y||h.every(b=>b.isSatisfied)},u=async()=>{e.explain!=="disabled"&&(s.length===0?await r(h=>h.whyIsNotSatisfied.configuration,e.explain,o):s.length===1&&await r(h=>h.whyIsNotSatisfied.attribute(s[0]),e.explain,o))};return(s.length>0?a():i.isSatisfied)?e.satisfiedChildren:pe(e.unsatisfiedChildren,{onClick:u,ref:t})}),La=pi,Ma={satisfiedChildren:{title:"Content – Satisfied",type:p.ControlType.ComponentInstance},unsatisfiedChildren:{title:"Content – Unsatisfied",type:p.ControlType.ComponentInstance},...re,attributes:{title:"Attributes",type:p.ControlType.Array,control:{type:p.ControlType.Object,controls:{...re}}},...Ne};p.addPropertyControls(pi,Ma);const hi=se(T.forwardRef(function(t,n){const o=b=>F.match(b).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),i=t.variants.find(b=>b.useInDesignTime)||t.variants[0];if(G())return i&&o(i.content);const l=J(t),s=t.choiceValueId??"",a=s.length>0,u=W.useAttributes([l])[0];if(!u)return f.jsx("span",{children:"Attribute not found"});const x=u.type===c.AttributeType.Choice;if(!x&&a)return f.jsx("span",{children:"Attribute is not a Choice Attribute"});let h=x&&a?u.values.find(b=>b.id===s):null;if(a&&h==null)return f.jsx("span",{children:"Choice Value not found"});const y=b=>()=>h?b(h):u.values.some(b),d=[...t.variants].find(({selection:b,condition:w})=>F.match({selection:b,condition:w,attribute:u}).with({attribute:{type:c.AttributeType.Choice},selection:"included",condition:"blocked"},y(m=>!m.possibleDecisionStates.includes(c.ChoiceValueDecisionState.Included))).with({attribute:{type:c.AttributeType.Choice},selection:"included",condition:"implicit"},y(m=>{var g,v;return((g=m.decision)==null?void 0:g.state)===c.ChoiceValueDecisionState.Included&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Implicit})).with({attribute:{type:c.AttributeType.Choice},selection:"included",condition:"explicit"},y(m=>{var g,v;return((g=m.decision)==null?void 0:g.state)===c.ChoiceValueDecisionState.Included&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Explicit})).with({attribute:{type:c.AttributeType.Choice},selection:"included",condition:"none"},y(m=>{var g;return((g=m.decision)==null?void 0:g.state)===c.ChoiceValueDecisionState.Included})).with({attribute:{type:c.AttributeType.Choice},selection:"excluded",condition:"blocked"},y(m=>!m.possibleDecisionStates.includes(c.ChoiceValueDecisionState.Excluded))).with({attribute:{type:c.AttributeType.Choice},selection:"excluded",condition:"implicit"},y(m=>{var g,v;return((g=m.decision)==null?void 0:g.state)===c.ChoiceValueDecisionState.Excluded&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Implicit})).with({attribute:{type:c.AttributeType.Choice},selection:"excluded",condition:"explicit"},y(m=>{var g,v;return((g=m.decision)==null?void 0:g.state)===c.ChoiceValueDecisionState.Excluded&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Explicit})).with({attribute:{type:c.AttributeType.Choice},selection:"excluded",condition:"none"},y(m=>{var g;return((g=m.decision)==null?void 0:g.state)===c.ChoiceValueDecisionState.Excluded})).with({attribute:{type:c.AttributeType.Boolean},selection:"true",condition:"blocked"},({attribute:m})=>!m.possibleDecisionStates.includes(!0)).with({attribute:{type:c.AttributeType.Boolean},selection:"true",condition:"implicit"},({attribute:m})=>{var g,v;return((g=m.decision)==null?void 0:g.state)===!0&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Boolean},selection:"true",condition:"explicit"},({attribute:m})=>{var g,v;return((g=m.decision)==null?void 0:g.state)===!0&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Boolean},selection:"true",condition:"none"},({attribute:m})=>{var g;return((g=m.decision)==null?void 0:g.state)===!0}).with({attribute:{type:c.AttributeType.Boolean},selection:"false",condition:"blocked"},({attribute:m})=>!m.possibleDecisionStates.includes(!1)).with({attribute:{type:c.AttributeType.Boolean},selection:"false",condition:"implicit"},({attribute:m})=>{var g,v;return((g=m.decision)==null?void 0:g.state)===!1&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Boolean},selection:"false",condition:"explicit"},({attribute:m})=>{var g,v;return((g=m.decision)==null?void 0:g.state)===!1&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Boolean},selection:"false",condition:"none"},({attribute:m})=>{var g;return((g=m.decision)==null?void 0:g.state)===!1}).with({attribute:{type:c.AttributeType.Component},selection:"included",condition:"blocked"},({attribute:m})=>!m.possibleDecisionStates.includes(c.ComponentDecisionState.Included)).with({attribute:{type:c.AttributeType.Component},selection:"included",condition:"implicit"},({attribute:m})=>{var g,v;return((g=m.decision)==null?void 0:g.state)===c.ComponentDecisionState.Included&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Component},selection:"included",condition:"explicit"},({attribute:m})=>{var g,v;return((g=m.decision)==null?void 0:g.state)===c.ComponentDecisionState.Included&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Component},selection:"included",condition:"none"},({attribute:m})=>{var g;return((g=m.decision)==null?void 0:g.state)===c.ComponentDecisionState.Included}).with({attribute:{type:c.AttributeType.Component},selection:"excluded",condition:"blocked"},({attribute:m})=>!m.possibleDecisionStates.includes(c.ComponentDecisionState.Excluded)).with({attribute:{type:c.AttributeType.Component},selection:"excluded",condition:"implicit"},({attribute:m})=>{var g,v;return((g=m.decision)==null?void 0:g.state)===c.ComponentDecisionState.Excluded&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Component},selection:"excluded",condition:"explicit"},({attribute:m})=>{var g,v;return((g=m.decision)==null?void 0:g.state)===c.ComponentDecisionState.Excluded&&((v=m.decision)==null?void 0:v.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Component},selection:"excluded",condition:"none"},({attribute:m})=>{var g;return((g=m.decision)==null?void 0:g.state)===c.ComponentDecisionState.Excluded}).with({attribute:{type:c.AttributeType.Numeric},selection:"numeric",condition:"implicit"},({attribute:m})=>{var g;return((g=m.decision)==null?void 0:g.kind)===c.DecisionKind.Implicit}).with({attribute:{type:c.AttributeType.Numeric},selection:"numeric",condition:"explicit"},({attribute:m})=>{var g;return((g=m.decision)==null?void 0:g.kind)===c.DecisionKind.Explicit}).with({attribute:{type:c.AttributeType.Numeric},selection:"numeric",condition:"none"},({attribute:m})=>m.decision!=null).with({attribute:{type:c.AttributeType.Choice},selection:"undefined"},()=>h.decision==null).with({attribute:{type:c.AttributeType.Boolean},selection:"undefined"},{attribute:{type:c.AttributeType.Component},selection:"undefined"},{attribute:{type:c.AttributeType.Numeric},selection:"undefined"},({attribute:m})=>m.decision==null).otherwise(()=>!1));return d&&pe(o(d.content),{ref:n})})),$a=hi,Ka={...re,...Be,variants:{title:"Variants",type:p.ControlType.Array,maxCount:10,control:{type:p.ControlType.Object,controls:{selection:{title:"Selection",type:p.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded","true","false","numeric"]},condition:{title:"Condition",type:p.ControlType.Enum,defaultValue:"none",options:["none","explicit","implicit","blocked"]},content:{title:"Content",type:p.ControlType.Enum,defaultValue:1,options:[1,2,3,4,5,6,7,8,9,10]},useInDesignTime:{title:"Design Time",type:p.ControlType.Boolean,defaultValue:!1}}}},content1:{title:"Content 1",type:p.ControlType.ComponentInstance},content2:{title:"Content 2",type:p.ControlType.ComponentInstance},content3:{title:"Content 3",type:p.ControlType.ComponentInstance},content4:{title:"Content 4",type:p.ControlType.ComponentInstance},content5:{title:"Content 5",type:p.ControlType.ComponentInstance},content6:{title:"Content 6",type:p.ControlType.ComponentInstance},content7:{title:"Content 7",type:p.ControlType.ComponentInstance},content8:{title:"Content 8",type:p.ControlType.ComponentInstance},content9:{title:"Content 9",type:p.ControlType.ComponentInstance},content10:{title:"Content 10",type:p.ControlType.ComponentInstance}};p.addPropertyControls(hi,Ka);const mi=se(e=>{const t=T.useRef(),[n,o]=T.useState(null),i=T.useRef(n),r=T.useMemo(()=>e.color.startsWith("var"),[e.color]),l=r?n:e.color,s=T.useMemo(()=>{if(!l)return;const a=Bi(l);return Ni.hexToCSSFilter(`#${a}`,{acceptanceLossPercentage:1,maxChecks:30}).filter.replace(";","")},[l]);return T.useLayoutEffect(()=>{if(r){const a=t.current&&getComputedStyle(t.current).color;a!=i.current&&(i.current=a,o(a))}}),f.jsx("div",{ref:t,style:{...e.style,color:e.color,filter:s},children:e.children})}),za=mi,Wa={children:{title:"Content",type:p.ControlType.ComponentInstance},color:{title:"Color",type:p.ControlType.Color,defaultValue:"#0000ff"}};p.addPropertyControls(mi,Wa);const yi=se(e=>{if(G())return e.children;const{error:n}=W.useConfigurationInitialization();return n?pe(e.children,{onClick:n.retry}):null}),qa=yi,Ha={children:{title:"Content",type:p.ControlType.ComponentInstance}};p.addPropertyControls(yi,Ha);function Ua(e){return T.forwardRef((t,n)=>{const o={...t.style,width:"100%",height:"100%"};return f.jsx(e,{...t,ref:n,style:o})})}const _a=O.div`
|
|
426
426
|
width: 10px;
|
|
427
427
|
height: 10px;
|
|
428
428
|
background-color: greenyellow;
|
|
429
|
-
`;function
|
|
429
|
+
`;function bi(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]),f.jsx(_a,{ref:t})}const Qa={delay:{title:"Delay",type:p.ControlType.Number,min:0,unit:"ms",defaultValue:0,step:1}};p.addPropertyControls(bi,Qa);const gi=O.div`
|
|
430
430
|
display: contents;
|
|
431
431
|
`,Ya=O.createGlobalStyle`
|
|
432
432
|
:root {
|
|
433
|
-
*:has(> ${
|
|
433
|
+
*:has(> ${gi}) {
|
|
434
434
|
display: contents !important;
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
`,gi=ae(ni(e=>{const t=ce(),n=G(),r=n?(()=>T.Children.toArray(e.itemTemplate)[0])():(()=>{const m=w=>{var x;const C=T.Children.toArray(w)[0],y=(x=C.props)==null?void 0:x.children;return y?m(y):C};return m(e.itemTemplate)})();if(!r)return d.jsx("span",{children:"Choice Value Template not defined"});const l=(m,w)=>m.map(C=>T.cloneElement(r,{key:C,layoutId:`${t}_${C}`,attributeId:e.attributeId,componentPath:e.componentPath,sharedConfigurationModel:e.sharedConfigurationModel,choiceValueId:C,choiceValueName:w[C]??C}));if(n)return d.jsx(Hn,{...e,children:l(["Choice Value 1","Choice Value 2","Choice Value 3"],{})});const s=Z(e),a=W.useChoiceAttribute(s);if(!a)return d.jsx("span",{children:"Choice Attribute not found"});const u=ut(s),g=e.filter??new Array,h=a.attribute.values.filter(m=>g.length===0||g.some(({selection:w,condition:C})=>F.match({selection:w,condition:C}).with({selection:"included",condition:"blocked"},()=>!m.possibleDecisionStates.includes(c.ChoiceValueDecisionState.Included)).with({selection:"included",condition:"implicit"},()=>{var y,x;return((y=m.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Included&&((x=m.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit}).with({selection:"included",condition:"explicit"},()=>{var y,x;return((y=m.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Included&&((x=m.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit}).with({selection:"included",condition:"none"},()=>{var y;return((y=m.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Included}).with({selection:"excluded",condition:"blocked"},()=>!m.possibleDecisionStates.includes(c.ChoiceValueDecisionState.Excluded)).with({selection:"excluded",condition:"implicit"},()=>{var y,x;return((y=m.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Excluded&&((x=m.decision)==null?void 0:x.kind)===c.DecisionKind.Implicit}).with({selection:"excluded",condition:"explicit"},()=>{var y,x;return((y=m.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Excluded&&((x=m.decision)==null?void 0:x.kind)===c.DecisionKind.Explicit}).with({selection:"excluded",condition:"none"},()=>{var y;return((y=m.decision)==null?void 0:y.state)===c.ChoiceValueDecisionState.Excluded}).with({selection:"undefined"},()=>m.decision==null).otherwise(()=>!1))),p=at(s,u,h).map(m=>m.id);return d.jsx(Hn,{...e,children:l(p,u)})}));function Hn(e){return d.jsxs(d.Fragment,{children:[d.jsx(st,{singletonId:"ChoiceValueListRenderer",children:d.jsx(Ya,{})}),d.jsx(bi,{style:e.style,children:e.children})]})}const Xa=gi,Ga={...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(gi,Ga);const{isValidElement:Un,cloneElement:_n}=A;function Ja(e,t){return t?(Array.isArray(t)&&(t=t.map((n,o)=>Un(n)&&typeof n.props=="object"?_n(n,{...n.props,key:o}):n)),!e||Array.isArray(e)?t:Un(e)?_n(e,{...e.props,children:t}):e):e}const{isValidElement:Za}=A;function xi(e,t,n){function o(r,l){return t.visit(r,n,l)}function i(r,l){return xi(r,t,l||n)}if(Za(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),i(e);if(e.props&&"children"in e.props){const r=e.props.children;return o(e,s=>Array.isArray(r)?r.map(a=>i(a,s)):i(r,s))}}else if(Array.isArray(e)){const r=e;return o(e,s=>r.map(a=>i(a,s)))}return o(e)}const{isValidElement:Qn}=A;function ec(e,t){let n;const{replace:o,updateState:i}=t;return"matchElement"in t?n=r=>Qn(r)&&r.type===t.matchElement:"matchLiteral"in t?n=r=>!Array.isArray(r)&&!Qn(r)&&t.matchLiteral(r):n=t.match,xi(e,{visit(r,l,s){const a=i?i(l):l,u=s?s(a):void 0,g=Ja(r,u);return n(g,a)?o(g,a):g}},t.initialState)}function Yn(e){return d.jsx(d.Fragment,{children:ec(e.children,e)})}function tc(e){return v.pipe(e,v.Str.replace(/[\s\u2013]/g,"-"),Li)}const nc=ae(e=>{const{children:t,mode:n,replaceString:o,propName:i,elementName:r,text:l}=e;return n==="replace"?d.jsx(Yn,{match:s=>typeof s=="string",replace:s=>s===o?l:s,children:t}):n==="set-prop"?d.jsx(Yn,{match:s=>{var a;return((a=s.type)==null?void 0:a.displayName)===r},replace:s=>T.cloneElement(s,{[tc(i)]:l}),children:t}):t}),en=nc,tn=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"}}),Ci=ae(e=>{const{attributeId:t,children:n,customName:o}=e,i=Z(e),r=(o==null?void 0:o.length)>0,l=G(),a=r?o:l?t:(()=>W.useAttributes([i],!1)[0]?$t(i)??t:"Attribute not found")();return d.jsx(en,{...e,text:a})}),oc=Ci,ic={...le,customName:{title:"Custom Name",type:f.ControlType.String},...tn("<AttributeName>")};f.addPropertyControls(Ci,ic);const vi=ae(e=>{const{choiceValueId:t,children:n,customName:o,mode:i,replaceString:r,propName:l,elementName:s}=e,a=Z(e),u=o.length>0,g=t.length>0,h=G(),p=u?o:h?t.length>0?t:"Choice Value":(()=>{const m=W.useChoiceAttribute(a);return m?g?m.attribute.values.find(C=>C.id===t)==null?"Choice Value not found":or(a,t)??t:"Choice Value Id missing":"Choice Attribute not found"})();return d.jsx(en,{...e,text:p})}),rc=vi,lc={...le,..._e,customName:{title:"Custom Name",type:f.ControlType.String},...tn("<ChoiceValueName>")};f.addPropertyControls(vi,lc);function wi(e){return e.children}const sc={children:{title:"Content",type:f.ControlType.ComponentInstance}};f.addPropertyControls(wi,sc);function Si(e){const{children:t,fileExtension:n,fileName:o,target:i}=e;if(G())return t;const{configuration:l}=W.useConfiguration();return ye(t,{onClick:async()=>{const u={type:"spc-stored-configuration",storedConfiguration:cc(l)};i==="file"?uc(u,`${o}.${n}`):i==="clipboard"&&dc(u)}})}const ac={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(Si,ac);function cc(e){return{schemaVersion:1,explicitDecisions:v.pipe(e.attributes,v.RA.chain(n=>F.match(n).returnType().with({type:c.AttributeType.Choice},o=>o.values.filter(i=>{var r;return((r=i.decision)==null?void 0:r.kind)===c.DecisionKind.Explicit}).map(i=>({type:c.AttributeType.Choice,attributeId:o.id,choiceValueId:i.id,state:i.decision.state}))).with({type:c.AttributeType.Numeric},o=>{var i;return((i=o.decision)==null?void 0:i.kind)===c.DecisionKind.Explicit?[{type:c.AttributeType.Numeric,attributeId:o.id,state:o.decision.state}]:[]}).with({type:c.AttributeType.Boolean},o=>{var i;return((i=o.decision)==null?void 0:i.kind)===c.DecisionKind.Explicit?[{type:c.AttributeType.Boolean,attributeId:o.id,state:o.decision.state}]:[]}).with({type:c.AttributeType.Component},o=>{var i;return((i=o.decision)==null?void 0:i.kind)===c.DecisionKind.Explicit?[{type:c.AttributeType.Component,attributeId:o.id,state:o.decision.state}]:[]}).exhaustive()))}}function uc(e,t){const n=JSON.stringify(e),o=new Blob([n],{type:"application/json"}),i=window.URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(i)}function dc(e){const t=JSON.stringify(e);navigator.clipboard.writeText(t).catch(n=>{alert("Failed to copy the configuration to clipboard: "+n)})}var Ti=(e=>(e[e.parseError=0]="parseError",e[e.noConfiguration=1]="noConfiguration",e[e.unsupportedSchemaVersion=2]="unsupportedSchemaVersion",e[e.noFileSelected=3]="noFileSelected",e[e.fileReadError=4]="fileReadError",e[e.noClipboardData=5]="noClipboardData",e[e.clipboardReadError=6]="clipboardReadError",e))(Ti||{});const Ai=me((e,t)=>{const{children:n,fileExtension:o,source:i}=e;if(G())return n;const l=ce(),{setManyDecision:s}=W.useDecision(),{handleExplainAnswer:a}=he();return ye(n,{onClick:async()=>{const g=v.pipe(await bc(i,o),v.O.toNullable);if(!g)return;const h={type:"DropExistingDecisions",conflictHandling:F.match(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()};try{const b=hc(g);await s(b,h)}catch(b){const p=b;if(console.debug("Failed to restore stored configuration",p),(p==null?void 0:p.type)===c.FailureType.ConfigurationSetManyConflict&&p.decisionExplanations){e.explain!=="disabled"&&await a(p,e.explain,l);return}alert("Failed to restore your configuration.");return}},ref:t})}),fc=Ai,pc={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},...Ne};f.addPropertyControls(Ai,pc);function hc(e){return e.explicitDecisions.map(t=>F.match(t).returnType().with({type:c.AttributeType.Choice},n=>({type:c.AttributeType.Choice,attributeId:n.attributeId,choiceValueId:n.choiceValueId,state:n.state})).with({type:c.AttributeType.Numeric},n=>({type:c.AttributeType.Numeric,attributeId:n.attributeId,state:n.state})).with({type:c.AttributeType.Boolean},n=>({type:c.AttributeType.Boolean,attributeId:n.attributeId,state:n.state})).with({type:c.AttributeType.Component},n=>({type:c.AttributeType.Component,attributeId:n.attributeId,state:n.state})).exhaustive())}function mc(e){return()=>new Promise(t=>{const n=document.createElement("input");n.type="file",n.accept=`.${e}`,n.onchange=o=>{const i=o.target;if(!i.files||i.files.length===0){t(v.left(3));return}const r=i.files[0],l=new FileReader;l.onload=()=>{t(v.right(l.result))},l.onerror=()=>{t(v.left(4))},l.readAsText(r)},n.oncancel=()=>{t(v.left(3))},n.click()})}function yc(){return()=>navigator.clipboard.readText().then(e=>e?v.right(e):v.left(5)).catch(()=>v.left(6))}function bc(e,t){return v.pipe(e==="file"?mc(t):yc(),v.TE.chainEitherK(n=>v.E.tryCatch(()=>JSON.parse(n),()=>0)),v.TE.filterOrElse(n=>n.type==="spc-stored-configuration",()=>1),v.TE.filterOrElse(n=>{var o;return((o=n.storedConfiguration)==null?void 0:o.schemaVersion)===1},()=>2),v.TE.map(n=>n.storedConfiguration),v.TE.doIfLeft(n=>()=>{console.debug(`Failed to load stored configuration: ${Ti[n]}`),n==4?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==2?alert("The specific configuration is not supported. Maybe the configuration was created with new application version than the current one."):n==6?alert("Can't read the clipboard. Make to give a permission for reading the clipboard."):n==5&&alert("The clipboard doesn't contain a configuration.")}),v.TO.fromTaskEither)()}const Ei=ae(e=>{const{fallback:t}=e,n=Z(e),r=G()?"0.0":(()=>{var a;const l=W.useNumericAttribute(n);if(!l)return"Numeric Attribute not found";const s=(a=l.attribute.decision)==null?void 0:a.state;return s!=null?s.toLocaleString():t})();return d.jsx(en,{...e,text:r})}),gc=Ei,xc={...le,fallback:{title:"Unselected Text",type:f.ControlType.String,defaultValue:""},...tn("<NumericValue>")};f.addPropertyControls(Ei,xc);exports.AttributeName=oc;exports.BooleanSelect=Sa;exports.ChoiceSelect=Ca;exports.ChoiceValueListRenderer=Xa;exports.ChoiceValueName=rc;exports.Colorize=za;exports.ComponentSelect=Aa;exports.Configuration=Bs;exports.InitializationRetry=qa;exports.NumericInput=Ia;exports.ResetConfiguration=Na;exports.RestoreConfiguration=fc;exports.SatisfactionIndicator=Ba;exports.ScrollIntoView=yi;exports.SelectedNumericValue=gc;exports.SelectionIndicator=$a;exports.SelectionToggle=Va;exports.SetSelection=Oa;exports.SetSelections=ja;exports.Singleton=st;exports.Slot=wi;exports.StoreConfiguration=Si;exports.useDebounceValue=li;exports.useRenderPlaceholder=G;exports.useSortedChoiceValues=at;exports.withFullSize=Ua;
|
|
437
|
+
`,xi=se(tn(e=>{const t=ae(),n=G(),i=(()=>{const d=b=>{var g;const w=T.Children.toArray(b)[0],m=(g=w.props)==null?void 0:g.children;return m?d(m):w};return d(e.itemTemplate)})();if(!i)return f.jsx("span",{children:"Choice Value Template not defined"});const r=(d,b)=>d.map(w=>T.cloneElement(i,{key:w,layoutId:`${t}_${w}`,attributeId:e.attributeId,componentPath:e.componentPath,sharedConfigurationModel:e.sharedConfigurationModel,choiceValueId:w,choiceValueName:b[w]??w}));if(n)return f.jsx(Un,{...e,children:r(["Choice Value 1","Choice Value 2","Choice Value 3"],{})});const l=J(e),s=W.useChoiceAttribute(l);if(!s)return f.jsx("span",{children:"Choice Attribute not found"});const a=qe(l),u=e.filter??new Array,x=s.attribute.values.filter(d=>u.length===0||u.some(({selection:b,condition:w})=>F.match({selection:b,condition:w}).with({selection:"included",condition:"blocked"},()=>!d.possibleDecisionStates.includes(c.ChoiceValueDecisionState.Included)).with({selection:"included",condition:"implicit"},()=>{var m,g;return((m=d.decision)==null?void 0:m.state)===c.ChoiceValueDecisionState.Included&&((g=d.decision)==null?void 0:g.kind)===c.DecisionKind.Implicit}).with({selection:"included",condition:"explicit"},()=>{var m,g;return((m=d.decision)==null?void 0:m.state)===c.ChoiceValueDecisionState.Included&&((g=d.decision)==null?void 0:g.kind)===c.DecisionKind.Explicit}).with({selection:"included",condition:"none"},()=>{var m;return((m=d.decision)==null?void 0:m.state)===c.ChoiceValueDecisionState.Included}).with({selection:"excluded",condition:"blocked"},()=>!d.possibleDecisionStates.includes(c.ChoiceValueDecisionState.Excluded)).with({selection:"excluded",condition:"implicit"},()=>{var m,g;return((m=d.decision)==null?void 0:m.state)===c.ChoiceValueDecisionState.Excluded&&((g=d.decision)==null?void 0:g.kind)===c.DecisionKind.Implicit}).with({selection:"excluded",condition:"explicit"},()=>{var m,g;return((m=d.decision)==null?void 0:m.state)===c.ChoiceValueDecisionState.Excluded&&((g=d.decision)==null?void 0:g.kind)===c.DecisionKind.Explicit}).with({selection:"excluded",condition:"none"},()=>{var m;return((m=d.decision)==null?void 0:m.state)===c.ChoiceValueDecisionState.Excluded}).with({selection:"undefined"},()=>d.decision==null).otherwise(()=>!1))),y=ct(l,a,x).map(d=>d.id);return f.jsx(Un,{...e,children:r(y,a)})}));function Un(e){return f.jsxs(f.Fragment,{children:[f.jsx(at,{singletonId:"ChoiceValueListRenderer",children:f.jsx(Ya,{})}),f.jsx(gi,{style:e.style,children:e.children})]})}const Xa=xi,Ga={...re,itemTemplate:{title:"Choice Value Template",type:p.ControlType.ComponentInstance},filter:{title:"Filter",type:p.ControlType.Array,control:{type:p.ControlType.Object,controls:{selection:{title:"Selection",type:p.ControlType.Enum,defaultValue:"undefined",options:["undefined","included","excluded"]},condition:{title:"Condition",type:p.ControlType.Enum,defaultValue:"none",options:["none","explicit","implicit","blocked"]}}}}};p.addPropertyControls(xi,Ga);const{isValidElement:_n,cloneElement:Qn}=A;function Ja(e,t){return t?(Array.isArray(t)&&(t=t.map((n,o)=>_n(n)&&typeof n.props=="object"?Qn(n,{...n.props,key:o}):n)),!e||Array.isArray(e)?t:_n(e)?Qn(e,{...e.props,children:t}):e):e}const{isValidElement:Za}=A;function Ci(e,t,n){function o(r,l){return t.visit(r,n,l)}function i(r,l){return Ci(r,t,l||n)}if(Za(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),i(e);if(e.props&&"children"in e.props){const r=e.props.children;return o(e,s=>Array.isArray(r)?r.map(a=>i(a,s)):i(r,s))}}else if(Array.isArray(e)){const r=e;return o(e,s=>r.map(a=>i(a,s)))}return o(e)}const{isValidElement:Yn}=A;function ec(e,t){let n;const{replace:o,updateState:i}=t;return"matchElement"in t?n=r=>Yn(r)&&r.type===t.matchElement:"matchLiteral"in t?n=r=>!Array.isArray(r)&&!Yn(r)&&t.matchLiteral(r):n=t.match,Ci(e,{visit(r,l,s){const a=i?i(l):l,u=s?s(a):void 0,x=Ja(r,u);return n(x,a)?o(x,a):x}},t.initialState)}function Xn(e){return f.jsx(f.Fragment,{children:ec(e.children,e)})}function tc(e){return C.pipe(e,C.Str.replace(/[\s\u2013]/g,"-"),Li)}const nc=se(e=>{const{children:t,mode:n,replaceString:o,propName:i,elementName:r,text:l}=e;return n==="replace"?f.jsx(Xn,{match:s=>typeof s=="string",replace:s=>s===o?l:s,children:t}):n==="set-prop"?f.jsx(Xn,{match:s=>{var a;return((a=s.type)==null?void 0:a.displayName)===r},replace:s=>T.cloneElement(s,{[tc(i)]:l}),children:t}):t}),mt=nc,nn=e=>({children:{title:"Content",type:p.ControlType.ComponentInstance},mode:{title:"Mode",type:p.ControlType.Enum,defaultValue:"replace",options:["replace","set-prop"],displaySegmentedControl:!0},replaceString:{title:"Replace Text",type:p.ControlType.String,defaultValue:e,hidden:t=>t.mode!=="replace"},elementName:{title:"Element Name",type:p.ControlType.String,hidden:t=>t.mode!=="set-prop"},propName:{title:"Property Name",type:p.ControlType.String,hidden:t=>t.mode!=="set-prop"}}),vi=se(e=>{const{attributeId:t,children:n,customName:o}=e,i=J(e),r=(o==null?void 0:o.length)>0,l=G(),a=r?o:l?t:(()=>W.useAttributes([i],!1)[0]?dt(i)??t:"Attribute not found")();return f.jsx(mt,{...e,text:a})}),oc=vi,ic={...re,customName:{title:"Custom Name",type:p.ControlType.String},...nn("<AttributeName>")};p.addPropertyControls(vi,ic);const wi=se(e=>{const{choiceValueId:t,children:n,customName:o,mode:i,replaceString:r,propName:l,elementName:s}=e,a=J(e),u=o.length>0,x=t.length>0,h=G(),d=u?o:h?t.length>0?t:"Choice Value":(()=>{const b=W.useChoiceAttribute(a);return b?x?b.attribute.values.find(m=>m.id===t)==null?"Choice Value not found":io(a,t)??t:"Choice Value Id missing":"Choice Attribute not found"})();return f.jsx(mt,{...e,text:d})}),rc=wi,lc={...re,...Be,customName:{title:"Custom Name",type:p.ControlType.String},...nn("<ChoiceValueName>")};p.addPropertyControls(wi,lc);function Si(e){return e.children}const sc={children:{title:"Content",type:p.ControlType.ComponentInstance}};p.addPropertyControls(Si,sc);function Ti(e){const{children:t,fileExtension:n,fileName:o,target:i}=e;if(G())return t;const{configuration:l}=W.useConfiguration();return pe(t,{onClick:async()=>{const u={type:"spc-stored-configuration",storedConfiguration:cc(l)};i==="file"?uc(u,`${o}.${n}`):i==="clipboard"&&dc(u)}})}const ac={children:{title:"Content",type:p.ControlType.ComponentInstance},target:{title:"Target",type:p.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileName:{title:"File Name",type:p.ControlType.String,defaultValue:"configuration",hidden:e=>e.target!=="file"},fileExtension:{title:"File Extension",type:p.ControlType.String,defaultValue:"json",hidden:e=>e.target!=="file"}};p.addPropertyControls(Ti,ac);function cc(e){return{schemaVersion:1,explicitDecisions:C.pipe(e.attributes,C.RA.chain(n=>F.match(n).returnType().with({type:c.AttributeType.Choice},o=>o.values.filter(i=>{var r;return((r=i.decision)==null?void 0:r.kind)===c.DecisionKind.Explicit}).map(i=>({type:c.AttributeType.Choice,attributeId:o.id,choiceValueId:i.id,state:i.decision.state}))).with({type:c.AttributeType.Numeric},o=>{var i;return((i=o.decision)==null?void 0:i.kind)===c.DecisionKind.Explicit?[{type:c.AttributeType.Numeric,attributeId:o.id,state:o.decision.state}]:[]}).with({type:c.AttributeType.Boolean},o=>{var i;return((i=o.decision)==null?void 0:i.kind)===c.DecisionKind.Explicit?[{type:c.AttributeType.Boolean,attributeId:o.id,state:o.decision.state}]:[]}).with({type:c.AttributeType.Component},o=>{var i;return((i=o.decision)==null?void 0:i.kind)===c.DecisionKind.Explicit?[{type:c.AttributeType.Component,attributeId:o.id,state:o.decision.state}]:[]}).exhaustive()))}}function uc(e,t){const n=JSON.stringify(e),o=new Blob([n],{type:"application/json"}),i=window.URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(i)}function dc(e){const t=JSON.stringify(e);navigator.clipboard.writeText(t).catch(n=>{alert("Failed to copy the configuration to clipboard: "+n)})}var Ai=(e=>(e[e.parseError=0]="parseError",e[e.noConfiguration=1]="noConfiguration",e[e.unsupportedSchemaVersion=2]="unsupportedSchemaVersion",e[e.noFileSelected=3]="noFileSelected",e[e.fileReadError=4]="fileReadError",e[e.noClipboardData=5]="noClipboardData",e[e.clipboardReadError=6]="clipboardReadError",e))(Ai||{});const Ei=fe((e,t)=>{const{children:n,fileExtension:o,source:i}=e;if(G())return n;const l=ae(),{setManyDecision:s}=W.useDecision(),{handleExplainAnswer:a}=de();return pe(n,{onClick:async()=>{const x=C.pipe(await bc(i,o),C.O.toNullable);if(!x)return;const h={type:"DropExistingDecisions",conflictHandling:F.match(e.autoResolveConflicts).with(!1,()=>({type:"Manual",includeConstraintsInConflictExplanation:!1})).with(!0,()=>({type:"Automatic"})).exhaustive()};try{const y=hc(x);await s(y,h)}catch(y){const d=y;if(console.debug("Failed to restore stored configuration",d),(d==null?void 0:d.type)===c.FailureType.ConfigurationSetManyConflict&&d.decisionExplanations){e.explain!=="disabled"&&await a(d,e.explain,l);return}alert("Failed to restore your configuration.");return}},ref:t})}),fc=Ei,pc={children:{title:"Content",type:p.ControlType.ComponentInstance},source:{title:"Source",type:p.ControlType.Enum,defaultValue:"file",options:["file","clipboard"],optionTitles:["File","Clipboard"],displaySegmentedControl:!0,segmentedControlDirection:"vertical"},fileExtension:{title:"File Extension",type:p.ControlType.String,defaultValue:"json",hidden:e=>e.source!=="file"},autoResolveConflicts:{title:"Auto Resolve Conflicts",type:p.ControlType.Boolean,defaultValue:!0},...Ne};p.addPropertyControls(Ei,pc);function hc(e){return e.explicitDecisions.map(t=>F.match(t).returnType().with({type:c.AttributeType.Choice},n=>({type:c.AttributeType.Choice,attributeId:n.attributeId,choiceValueId:n.choiceValueId,state:n.state})).with({type:c.AttributeType.Numeric},n=>({type:c.AttributeType.Numeric,attributeId:n.attributeId,state:n.state})).with({type:c.AttributeType.Boolean},n=>({type:c.AttributeType.Boolean,attributeId:n.attributeId,state:n.state})).with({type:c.AttributeType.Component},n=>({type:c.AttributeType.Component,attributeId:n.attributeId,state:n.state})).exhaustive())}function mc(e){return()=>new Promise(t=>{const n=document.createElement("input");n.type="file",n.accept=`.${e}`,n.onchange=o=>{const i=o.target;if(!i.files||i.files.length===0){t(C.left(3));return}const r=i.files[0],l=new FileReader;l.onload=()=>{t(C.right(l.result))},l.onerror=()=>{t(C.left(4))},l.readAsText(r)},n.oncancel=()=>{t(C.left(3))},n.click()})}function yc(){return()=>navigator.clipboard.readText().then(e=>e?C.right(e):C.left(5)).catch(()=>C.left(6))}function bc(e,t){return C.pipe(e==="file"?mc(t):yc(),C.TE.chainEitherK(n=>C.E.tryCatch(()=>JSON.parse(n),()=>0)),C.TE.filterOrElse(n=>n.type==="spc-stored-configuration",()=>1),C.TE.filterOrElse(n=>{var o;return((o=n.storedConfiguration)==null?void 0:o.schemaVersion)===1},()=>2),C.TE.map(n=>n.storedConfiguration),C.TE.doIfLeft(n=>()=>{console.debug(`Failed to load stored configuration: ${Ai[n]}`),n==4?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==2?alert("The specific configuration is not supported. Maybe the configuration was created with new application version than the current one."):n==6?alert("Can't read the clipboard. Make to give a permission for reading the clipboard."):n==5&&alert("The clipboard doesn't contain a configuration.")}),C.TO.fromTaskEither)()}const Ii=se(e=>{const{fallback:t}=e,n=J(e),r=G()?"0.0":(()=>{var a;const l=W.useNumericAttribute(n);if(!l)return"Numeric Attribute not found";const s=(a=l.attribute.decision)==null?void 0:a.state;return s!=null?s.toLocaleString():t})();return f.jsx(mt,{...e,text:r})}),gc=Ii,xc={...re,fallback:{title:"Unselected Text",type:p.ControlType.String,defaultValue:""},...nn("<NumericValue>")};p.addPropertyControls(Ii,xc);exports.AttributeName=oc;exports.BooleanSelect=Sa;exports.ChoiceSelect=Ca;exports.ChoiceValueListRenderer=Xa;exports.ChoiceValueName=rc;exports.Colorize=za;exports.ComponentSelect=Aa;exports.Configuration=Ls;exports.InitializationRetry=qa;exports.NumericInput=Ia;exports.ReplaceText=mt;exports.ResetConfiguration=Na;exports.RestoreConfiguration=fc;exports.SatisfactionIndicator=La;exports.ScrollIntoView=bi;exports.SelectedNumericValue=gc;exports.SelectionIndicator=$a;exports.SelectionToggle=Va;exports.SetSelection=Oa;exports.SetSelections=ja;exports.Singleton=at;exports.Slot=Si;exports.StoreConfiguration=Ti;exports.attributeIdPropertyControls=re;exports.choiceValueIdPropertyControls=Be;exports.cloneChildrenWithProps=pe;exports.explainableComponent=fe;exports.parseGlobalAttributeId=J;exports.useAttributeName=dt;exports.useChoiceValueName=io;exports.useChoiceValueNames=qe;exports.useControlId=ae;exports.useDebounceValue=si;exports.useExplain=de;exports.useExplainProcess=ye;exports.useRenderPlaceholder=G;exports.useSortedChoiceValues=ct;exports.withControlId=tn;exports.withErrorBoundary=se;exports.withFullSize=Ua;
|