@viamedici-spc/configurator-framer-bundle 0.1.0-alpha0002 → 0.1.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.
Files changed (3) hide show
  1. package/dist/index.cjs +41 -39
  2. package/dist/index.js +2033 -2000
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),X=require("react/jsx-runtime"),yt=require("framer"),Wg=require("framer-motion");function Kg(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const pp=Kg(R);var Jg=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},Yg=function(t){return function(){return{concat:function(e,n){return function(r){return t.concat(e(r),n(r))}}}}},Xg=function(t){var e=Yg(t);return function(){return{concat:e().concat,empty:function(){return t.empty}}}};function zr(t){return t}function ru(t){return function(){return t}}var Zg=ru(null),vp=ru(void 0),Ar=vp;function Pn(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function m(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return s(u(a(o(i(r(n(e(t))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var mr=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(i){return e.apply(void 0,Jg([i],r,!1))}}},Qg=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},tb=function(t){return t._tag==="None"},Jl=function(t){return t._tag==="Some"},iu={_tag:"None"},ou=function(t){return{_tag:"Some",value:t}},eb=function(t){return t._tag==="Left"},au=function(t){return{_tag:"Left",left:t}},su=function(t){return{_tag:"Right",right:t}},nb=function(t){return[t]},rb=function(t){return t.length>0},ib=function(t){return t[0]},ob=function(t){return t.slice(1)},ab=[],sb={},ub=Object.prototype.hasOwnProperty,cb=function(t){return Qg([t[0]],t.slice(1),!0)};function lb(t,e){return function(n){return function(r){return t.ap(t.map(r,function(i){return function(o){return e.ap(i,o)}}),n)}}}function fb(t){return function(e){return{concat:function(n,r){return t.ap(t.map(n,function(i){return function(o){return e.concat(i,o)}}),r)}}}}function yp(t,e,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,e===0?t.apply(null,i):yp(t,e-1,i)}}function db(t){var e=t.length;switch(e){case 1:return function(n){var r;return r={},r[t[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[t[0]]=n,i[t[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[t[0]]=n,o[t[1]]=r,o[t[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[t[0]]=n,a[t[1]]=r,a[t[2]]=i,a[t[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return u={},u[t[0]]=n,u[t[1]]=r,u[t[2]]=i,u[t[3]]=o,u[t[4]]=a,u}}}}};default:return yp(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<e;o++)i[t[o]]=n[o];return i},e-1,[])}}function hb(t){return function(e){for(var n=Object.keys(e),r=n.length,i=db(n),o=t.map(e[n[0]],i),a=1;a<r;a++)o=t.ap(o,e[n[a]]);return o}}function pb(t,e){return function(n){return function(r){return t.map(r,function(i){return e.map(i,n)})}}}function vb(t){var e=fb(t);return function(n){return{concat:e(n).concat,empty:t.of(n.empty)}}}function yb(t){return function(e,n){return t.chain(e,function(r){return t.map(n(r),function(){return r})})}}function mp(t){return function(e){return function(n){return t.fromEither(tb(n)?au(e()):su(n.value))}}}function mb(t,e){return function(n,r){return function(i){return e.chain(i,function(o){return t.fromEither(n(o)?su(o):au(r(o)))})}}}var ho=function(t){return{equals:function(e,n){return e===n||t(e,n)}}},Xn=function(t){return ho(function(e,n){for(var r in t)if(!t[r].equals(e[r],n[r]))return!1;return!0})},gb={equals:function(t,e){return t===e}},bb=function(t){return function(e,n){return e===n||t.compare(e,n)>-1?e:n}};function Sb(t,e){return t<e?-1:t>e?1:0}var Cb={equals:gb.equals,compare:Sb},wb=Cb,Tb=function(t){return{concat:bb(t)}},Ib=Tb,et=iu,wt=ou;function Eb(t){return function(e){return t(e)?wt(e):et}}var xb=function(t,e){return m(t,F(e))},Ab=function(t,e){return m(t,Db(e))},$b="Option",Oa=function(t){return{equals:function(e,n){return e===n||(Mn(e)?Mn(n):Mn(n)?!1:t.equals(e.value,n.value))}}},F=function(t){return function(e){return Mn(e)?et:wt(t(e.value))}},_r=wt,Db=function(t){return function(e){return Mn(e)||Mn(t)?et:wt(e.value(t.value))}},Ob={URI:$b,map:xb,ap:Ab,of:_r},gp=mr(2,function(t,e){return Mn(t)?et:e(t.value)}),Nb=mr(2,function(t,e){return Mn(t)?e():t}),ld=Nb,Pb=gp(zr),Te=function(t){return function(e){return Mn(e)?et:t(e.value)?e:et}},Ho=Jl,Mn=function(t){return t._tag==="None"},Mb=function(t,e){return function(n){return Mn(n)?t():e(n.value)}},lr=Mb,bp=lr,Rb=function(t){return function(e){return Mn(e)?t():e.value}},Gt=Rb,Lc=Pb,st=function(t){return t==null?et:wt(t)},Mr=lr(Zg,zr),ie=lr(vp,zr),bn=gp,_b=vb(Ob),uu={equals:function(t,e){return t===e}},jb={equals:uu.equals,compare:function(t,e){return t<e?-1:t>e?1:0}};uu.equals,jb.compare;globalThis&&globalThis.__spreadArray;var qb=ab,kb=rb,Ub=function(t,e){return t<0||t>=e.length},Bb=function(t,e,n){if(n[t]===e)return n;var r=cb(n);return r[t]=e,r},Vb=function(t){return function(e){if(e.length===1)return e;for(var n=[Gb(e)],r=zb(e),i=function(s){n.every(function(c){return!t.equals(c,s)})&&n.push(s)},o=0,a=r;o<a.length;o++){var u=a[o];i(u)}return n}},Fb=nb,Lb=ib,Gb=Lb,zb=ob;globalThis&&globalThis.__spreadArray;var Ps=function(t){return t.length===0},cu=kb,Hb=function(t){return function(e){if(Ps(e))return Ip;for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}},Wb=Ub,Kb=function(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return ou(n);return iu}};function Me(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return ou(e[n]);return iu}}var Jb=function(t,e){return function(n){return Wb(t,n)?iu:ou(nS(t,e(n[t]),n))}},Yb=function(t,e,n){for(var r=[],i=Math.min(t.length,e.length),o=0;o<i;o++)r[o]=n(t[o],e[o]);return r};function Sp(t,e){return e===void 0?function(n){return Sp(n,t)}:Yb(t,e,function(n,r){return[n,r]})}function Cp(t){return function(e,n){if(n===void 0){var r=Cp(t);return function(a){return r(e,a)}}for(var i=function(a){return t.equals(a,e)},o=0;o<n.length;o++)if(i(n[o]))return!0;return!1}}var Ji=function(t){var e=Vb(t);return function(n){return cu(n)?e(n):n}},Xb=function(t){return function(e){return Ps(e)?t:Ps(t)?e:e.concat(t)}},dt=Xb;function wp(t){var e=Cp(t);return function(n,r){if(r===void 0){var i=wp(t);return function(o){return i(o,n)}}return n.filter(function(o){return!e(o,r)})}}var Zb=Fb,Qb=mr(2,function(t,e){return m(t,Hb(function(n,r){return e(r,n)}))}),Tp=Qb(zr),_=function(t){return function(e){return e.map(function(n){return t(n)})}},on=function(t){return function(e){return e.filter(t)}},tS=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Jl(i)&&n.push(i.value)}return n}},po=function(t){return tS(function(e,n){return t(n)})},Gn=po(zr),Gc=function(t,e){return eS(t,function(n,r,i){return e(r,i)})},eS=function(t,e){return function(n){for(var r=n.length,i=t,o=0;o<r;o++)i=e(o,i,n[o]);return i}},Yl=function(t){return ho(function(e,n){return e.length===n.length&&e.every(function(r,i){return t.equals(r,n[i])})})},nS=function(t,e,n){return cu(n)?Bb(t,e,n):n},fd=function(t){return t.slice()},dd=function(t){return Ps(t)?Ip:t.slice()},Ip=qb;function rS(t){return function(e){return e.every(t)}}var jn=Symbol("@ts-pattern/matcher"),Ms="@ts-pattern/anonymous-select-key",zc=function(t){return!!(t&&typeof t=="object")},ps=function(t){return t&&!!t[jn]},Di=function t(e,n,r){if(zc(e)){if(ps(e)){var i=e[jn]().match(n),o=i.matched,a=i.selections;return o&&a&&Object.keys(a).forEach(function(s){return r(s,a[s])}),o}if(!zc(n))return!1;if(Array.isArray(e))return!!Array.isArray(n)&&e.length===n.length&&e.every(function(s,c){return t(s,n[c],r)});if(e instanceof Map)return n instanceof Map&&Array.from(e.keys()).every(function(s){return t(e.get(s),n.get(s),r)});if(e instanceof Set){if(!(n instanceof Set))return!1;if(e.size===0)return n.size===0;if(e.size===1){var u=Array.from(e.values())[0];return ps(u)?Array.from(n.values()).every(function(s){return t(u,s,r)}):n.has(u)}return Array.from(e.values()).every(function(s){return n.has(s)})}return Object.keys(e).every(function(s){var c,l=e[s];return(s in n||ps(c=l)&&c[jn]().matcherType==="optional")&&t(l,n[s],r)})}return Object.is(n,e)},kr=function t(e){var n,r,i;return zc(e)?ps(e)?(n=(r=(i=e[jn]()).getSelectionKeys)==null?void 0:r.call(i))!=null?n:[]:Array.isArray(e)?ha(e,t):ha(Object.values(e),t):[]},ha=function(t,e){return t.reduce(function(n,r){return n.concat(e(r))},[])};function hd(t){var e;return(e={})[jn]=function(){return{match:function(n){var r={},i=function(o,a){r[o]=a};return n===void 0?(kr(t).forEach(function(o){return i(o,void 0)}),{matched:!0,selections:r}):{matched:Di(t,n,i),selections:r}},getSelectionKeys:function(){return kr(t)},matcherType:"optional"}},e}function pd(t){var e;return(e={})[jn]=function(){return{match:function(n){if(!Array.isArray(n))return{matched:!1};var r={};if(n.length===0)return kr(t).forEach(function(o){r[o]=[]}),{matched:!0,selections:r};var i=function(o,a){r[o]=(r[o]||[]).concat([a])};return{matched:n.every(function(o){return Di(t,o,i)}),selections:r}},getSelectionKeys:function(){return kr(t)}}},e}function vd(){var t,e=[].slice.call(arguments);return(t={})[jn]=function(){return{match:function(n){var r={},i=function(o,a){r[o]=a};return{matched:e.every(function(o){return Di(o,n,i)}),selections:r}},getSelectionKeys:function(){return ha(e,kr)},matcherType:"and"}},t}function yd(){var t,e=[].slice.call(arguments);return(t={})[jn]=function(){return{match:function(n){var r={},i=function(o,a){r[o]=a};return ha(e,kr).forEach(function(o){return i(o,void 0)}),{matched:e.some(function(o){return Di(o,n,i)}),selections:r}},getSelectionKeys:function(){return ha(e,kr)},matcherType:"or"}},t}function md(t){var e;return(e={})[jn]=function(){return{match:function(n){return{matched:!Di(t,n,function(){})}},getSelectionKeys:function(){return[]},matcherType:"not"}},e}function Hn(t){var e;return(e={})[jn]=function(){return{match:function(n){return{matched:!!t(n)}}}},e}function gd(){var t,e=[].slice.call(arguments),n=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return(t={})[jn]=function(){return{match:function(i){var o,a=((o={})[n??Ms]=i,o);return{matched:r===void 0||Di(r,i,function(u,s){a[u]=s}),selections:a}},getSelectionKeys:function(){return[n??Ms].concat(r===void 0?[]:kr(r))}}},t}var Ep=Hn(function(t){return!0}),iS=Ep,oS=Hn(function(t){return typeof t=="string"}),aS=Hn(function(t){return typeof t=="number"}),sS=Hn(function(t){return typeof t=="boolean"}),uS=Hn(function(t){return typeof t=="bigint"}),cS=Hn(function(t){return typeof t=="symbol"}),lS=Hn(function(t){return t==null}),Kt={__proto__:null,optional:hd,array:pd,intersection:vd,union:yd,not:md,when:Hn,select:gd,any:Ep,_:iS,string:oS,number:aS,boolean:sS,bigint:uS,symbol:cS,nullish:lS,instanceOf:function(t){return Hn(function(e){return function(n){return n instanceof e}}(t))},typed:function(){return{array:pd,optional:hd,intersection:vd,union:yd,not:md,select:gd,when:Hn}}};function K(t){return new fS(t,[])}var fS=function(){function t(n,r){this.value=void 0,this.cases=void 0,this.value=n,this.cases=r}var e=t.prototype;return e.with=function(){var n=[].slice.call(arguments),r=n[n.length-1],i=[n[0]],o=[];return n.length===3&&typeof n[1]=="function"?(i.push(n[0]),o.push(n[1])):n.length>2&&i.push.apply(i,n.slice(1,n.length-1)),new t(this.value,this.cases.concat([{match:function(a){var u={},s=!!(i.some(function(c){return Di(c,a,function(l,d){u[l]=d})})&&o.every(function(c){return c(a)}));return{matched:s,value:s&&Object.keys(u).length?Ms in u?u[Ms]:u:a}},handler:r}]))},e.when=function(n,r){return new t(this.value,this.cases.concat([{match:function(i){return{matched:!!n(i),value:i}},handler:r}]))},e.otherwise=function(n){return new t(this.value,this.cases.concat([{match:function(r){return{matched:!0,value:r}},handler:n}])).run()},e.exhaustive=function(){return this.run()},e.run=function(){for(var n=this.value,r=void 0,i=0;i<this.cases.length;i++){var o=this.cases[i],a=o.match(this.value);if(a.matched){n=a.value,r=o.handler;break}}if(!r){var u;try{u=JSON.stringify(this.value)}catch{u=this.value}throw new Error("Pattern matching error: no pattern matches value "+u)}return r(n,this.value)},t}(),Xt={equals:function(t,e){return t===e}};Xt.equals;var Xl={equals:function(t,e){return t===e}};Xl.equals;var dS=function(t){return function(e){for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}};function ii(t){return Me(t)}var vs=function(t){return function(e){return e.map(function(n){return t(n)})}},hS=mr(2,function(t,e){return m(t,dS(function(n,r){return e(r,n)}))}),pS=hS(zr),vS=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Jl(i)&&n.push(i.value)}return n}},Sr=function(t){return vS(function(e,n){return t(n)})},yS=function(t){return function(e){return e.filter(t)}},Zl=au,lu=su,xp=function(t,e){return m(t,gS(e))},mS=function(t,e){return m(t,CS(e))},Ql="Either",gS=function(t){return function(e){return Ur(e)?e:lu(t(e.right))}},bS={URI:Ql,map:xp},SS=function(t){return function(e){return Ur(e)?e:Ur(t)?t:lu(e.right(t.right))}},CS=SS,wS={URI:Ql,map:xp,ap:mS},TS=function(t){return function(e){return Ur(e)?Zl(t(e.left)):e}},Ap={URI:Ql,fromEither:zr},IS=mp(Ap),Ur=eb,ES=function(t,e){return function(n){return Ur(n)?t(n.left):e(n.right)}},ai=ES;Ap.fromEither;var xS=function(t){return Ur(t)?lu(t.left):Zl(t.right)};function AS(t){return Pn(lu,t.of)}function $S(t){return Pn(Zl,t.of)}function DS(t){return pb(t,bS)}function OS(t){return lb(t,wS)}function NS(t){return function(e,n){return t.chain(e,function(r){return Ur(r)?t.of(r):n(r.right)})}}function PS(t){return function(e,n){return t.map(e,TS(n))}}function MS(t){return function(e,n){return function(r){return t.map(r,ai(e,n))}}}function RS(t){return function(e){return function(n){return t.chain(n,function(r){return Ur(r)?e(r.left):t.of(r)})}}}function _S(t){return function(e){return t.map(e,xS)}}var jS=function(t){return function(){return Promise.resolve().then(t)}};function qS(t){return function(e){return function(){return new Promise(function(n){setTimeout(function(){Promise.resolve().then(e).then(n)},t)})}}}var fu=function(t,e){return m(t,$p(e))},tf=function(t,e){return m(t,kS(e))},$p=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},kS=function(t){return function(e){return function(){return Promise.all([Promise.resolve().then(e),Promise.resolve().then(t)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Na=function(t){return function(){return Promise.resolve(t)}},ef=mr(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),Pa="Task",du={URI:Pa,map:fu},nf={URI:Pa,of:Na},US={URI:Pa,map:fu,ap:tf},rf={URI:Pa,map:fu,of:Na,ap:tf,chain:ef},BS=zr,bd=ef,Rs={URI:Pa,map:fu,of:Na,ap:tf,chain:ef,fromIO:jS,fromTask:BS},VS=globalThis&&globalThis.__awaiter||function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(l){try{c(r.next(l))}catch(d){a(d)}}function s(l){try{c(r.throw(l))}catch(d){a(d)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((r=r.apply(t,e||[])).next())})},FS=globalThis&&globalThis.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},or=$S(nf),vo=AS(nf),LS=Na,GS=function(t){return $p(IS(t))},_s=MS(du),Sd=function(t,e){return function(){return VS(void 0,void 0,void 0,function(){var n;return FS(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t().then(su)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,au(e(n))];case 3:return[2]}})})}},Dp=RS(rf),Cd=_S(du),Op=function(t,e){return m(t,ve(e))},Np=function(t,e){return m(t,HS(e))},ve=DS(du),zS=mr(2,PS(du)),Dn=zS,HS=OS(US),Pp=mr(2,NS(rf)),Yi=vo,of="TaskEither",WS={URI:of,map:Op,ap:Np,of:Yi},Mp={URI:of,map:Op,ap:Np,chain:Pp},af={URI:of,fromEither:LS},KS=mr(2,yb(Mp)),sf=mp(af);af.fromEither;var JS=mb(af,Mp),YS=Yi(sb),An=Pp,XS=KS,ZS=Object.getOwnPropertyNames,QS=Object.getOwnPropertySymbols,tC=Object.prototype.hasOwnProperty;function wd(t,e){return function(r,i,o){return t(r,i,o)&&e(r,i,o)}}function Ja(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);var o=i.cache,a=o.get(n),u=o.get(r);if(a&&u)return a===r&&u===n;o.set(n,r),o.set(r,n);var s=t(n,r,i);return o.delete(n),o.delete(r),s}}function Td(t){return ZS(t).concat(QS(t))}var Rp=Object.hasOwn||function(t,e){return tC.call(t,e)};function yo(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var _p="_owner",Id=Object.getOwnPropertyDescriptor,Ed=Object.keys;function eC(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function nC(t,e){return yo(t.getTime(),e.getTime())}function xd(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,a,u;(a=i.next())&&!a.done;){for(var s=e.entries(),c=!1,l=0;(u=s.next())&&!u.done;){var d=a.value,f=d[0],h=d[1],v=u.value,p=v[0],S=v[1];!c&&!r[l]&&(c=n.equals(f,p,o,l,t,e,n)&&n.equals(h,S,f,p,t,e,n))&&(r[l]=!0),l++}if(!c)return!1;o++}return!0}function rC(t,e,n){var r=Ed(t),i=r.length;if(Ed(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===_p&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!Rp(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function qo(t,e,n){var r=Td(t),i=r.length;if(Td(e).length!==i)return!1;for(var o,a,u;i-- >0;)if(o=r[i],o===_p&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!Rp(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(a=Id(t,o),u=Id(e,o),(a||u)&&(!a||!u||a.configurable!==u.configurable||a.enumerable!==u.enumerable||a.writable!==u.writable)))return!1;return!0}function iC(t,e){return yo(t.valueOf(),e.valueOf())}function oC(t,e){return t.source===e.source&&t.flags===e.flags}function Ad(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,a;(o=i.next())&&!o.done;){for(var u=e.values(),s=!1,c=0;(a=u.next())&&!a.done;)!s&&!r[c]&&(s=n.equals(o.value,a.value,o.value,a.value,t,e,n))&&(r[c]=!0),c++;if(!s)return!1}return!0}function aC(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var sC="[object Arguments]",uC="[object Boolean]",cC="[object Date]",lC="[object Map]",fC="[object Number]",dC="[object Object]",hC="[object RegExp]",pC="[object Set]",vC="[object String]",yC=Array.isArray,$d=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Dd=Object.assign,mC=Object.prototype.toString.call.bind(Object.prototype.toString);function gC(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,a=t.areRegExpsEqual,u=t.areSetsEqual,s=t.areTypedArraysEqual;return function(l,d,f){if(l===d)return!0;if(l==null||d==null||typeof l!="object"||typeof d!="object")return l!==l&&d!==d;var h=l.constructor;if(h!==d.constructor)return!1;if(h===Object)return i(l,d,f);if(yC(l))return e(l,d,f);if($d!=null&&$d(l))return s(l,d,f);if(h===Date)return n(l,d,f);if(h===RegExp)return a(l,d,f);if(h===Map)return r(l,d,f);if(h===Set)return u(l,d,f);var v=mC(l);return v===cC?n(l,d,f):v===hC?a(l,d,f):v===lC?r(l,d,f):v===pC?u(l,d,f):v===dC?typeof l.then!="function"&&typeof d.then!="function"&&i(l,d,f):v===sC?i(l,d,f):v===uC||v===fC||v===vC?o(l,d,f):!1}}function bC(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?qo:eC,areDatesEqual:nC,areMapsEqual:r?wd(xd,qo):xd,areObjectsEqual:r?qo:rC,arePrimitiveWrappersEqual:iC,areRegExpsEqual:oC,areSetsEqual:r?wd(Ad,qo):Ad,areTypedArraysEqual:r?qo:aC};if(n&&(i=Dd({},i,n(i))),e){var o=Ja(i.areArraysEqual),a=Ja(i.areMapsEqual),u=Ja(i.areObjectsEqual),s=Ja(i.areSetsEqual);i=Dd({},i,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:u,areSetsEqual:s})}return i}function SC(t){return function(e,n,r,i,o,a,u){return t(e,n,u)}}function CC(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(s,c){var l=r(),d=l.cache,f=d===void 0?e?new WeakMap:void 0:d,h=l.meta;return n(s,c,{cache:f,equals:i,meta:h,strict:o})};if(e)return function(s,c){return n(s,c,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var a={cache:void 0,equals:i,meta:void 0,strict:o};return function(s,c){return n(s,c,a)}}var wC=Hr();Hr({strict:!0});Hr({circular:!0});Hr({circular:!0,strict:!0});Hr({createInternalComparator:function(){return yo}});Hr({strict:!0,createInternalComparator:function(){return yo}});Hr({circular:!0,createInternalComparator:function(){return yo}});Hr({circular:!0,createInternalComparator:function(){return yo},strict:!0});function Hr(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,a=o===void 0?!1:o,u=bC(t),s=gC(u),c=r?r(s):SC(s);return CC({circular:n,comparator:s,createState:i,equals:c,strict:a})}function jp(t){return function(e,n){if(n===void 0){var r=jp(t);return function(o){return r(o,e)}}for(var i in e)if(!ub.call(n,i)||!t.equals(e[i],n[i]))return!1;return!0}}function TC(t){var e=jp(t);return ho(function(n,r){return e(n)(r)&&e(r)(n)})}function IC(t){return Pn(wt,t.of)}function EC(t){return ru(t.of(et))}function xC(t){var e=EC(t);return function(n,r){return t.chain(n,lr(function(){return e()},r))}}globalThis&&globalThis.__awaiter;globalThis&&globalThis.__generator;var AC=IC(nf),$C=Na,DC=mr(2,xC(rf)),OC=DC,NC=Xg,aa=m,PC=NC(_b({concat:Ib(wb).concat,empty:0}))();function MC(t){return function(e){return e.iterNumber>=t?et:wt(0)}}function RC(t,e){return function(n){return aa(n,e,F(function(r){return Math.min(t,r)}))}}function _C(t){return function(e){return wt(t*Math.pow(2,e.iterNumber))}}var jC={iterNumber:0,cumulativeDelay:0,previousDelay:et};function qC(t,e){var n=t(e);return{iterNumber:e.iterNumber+1,cumulativeDelay:e.cumulativeDelay+Gt(function(){return 0})(n),previousDelay:n}}function kC(t,e){var n=qC(t,e);return aa(n.previousDelay,bp(function(){return Rs.of(n)},function(r){return qS(r)(Rs.of(n))}))}function Mi(t,e,n){var r=function(i){return aa(i,e,bd(function(o){return n(o)?aa(kC(t,i),bd(function(a){return aa(a.previousDelay,bp(function(){return Rs.of(o)},function(){return r(a)}))})):Rs.of(o)}))};return r(jC)}function UC(t){return e=>m(e,ve(n=>(t(n)(),n)))}const pa=UC;function js(t){return e=>m(e,Cd,pa(t),Cd)}function BC(t){return e=>m(e,pa(n=>()=>t(n)()),js(n=>()=>t(n)()))}function VC(t){return e=>m(e,F(n=>(t(n)(),n)))}const FC=VC;function uf(t){return{equals(e,n){return e==null&&n==null?!0:e==null||n===null||n===void 0?!1:t.equals(e,n)}}}function Ma(t){return{equals(e,n){const r=m(st(e),Gt(()=>[])),i=m(st(n),Gt(()=>[]));return Yl(t).equals(r,i)}}}const Oi=Xn({localId:Xt,componentPath:Ma(Xt),sharedConfigurationModelId:uf(Xt)}),qp=Xn({localId:Xt,configurationModelId:Xt}),kp=ho((t,e)=>K({x:t,y:e}).with({x:{type:"Choice"},y:{type:"Choice"}},n=>LC.equals(n.x,n.y)).with({x:{type:"Component"},y:{type:"Component"}},n=>GC.equals(n.x,n.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},n=>zC.equals(n.x,n.y)).with({x:{type:"Boolean"},y:{type:"Boolean"}},n=>HC.equals(n.x,n.y)).otherwise(()=>!1)),LC=Xn({type:Xt,attributeId:Oi,state:Xt,choiceValueId:Xt}),GC=Xn({type:Xt,attributeId:Oi,state:Xt}),zC=Xn({type:Xt,attributeId:Oi,state:uu}),HC=Xn({type:Xt,attributeId:Oi,state:Xl});var ze=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(ze||{}),He=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(He||{}),Qi=(t=>(t.Rule="Rule",t.Cardinality="Cardinality",t.Component="Component",t))(Qi||{}),va=(t=>(t.all="all",t.none="none",t.specific="specific",t))(va||{}),fr=(t=>(t.Channel="Channel",t.Package="Package",t))(fr||{}),kt=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(kt||{}),dr=(t=>(t.Included="Included",t.Excluded="Excluded",t))(dr||{}),Br=(t=>(t.Included="Included",t.Excluded="Excluded",t))(Br||{}),hr=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(hr||{}),yi=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(yi||{}),mi=(t=>(t.Always="Always",t.Optional="Optional",t))(mi||{});const WC=Object.freeze(Object.defineProperty({__proto__:null,AllowedRulesInExplainType:va,AttributeType:kt,ChoiceValueDecisionState:dr,ComponentDecisionState:Br,ConfigurationModelSourceType:fr,ConstraintType:Qi,DecisionKind:hr,ExplainQuestionSubject:He,ExplainQuestionType:ze,Inclusion:mi,Selection:yi,eqCausedByDecision:kp,eqGlobalAttributeId:Oi,eqGlobalConstraintId:qp},Symbol.toStringTag,{value:"Module"}));var pe=(t=>(t.Unknown="Unknown",t.CommunicationError="Local.LowLevelCommunicationError",t.ServiceError="ServiceError",t.ConfigurationConflict="ConfigurationConflict",t.ConfigurationUnauthenticated="ConfigurationUnauthenticated",t.ConfigurationUnauthorized="ConfigurationUnauthorized",t.ConfigurationApplicationError="ConfigurationApplicationError",t.ConfigurationTimeout="ConfigurationTimeout",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConfigurationAttributeNotFound="ConfigurationAttributeNotFound",t.ConfigurationSolutionNotAvailable="ConfigurationSolutionNotAvailable",t.ConfigurationRejectedDecisionsConflict="ConfigurationRejectedDecisionsConflict",t.ConfigurationChoiceValueNotFound="ConfigurationChoiceValueNotFound",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.ConfigurationInitializationFailure="ConfigurationInitializationFailure",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t.ConfigurationSetManyConflict="ConfigurationSetManyConflict",t))(pe||{}),hu=(t=>(t[t.NumericDecisionOutOfRange=0]="NumericDecisionOutOfRange",t))(hu||{});const Up={createConfigurationRejectedDecisionsConflict(t){return{type:"ConfigurationRejectedDecisionsConflict",rejectedDecisions:t}}},KC=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationConflictReason:hu,FailureResultFactory:Up,FailureType:pe},Symbol.toStringTag,{value:"Module"}));let Bp=class{mapToCreateSessionRequest(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),attributeRelations:this.mapToAttributeRelations(e.attributeRelations),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters),allowedInExplain:this.mapToAllowedInExplain(e.allowedInExplain)}}mapToConfigurationModelSource(e){return K(e).with({type:fr.Channel},n=>({type:"Channel",deploymentName:n.deploymentName,channel:n.channel})).with({type:fr.Package},n=>({type:"Package",configurationModelPackage:n.configurationModelPackage})).exhaustive()}mapToAttributeRelations(e){return m(e,st,F(Pn(_(n=>this.mapToDecisionsToRespect(n)),n=>[...n])),ie)}mapToDecisionsToRespect(e){return{attributeId:e.attributeId,decisions:m([...e.decisions],vs(n=>this.mapToGlobalAttributeId(n)))}}mapToUsageRuleParameters(e){return m(st(e),ie)}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:e.componentPath,sharedConfigurationModelId:e.sharedConfigurationModelId}}mapToAllowedInExplain(e){return K(e).with({rules:{type:va.none}},n=>({rules:{type:"AllowedRulesNone"}})).with({rules:{type:va.specific,rules:Kt.array(Kt.any)}},n=>({rules:{type:"AllowedRulesSpecific",rules:m(n.rules.rules,_(r=>this.mapToGlobalConstraintId(r)),r=>[...r])}})).otherwise(()=>({rules:{type:"AllowedRulesAll"}}))}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}};function JC(t){return e=>JS(n=>n!=null,t)(e)}function YC(){return vo(Ar())}var hn=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(hn||{}),di=(t=>(t.decisions="decisions",t.constraints="constraints",t.all="all",t))(di||{}),Re=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(Re||{});const Fe=Xn({localId:Xt,componentPath:Ma(Xt),sharedConfigurationModel:uf(Xt)}),XC=Oa(Yl(Xn({attributeId:Fe,decisions:Ma(Fe)}))),ZC=Xn({configurationModelSource:ho((t,e)=>wC(t,e)),decisionsToRespect:XC,usageRuleParameters:TC(Xt)});var ya=(t=>(t.Channel="Channel",t.Package="Package",t))(ya||{}),Ut=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(Ut||{}),ot=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.ChoiceValue="ChoiceValue",t.Component="Component",t))(ot||{}),me=(t=>(t.Included="Included",t.Excluded="Excluded",t))(me||{}),ue=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(ue||{}),gi=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(gi||{}),bi=(t=>(t.Always="Always",t.Optional="Optional",t))(bi||{});const QC={equals:(t,e)=>t.choiceValueId!==e.choiceValueId?!1:Oa(Xt).equals(t.state,e.state)},tw={equals(t,e){return Oa(uu).equals(t.value,e.value)}},ew={equals(t,e){return Oa(Xl).equals(t.value,e.value)}},nw={equals(t,e){return Oa(Xt).equals(t.state,e.state)}},rw={equals(t,e){return Fe.equals(t.attributeId,e.attributeId)?K({x:t,y:e}).with({x:{type:"Boolean"},y:{type:"Boolean"}},(n,r)=>ew.equals(r.x,r.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},(n,r)=>tw.equals(r.x,r.y)).with({x:{type:"Component"},y:{type:"Component"}},(n,r)=>nw.equals(r.x,r.y)).with({x:{type:"ChoiceValue"},y:{type:"ChoiceValue"}},(n,r)=>QC.equals(r.x,r.y)).otherwise(()=>!1):!1}},iw=Yl(rw),ow={equals:(t,e)=>iw.equals(t.decisions,e.decisions)&&aw.equals(t.mode,e.mode)},aw={equals:(t,e)=>K({x:t,y:e}).with({x:{type:"Default"},y:{type:"Default"}},n=>!0).with({x:{type:"DropExistingDecisions"},y:{type:"DropExistingDecisions"}},n=>!0).otherwise(()=>!1)};var Hc=(t=>(t.NotAvailable="NotAvailable",t.StateNotPossible="StateNotPossible",t))(Hc||{}),to=(t=>(t.Rule="Rule",t.Cardinality="Cardinality",t.Component="Component",t))(to||{}),nt=(t=>(t.ServiceError="ServiceError",t.Unknown="Unknown",t.CommunicationError="CommunicationError",t.ConfigurationConflict="ConfigurationConflict",t.ConfigurationSolutionNotAvailable="ConfigurationSolutionNotAvailable",t.ConfigurationAttributeNotFound="ConfigurationAttributeNotFound",t.ConfigurationChoiceValueNotFound="ConfigurationChoiceValueNotFound",t.ConfigurationUnauthenticated="ConfigurationUnauthenticated",t.ConfigurationApplicationError="ConfigurationApplicationError",t.ConfigurationTimeout="ConfigurationTimeout",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConfigurationRejectedDecisionsConflict="ConfigurationRejectedDecisionsConflict",t.ConfigurationSetManyConflict="ConfigurationSetManyConflict",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.ConfigurationInitializationFailure="ConfigurationInitializationFailure",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t))(nt||{}),cf=(t=>(t[t.NumericDecisionOutOfRange=0]="NumericDecisionOutOfRange",t))(cf||{});const sw={createConfigurationRejectedDecisionsConflict(t){return{type:"ConfigurationRejectedDecisionsConflict",rejectedDecisions:t}}};function uw(t,e){console.log(`--------------------------------------------------------------------------------
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),X=require("react/jsx-runtime"),pt=require("framer"),Kg=require("framer-motion");function Yg(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const pp=Yg(R);var Jg=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},Xg=function(t){return function(){return{concat:function(e,n){return function(r){return t.concat(e(r),n(r))}}}}},Zg=function(t){var e=Xg(t);return function(){return{concat:e().concat,empty:function(){return t.empty}}}};function zr(t){return t}function ru(t){return function(){return t}}var Qg=ru(null),vp=ru(void 0),Ar=vp;function Pn(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function m(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return s(u(a(o(i(r(n(e(t))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var mr=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(i){return e.apply(void 0,Jg([i],r,!1))}}},tb=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},eb=function(t){return t._tag==="None"},Yl=function(t){return t._tag==="Some"},iu={_tag:"None"},ou=function(t){return{_tag:"Some",value:t}},nb=function(t){return t._tag==="Left"},au=function(t){return{_tag:"Left",left:t}},su=function(t){return{_tag:"Right",right:t}},rb=function(t){return[t]},ib=function(t){return t.length>0},ob=function(t){return t[0]},ab=function(t){return t.slice(1)},sb=[],ub={},cb=Object.prototype.hasOwnProperty,lb=function(t){return tb([t[0]],t.slice(1),!0)};function fb(t,e){return function(n){return function(r){return t.ap(t.map(r,function(i){return function(o){return e.ap(i,o)}}),n)}}}function db(t){return function(e){return{concat:function(n,r){return t.ap(t.map(n,function(i){return function(o){return e.concat(i,o)}}),r)}}}}function yp(t,e,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,e===0?t.apply(null,i):yp(t,e-1,i)}}function hb(t){var e=t.length;switch(e){case 1:return function(n){var r;return r={},r[t[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[t[0]]=n,i[t[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[t[0]]=n,o[t[1]]=r,o[t[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[t[0]]=n,a[t[1]]=r,a[t[2]]=i,a[t[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return u={},u[t[0]]=n,u[t[1]]=r,u[t[2]]=i,u[t[3]]=o,u[t[4]]=a,u}}}}};default:return yp(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<e;o++)i[t[o]]=n[o];return i},e-1,[])}}function pb(t){return function(e){for(var n=Object.keys(e),r=n.length,i=hb(n),o=t.map(e[n[0]],i),a=1;a<r;a++)o=t.ap(o,e[n[a]]);return o}}function vb(t,e){return function(n){return function(r){return t.map(r,function(i){return e.map(i,n)})}}}function yb(t){var e=db(t);return function(n){return{concat:e(n).concat,empty:t.of(n.empty)}}}function mb(t){return function(e,n){return t.chain(e,function(r){return t.map(n(r),function(){return r})})}}function mp(t){return function(e){return function(n){return t.fromEither(eb(n)?au(e()):su(n.value))}}}function gb(t,e){return function(n,r){return function(i){return e.chain(i,function(o){return t.fromEither(n(o)?su(o):au(r(o)))})}}}var ho=function(t){return{equals:function(e,n){return e===n||t(e,n)}}},Xn=function(t){return ho(function(e,n){for(var r in t)if(!t[r].equals(e[r],n[r]))return!1;return!0})},bb={equals:function(t,e){return t===e}},Sb=function(t){return function(e,n){return e===n||t.compare(e,n)>-1?e:n}};function Cb(t,e){return t<e?-1:t>e?1:0}var wb={equals:bb.equals,compare:Cb},Tb=wb,Ib=function(t){return{concat:Sb(t)}},Eb=Ib,et=iu,wt=ou;function xb(t){return function(e){return t(e)?wt(e):et}}var Ab=function(t,e){return m(t,F(e))},$b=function(t,e){return m(t,Ob(e))},Db="Option",Oa=function(t){return{equals:function(e,n){return e===n||(Mn(e)?Mn(n):Mn(n)?!1:t.equals(e.value,n.value))}}},F=function(t){return function(e){return Mn(e)?et:wt(t(e.value))}},_r=wt,Ob=function(t){return function(e){return Mn(e)||Mn(t)?et:wt(e.value(t.value))}},Nb={URI:Db,map:Ab,ap:$b,of:_r},gp=mr(2,function(t,e){return Mn(t)?et:e(t.value)}),Pb=mr(2,function(t,e){return Mn(t)?e():t}),ld=Pb,Mb=gp(zr),Te=function(t){return function(e){return Mn(e)?et:t(e.value)?e:et}},Ho=Yl,Mn=function(t){return t._tag==="None"},Rb=function(t,e){return function(n){return Mn(n)?t():e(n.value)}},lr=Rb,bp=lr,_b=function(t){return function(e){return Mn(e)?t():e.value}},Gt=_b,Lc=Mb,st=function(t){return t==null?et:wt(t)},Mr=lr(Qg,zr),ie=lr(vp,zr),bn=gp,jb=yb(Nb),uu={equals:function(t,e){return t===e}},qb={equals:uu.equals,compare:function(t,e){return t<e?-1:t>e?1:0}};uu.equals,qb.compare;globalThis&&globalThis.__spreadArray;var kb=sb,Ub=ib,Bb=function(t,e){return t<0||t>=e.length},Vb=function(t,e,n){if(n[t]===e)return n;var r=lb(n);return r[t]=e,r},Fb=function(t){return function(e){if(e.length===1)return e;for(var n=[zb(e)],r=Hb(e),i=function(s){n.every(function(c){return!t.equals(c,s)})&&n.push(s)},o=0,a=r;o<a.length;o++){var u=a[o];i(u)}return n}},Lb=rb,Gb=ob,zb=Gb,Hb=ab;globalThis&&globalThis.__spreadArray;var Ps=function(t){return t.length===0},cu=Ub,Wb=function(t){return function(e){if(Ps(e))return Ip;for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}},Kb=Bb,Yb=function(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return ou(n);return iu}};function Me(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return ou(e[n]);return iu}}var Jb=function(t,e){return function(n){return Kb(t,n)?iu:ou(rS(t,e(n[t]),n))}},Xb=function(t,e,n){for(var r=[],i=Math.min(t.length,e.length),o=0;o<i;o++)r[o]=n(t[o],e[o]);return r};function Sp(t,e){return e===void 0?function(n){return Sp(n,t)}:Xb(t,e,function(n,r){return[n,r]})}function Cp(t){return function(e,n){if(n===void 0){var r=Cp(t);return function(a){return r(e,a)}}for(var i=function(a){return t.equals(a,e)},o=0;o<n.length;o++)if(i(n[o]))return!0;return!1}}var Yi=function(t){var e=Fb(t);return function(n){return cu(n)?e(n):n}},Zb=function(t){return function(e){return Ps(e)?t:Ps(t)?e:e.concat(t)}},dt=Zb;function wp(t){var e=Cp(t);return function(n,r){if(r===void 0){var i=wp(t);return function(o){return i(o,n)}}return n.filter(function(o){return!e(o,r)})}}var Qb=Lb,tS=mr(2,function(t,e){return m(t,Wb(function(n,r){return e(r,n)}))}),Tp=tS(zr),_=function(t){return function(e){return e.map(function(n){return t(n)})}},on=function(t){return function(e){return e.filter(t)}},eS=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Yl(i)&&n.push(i.value)}return n}},po=function(t){return eS(function(e,n){return t(n)})},Gn=po(zr),Gc=function(t,e){return nS(t,function(n,r,i){return e(r,i)})},nS=function(t,e){return function(n){for(var r=n.length,i=t,o=0;o<r;o++)i=e(o,i,n[o]);return i}},Jl=function(t){return ho(function(e,n){return e.length===n.length&&e.every(function(r,i){return t.equals(r,n[i])})})},rS=function(t,e,n){return cu(n)?Vb(t,e,n):n},fd=function(t){return t.slice()},dd=function(t){return Ps(t)?Ip:t.slice()},Ip=kb;function iS(t){return function(e){return e.every(t)}}var jn=Symbol("@ts-pattern/matcher"),Ms="@ts-pattern/anonymous-select-key",zc=function(t){return!!(t&&typeof t=="object")},ps=function(t){return t&&!!t[jn]},Di=function t(e,n,r){if(zc(e)){if(ps(e)){var i=e[jn]().match(n),o=i.matched,a=i.selections;return o&&a&&Object.keys(a).forEach(function(s){return r(s,a[s])}),o}if(!zc(n))return!1;if(Array.isArray(e))return!!Array.isArray(n)&&e.length===n.length&&e.every(function(s,c){return t(s,n[c],r)});if(e instanceof Map)return n instanceof Map&&Array.from(e.keys()).every(function(s){return t(e.get(s),n.get(s),r)});if(e instanceof Set){if(!(n instanceof Set))return!1;if(e.size===0)return n.size===0;if(e.size===1){var u=Array.from(e.values())[0];return ps(u)?Array.from(n.values()).every(function(s){return t(u,s,r)}):n.has(u)}return Array.from(e.values()).every(function(s){return n.has(s)})}return Object.keys(e).every(function(s){var c,l=e[s];return(s in n||ps(c=l)&&c[jn]().matcherType==="optional")&&t(l,n[s],r)})}return Object.is(n,e)},kr=function t(e){var n,r,i;return zc(e)?ps(e)?(n=(r=(i=e[jn]()).getSelectionKeys)==null?void 0:r.call(i))!=null?n:[]:Array.isArray(e)?ha(e,t):ha(Object.values(e),t):[]},ha=function(t,e){return t.reduce(function(n,r){return n.concat(e(r))},[])};function hd(t){var e;return(e={})[jn]=function(){return{match:function(n){var r={},i=function(o,a){r[o]=a};return n===void 0?(kr(t).forEach(function(o){return i(o,void 0)}),{matched:!0,selections:r}):{matched:Di(t,n,i),selections:r}},getSelectionKeys:function(){return kr(t)},matcherType:"optional"}},e}function pd(t){var e;return(e={})[jn]=function(){return{match:function(n){if(!Array.isArray(n))return{matched:!1};var r={};if(n.length===0)return kr(t).forEach(function(o){r[o]=[]}),{matched:!0,selections:r};var i=function(o,a){r[o]=(r[o]||[]).concat([a])};return{matched:n.every(function(o){return Di(t,o,i)}),selections:r}},getSelectionKeys:function(){return kr(t)}}},e}function vd(){var t,e=[].slice.call(arguments);return(t={})[jn]=function(){return{match:function(n){var r={},i=function(o,a){r[o]=a};return{matched:e.every(function(o){return Di(o,n,i)}),selections:r}},getSelectionKeys:function(){return ha(e,kr)},matcherType:"and"}},t}function yd(){var t,e=[].slice.call(arguments);return(t={})[jn]=function(){return{match:function(n){var r={},i=function(o,a){r[o]=a};return ha(e,kr).forEach(function(o){return i(o,void 0)}),{matched:e.some(function(o){return Di(o,n,i)}),selections:r}},getSelectionKeys:function(){return ha(e,kr)},matcherType:"or"}},t}function md(t){var e;return(e={})[jn]=function(){return{match:function(n){return{matched:!Di(t,n,function(){})}},getSelectionKeys:function(){return[]},matcherType:"not"}},e}function Hn(t){var e;return(e={})[jn]=function(){return{match:function(n){return{matched:!!t(n)}}}},e}function gd(){var t,e=[].slice.call(arguments),n=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return(t={})[jn]=function(){return{match:function(i){var o,a=((o={})[n??Ms]=i,o);return{matched:r===void 0||Di(r,i,function(u,s){a[u]=s}),selections:a}},getSelectionKeys:function(){return[n??Ms].concat(r===void 0?[]:kr(r))}}},t}var Ep=Hn(function(t){return!0}),oS=Ep,aS=Hn(function(t){return typeof t=="string"}),sS=Hn(function(t){return typeof t=="number"}),uS=Hn(function(t){return typeof t=="boolean"}),cS=Hn(function(t){return typeof t=="bigint"}),lS=Hn(function(t){return typeof t=="symbol"}),fS=Hn(function(t){return t==null}),Kt={__proto__:null,optional:hd,array:pd,intersection:vd,union:yd,not:md,when:Hn,select:gd,any:Ep,_:oS,string:aS,number:sS,boolean:uS,bigint:cS,symbol:lS,nullish:fS,instanceOf:function(t){return Hn(function(e){return function(n){return n instanceof e}}(t))},typed:function(){return{array:pd,optional:hd,intersection:vd,union:yd,not:md,select:gd,when:Hn}}};function K(t){return new dS(t,[])}var dS=function(){function t(n,r){this.value=void 0,this.cases=void 0,this.value=n,this.cases=r}var e=t.prototype;return e.with=function(){var n=[].slice.call(arguments),r=n[n.length-1],i=[n[0]],o=[];return n.length===3&&typeof n[1]=="function"?(i.push(n[0]),o.push(n[1])):n.length>2&&i.push.apply(i,n.slice(1,n.length-1)),new t(this.value,this.cases.concat([{match:function(a){var u={},s=!!(i.some(function(c){return Di(c,a,function(l,d){u[l]=d})})&&o.every(function(c){return c(a)}));return{matched:s,value:s&&Object.keys(u).length?Ms in u?u[Ms]:u:a}},handler:r}]))},e.when=function(n,r){return new t(this.value,this.cases.concat([{match:function(i){return{matched:!!n(i),value:i}},handler:r}]))},e.otherwise=function(n){return new t(this.value,this.cases.concat([{match:function(r){return{matched:!0,value:r}},handler:n}])).run()},e.exhaustive=function(){return this.run()},e.run=function(){for(var n=this.value,r=void 0,i=0;i<this.cases.length;i++){var o=this.cases[i],a=o.match(this.value);if(a.matched){n=a.value,r=o.handler;break}}if(!r){var u;try{u=JSON.stringify(this.value)}catch{u=this.value}throw new Error("Pattern matching error: no pattern matches value "+u)}return r(n,this.value)},t}(),Xt={equals:function(t,e){return t===e}};Xt.equals;var Xl={equals:function(t,e){return t===e}};Xl.equals;var hS=function(t){return function(e){for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}};function ii(t){return Me(t)}var vs=function(t){return function(e){return e.map(function(n){return t(n)})}},pS=mr(2,function(t,e){return m(t,hS(function(n,r){return e(r,n)}))}),vS=pS(zr),yS=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Yl(i)&&n.push(i.value)}return n}},Sr=function(t){return yS(function(e,n){return t(n)})},mS=function(t){return function(e){return e.filter(t)}},Zl=au,lu=su,xp=function(t,e){return m(t,bS(e))},gS=function(t,e){return m(t,wS(e))},Ql="Either",bS=function(t){return function(e){return Ur(e)?e:lu(t(e.right))}},SS={URI:Ql,map:xp},CS=function(t){return function(e){return Ur(e)?e:Ur(t)?t:lu(e.right(t.right))}},wS=CS,TS={URI:Ql,map:xp,ap:gS},IS=function(t){return function(e){return Ur(e)?Zl(t(e.left)):e}},Ap={URI:Ql,fromEither:zr},ES=mp(Ap),Ur=nb,xS=function(t,e){return function(n){return Ur(n)?t(n.left):e(n.right)}},ai=xS;Ap.fromEither;var AS=function(t){return Ur(t)?lu(t.left):Zl(t.right)};function $S(t){return Pn(lu,t.of)}function DS(t){return Pn(Zl,t.of)}function OS(t){return vb(t,SS)}function NS(t){return fb(t,TS)}function PS(t){return function(e,n){return t.chain(e,function(r){return Ur(r)?t.of(r):n(r.right)})}}function MS(t){return function(e,n){return t.map(e,IS(n))}}function RS(t){return function(e,n){return function(r){return t.map(r,ai(e,n))}}}function _S(t){return function(e){return function(n){return t.chain(n,function(r){return Ur(r)?e(r.left):t.of(r)})}}}function jS(t){return function(e){return t.map(e,AS)}}var qS=function(t){return function(){return Promise.resolve().then(t)}};function kS(t){return function(e){return function(){return new Promise(function(n){setTimeout(function(){Promise.resolve().then(e).then(n)},t)})}}}var fu=function(t,e){return m(t,$p(e))},tf=function(t,e){return m(t,US(e))},$p=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},US=function(t){return function(e){return function(){return Promise.all([Promise.resolve().then(e),Promise.resolve().then(t)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Na=function(t){return function(){return Promise.resolve(t)}},ef=mr(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),Pa="Task",du={URI:Pa,map:fu},nf={URI:Pa,of:Na},BS={URI:Pa,map:fu,ap:tf},rf={URI:Pa,map:fu,of:Na,ap:tf,chain:ef},VS=zr,bd=ef,Rs={URI:Pa,map:fu,of:Na,ap:tf,chain:ef,fromIO:qS,fromTask:VS},FS=globalThis&&globalThis.__awaiter||function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(l){try{c(r.next(l))}catch(d){a(d)}}function s(l){try{c(r.throw(l))}catch(d){a(d)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((r=r.apply(t,e||[])).next())})},LS=globalThis&&globalThis.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},or=DS(nf),vo=$S(nf),GS=Na,zS=function(t){return $p(ES(t))},_s=RS(du),Sd=function(t,e){return function(){return FS(void 0,void 0,void 0,function(){var n;return LS(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t().then(su)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,au(e(n))];case 3:return[2]}})})}},Dp=_S(rf),Cd=jS(du),Op=function(t,e){return m(t,ve(e))},Np=function(t,e){return m(t,WS(e))},ve=OS(du),HS=mr(2,MS(du)),Dn=HS,WS=NS(BS),Pp=mr(2,PS(rf)),Ji=vo,of="TaskEither",KS={URI:of,map:Op,ap:Np,of:Ji},Mp={URI:of,map:Op,ap:Np,chain:Pp},af={URI:of,fromEither:GS},YS=mr(2,mb(Mp)),sf=mp(af);af.fromEither;var JS=gb(af,Mp),XS=Ji(ub),An=Pp,ZS=YS,QS=Object.getOwnPropertyNames,tC=Object.getOwnPropertySymbols,eC=Object.prototype.hasOwnProperty;function wd(t,e){return function(r,i,o){return t(r,i,o)&&e(r,i,o)}}function Ya(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);var o=i.cache,a=o.get(n),u=o.get(r);if(a&&u)return a===r&&u===n;o.set(n,r),o.set(r,n);var s=t(n,r,i);return o.delete(n),o.delete(r),s}}function Td(t){return QS(t).concat(tC(t))}var Rp=Object.hasOwn||function(t,e){return eC.call(t,e)};function yo(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var _p="_owner",Id=Object.getOwnPropertyDescriptor,Ed=Object.keys;function nC(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function rC(t,e){return yo(t.getTime(),e.getTime())}function xd(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,a,u;(a=i.next())&&!a.done;){for(var s=e.entries(),c=!1,l=0;(u=s.next())&&!u.done;){var d=a.value,f=d[0],h=d[1],v=u.value,p=v[0],S=v[1];!c&&!r[l]&&(c=n.equals(f,p,o,l,t,e,n)&&n.equals(h,S,f,p,t,e,n))&&(r[l]=!0),l++}if(!c)return!1;o++}return!0}function iC(t,e,n){var r=Ed(t),i=r.length;if(Ed(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===_p&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!Rp(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function qo(t,e,n){var r=Td(t),i=r.length;if(Td(e).length!==i)return!1;for(var o,a,u;i-- >0;)if(o=r[i],o===_p&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!Rp(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(a=Id(t,o),u=Id(e,o),(a||u)&&(!a||!u||a.configurable!==u.configurable||a.enumerable!==u.enumerable||a.writable!==u.writable)))return!1;return!0}function oC(t,e){return yo(t.valueOf(),e.valueOf())}function aC(t,e){return t.source===e.source&&t.flags===e.flags}function Ad(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,a;(o=i.next())&&!o.done;){for(var u=e.values(),s=!1,c=0;(a=u.next())&&!a.done;)!s&&!r[c]&&(s=n.equals(o.value,a.value,o.value,a.value,t,e,n))&&(r[c]=!0),c++;if(!s)return!1}return!0}function sC(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var uC="[object Arguments]",cC="[object Boolean]",lC="[object Date]",fC="[object Map]",dC="[object Number]",hC="[object Object]",pC="[object RegExp]",vC="[object Set]",yC="[object String]",mC=Array.isArray,$d=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Dd=Object.assign,gC=Object.prototype.toString.call.bind(Object.prototype.toString);function bC(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,a=t.areRegExpsEqual,u=t.areSetsEqual,s=t.areTypedArraysEqual;return function(l,d,f){if(l===d)return!0;if(l==null||d==null||typeof l!="object"||typeof d!="object")return l!==l&&d!==d;var h=l.constructor;if(h!==d.constructor)return!1;if(h===Object)return i(l,d,f);if(mC(l))return e(l,d,f);if($d!=null&&$d(l))return s(l,d,f);if(h===Date)return n(l,d,f);if(h===RegExp)return a(l,d,f);if(h===Map)return r(l,d,f);if(h===Set)return u(l,d,f);var v=gC(l);return v===lC?n(l,d,f):v===pC?a(l,d,f):v===fC?r(l,d,f):v===vC?u(l,d,f):v===hC?typeof l.then!="function"&&typeof d.then!="function"&&i(l,d,f):v===uC?i(l,d,f):v===cC||v===dC||v===yC?o(l,d,f):!1}}function SC(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?qo:nC,areDatesEqual:rC,areMapsEqual:r?wd(xd,qo):xd,areObjectsEqual:r?qo:iC,arePrimitiveWrappersEqual:oC,areRegExpsEqual:aC,areSetsEqual:r?wd(Ad,qo):Ad,areTypedArraysEqual:r?qo:sC};if(n&&(i=Dd({},i,n(i))),e){var o=Ya(i.areArraysEqual),a=Ya(i.areMapsEqual),u=Ya(i.areObjectsEqual),s=Ya(i.areSetsEqual);i=Dd({},i,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:u,areSetsEqual:s})}return i}function CC(t){return function(e,n,r,i,o,a,u){return t(e,n,u)}}function wC(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(s,c){var l=r(),d=l.cache,f=d===void 0?e?new WeakMap:void 0:d,h=l.meta;return n(s,c,{cache:f,equals:i,meta:h,strict:o})};if(e)return function(s,c){return n(s,c,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var a={cache:void 0,equals:i,meta:void 0,strict:o};return function(s,c){return n(s,c,a)}}var TC=Hr();Hr({strict:!0});Hr({circular:!0});Hr({circular:!0,strict:!0});Hr({createInternalComparator:function(){return yo}});Hr({strict:!0,createInternalComparator:function(){return yo}});Hr({circular:!0,createInternalComparator:function(){return yo}});Hr({circular:!0,createInternalComparator:function(){return yo},strict:!0});function Hr(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,a=o===void 0?!1:o,u=SC(t),s=bC(u),c=r?r(s):CC(s);return wC({circular:n,comparator:s,createState:i,equals:c,strict:a})}function jp(t){return function(e,n){if(n===void 0){var r=jp(t);return function(o){return r(o,e)}}for(var i in e)if(!cb.call(n,i)||!t.equals(e[i],n[i]))return!1;return!0}}function IC(t){var e=jp(t);return ho(function(n,r){return e(n)(r)&&e(r)(n)})}function EC(t){return Pn(wt,t.of)}function xC(t){return ru(t.of(et))}function AC(t){var e=xC(t);return function(n,r){return t.chain(n,lr(function(){return e()},r))}}globalThis&&globalThis.__awaiter;globalThis&&globalThis.__generator;var $C=EC(nf),DC=Na,OC=mr(2,AC(rf)),NC=OC,PC=Zg,aa=m,MC=PC(jb({concat:Eb(Tb).concat,empty:0}))();function RC(t){return function(e){return e.iterNumber>=t?et:wt(0)}}function _C(t,e){return function(n){return aa(n,e,F(function(r){return Math.min(t,r)}))}}function jC(t){return function(e){return wt(t*Math.pow(2,e.iterNumber))}}var qC={iterNumber:0,cumulativeDelay:0,previousDelay:et};function kC(t,e){var n=t(e);return{iterNumber:e.iterNumber+1,cumulativeDelay:e.cumulativeDelay+Gt(function(){return 0})(n),previousDelay:n}}function UC(t,e){var n=kC(t,e);return aa(n.previousDelay,bp(function(){return Rs.of(n)},function(r){return kS(r)(Rs.of(n))}))}function Mi(t,e,n){var r=function(i){return aa(i,e,bd(function(o){return n(o)?aa(UC(t,i),bd(function(a){return aa(a.previousDelay,bp(function(){return Rs.of(o)},function(){return r(a)}))})):Rs.of(o)}))};return r(qC)}function BC(t){return e=>m(e,ve(n=>(t(n)(),n)))}const pa=BC;function js(t){return e=>m(e,Cd,pa(t),Cd)}function VC(t){return e=>m(e,pa(n=>()=>t(n)()),js(n=>()=>t(n)()))}function FC(t){return e=>m(e,F(n=>(t(n)(),n)))}const LC=FC;function uf(t){return{equals(e,n){return e==null&&n==null?!0:e==null||n===null||n===void 0?!1:t.equals(e,n)}}}function Ma(t){return{equals(e,n){const r=m(st(e),Gt(()=>[])),i=m(st(n),Gt(()=>[]));return Jl(t).equals(r,i)}}}const Oi=Xn({localId:Xt,componentPath:Ma(Xt),sharedConfigurationModelId:uf(Xt)}),qp=Xn({localId:Xt,configurationModelId:Xt}),kp=ho((t,e)=>K({x:t,y:e}).with({x:{type:"Choice"},y:{type:"Choice"}},n=>GC.equals(n.x,n.y)).with({x:{type:"Component"},y:{type:"Component"}},n=>zC.equals(n.x,n.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},n=>HC.equals(n.x,n.y)).with({x:{type:"Boolean"},y:{type:"Boolean"}},n=>WC.equals(n.x,n.y)).otherwise(()=>!1)),GC=Xn({type:Xt,attributeId:Oi,state:Xt,choiceValueId:Xt}),zC=Xn({type:Xt,attributeId:Oi,state:Xt}),HC=Xn({type:Xt,attributeId:Oi,state:uu}),WC=Xn({type:Xt,attributeId:Oi,state:Xl});var ze=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(ze||{}),He=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(He||{}),Qi=(t=>(t.Rule="Rule",t.Cardinality="Cardinality",t.Component="Component",t))(Qi||{}),va=(t=>(t.all="all",t.none="none",t.specific="specific",t))(va||{}),fr=(t=>(t.Channel="Channel",t.Package="Package",t))(fr||{}),kt=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(kt||{}),dr=(t=>(t.Included="Included",t.Excluded="Excluded",t))(dr||{}),Br=(t=>(t.Included="Included",t.Excluded="Excluded",t))(Br||{}),hr=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(hr||{}),yi=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(yi||{}),mi=(t=>(t.Always="Always",t.Optional="Optional",t))(mi||{});const KC=Object.freeze(Object.defineProperty({__proto__:null,AllowedRulesInExplainType:va,AttributeType:kt,ChoiceValueDecisionState:dr,ComponentDecisionState:Br,ConfigurationModelSourceType:fr,ConstraintType:Qi,DecisionKind:hr,ExplainQuestionSubject:He,ExplainQuestionType:ze,Inclusion:mi,Selection:yi,eqCausedByDecision:kp,eqGlobalAttributeId:Oi,eqGlobalConstraintId:qp},Symbol.toStringTag,{value:"Module"}));var pe=(t=>(t.Unknown="Unknown",t.CommunicationError="Local.LowLevelCommunicationError",t.ServiceError="ServiceError",t.ConfigurationConflict="ConfigurationConflict",t.ConfigurationUnauthenticated="ConfigurationUnauthenticated",t.ConfigurationUnauthorized="ConfigurationUnauthorized",t.ConfigurationApplicationError="ConfigurationApplicationError",t.ConfigurationTimeout="ConfigurationTimeout",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConfigurationAttributeNotFound="ConfigurationAttributeNotFound",t.ConfigurationSolutionNotAvailable="ConfigurationSolutionNotAvailable",t.ConfigurationRejectedDecisionsConflict="ConfigurationRejectedDecisionsConflict",t.ConfigurationChoiceValueNotFound="ConfigurationChoiceValueNotFound",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.ConfigurationInitializationFailure="ConfigurationInitializationFailure",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t.ConfigurationSetManyConflict="ConfigurationSetManyConflict",t))(pe||{}),hu=(t=>(t[t.NumericDecisionOutOfRange=0]="NumericDecisionOutOfRange",t))(hu||{});const Up={createConfigurationRejectedDecisionsConflict(t){return{type:"ConfigurationRejectedDecisionsConflict",rejectedDecisions:t}}},YC=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationConflictReason:hu,FailureResultFactory:Up,FailureType:pe},Symbol.toStringTag,{value:"Module"}));let Bp=class{mapToCreateSessionRequest(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),attributeRelations:this.mapToAttributeRelations(e.attributeRelations),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters),allowedInExplain:this.mapToAllowedInExplain(e.allowedInExplain)}}mapToConfigurationModelSource(e){return K(e).with({type:fr.Channel},n=>({type:"Channel",deploymentName:n.deploymentName,channel:n.channel})).with({type:fr.Package},n=>({type:"Package",configurationModelPackage:n.configurationModelPackage})).exhaustive()}mapToAttributeRelations(e){return m(e,st,F(Pn(_(n=>this.mapToDecisionsToRespect(n)),n=>[...n])),ie)}mapToDecisionsToRespect(e){return{attributeId:e.attributeId,decisions:m([...e.decisions],vs(n=>this.mapToGlobalAttributeId(n)))}}mapToUsageRuleParameters(e){return m(st(e),ie)}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:e.componentPath,sharedConfigurationModelId:e.sharedConfigurationModelId}}mapToAllowedInExplain(e){return K(e).with({rules:{type:va.none}},n=>({rules:{type:"AllowedRulesNone"}})).with({rules:{type:va.specific,rules:Kt.array(Kt.any)}},n=>({rules:{type:"AllowedRulesSpecific",rules:m(n.rules.rules,_(r=>this.mapToGlobalConstraintId(r)),r=>[...r])}})).otherwise(()=>({rules:{type:"AllowedRulesAll"}}))}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}};function JC(t){return e=>JS(n=>n!=null,t)(e)}function XC(){return vo(Ar())}var hn=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(hn||{}),di=(t=>(t.decisions="decisions",t.constraints="constraints",t.all="all",t))(di||{}),Re=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(Re||{});const Fe=Xn({localId:Xt,componentPath:Ma(Xt),sharedConfigurationModel:uf(Xt)}),ZC=Oa(Jl(Xn({attributeId:Fe,decisions:Ma(Fe)}))),QC=Xn({configurationModelSource:ho((t,e)=>TC(t,e)),decisionsToRespect:ZC,usageRuleParameters:IC(Xt)});var ya=(t=>(t.Channel="Channel",t.Package="Package",t))(ya||{}),Ut=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(Ut||{}),ot=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.ChoiceValue="ChoiceValue",t.Component="Component",t))(ot||{}),me=(t=>(t.Included="Included",t.Excluded="Excluded",t))(me||{}),ue=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(ue||{}),gi=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(gi||{}),bi=(t=>(t.Always="Always",t.Optional="Optional",t))(bi||{});const tw={equals:(t,e)=>t.choiceValueId!==e.choiceValueId?!1:Oa(Xt).equals(t.state,e.state)},ew={equals(t,e){return Oa(uu).equals(t.value,e.value)}},nw={equals(t,e){return Oa(Xl).equals(t.value,e.value)}},rw={equals(t,e){return Oa(Xt).equals(t.state,e.state)}},iw={equals(t,e){return Fe.equals(t.attributeId,e.attributeId)?K({x:t,y:e}).with({x:{type:"Boolean"},y:{type:"Boolean"}},(n,r)=>nw.equals(r.x,r.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},(n,r)=>ew.equals(r.x,r.y)).with({x:{type:"Component"},y:{type:"Component"}},(n,r)=>rw.equals(r.x,r.y)).with({x:{type:"ChoiceValue"},y:{type:"ChoiceValue"}},(n,r)=>tw.equals(r.x,r.y)).otherwise(()=>!1):!1}},ow=Jl(iw),aw={equals:(t,e)=>ow.equals(t.decisions,e.decisions)&&sw.equals(t.mode,e.mode)},sw={equals:(t,e)=>K({x:t,y:e}).with({x:{type:"Default"},y:{type:"Default"}},n=>!0).with({x:{type:"DropExistingDecisions"},y:{type:"DropExistingDecisions"}},n=>!0).otherwise(()=>!1)};var Hc=(t=>(t.NotAvailable="NotAvailable",t.StateNotPossible="StateNotPossible",t))(Hc||{}),to=(t=>(t.Rule="Rule",t.Cardinality="Cardinality",t.Component="Component",t))(to||{}),nt=(t=>(t.ServiceError="ServiceError",t.Unknown="Unknown",t.CommunicationError="CommunicationError",t.ConfigurationConflict="ConfigurationConflict",t.ConfigurationSolutionNotAvailable="ConfigurationSolutionNotAvailable",t.ConfigurationAttributeNotFound="ConfigurationAttributeNotFound",t.ConfigurationChoiceValueNotFound="ConfigurationChoiceValueNotFound",t.ConfigurationUnauthenticated="ConfigurationUnauthenticated",t.ConfigurationApplicationError="ConfigurationApplicationError",t.ConfigurationTimeout="ConfigurationTimeout",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConfigurationRejectedDecisionsConflict="ConfigurationRejectedDecisionsConflict",t.ConfigurationSetManyConflict="ConfigurationSetManyConflict",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.ConfigurationInitializationFailure="ConfigurationInitializationFailure",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t))(nt||{}),cf=(t=>(t[t.NumericDecisionOutOfRange=0]="NumericDecisionOutOfRange",t))(cf||{});const uw={createConfigurationRejectedDecisionsConflict(t){return{type:"ConfigurationRejectedDecisionsConflict",rejectedDecisions:t}}};function cw(t,e){console.log(`--------------------------------------------------------------------------------
2
2
  -- ${e??""}
3
3
  --------------------------------------------------------------------------------
4
- ${JSON.stringify(t,null,2)}`)}var sa=(t=>(t.ConfigurationEngineRestApiUnauthorized="Generic::Unauthorized",t.ClientError="Generic::LocalClientError",t.ServerError="Generic::ServerError",t.UnhandledResponseStatus="LocalUnhandledResponseStatus",t.LowLevelCommunicationError="LocalLowLevelCommunicationError",t))(sa||{}),Vp=(t=>(t.BooleanAttributeNotFound="BooleanAttributeNotFound",t.ChoiceAttributeNotFound="ChoiceAttributeNotFound",t.ChoiceValueNotFound="ChoiceValueNotFound",t.ConfigurationInitializationFailure="InitializationFailure",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.LegacyConfigurationModelInvalid="DeploymentStore.Core.Store.SnapshotInvalid",t.LegacySnapshotInvalid="SnapshotInvalid",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConflictWithConsequence="ConflictWithConsequence",t.DecisionInvalid="DecisionInvalid",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.NumericAttributeNotFound="NumericAttributeNotFound",t.NumericDecisionOutOfRange="NumericDecisionOutOfRange",t.SessionNotFound="SessionNotFound",t.SetDecisionConflict="SetDecisionConflict",t.Unauthorized="Unauthorized",t))(Vp||{});const cw=t=>Object.values(Vp).includes(t),lw=t=>cw(t)?wt(t):et;function fw(t){return m(t,lw,F(e=>K(e).with("ConfigurationModelNotFound",()=>({type:nt.ConfigurationModelNotFound})).with("DecisionsToRespectInvalid",()=>({type:nt.DecisionsToRespectInvalid})).with(Kt.union("ChoiceAttributeNotFound","NumericAttributeNotFound","BooleanAttributeNotFound"),()=>({type:nt.ConfigurationAttributeNotFound})).with("ChoiceValueNotFound",()=>({type:nt.ConfigurationChoiceValueNotFound})).with("DecisionInvalid",()=>({type:nt.ConfigurationConflict})).with("NumericDecisionOutOfRange",()=>({type:nt.ConfigurationConflict,reason:cf.NumericDecisionOutOfRange})).with("ConflictWithConsequence",()=>({type:nt.ConfigurationConflict})).with(Kt.union("SessionNotFound","Unauthorized"),()=>({type:nt.ConfigurationUnauthenticated})).with("ConfigurationModelInvalid",()=>({type:nt.ConfigurationModelInvalid})).with("DeploymentStore.Core.Store.SnapshotInvalid",()=>({type:nt.ConfigurationModelInvalid})).with("SnapshotInvalid",()=>({type:nt.ConfigurationModelInvalid})).with("InitializationFailure",()=>({type:nt.ConfigurationInitializationFailure})).with("ConfigurationModelNotFeasible",n=>({type:nt.ConfigurationModelNotFeasible,constraintExplanations:[]})).with("SetDecisionConflict",()=>({type:nt.ConfigurationConflict})).exhaustive()))}const dw=t=>Object.values(sa).includes(t),hw=t=>dw(t)?wt(t):et;function pw(t){return m(t,hw,F(e=>K(e).with("Generic::LocalClientError",()=>({type:nt.ConfigurationApplicationError})).with("Generic::ServerError",()=>({type:nt.ServiceError})).with("LocalLowLevelCommunicationError",()=>({type:nt.CommunicationError})).with("Generic::Unauthorized",()=>({type:nt.ConfigurationUnauthenticated})).with("LocalUnhandledResponseStatus",()=>({type:nt.Unknown})).exhaustive()))}function rr(t,e){uw(t,e);const n=t.type;return m(et,ld(()=>fw(n)),ld(()=>pw(n)),Gt(()=>(console.error("InterpretEngineError encountered unexpected error type","ProblemDetails",t,"Context",e),{type:nt.Unknown})))}let Fp=class{constructor(e,n,r,i){this.engineApiClient=e,this.contractToRestMapper=n,this.restToDomainMapper=r,this.options=i}create(e){const n=this.contractToRestMapper.mapToCreateSessionRequest(e);return m(this.engineApiClient.createSessionUsingJwtBearer(n,this.options.accessToken),Dn(r=>rr(r,"ClientSideSessionLifetimeHandler - create")),An(r=>this.restToDomainMapper.mapToSessionId(r)),JC(()=>({type:nt.ConfigurationUnauthenticated})))}close(e){return m(this.engineApiClient.deleteSessionUsingJwtBearer(e,this.options.accessToken),Dn(n=>rr(n,"ClientSideSessionLifetimeHandler - close")),ve(()=>Ar()))}};function vw(t){var e=[];if(t.length===0)return"";if(typeof t[0]!="string")throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var i=t[r];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(r>0&&(i=i.replace(/^[\/]+/,"")),r<t.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/");o=o.replace(/\/(\?|&|#[^!])/g,"$1");var a=o.split("?");return o=a.shift()+(a.length>0?"?":"")+a.join("&"),o}function yw(){var t;return typeof arguments[0]=="object"?t=arguments[0]:t=[].slice.call(arguments),vw(t)}var Lp=(t=>(t[t.Ok=200]="Ok",t[t.NoContent=204]="NoContent",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.NotFound=404]="NotFound",t[t.Conflict=409]="Conflict",t))(Lp||{});function tr(t,e,n){const r=m(Array.isArray(t)?t:[t],yw);return m(Sd(()=>fetch(r,e),i=>({type:"error"})),An(i=>m(Sd(async()=>{const o=await i.json();return{response:i,data:o}},()=>i))),Dp(i=>i.status===401?or({type:sa.ConfigurationEngineRestApiUnauthorized,status:401}):i.status===204?vo({response:i,data:{}}):i.type==="error"?or({type:sa.LowLevelCommunicationError}):or({type:sa.UnhandledResponseStatus})),An(i=>m(n(i),sf(()=>i.data))))}function Wc(t,e){return tr(t,e,n=>{if(n.response.status===200)return _r(n.data);if(n.response.status===409){const r=n.data;return K(r).with({type:"ConfigurationModelInvalid"},i=>_r(r)).with({type:"ConfigurationModelNotFeasible"},i=>_r(r)).otherwise(()=>et)}return et})}let mw=class{constructor(e){this.baseUrl=e}createSessionUsingApiKey(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-API-KEY":n},body:JSON.stringify(e)};return Wc([this.baseUrl,"v2/session"],r)}createSessionUsingJwtBearer(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify(e)};return Wc([this.baseUrl,"v2/session"],r)}setMany(e,n){const r={method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return tr([this.baseUrl,"v2/session/configuration/decision/many"],r,i=>i.response.status===200||i.response.status===409?wt(i.data):et)}makeDecision(e,n){const r={method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return tr([this.baseUrl,"v2/session/configuration/decision"],r,i=>i.response.status===200?wt(i.data):et)}getDecisions(e){const n={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}};return tr([this.baseUrl,"v2/session/configuration/decision"],n,r=>r.response.status===200?wt(r.data):et)}getWhyStateNotPossible(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return tr([this.baseUrl,"v2/session/configuration/consequence/explain/why-state-not-possible"],r,i=>i.response.status===200?wt(i.data):et)}getWhyNotSatisfied(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return tr([this.baseUrl,"v2/session/configuration/consequence/explain/why-not-satisfied"],r,i=>i.response.status===200?wt(i.data):et)}getConsequence(e){const n={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}};return tr([this.baseUrl,"v2/session/configuration/consequence"],n,r=>r.response.status===200?wt(r.data):et)}deleteSessionUsingJwtBearer(e,n){const r={method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`}};return tr([this.baseUrl,`v2/session/${e}`],r,i=>i.response.status===204?wt({}):et)}};var Si=(t=>(t.Included="Included",t.Excluded="Excluded",t))(Si||{}),Kc=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(Kc||{}),Jc=(t=>(t.Always="Always",t.Optional="Optional",t))(Jc||{}),ma=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(ma||{}),ar=(t=>(t.Included="Included",t.Excluded="Excluded",t.Undefined="Undefined",t))(ar||{}),cn=(t=>(t.Choice="Choice",t.Numeric="Numeric",t.Boolean="Boolean",t.Component="Component",t))(cn||{}),Yc=(t=>(t.NotAvailable="NotAvailable",t.StateNotPossible="StateNotPossible",t))(Yc||{}),Xc=(t=>(t.Attribute="Attribute",t.Configuration="Configuration",t))(Xc||{}),Wo=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.ChoiceValue="ChoiceValue",t.Component="Component",t))(Wo||{});const sn=Xn({localId:Xt,componentPath:Ma(Xt),sharedConfigurationModelId:uf(Xt)});let Gp=class{mapToDecisions(e){return{}}mapToSessionId(e){return K(e).with({sessionId:Kt.string},n=>vo(n.sessionId)).with({type:"ConfigurationModelNotFeasible"},n=>{const r=m(n.constraintExplanations,_(i=>this.mapToConstraintExplanation(i)));return or({type:nt.ConfigurationModelNotFeasible,constraintExplanations:r})}).with({type:"ConfigurationModelInvalid"},()=>or({type:nt.ConfigurationModelInvalid})).otherwise(()=>or({type:nt.Unknown}))}mapToExplainAnswer(e,n){const r=K(n).with({question:hn.whyIsStateNotPossible,subject:Re.boolean},a=>[{type:ot.Boolean,attributeId:a.attributeId,value:wt(a.state)}]).with({question:hn.whyIsStateNotPossible,subject:Re.numeric},a=>[{type:ot.Numeric,attributeId:a.attributeId,value:wt(a.state)}]).with({question:hn.whyIsStateNotPossible,subject:Re.component},a=>[{type:ot.Component,attributeId:a.attributeId,state:wt(a.state)}]).with({question:hn.whyIsStateNotPossible,subject:Re.choiceValue},a=>[{type:ot.ChoiceValue,attributeId:a.attributeId,choiceValueId:a.choiceValueId,state:wt(a.state)}]).otherwise(()=>[]),i=m(e.decisionExplanations,_(a=>this.mapToDecisionExplanation(a,r,{type:"Default"}))),o=m(e.constraintExplanations,_(a=>this.mapToConstraintExplanation(a)));return K(n).with({answerType:di.decisions},()=>({decisionExplanations:i})).with({answerType:di.constraints},()=>({constraintExplanations:o})).with({answerType:di.all},()=>({constraintExplanations:o,decisionExplanations:i})).exhaustive()}mapToConfigurationSetManyConflictFailure(e,n,r){const i=this.mapToExplicitDecisions(n);return{type:nt.ConfigurationSetManyConflict,decisionExplanations:m(e.decisionExplanations,_(o=>this.mapToDecisionExplanation(o,i,r))),constraintExplanations:m(e.constraintExplanations,_(o=>this.mapToConstraintExplanation(o)))}}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}mapToConfigurationModel(e,n){const r=this.mapToAttributes(e,n);return{isSatisfied:n.isConfigurationSatisfied??!1,attributes:r}}mapToBooleanDecision(e){return{type:ot.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),value:st(e.state)}}mapToNumericDecision(e){return{type:ot.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),value:st(e.state)}}mapToComponentDecision(e){return{type:ot.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToDecisionState(e.state)}}mapToExplicitChoiceValueDecision(e){return{type:ot.ChoiceValue,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToDecisionState(e.state)}}mapToGlobalAttributeId(e){return{localId:e.localId,sharedConfigurationModel:e.sharedConfigurationModelId,componentPath:e.componentPath??[]}}mapToChoiceValueDecision(e){return m(this.mapToDecisionState(e.state),F(n=>({kind:this.mapToDecisionKind(e.kind),state:n})))}mapToConstraintExplanation(e){return{causedByRules:m(e.causedByRules,_(n=>this.mapToRuleConstraint(n))),causedByCardinalities:m(e.causedByCardinalities,_(n=>this.mapToCardinalityConstraint(n)))}}mapToRuleConstraint(e){return{type:to.Rule,ruleId:this.mapToGlobalConstraintId(e.constraintId)}}mapToCardinalityConstraint(e){return{type:to.Cardinality,attributeId:this.mapToGlobalAttributeId(e.attributeId)}}mapToExplicitDecisions(e){const n=m(e.booleanDecisions??[],_(a=>({type:ot.Boolean,attributeId:this.mapToGlobalAttributeId(a.attributeId),value:st(a.state)}))),r=m(e.numericDecisions??[],_(a=>({type:ot.Numeric,attributeId:this.mapToGlobalAttributeId(a.attributeId),value:st(a.state)}))),i=m(e.componentDecisions??[],_(a=>({type:ot.Component,attributeId:this.mapToGlobalAttributeId(a.attributeId),state:m(st(a.state),F(u=>this.mapToDecisionState(u)),Lc)}))),o=m(e.choiceDecisions??[],_(a=>({type:ot.ChoiceValue,attributeId:this.mapToGlobalAttributeId(a.attributeId),choiceValueId:a.choiceValueId,state:m(st(a.state),F(u=>this.mapToDecisionState(u)),Lc)})));return m([],dt(n),dt(r),dt(i),dt(o))}mapToDecisionExplanation(e,n,r){const i=m(e.causedByBooleanDecisions,_(v=>this.mapToCausedByBooleanDecision(v))),o=m(e.causedByNumericDecisions,_(v=>this.mapToCausedByNumericDecision(v))),a=m(e.causedByComponentDecisions,_(v=>this.mapToCausedByComponentDecision(v))),u=m(e.causedByChoiceDecisions,_(v=>this.mapToCausedByChoiceValueDecision(v))),s=m(i,_(v=>({type:ot.Boolean,attributeId:v.attributeId,value:et}))),c=m(o,_(v=>({type:ot.Numeric,attributeId:v.attributeId,value:et}))),l=m(a,_(v=>({type:ot.Component,attributeId:v.attributeId,state:et}))),d=m(u,_(v=>({type:ot.ChoiceValue,attributeId:v.attributeId,choiceValueId:v.choiceValueId,state:et}))),f=m([],dt(s),dt(c),dt(l),dt(d)),h=wp(ho((v,p)=>{const S=Fe.equals(v.attributeId,p.attributeId);return K({a:v,b:p}).with({a:{type:ot.ChoiceValue},b:{type:ot.ChoiceValue}},C=>S&&C.a.choiceValueId===C.b.choiceValueId).otherwise(()=>S)}))(f)(n);return{causedByBooleanDecisions:i,causedByNumericDecisions:o,causedByComponentDecisions:a,causedByChoiceDecisions:u,solution:{decisions:m([],dt(f),dt(h)),mode:r}}}mapToCausedByBooleanDecision(e){return{type:ot.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state,reason:this.mapToReason(e.reason)}}mapToReason(e){return K(e).with(Yc.NotAvailable,()=>Hc.NotAvailable).with(Yc.StateNotPossible,()=>Hc.StateNotPossible).exhaustive()}mapToCausedByNumericDecision(e){return{type:ot.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state,reason:this.mapToReason(e.reason)}}mapToCausedByComponentDecision(e){return{type:ot.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToPossibleDecisionState(e.state),reason:this.mapToReason(e.reason)}}mapToCausedByChoiceValueDecision(e){return{type:ot.ChoiceValue,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToPossibleDecisionState(e.state),reason:this.mapToReason(e.reason)}}mapToAttributes(e,n){function r(f){return m(n.canAttributeContributeToConfigurationSatisfaction,Me(h=>sn.equals(h,f)),Ho)}const i=m([],dt(m(e.choiceValueDecisions,_(f=>f.attributeId))),dt(m(n.choiceConsequences,_(f=>f.attributeId))),Ji(sn)),o=m(i,_(f=>{const h=m(e.choiceValueDecisions??[],yS(p=>sn.equals(p.attributeId,f))),v=m(n.choiceConsequences??[],ii(p=>sn.equals(p.attributeId,f)));return m(v,F(p=>this.mapToChoiceAttributes(p,h,r(f))))}),Gn),a=m([],dt(m(e.numericDecisions,_(f=>f.attributeId))),dt(m(n.numericConsequences,_(f=>f.attributeId))),Ji(sn)),u=m(a,_(f=>{const h=m(e.numericDecisions??[],ii(p=>sn.equals(p.attributeId,f))),v=m(n.numericConsequences??[],ii(p=>sn.equals(p.attributeId,f)));return m(v,F(p=>this.mapToNumericAttribute(p,h,r(f))))}),Gn),s=m([],dt(m(e.booleanDecisions,_(f=>f.attributeId))),dt(m(n.booleanConsequences,_(f=>f.attributeId))),Ji(sn)),c=m(s,_(f=>{const h=m(e.booleanDecisions??[],ii(p=>sn.equals(p.attributeId,f))),v=m(n.booleanConsequences??[],ii(p=>sn.equals(p.attributeId,f)));return m(v,F(p=>this.mapToBooleanAttribute(p,h,r(f))))}),Gn),l=m([],dt(m(e.componentDecisions,_(f=>f.attributeId))),dt(m(n.componentConsequences,_(f=>f.attributeId))),Ji(sn)),d=m(l,_(f=>{const h=m(e.componentDecisions??[],ii(p=>sn.equals(p.attributeId,f))),v=m(n.componentConsequences??[],ii(p=>sn.equals(p.attributeId,f)));return m(v,F(p=>this.mapToComponentAttribute(p,h,r(f))))}),Gn);return m([],dt(o),dt(d),dt(u),dt(c))}mapToComponentAttribute(e,n,r){return{type:Ut.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,possibleDecisionStates:m(e.possibleDecisionStates,vs(i=>this.mapToPossibleDecisionState(i))),decision:m(n,bn(i=>m(this.mapToDecisionState(i.state),F(o=>({state:o,kind:i.kind}))))),inclusion:this.mapToInclusion(e.inclusion),selection:m(e.selection,st,F(i=>this.mapToSelection(i)),ie),canContributeToConfigurationSatisfaction:r}}mapToChoiceAttributes(e,n,r){const i=m(e.values,vs(o=>{const a=m(n,Me(u=>u.choiceValueId==o.choiceValueId));return this.mapToChoiceValue(o,a)}));return{type:Ut.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,cardinality:this.mapToCardinality(e.cardinality),values:i,canContributeToConfigurationSatisfaction:r}}mapToBooleanAttribute(e,n,r){return{type:Ut.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,selection:this.mapToSelection(e.selection),possibleDecisionStates:e.possibleDecisionStates,decision:m(n,bn(i=>m(i.state,st,F(o=>({kind:this.mapToDecisionKind(i.kind),state:o}))))),canContributeToConfigurationSatisfaction:r}}mapToNumericAttribute(e,n,r){return{type:Ut.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,range:{min:e.range.min,max:e.range.max},selection:this.mapToSelection(e.selection),decimalPlaces:e.decimalPlaces,decision:m(n,bn(i=>m(i.state,st,F(o=>({kind:this.mapToDecisionKind(i.kind),state:o}))))),canContributeToConfigurationSatisfaction:r}}mapToChoiceValue(e,n){const r=m(e.possibleDecisionStates,vs(i=>this.mapToPossibleDecisionState(i)));return{choiceValueId:e.choiceValueId,decision:m(n,bn(i=>this.mapToChoiceValueDecision(i))),possibleDecisionStates:r}}mapToDecisionKind(e){return K(e).with(ma.Implicit,()=>ue.Implicit).with(ma.Explicit,()=>ue.Explicit).exhaustive()}mapToDecisionState(e){return K(e).with(ar.Included,()=>wt(me.Included)).with(ar.Excluded,()=>wt(me.Excluded)).with(ar.Undefined,()=>et).exhaustive()}mapToPossibleDecisionState(e){return K(e).with(Si.Included,()=>me.Included).with(Si.Excluded,()=>me.Excluded).exhaustive()}mapToSelection(e){return K(e).with(Kc.Mandatory,()=>gi.Mandatory).with(Kc.Optional,()=>gi.Optional).exhaustive()}mapToInclusion(e){return K(e).with(Jc.Always,()=>bi.Always).with(Jc.Optional,()=>bi.Optional).exhaustive()}mapToCardinality(e){return{lowerBound:e.lowerBound,upperBound:e.upperBound}}},zp=class{constructor(e,n){this.restToDomainMapper=new Gp,this.contractToRestMapper=e,this.options=n}create(e){const n=this.contractToRestMapper.mapToCreateSessionRequest(e),r=Wc(this.options.sessionCreateUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(n)});return m(r,Dn(i=>rr(i,"ServerSideSessionLifetimeHandler - create")),An(i=>this.restToDomainMapper.mapToSessionId(i)))}close(e){return m(tr(this.options.sessionDeleteUrl,{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}},n=>n.response.status===Lp.NoContent?wt({}):et),Dn(n=>rr(n,"ServerSideSessionLifetimeHandler - close")),ve(Ar))}},gw=class{constructor(e,n,r){this.inner=e,this.contractToDomainMapper=n,this.domainToContractMapper=r,this.onConfigurationChangedHandler=et}setOnConfigurationChangedHandler(e){const n=m(e,st,F(r=>i=>{const o=this.domainToContractMapper.mapToConfiguration(i);r(o)}));this.inner.setOnConfigurationChangedHandler(n)}getConfiguration(){const e=this.inner.getConfiguration();return this.domainToContractMapper.mapToConfiguration(e)}getSessionContext(){const e=this.inner.getSessionContext();return this.domainToContractMapper.mapToSessionContext(e)}async setSessionContext(e){const n=this.contractToDomainMapper.mapToSessionContext(e);return await m(this.inner.setSessionContext(n),ve(Ar),this.adaptToContractPromise())()}async restoreConfiguration(e){const n=this.contractToDomainMapper.mapToConfiguration(e);return await m(this.inner.restoreConfiguration(n),ve(Ar),this.adaptToContractPromise())()}async makeDecision(e){const n=this.contractToDomainMapper.mapToAttributeDecision(e);return await m(this.inner.makeDecision(n),ve(Ar),this.adaptToContractPromise())()}async setMany(e,n){const r=this.contractToDomainMapper.mapToAttributeDecisions(e),i=this.contractToDomainMapper.mapToMode(n);return await m(this.inner.setMany(r,i),ve(Ar),this.adaptToContractPromise())()}async applySolution(e){const n=this.contractToDomainMapper.mapToSolution(e);return await m(this.inner.applySolution(n),ve(Ar),this.adaptToContractPromise())()}async explain(e,n){const r=this.contractToDomainMapper.mapToExplainQuestion(e,n);return await m(this.inner.explain(r),ve(i=>this.domainToContractMapper.mapToExplainAnswer(i)),this.adaptToContractPromise())()}async close(){return await m(this.inner.close(),Dn(e=>this.domainToContractMapper.mapToFailureResult(e)),_s(Promise.reject,e=>Promise.resolve()))()}adaptToContractPromise(){return Pn(Dn(e=>this.domainToContractMapper.mapToFailureResult(e)),_s(e=>Promise.reject(e),e=>Promise.resolve(e)))}},bw=class{mapToExplainQuestion(e,n){const r={answerType:K(n).with("decisions",()=>di.decisions).with("constraints",()=>di.constraints).with("full",()=>di.all).exhaustive()};return K(e).with({question:ze.whyIsNotSatisfied,subject:He.configuration},i=>({...r,question:hn.whyIsNotSatisfied,subject:Re.configuration})).with({question:ze.whyIsNotSatisfied,subject:He.attribute},i=>({...r,question:hn.whyIsNotSatisfied,subject:Re.attribute,attributeId:this.mapToGlobalAttributeId(i.attributeId)})).with({question:ze.whyIsStateNotPossible,subject:He.choiceValue},i=>({...r,question:hn.whyIsStateNotPossible,subject:Re.choiceValue,attributeId:this.mapToGlobalAttributeId(i.attributeId),choiceValueId:i.choiceValueId,state:this.mapToDecisionState(i.state)})).with({question:ze.whyIsStateNotPossible,subject:He.component},i=>({...r,question:hn.whyIsStateNotPossible,subject:Re.component,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:this.mapToDecisionState(i.state)})).with({question:ze.whyIsStateNotPossible,subject:He.numeric},i=>({...r,question:hn.whyIsStateNotPossible,subject:Re.numeric,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:i.state})).with({question:ze.whyIsStateNotPossible,subject:He.boolean},i=>({...r,question:hn.whyIsStateNotPossible,subject:Re.boolean,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:i.state})).exhaustive()}mapToConfiguration(e){return{isSatisfied:e.isSatisfied,attributes:m(e.attributes,_(n=>this.mapToAttribute(n)))}}mapToAttributeDecisions(e){return m(e,_(n=>this.mapToAttributeDecision(n)))}mapToSessionContext(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),decisionsToRespect:this.mapToDecisionsToRespect(e.attributeRelations),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters)}}mapToAttributeDecision(e){return K(e).with({type:kt.Choice,choiceValueId:Kt.string},n=>({type:ot.ChoiceValue,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToDecisionStateOption(n.state)})).with({type:kt.Numeric},n=>({type:ot.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),value:st(n.state)})).with({type:kt.Boolean},n=>({type:ot.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),value:st(n.state)})).with({type:kt.Component},n=>({type:ot.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(st(n.state),bn(r=>this.mapToDecisionStateOption(r)))})).exhaustive()}mapToDecisionsToRespect(e){return m(st(e),F(n=>m(n,_(r=>({attributeId:this.mapToGlobalAttributeId(r.attributeId),decisions:m(r.decisions,_(i=>this.mapToGlobalAttributeId(i)))})))))}mapToMode(e){return K(e).with({type:"DropExistingDecisions"},n=>({type:"DropExistingDecisions",conflictHandling:this.mapToConflictHandling(n.conflictHandling)})).otherwise(()=>({type:"Default"}))}mapToConflictHandling(e){return K(e).with({type:"Manual"},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).with({type:"Automatic"},n=>({type:"Automatic"})).exhaustive()}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:e.componentPath??[],sharedConfigurationModel:e.sharedConfigurationModelId}}mapToConfigurationModelSource(e){return K(e).with({type:fr.Package},n=>({type:ya.Package,configurationModelPackage:n.configurationModelPackage})).with({type:fr.Channel},n=>({type:ya.Channel,deploymentName:n.deploymentName,channel:n.channel})).exhaustive()}mapToSolution(e){return{decisions:m(e.decisions,_(n=>this.mapToAttributeDecision(n))),mode:this.mapToMode(e.mode)}}mapToAttribute(e){return K(e).with({type:kt.Boolean},n=>({type:Ut.Boolean,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,possibleDecisionStates:n.possibleDecisionStates,selection:this.mapToSelection(n.selection),decision:m(n.decision,st,F(r=>({kind:this.mapToDecisionKind(r.kind),state:r.state}))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:kt.Numeric},n=>({type:Ut.Numeric,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,range:{min:n.range.min,max:n.range.max},decimalPlaces:n.decimalPlaces,selection:this.mapToSelection(n.selection),decision:m(n.decision,st,F(r=>({kind:this.mapToDecisionKind(r.kind),state:r.state}))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:kt.Choice},n=>({type:Ut.Choice,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,cardinality:{lowerBound:n.cardinality.lowerBound,upperBound:n.cardinality.upperBound},values:m(n.values,_(r=>this.mapToChoiceValue(r))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:kt.Component},n=>({type:Ut.Component,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,decision:m(n.decision,st,bn(r=>m(this.mapToDecisionStateOption(r.state),F(i=>({kind:this.mapToDecisionKind(r.kind),state:i}))))),possibleDecisionStates:m(n.possibleDecisionStates,_(r=>this.mapToDecisionStateOption(r)),Gn),selection:m(n.selection,st,F(r=>this.mapToSelection(r)),ie),inclusion:this.mapToInclusion(n.inclusion),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).exhaustive()}mapToChoiceValue(e){return{choiceValueId:e.id,decision:this.mapToChoiceValueDecision(e),possibleDecisionStates:m(e.possibleDecisionStates,_(n=>this.mapToDecisionStateOption(n)),Gn)}}mapToChoiceValueDecision(e){return m(e.decision,st,bn(n=>m(this.mapToDecisionStateOption(n.state),F(r=>({state:r,kind:this.mapToDecisionKind(n.kind)})))))}mapToDecisionKind(e){return K(e).with(hr.Implicit,()=>ue.Implicit).with(hr.Explicit,()=>ue.Explicit).exhaustive()}mapToSelection(e){return K(e).with(yi.Mandatory,()=>gi.Mandatory).with(yi.Optional,()=>gi.Optional).exhaustive()}mapToInclusion(e){return K(e).with(mi.Always,()=>bi.Always).with(mi.Optional,()=>bi.Optional).exhaustive()}mapToDecisionState(e){return K(e).with(Kt.union(dr.Included,Br.Included),()=>me.Included).with(Kt.union(dr.Excluded,Br.Excluded),()=>me.Excluded).exhaustive()}mapToDecisionStateOption(e){return m(st(e),F(n=>this.mapToDecisionState(n)))}mapToUsageRuleParameters(e){return e??{}}},Hp=class{mapToExplainAnswer(e){const n=K(e).with({decisionExplanations:Kt.array(Kt.any)},i=>m(i.decisionExplanations,_(o=>this.mapToDecisionExplanation(o)))).otherwise(()=>[]),r=K(e).with({constraintExplanations:Kt.array(Kt.any)},i=>m(i.constraintExplanations,_(o=>this.mapToConstraintExplanation(o)))).otherwise(()=>[]);return{decisionExplanations:n,constraintExplanations:r}}mapToConstraintExplanation(e){return{causedByCardinalities:m(e.causedByCardinalities,_(n=>this.mapToGlobalAttributeId(n.attributeId))),causedByRules:m(e.causedByRules,_(n=>this.mapToGlobalConstraintId(n.ruleId)))}}mapToDecisionExplanation(e){const n=m(e.causedByChoiceDecisions,_(a=>this.mapToCausedByChoiceAttributeDecision(a))),r=m(e.causedByComponentDecisions,_(a=>this.mapToCausedByComponentAttributeDecision(a))),i=m(e.causedByNumericDecisions,_(a=>this.mapToCausedByNumericAttributeDecision(a))),o=m(e.causedByBooleanDecisions,_(a=>this.mapToCausedByBooleanAttributeDecision(a)));return{causedByDecisions:m([],dt(n),dt(r),dt(i),dt(o)),solution:this.mapToSolution(e.solution)}}mapToSolution(e){return{decisions:m(e.decisions,_(n=>this.mapToExplicitDecision(n))),mode:this.mapToMode(e.mode)}}mapToMode(e){return K(e).with({type:"DropExistingDecisions"},n=>({type:"DropExistingDecisions",conflictHandling:this.mapToConflictHandling(n.conflictHandling)})).otherwise(()=>({type:"Default"}))}mapToConflictHandling(e){return K(e).with({type:"Manual"},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).with({type:"Automatic"},n=>({type:"Automatic"})).exhaustive()}mapToSessionContext(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),attributeRelations:this.mapToDecisionsToRespect(e.decisionsToRespect),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters)}}mapToFailureResult(e){return K(e).with({type:nt.ConfigurationConflict},n=>({type:pe.ConfigurationConflict,reason:K(n.reason).with(cf.NumericDecisionOutOfRange,()=>hu.NumericDecisionOutOfRange).otherwise(()=>{})})).with({type:nt.ConfigurationApplicationError},()=>({type:pe.ConfigurationApplicationError})).with({type:nt.ConfigurationUnauthenticated},()=>({type:pe.ConfigurationUnauthenticated})).with({type:nt.ConfigurationModelNotFound},()=>({type:pe.ConfigurationModelNotFound})).with({type:nt.ConfigurationTimeout},()=>({type:pe.ConfigurationTimeout})).with({type:nt.ConfigurationAttributeNotFound},()=>({type:pe.ConfigurationAttributeNotFound})).with({type:nt.ConfigurationChoiceValueNotFound},()=>({type:pe.ConfigurationChoiceValueNotFound})).with({type:nt.ConfigurationSolutionNotAvailable},()=>({type:pe.ConfigurationSolutionNotAvailable})).with({type:nt.ConfigurationRejectedDecisionsConflict},n=>{const r=m(n.rejectedDecisions,_(i=>this.mapToExplicitDecision(i)));return Up.createConfigurationRejectedDecisionsConflict(r)}).with({type:nt.DecisionsToRespectInvalid},()=>({type:pe.DecisionsToRespectInvalid})).with({type:nt.ServiceError},()=>({type:pe.ServiceError})).with({type:nt.CommunicationError},()=>({type:pe.CommunicationError})).with({type:nt.Unknown},()=>({type:pe.Unknown})).with({type:nt.ConfigurationModelInvalid},()=>({type:pe.ConfigurationModelInvalid})).with({type:nt.ConfigurationInitializationFailure},()=>({type:pe.ConfigurationInitializationFailure})).with({type:nt.ConfigurationModelNotFeasible},n=>({type:pe.ConfigurationModelNotFeasible,constraintExplanations:m(n.constraintExplanations,_(r=>this.mapToConstraintExplanation(r)))})).with({type:nt.ConfigurationSetManyConflict},n=>({type:pe.ConfigurationSetManyConflict,decisionExplanations:m(n.decisionExplanations,_(r=>this.mapToDecisionExplanation(r))),constraintExplanations:m(n.constraintExplanations,_(r=>this.mapToConstraintExplanation(r)))})).exhaustive()}mapToConfiguration(e){return{isSatisfied:e.isSatisfied,attributes:m(e.attributes,_(n=>this.mapToAttribute(n)))}}mapToDecisionsToRespect(e){return m(e,F(Pn(_(n=>({attributeId:this.mapToGlobalAttributeId(n.attributeId),decisions:m(n.decisions,_(r=>this.mapToGlobalAttributeId(r)))})))),ie)}mapToGlobalAttributeId(e){return{localId:e.localId,sharedConfigurationModelId:e.sharedConfigurationModel,componentPath:[...e.componentPath??[]]}}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}mapToConfigurationModelSource(e){return K(e).with({type:ya.Package},n=>({type:fr.Package,configurationModelPackage:n.configurationModelPackage})).with({type:ya.Channel},n=>({type:fr.Channel,deploymentName:n.deploymentName,channel:n.channel})).exhaustive()}mapToExplicitDecision(e){return K(e).with({type:ot.ChoiceValue},n=>({type:kt.Choice,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.state,F(r=>this.mapToChoiceValueDecisionState(r)),ie),choiceValueId:n.choiceValueId})).with({type:ot.Component},n=>({type:kt.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.state,F(r=>this.mapToComponentDecisionState(r)),ie)})).with({type:ot.Numeric},n=>({type:kt.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.value,ie)})).with({type:ot.Boolean},n=>({type:kt.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.value,ie)})).exhaustive()}mapToCardinality(e){return K(e).with(to.Cardinality,()=>Qi.Cardinality).with(to.Component,()=>Qi.Component).with(to.Rule,()=>Qi.Rule).exhaustive()}mapToCausedByAttributeDecision(e){return K(e).with({type:ot.ChoiceValue},n=>this.mapToCausedByChoiceAttributeDecision(n)).with({type:ot.Numeric},n=>this.mapToCausedByNumericAttributeDecision(n)).with({type:ot.Boolean},n=>this.mapToCausedByBooleanAttributeDecision(n)).with({type:ot.Component},n=>this.mapToCausedByComponentAttributeDecision(n)).exhaustive()}mapToCausedByChoiceAttributeDecision(e){return{type:kt.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToChoiceValueDecisionState(e.state)}}mapToCausedByNumericAttributeDecision(e){return{type:kt.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state}}mapToCausedByBooleanAttributeDecision(e){return{type:kt.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state}}mapToCausedByComponentAttributeDecision(e){return{type:kt.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToComponentDecisionState(e.state)}}mapToSelection(e){return K(e).with(gi.Mandatory,()=>yi.Mandatory).with(gi.Optional,()=>yi.Optional).exhaustive()}mapToAttribute(e){const n={id:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,canContributeToConfigurationSatisfaction:e.canContributeToConfigurationSatisfaction};return K(e).with({type:Ut.Boolean},r=>({...n,type:kt.Boolean,decision:m(r.decision,F(i=>({state:i.state,kind:this.mapToDecisionKind(i.kind)})),Mr),selection:this.mapToSelection(r.selection),possibleDecisionStates:r.possibleDecisionStates})).with({type:Ut.Numeric},r=>({...n,type:kt.Numeric,decision:m(r.decision,F(i=>({state:i.state,kind:this.mapToDecisionKind(i.kind)})),Mr),range:r.range,decimalPlaces:r.decimalPlaces,selection:this.mapToSelection(r.selection)})).with({type:Ut.Choice},r=>({...n,type:kt.Choice,cardinality:r.cardinality,values:m(r.values,_(i=>{const o=m(i.decision,F(a=>({state:this.mapToChoiceValueDecisionState(a.state),kind:this.mapToDecisionKind(a.kind)})),Mr);return{id:i.choiceValueId,possibleDecisionStates:m(i.possibleDecisionStates,_(a=>this.mapToChoiceValueDecisionState(a))),decision:o}}))})).with({type:Ut.Component},r=>({...n,type:kt.Component,decision:m(r.decision,F(i=>({state:this.mapToComponentDecisionState(i.state),kind:this.mapToDecisionKind(i.kind)})),Mr),possibleDecisionStates:m(r.possibleDecisionStates,_(i=>this.mapToComponentDecisionState(i))),selection:m(r.selection,st,F(i=>this.mapToSelection(i)),ie),inclusion:this.mapToInclusion(r.inclusion)})).exhaustive()}mapToInclusion(e){return K(e).with(bi.Always,()=>mi.Always).with(bi.Optional,()=>mi.Optional).exhaustive()}mapToComponentDecisionState(e){return K(e).with(me.Included,()=>Br.Included).with(me.Excluded,()=>Br.Excluded).exhaustive()}mapToChoiceValueDecisionState(e){return K(e).with(me.Included,()=>dr.Included).with(me.Excluded,()=>dr.Excluded).exhaustive()}mapToDecisionKind(e){return K(e).with(ue.Explicit,()=>hr.Explicit).with(ue.Implicit,()=>hr.Implicit).exhaustive()}mapToUsageRuleParameters(e){return e}},Wp=class{constructor(e,n){this.contractToDomainMapper=new bw,this.domainToContractMapper=new Hp,this.sessionHandler=e,this.internalConfigurationSessionCreator=n}async createSession(e){const n=this.configurationSessionFrom(e);return await m(this.sessionHandler.recreate(n),ve(r=>{const i=this.internalConfigurationSessionCreator(this.sessionHandler,r);return new gw(i,this.contractToDomainMapper,this.domainToContractMapper)}),_s(r=>{const i=this.domainToContractMapper.mapToFailureResult(r);return Promise.reject(i)},r=>Promise.resolve(r)))()}configurationSessionFrom(e){return{context:this.contractToDomainMapper.mapToSessionContext(e),sessionId:et,configuration:{isSatisfied:!1,attributes:[]},solutions:[]}}};function lf(t){return t.possibleDecisionStates.some(e=>e===dr.Included)}function Kp(t){return!lf(t)}const Sw=Object.freeze(Object.defineProperty({__proto__:null,isAllowed:lf,isBlocked:Kp},Symbol.toStringTag,{value:"Module"}));function Cw(t){return K(t).with({type:kt.Choice},e=>e.cardinality.lowerBound>0).otherwise(()=>!0)}function ww(t){return K(t).with({type:kt.Choice},e=>e.cardinality.upperBound>1).otherwise(()=>!1)}function Tw(t){return m(t.values,on(lf))}function Iw(t){return m(t.values,on(Kp))}function Jp(t,e){return m(t.values,po(n=>m(n.decision,st,Te(r=>r.kind===e))))}function Yp(t){return m(t.values,on(e=>m(e.decision,st,F(n=>n.state===dr.Included),Gt(()=>!1))))}const Ew=Yp;function Xp(t){return m(t.decision,st,Te(e=>e.kind===hr.Explicit),Mr)}function Zp(t){return m(t.decision,st,Te(e=>e.kind===hr.Explicit),Mr)}function xw(t,e){return t.possibleDecisionStates.some(n=>n===e)}function Qp(t){return m(t.decision,st,Mr)}function tv(t){return ev(t,Br.Included)}function Aw(t){return!tv(t)}function ev(t,e){return t.possibleDecisionStates.some(n=>n===e)}const $w=Object.freeze(Object.defineProperty({__proto__:null,getAllowedChoiceValues:Tw,getBlockedChoiceValues:Iw,getBooleanDecision:Zp,getChoiceDecisions:Jp,getComponentDecision:Qp,getIncludedChoiceValues:Yp,getNumericDecision:Xp,getSelectedChoiceValues:Ew,isBooleanValuePossible:xw,isComponentAllowed:tv,isComponentBlocked:Aw,isComponentStatePossible:ev,isMandatory:Cw,isMultiSelect:ww},Symbol.toStringTag,{value:"Module"})),nv=t=>t.type===kt.Boolean,rv=t=>t.type===kt.Choice,iv=t=>t.type===kt.Numeric,ov=t=>t.type===kt.Component,Dw=Ma(Xt);function Ow(t,e,n){var r;const i=((r=e.componentPath)==null?void 0:r.length)??0;return m(t,on(o=>{var a;const u=((a=o.id.componentPath)==null?void 0:a.length)??0;return n?i>u?!1:m(o.id.componentPath??[],Sp(e.componentPath??[]),rS(([s,c])=>s===c)):Dw.equals(o.id.componentPath,e.componentPath)}))}function Nw(t,e,n){return[]}function Pw(t){return m(t,on(e=>{const n=m(e.id.componentPath,st,F(i=>i.length===0),Gt(()=>!0)),r=m(e.id.sharedConfigurationModelId,st,lr(()=>!0,()=>!1));return n&&r}))}function Mw(t,e){return m(av(t),_(n=>Jp(n,e)),Tp,po(n=>st(n)))}function Rw(t,e){return m(uv(t),on(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),_(n=>Xp(n)),po(n=>st(n)))}function _w(t,e){return m(cv(t),on(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),_(n=>Zp(n)),po(n=>st(n)))}function jw(t,e){return m(sv(t),on(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),_(n=>Qp(n)),po(n=>st(n)))}function av(t){return m(t.attributes,on(rv))}function sv(t){return m(t.attributes,on(ov))}function uv(t){return m(t.attributes,on(iv))}function cv(t){return m(t.attributes,on(nv))}function qw(t,e){return m(Ra(t,e),ie)}function kw(t,e){return m(lv(t,e),ie)}function Uw(t,e,n){return m(lv(t,e),F(r=>r.values),bn(Pn(Me(r=>r.id===n))),ie)}function Bw(t,e){return m(Ra(t,e),Te(iv),ie)}function Vw(t,e){return m(Ra(t,e),Te(nv),ie)}function Fw(t,e){return m(Ra(t,e),Te(ov),ie)}function Ra(t,e){return m(t.attributes,Me(n=>Oi.equals(n.id,e)))}function lv(t,e){return m(Ra(t,e),Te(rv))}const Lw=Object.freeze(Object.defineProperty({__proto__:null,filterAttributesOfComponent:Ow,filterAttributesOfRoot:Pw,filterAttributesOfShared:Nw,getAttribute:qw,getBooleanAttribute:Vw,getBooleanAttributes:cv,getBooleanDecisions:_w,getChoiceAttribute:kw,getChoiceAttributes:av,getChoiceDecisions:Mw,getChoiceValue:Uw,getComponentAttribute:Fw,getComponentAttributes:sv,getComponentDecisions:jw,getNumericAttribute:Bw,getNumericAttributes:uv,getNumericDecisions:Rw},Symbol.toStringTag,{value:"Module"})),fv={whyIsNotSatisfied:{configuration:{question:ze.whyIsNotSatisfied,subject:He.configuration},attribute:t=>({question:ze.whyIsNotSatisfied,subject:He.attribute,attributeId:t})},whyIsStateNotPossible:{choice:t=>({choiceValue:e=>({state:n=>({question:ze.whyIsStateNotPossible,subject:He.choiceValue,attributeId:t,choiceValueId:e,state:n})})}),boolean:t=>({state:e=>({question:ze.whyIsStateNotPossible,subject:He.boolean,attributeId:t,state:e})}),numeric:t=>({state:e=>({question:ze.whyIsStateNotPossible,subject:He.numeric,attributeId:t,state:e})}),component:t=>({state:e=>({question:ze.whyIsStateNotPossible,subject:He.component,attributeId:t,state:e})})}},Gw=Object.freeze(Object.defineProperty({__proto__:null,explainQuestionBuilder:fv},Symbol.toStringTag,{value:"Module"})),zw="https://spc.cloud.ceventis.de/api/engine",Hw={hcaEngineBaseUrl:zw};function Ww(t){return{hcaEngineBaseUrl:t.hcaEngineBaseUrl??Hw.hcaEngineBaseUrl,sessionHandler:t.sessionHandler}}function ko(t){if(t==null)throw new Error("Implementation Error: Unexpected null value encountered");return t}const dv=t=>e=>n=>m(n,Kb(r=>t.equals(r,e)),F(r=>m(n,Jb(r,i=>e))),Lc,Gt(()=>m(n,dt(Zb(e))))),Ya=dv({equals:(t,e)=>Fe.equals(t.attributeId,e.attributeId)}),Kw=dv({equals:(t,e)=>t.choiceValueId===e.choiceValueId});let Jw=class{constructor(e){this.restToDomainMapper=e}updateConfigurationSession(e,n){const r=this.updateConfigurationModel(e.configuration,n);return{...e,configuration:r}}updateConfigurationModel(e,n){var r,i,o,a,u,s,c,l,d;const f=m(((r=n.affectedDecisions)==null?void 0:r.choiceValueDecisions)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),h=m(((i=n.consequences)==null?void 0:i.choiceConsequences)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),v=m(((o=n.affectedDecisions)==null?void 0:o.componentDecisions)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),p=m(((a=n.consequences)==null?void 0:a.componentConsequences)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),S=m(((u=n.affectedDecisions)==null?void 0:u.numericDecisions)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),C=m(((s=n.consequences)==null?void 0:s.numericConsequences)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),w=m(((c=n.affectedDecisions)==null?void 0:c.booleanDecisions)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),T=m(((l=n.consequences)==null?void 0:l.booleanConsequences)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),I=m([],dt(m(w,_(b=>b.attributeId))),dt(m(T,_(b=>b.attributeId))),dt(m(S,_(b=>b.attributeId))),dt(m(C,_(b=>b.attributeId))),dt(m(f,_(b=>b.attributeId))),dt(m(h,_(b=>b.attributeId))),dt(m(v,_(b=>b.attributeId))),dt(m(p,_(b=>b.attributeId))),Ji(Fe)),x=m(I,Gc(e.attributes,(b,E)=>{const P=e.attributes.find(A=>Fe.equals(A.attributeId,E));return K(P).with({type:Ut.Choice},(A,U)=>{const M=this.mergeChoice(U,m(h,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)),m(f,on($=>Fe.equals($.attributeId,E)),_($=>$.payload)));return Ya(M)(b)}).with({type:Ut.Numeric},(A,U)=>{const M=this.mergeNumeric(U,m(C,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)),m(S,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)));return Ya(M)(b)}).with({type:Ut.Boolean},(A,U)=>{const M=this.mergeBoolean(U,m(T,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)),m(w,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)));return Ya(M)(b)}).with({type:Ut.Component},(A,U)=>{const M=this.mergeComponent(U,m(p,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)),m(v,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)));return Ya(M)(b)}).exhaustive()}));return{...e,isSatisfied:m((d=n.consequences)==null?void 0:d.isConfigurationSatisfied,st,Gt(()=>e.isSatisfied)),attributes:x}}mergeChoice(e,n,r){const i=m(n,F(s=>s.values??[]),Gt(()=>[])),o=m(r),a=m([],dt(m(i,_(s=>s.choiceValueId))),dt(m(o,_(s=>s.choiceValueId))),_(ko),Ji(Xt)),u=m(a,Gc(e.values,(s,c)=>{const l=m(i,Me(v=>v.choiceValueId===c)),d=m(o,Me(v=>v.choiceValueId===c)),f=m(e.values.find(v=>v.choiceValueId===c),st),h=this.mergeChoiceValue(c,f,l,d);return Kw(h)(s)}));return{...e,isSatisfied:m(n,F(s=>ko(s.isSatisfied)),Gt(()=>e.isSatisfied)),values:u}}mergeChoiceValue(e,n,r,i){const o=m(i,F(u=>({state:this.toDecisionState(ko(u.state)),kind:this.toDecisionKind(ko(u.kind))})),Gt(()=>({state:m(n,bn(u=>m(u.decision,F(s=>s.state)))),kind:m(n,bn(u=>m(u.decision,F(s=>s.kind))),Gt(()=>ue.Explicit))}))),a=m(r,F(u=>m(dd(u.possibleDecisionStates??[]),_(s=>this.toPossibleDecisionState(s)),Gn)),Gt(()=>m(n,F(u=>u.possibleDecisionStates??[]),Gt(()=>[]))));return{choiceValueId:e,decision:m(o.state,F(u=>({state:u,kind:o.kind}))),possibleDecisionStates:a}}mergeComponent(e,n,r){const i=m(r,F(a=>{const u=this.toDecisionState(ko(a.state));return m(u,F(s=>({state:s,kind:this.toDecisionKind(a.kind)})))}),Gt(()=>m(e.decision,F(a=>({state:a.state,kind:a.kind}))))),o=m(n,F(a=>m(dd(a.possibleDecisionStates??[]),_(u=>this.toPossibleDecisionState(u)),Gn)),Gt(()=>e.possibleDecisionStates));return{...e,isSatisfied:m(n,F(a=>a.isSatisfied),Gt(()=>e.isSatisfied)),possibleDecisionStates:o,decision:i}}mergeNumeric(e,n,r){return{...e,isSatisfied:m(n,bn(i=>st(i.isSatisfied)),Gt(()=>e.isSatisfied)),decision:m(r,lr(()=>e.decision,i=>m(i.state,st,F(o=>({kind:this.toDecisionKind(i.kind),state:o})))))}}mergeBoolean(e,n,r){return{...e,isSatisfied:m(n,bn(i=>st(i.isSatisfied)),Gt(()=>e.isSatisfied)),decision:m(r,lr(()=>e.decision,i=>m(i.state,st,F(o=>({kind:this.toDecisionKind(i.kind),state:o}))))),possibleDecisionStates:m(n,F(i=>i.possibleDecisionStates),Gt(()=>e.possibleDecisionStates))}}toPossibleDecisionState(e){return K(e).with(Si.Included,()=>wt(me.Included)).with(Si.Excluded,()=>wt(me.Excluded)).otherwise(()=>et)}toDecisionState(e){return K(e).with(ar.Included,()=>wt(me.Included)).with(ar.Excluded,()=>wt(me.Excluded)).otherwise(()=>et)}toDecisionKind(e){return K(e).with(ma.Implicit,()=>ue.Implicit).with(ma.Explicit,()=>ue.Explicit).exhaustive()}},Yw=class{mapSessionToExplicitDecisions(e){return this.mapToExplicitDecisionsInner(e.configuration.attributes)}mapToExplicitDecision(e){return K(e).with({type:ot.ChoiceValue},n=>({type:cn.Choice,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToDecisionState(n.state)})).with({type:ot.Component},n=>({type:cn.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:this.mapToDecisionState(n.state)})).with({type:ot.Numeric},n=>({type:cn.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.value,ie)})).with({type:ot.Boolean},n=>({type:cn.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.value,ie)})).exhaustive()}mapToExplicitDecisions(e,n){const r=this.mapToMode(n),i=m([...e],Sr(s=>s.type!==ot.Boolean?et:wt({type:cn.Boolean,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:m(s.value,ie)}))),o=m([...e],Sr(s=>s.type!==ot.Numeric?et:wt({type:cn.Numeric,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:m(s.value,ie)}))),a=m([...e],Sr(s=>s.type!==ot.ChoiceValue?et:wt({type:cn.Choice,attributeId:this.mapToGlobalAttributeId(s.attributeId),choiceValueId:s.choiceValueId,state:this.mapToDecisionState(s.state)}))),u=m([...e],Sr(s=>s.type!==ot.Component?et:wt({type:cn.Component,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:this.mapToDecisionState(s.state)})));return{mode:r,choiceDecisions:a,numericDecisions:o,booleanDecisions:i,componentDecisions:u}}mapToExplicitDecisionsInner(e){const n=m([...e],Sr(a=>a.type!==Ut.Boolean?et:m(a.decision,Te(u=>u.kind===ue.Explicit),F(()=>this.mapToExplicitBooleanDecision(a))))),r=m([...e],Sr(a=>a.type!==Ut.Numeric?et:m(a.decision,Te(u=>u.kind===ue.Explicit),F(()=>this.mapToExplicitNumericDecision(a))))),i=m([...e],Sr(a=>a.type!==Ut.Component?et:m(a.decision,Te(u=>u.kind===ue.Explicit),F(()=>this.mapToExplicitComponentDecision(a))))),o=m([...e],Sr(a=>a.type!==Ut.Choice?et:m(this.mapToExplicitChoiceDecisions(a),Eb(u=>m(u,cu)))),pS);return{booleanDecisions:n,numericDecisions:r,choiceDecisions:o,componentDecisions:i}}mapToMode(e){return K(e).with({type:"Default"},n=>({type:"Default"})).with({type:"DropExistingDecisions"},n=>this.mapToDropExistingDecisionsMode(n)).exhaustive()}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:m(e.componentPath,st,F(fd),Mr),sharedConfigurationModelId:e.sharedConfigurationModel}}mapToDropExistingDecisionsMode(e){return{type:"DropExistingDecisions",conflictResolution:K(e.conflictHandling).with({type:"Manual",includeConstraintsInConflictExplanation:Kt.boolean},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).otherwise(()=>({type:"Automatic"}))}}mapToExplicitBooleanDecision(e){return{type:cn.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:m(e.decision,F(n=>n.state),ie)}}mapToExplicitNumericDecision(e){return{type:cn.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:m(e.decision,F(n=>n.state),ie)}}mapToExplicitComponentDecision(e){return{type:cn.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToDecisionState(m(e.decision,F(n=>n.state)))}}mapToExplicitChoiceDecisions(e){function n(r){return m(r.decision,F(i=>i.kind===ue.Explicit),Gt(()=>!1))}return m(e.values,on(n),_(r=>({type:cn.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:r.choiceValueId,state:this.mapToDecisionState(m(r.decision,F(i=>i.state)))})),fd)}mapToDecisionState(e){return m(e,F(n=>K(n).with(me.Included,()=>ar.Included).with(me.Excluded,()=>ar.Excluded).exhaustive()),Gt(()=>ar.Undefined))}mapToPossibleDecisionState(e){return K(e).with(me.Included,()=>Si.Included).with(me.Excluded,()=>Si.Excluded).exhaustive()}mapToWhyNotSatisfiedRequest(e){return K(e).with({subject:Re.attribute},n=>({type:Xc.Attribute,attributeId:this.mapToGlobalAttributeId(n.attributeId)})).with({subject:Re.configuration},()=>({type:Xc.Configuration})).exhaustive()}mapToWhyStateNotPossibleRequest(e){return K(e).with({subject:Re.boolean},n=>({type:Wo.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:n.state})).with({subject:Re.numeric},n=>({type:Wo.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:n.state})).with({subject:Re.component},n=>({type:Wo.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:this.mapToPossibleDecisionState(n.state)})).with({subject:Re.choiceValue},n=>({type:Wo.ChoiceValue,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToPossibleDecisionState(n.state)})).exhaustive()}},Xw=class{constructor(){this.configurationSession={hasExplicitDecisions(e){return m(e.configuration.attributes,Me(n=>K(n).with({type:Ut.Boolean},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),Ho)).with({type:Ut.Numeric},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),Ho)).with({type:Ut.Choice},r=>m(r.values,Me(i=>m(i.decision,F(o=>o.kind===ue.Explicit),Gt(()=>!1))),Ho)).with({type:Ut.Component},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),Ho)).exhaustive()),lr(()=>!1,()=>!0))},getExplicitDecisions(e){return m(e.configuration.attributes,_(n=>K(n).with({type:Ut.Boolean},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),F(i=>({type:ot.Boolean,attributeId:r.attributeId,value:st(i.state)})),F(i=>[i]))).with({type:Ut.Numeric},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),F(i=>({type:ot.Numeric,attributeId:r.attributeId,value:st(i.state)})),F(i=>[i]))).with({type:Ut.Choice},r=>m(r.values,_(i=>m(i.decision,Te(o=>o.kind===ue.Explicit),F(o=>({type:ot.ChoiceValue,attributeId:r.attributeId,choiceValueId:i.choiceValueId,state:st(o.state)})))),Gn,_r)).with({type:Ut.Component},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),F(i=>({type:ot.Component,attributeId:r.attributeId,state:st(i.state)})),F(i=>[i]))).exhaustive()),Gn,Tp)}}}},Zw=class{constructor(e,n,r,i,o,a){this.engineApiClient=n,this.domainToRestMapper=i,this.restToDomainMapper=r,this.domainToContractMapper=o,this.domainUpdater=a,this.sessionHandler=e,this.interpreter=new Xw}close(e){return this.sessionHandler.close(e)}recreate(e){return this.initializeInner(e,!1)}reinitialize(e){return this.initializeInner(e,!0)}makeDecision(e,n){const r=this.domainToRestMapper.mapToExplicitDecision(e);return this.withSession(n,(i,o)=>m(this.engineApiClient.makeDecision(i,r),Dn(rr),ve(a=>this.domainUpdater.updateConfigurationSession(o,a))))}explain(e,n){return this.withSession(n,r=>{const i=K(e).with({question:hn.whyIsNotSatisfied},o=>this.explainWhyNotSatisfied(o,r)).with({question:hn.whyIsStateNotPossible},o=>this.explainWhyStateNotPossible(o,r)).exhaustive();return m(i,Dn(rr),ve(o=>this.restToDomainMapper.mapToExplainAnswer(o,e)))})}setMany(e,n,r){return this.withSession(r,(i,o)=>{const a=this.setManyInner(e,n,i);return m(a,An(u=>{var s,c,l,d;const f=m([],dt(m(((s=u.rejectedDecisions)==null?void 0:s.booleanDecisions)??[],_(h=>this.restToDomainMapper.mapToBooleanDecision(h)))),dt(m(((c=u.rejectedDecisions)==null?void 0:c.numericDecisions)??[],_(h=>this.restToDomainMapper.mapToNumericDecision(h)))),dt(m(((l=u.rejectedDecisions)==null?void 0:l.componentDecisions)??[],_(h=>this.restToDomainMapper.mapToComponentDecision(h)))),dt(m(((d=u.rejectedDecisions)==null?void 0:d.choiceValueDecisions)??[],_(h=>this.restToDomainMapper.mapToExplicitChoiceValueDecision(h)))));return m(f,cu)?or(sw.createConfigurationRejectedDecisionsConflict(f)):Yi(this.domainUpdater.updateConfigurationSession(o,u))}))})}replaceDecisions(e,n){const r=this.interpreter.configurationSession.getExplicitDecisions(n),i=this.setManyInner(r,{type:"DropExistingDecisions",conflictHandling:{type:"Automatic"}},e);return m(i,ve(o=>({})))}setManyInner(e,n,r){const i=this.domainToRestMapper.mapToExplicitDecisions(e,n),o=this.engineApiClient.setMany(r,i);return m(o,Dn(rr),An(a=>{const u={rejectedDecisions:{booleanDecisions:Kt.array(Kt.any)}},s={decisionExplanations:Kt.array(Kt.any)};return K(a).with(u,c=>vo(c)).with(s,c=>or(this.restToDomainMapper.mapToConfigurationSetManyConflictFailure(c,i,n))).otherwise(()=>or({type:nt.Unknown}))}))}explainWhyStateNotPossible(e,n){const r=this.domainToRestMapper.mapToWhyStateNotPossibleRequest(e);return this.engineApiClient.getWhyStateNotPossible(n,r)}explainWhyNotSatisfied(e,n){const r=this.domainToRestMapper.mapToWhyNotSatisfiedRequest(e);return this.engineApiClient.getWhyNotSatisfied(n,r)}withSession(e,n){return m(Yi(e),An(r=>m(r.sessionId,lr(()=>this.initializeInner(r,!1),()=>Yi(r)))),An(r=>m(r.sessionId,sf(()=>({type:nt.ConfigurationUnauthenticated})),An(i=>n(i,r)))))}initializeInner(e,n){return m(YS,()=>m(e.sessionId,$C,OC(r=>n?AC(r):m(this.sessionHandler.close(r),_s(()=>et,()=>et)))),r=>{const i=this.domainToContractMapper.mapToSessionContext(e.context);return m(r,GS(()=>({type:nt.ConfigurationUnauthenticated})),Dp(()=>this.sessionHandler.create(i)))},r=>m(r,XS(i=>m(_r(e),Te(this.interpreter.configurationSession.hasExplicitDecisions),F(o=>this.replaceDecisions(i,o)),Gt(()=>Yi({}))))),r=>m(r,An(i=>{const o=this.determineConsequences(i),a=this.determineDecisions(i),u=hb(WS)({consequences:o,decisions:a});return m(u,ve(({decisions:s,consequences:c})=>this.restToDomainMapper.mapToConfigurationModel(s,c)),ve(s=>({sessionId:_r(i),configuration:s,context:e.context,solutions:[]})))})))}determineDecisions(e){return m(this.engineApiClient.getDecisions(e),Dn(rr))}determineConsequences(e){return m(this.engineApiClient.getConsequence(e),Dn(rr))}},Qw=class{constructor(e,n){this.onConfigurationChangedHandler=et,this.sessionHandler=e,this.configurationSession=n}setOnConfigurationChangedHandler(e){this.onConfigurationChangedHandler=e}getSessionContext(){return this.configurationSession.context}getConfiguration(){return this.configurationSession.configuration}explain(e){return m(this.sessionHandler.explain(e,this.configurationSession),this.updateAvailableSolutionsIfRight(n=>this.deriveSolutionsFromExplainAnswer(n)),this.invalidateAvailableSolutionsIfLeft())}setSessionContext(e){return m(this.sessionHandler.recreate({...this.configurationSession,context:e}),this.updateSession())}invalidateSessionId(){this.configurationSession={...this.configurationSession,sessionId:et}}restoreConfiguration(e){return m(this.sessionHandler.reinitialize({...this.configurationSession,configuration:e}),this.updateSession())}makeDecision(e){return m(this.sessionHandler.makeDecision(e,this.configurationSession),this.updateSession())}close(){return m(this.configurationSession.sessionId,F(e=>this.sessionHandler.close(e)),F(Pn(ve(e=>{this.configurationSession={...this.configurationSession,sessionId:et}}))),Gt(ru(YC())))}applySolution(e){return m(this.configurationSession.solutions,Me(n=>ow.equals(n,e)),sf(()=>({type:nt.ConfigurationSolutionNotAvailable})),ve(n=>n.decisions),An(n=>this.setMany(n,e.mode)))}setMany(e,n){return m(this.sessionHandler.setMany(e,n,this.configurationSession),this.updateSession(),js(r=>()=>{const i=K(r).with({decisionExplanations:Kt.array(Kt.any)},o=>wt(o.decisionExplanations)).otherwise(()=>et);this.configurationSession={...this.configurationSession,solutions:m(i,F(Pn(_(o=>o.solution))),Gt(()=>[]))}}))}deriveSolutionsFromExplainAnswer(e){const n=K(e).with({decisionExplanations:Kt.array(Kt.any)},r=>r.decisionExplanations).otherwise(()=>[]);return m(n,_(r=>r.solution))}invalidateAvailableSolutions(){return BC(()=>()=>{this.configurationSession={...this.configurationSession,solutions:[]}})}invalidateAvailableSolutionsIfLeft(){return js(()=>()=>{this.configurationSession={...this.configurationSession,solutions:[]}})}updateAvailableSolutionsIfRight(e){return pa(n=>()=>{this.configurationSession={...this.configurationSession,solutions:e(n)}})}updateSession(){return Pn(pa(e=>()=>{this.configurationSession=e,m(this.onConfigurationChangedHandler,FC(n=>()=>n(this.configurationSession.configuration)))}),ve(e=>e.configuration),this.invalidateAvailableSolutions())}},tT=class{constructor(e){this.inner=e;const n=3,r=2e3,i=200;this.policy=RC(r,PC.concat(_C(i),MC(n)))}getSessionContext(){return this.inner.getSessionContext()}close(){return this.inner.close()}setSessionContext(e){const n=()=>this.inner.setSessionContext(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}makeDecision(e){const n=()=>this.inner.makeDecision(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}restoreConfiguration(e){const n=()=>this.inner.restoreConfiguration(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}explain(e){const n=()=>this.inner.explain(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}applySolution(e){const n=()=>this.inner.applySolution(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}setMany(e,n){const r=()=>this.inner.setMany(e,n);return Mi(this.policy,r,i=>m(i,ai(o=>this.determineAndPrepareRetry(o),()=>!1)))}setOnConfigurationChangedHandler(e){this.inner.setOnConfigurationChangedHandler(e)}invalidateSessionId(){this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}determineAndPrepareRetry(e){return K(e).with({type:nt.ConfigurationUnauthenticated},()=>(this.invalidateSessionId(),!0)).with({type:nt.ConfigurationTimeout},()=>!0).otherwise(()=>!1)}},eT=class{constructor(){this.queue=[],this.operating=et}push(e){const n=new nT(e);return this.queue.push(n),this.operating=m(this.operating,Gt(()=>this.start()),_r),n.promise}async start(){for(;this.queue.length;){const e=[...this.queue];this.queue=[];const n=m(e,_(r=>r.argument),Gc(et,(r,i)=>this.reduce(r,i)),F(Pn(r=>this.execute(r),r=>r.then(i=>{m(e,_(o=>{o.resolve(i)}))}).catch(i=>{m(e,_(o=>{o.reject(i)}))}))),ie);n&&await n}this.operating=et}async flush(){return this.operating||Promise.resolve()}size(){return this.queue.length}},nT=class{constructor(e){this.resolve=()=>{},this.reject=()=>{},this.argument=e,this.promise=new Promise((n,r)=>{this.resolve=n,this.reject=r})}},rT=class extends eT{constructor(e){super(),this.inner=e}reduce(e,n){return wt(n)}async execute(e){return await this.inner.setSessionContext(e)()}},iT=class{constructor(e){this.inner=e,this.setContextReducingTaskExecutor=new rT(e)}getSessionContext(){return this.inner.getSessionContext()}setSessionContext(e){const n=this.inner.getSessionContext();if(ZC.equals(n,e))return vo(this.getConfiguration());const r=this.setContextReducingTaskExecutor.push(e);return()=>r}applySolution(e){return this.inner.applySolution(e)}close(){return this.inner.close()}makeDecision(e){return this.inner.makeDecision(e)}restoreConfiguration(e){return this.inner.restoreConfiguration(e)}setMany(e,n){return this.inner.setMany(e,n)}explain(e){return this.inner.explain(e)}invalidateSessionId(){return this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}setOnConfigurationChangedHandler(e){return this.inner.setOnConfigurationChangedHandler(e)}},oT=class{constructor(e,n=!1){this.stringify=n,this.inner=e,this.durationNumberFormat=new Intl.NumberFormat("en-EN",{maximumFractionDigits:3})}withLogging(e,n,r){const i=performance.now(),o=()=>{const a=performance.now()-i;return this.durationNumberFormat.format(a)};return console.debug(`Operation ${e} started with`,this.renderAsRequired(n)),m(r(),js(a=>()=>{console.debug(`Operation ${e} completed after ${o()}ms with failure`,this.renderAsRequired(a))}),pa(a=>()=>{console.debug(`Operation ${e} completed after ${o()}ms with success`,this.renderAsRequired(a))}))}renderAsRequired(e){return this.stringify?JSON.stringify(e,null,2):e}explain(e){return this.withLogging("explain",[e],()=>this.inner.explain(e))}getSessionContext(){return this.inner.getSessionContext()}setSessionContext(e){return this.withLogging("setSessionContext",[e],()=>this.inner.setSessionContext(e))}applySolution(e){return this.withLogging("applySolution",[e],()=>this.inner.applySolution(e))}close(){return this.inner.close()}makeDecision(e){return this.withLogging("makeDecision",[e],()=>this.inner.makeDecision(e))}restoreConfiguration(e){return this.withLogging("restoreConfiguration",[e],()=>this.inner.restoreConfiguration(e))}setMany(e,n){return this.withLogging("setMany",[e,n],()=>this.inner.setMany(e,n))}invalidateSessionId(){return this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}setOnConfigurationChangedHandler(e){return this.inner.setOnConfigurationChangedHandler(e)}};function aT(t){t=Ww(t);const e=new mw(t.hcaEngineBaseUrl),n=new Gp,r=new Yw,i=new Hp,o=new Bp,a=new Jw(n),u=K(t.sessionHandler).with({create:Kt.any,close:Kt.any},l=>l).with({accessToken:Kt.string},l=>new Fp(e,o,n,l)).with({sessionCreateUrl:Kt.string,sessionDeleteUrl:Kt.string},l=>new zp(o,l)).exhaustive(),s=new Zw(u,e,n,r,i,a),c=(l,d)=>m(new Qw(l,d),f=>new tT(f),f=>new iT(f),f=>new oT(f,!1));return new Wp(s,c)}const sT=Oi.equals,uT=qp.equals,cT=kp.equals,lT=Object.freeze(Object.defineProperty({__proto__:null,AllowedRulesInExplainType:va,AttributeInterpreter:$w,AttributeType:kt,ChoiceValueDecisionState:dr,ChoiceValueInterpreter:Sw,ClientSideSessionLifetimeHandler:Fp,ComponentDecisionState:Br,ConfigurationConflictReason:hu,ConfigurationInterpreter:Lw,ConfigurationModelSourceType:fr,ConfiguratorClient:Wp,ConstraintType:Qi,ContractToRestMapper:Bp,DecisionKind:hr,ExplainQuestionSubject:He,ExplainQuestionType:ze,FailureType:pe,Inclusion:mi,QuestionBuilder:Gw,Results:KC,Selection:yi,ServerSideSessionLifetimeHandler:zp,Types:WC,causedByDecisionEquals:cT,createClient:aT,explainQuestionBuilder:fv,globalAttributeIdEquals:sT,globalConstraintIdEquals:uT},Symbol.toStringTag,{value:"Module"}));function hv(t){return function(n,r,i,o,a,u,s){return t(n,r,s)}}function pu(t){return function(n,r,i,o){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i,o);var a=o.get(n),u=o.get(r);if(a&&u)return a===r&&u===n;o.set(n,r),o.set(r,n);var s=t(n,r,i,o);return o.delete(n),o.delete(r),s}}function pv(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n}function Od(t){return t.constructor===Object||t.constructor==null}function Nd(t){return typeof t.then=="function"}function vu(t,e){return t===e||t!==t&&e!==e}var fT="[object Arguments]",dT="[object Boolean]",hT="[object Date]",pT="[object RegExp]",vT="[object Map]",yT="[object Number]",mT="[object Object]",gT="[object Set]",bT="[object String]",Pd=Object.prototype.toString;function yu(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.areRegExpsEqual,a=t.areSetsEqual,u=t.createIsNestedEqual,s=u(c);function c(l,d,f){if(l===d)return!0;if(!l||!d||typeof l!="object"||typeof d!="object")return l!==l&&d!==d;if(Od(l)&&Od(d))return i(l,d,s,f);var h=Array.isArray(l),v=Array.isArray(d);if(h||v)return h===v&&e(l,d,s,f);var p=Pd.call(l);return p!==Pd.call(d)?!1:p===hT?n(l,d,s,f):p===pT?o(l,d,s,f):p===vT?r(l,d,s,f):p===gT?a(l,d,s,f):p===mT||p===fT?Nd(l)||Nd(d)?!1:i(l,d,s,f):p===dT||p===yT||p===bT?vu(l.valueOf(),d.valueOf()):!1}return c}function vv(t,e,n,r){var i=t.length;if(e.length!==i)return!1;for(;i-- >0;)if(!n(t[i],e[i],i,i,t,e,r))return!1;return!0}var ST=pu(vv);function yv(t,e){return vu(t.valueOf(),e.valueOf())}function mv(t,e,n,r){var i=t.size===e.size;if(!i)return!1;if(!t.size)return!0;var o={},a=0;return t.forEach(function(u,s){if(i){var c=!1,l=0;e.forEach(function(d,f){!c&&!o[l]&&(c=n(s,f,a,l,t,e,r)&&n(u,d,s,f,t,e,r))&&(o[l]=!0),l++}),a++,i=c}}),i}var CT=pu(mv),wT="_owner",TT=Object.prototype.hasOwnProperty;function gv(t,e,n,r){var i=Object.keys(t),o=i.length;if(Object.keys(e).length!==o)return!1;for(var a;o-- >0;){if(a=i[o],a===wT){var u=!!t.$$typeof,s=!!e.$$typeof;if((u||s)&&u!==s)return!1}if(!TT.call(e,a)||!n(t[a],e[a],a,a,t,e,r))return!1}return!0}var IT=pu(gv);function bv(t,e){return t.source===e.source&&t.flags===e.flags}function Sv(t,e,n,r){var i=t.size===e.size;if(!i)return!1;if(!t.size)return!0;var o={};return t.forEach(function(a,u){if(i){var s=!1,c=0;e.forEach(function(l,d){!s&&!o[c]&&(s=n(a,l,u,d,t,e,r))&&(o[c]=!0),c++}),i=s}}),i}var ET=pu(Sv),Cv=Object.freeze({areArraysEqual:vv,areDatesEqual:yv,areMapsEqual:mv,areObjectsEqual:gv,areRegExpsEqual:bv,areSetsEqual:Sv,createIsNestedEqual:hv}),wv=Object.freeze({areArraysEqual:ST,areDatesEqual:yv,areMapsEqual:CT,areObjectsEqual:IT,areRegExpsEqual:bv,areSetsEqual:ET,createIsNestedEqual:hv}),xT=yu(Cv);function AT(t,e){return xT(t,e,void 0)}yu(pv(Cv,{createIsNestedEqual:function(){return vu}}));yu(wv);yu(pv(wv,{createIsNestedEqual:function(){return vu}}));/*! *****************************************************************************
4
+ ${JSON.stringify(t,null,2)}`)}var sa=(t=>(t.ConfigurationEngineRestApiUnauthorized="Generic::Unauthorized",t.ClientError="Generic::LocalClientError",t.ServerError="Generic::ServerError",t.UnhandledResponseStatus="LocalUnhandledResponseStatus",t.LowLevelCommunicationError="LocalLowLevelCommunicationError",t))(sa||{}),Vp=(t=>(t.BooleanAttributeNotFound="BooleanAttributeNotFound",t.ChoiceAttributeNotFound="ChoiceAttributeNotFound",t.ChoiceValueNotFound="ChoiceValueNotFound",t.ConfigurationInitializationFailure="InitializationFailure",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.LegacyConfigurationModelInvalid="DeploymentStore.Core.Store.SnapshotInvalid",t.LegacySnapshotInvalid="SnapshotInvalid",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConflictWithConsequence="ConflictWithConsequence",t.DecisionInvalid="DecisionInvalid",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.NumericAttributeNotFound="NumericAttributeNotFound",t.NumericDecisionOutOfRange="NumericDecisionOutOfRange",t.SessionNotFound="SessionNotFound",t.SetDecisionConflict="SetDecisionConflict",t.Unauthorized="Unauthorized",t))(Vp||{});const lw=t=>Object.values(Vp).includes(t),fw=t=>lw(t)?wt(t):et;function dw(t){return m(t,fw,F(e=>K(e).with("ConfigurationModelNotFound",()=>({type:nt.ConfigurationModelNotFound})).with("DecisionsToRespectInvalid",()=>({type:nt.DecisionsToRespectInvalid})).with(Kt.union("ChoiceAttributeNotFound","NumericAttributeNotFound","BooleanAttributeNotFound"),()=>({type:nt.ConfigurationAttributeNotFound})).with("ChoiceValueNotFound",()=>({type:nt.ConfigurationChoiceValueNotFound})).with("DecisionInvalid",()=>({type:nt.ConfigurationConflict})).with("NumericDecisionOutOfRange",()=>({type:nt.ConfigurationConflict,reason:cf.NumericDecisionOutOfRange})).with("ConflictWithConsequence",()=>({type:nt.ConfigurationConflict})).with(Kt.union("SessionNotFound","Unauthorized"),()=>({type:nt.ConfigurationUnauthenticated})).with("ConfigurationModelInvalid",()=>({type:nt.ConfigurationModelInvalid})).with("DeploymentStore.Core.Store.SnapshotInvalid",()=>({type:nt.ConfigurationModelInvalid})).with("SnapshotInvalid",()=>({type:nt.ConfigurationModelInvalid})).with("InitializationFailure",()=>({type:nt.ConfigurationInitializationFailure})).with("ConfigurationModelNotFeasible",n=>({type:nt.ConfigurationModelNotFeasible,constraintExplanations:[]})).with("SetDecisionConflict",()=>({type:nt.ConfigurationConflict})).exhaustive()))}const hw=t=>Object.values(sa).includes(t),pw=t=>hw(t)?wt(t):et;function vw(t){return m(t,pw,F(e=>K(e).with("Generic::LocalClientError",()=>({type:nt.ConfigurationApplicationError})).with("Generic::ServerError",()=>({type:nt.ServiceError})).with("LocalLowLevelCommunicationError",()=>({type:nt.CommunicationError})).with("Generic::Unauthorized",()=>({type:nt.ConfigurationUnauthenticated})).with("LocalUnhandledResponseStatus",()=>({type:nt.Unknown})).exhaustive()))}function rr(t,e){cw(t,e);const n=t.type;return m(et,ld(()=>dw(n)),ld(()=>vw(n)),Gt(()=>(console.error("InterpretEngineError encountered unexpected error type","ProblemDetails",t,"Context",e),{type:nt.Unknown})))}let Fp=class{constructor(e,n,r,i){this.engineApiClient=e,this.contractToRestMapper=n,this.restToDomainMapper=r,this.options=i}create(e){const n=this.contractToRestMapper.mapToCreateSessionRequest(e);return m(this.engineApiClient.createSessionUsingJwtBearer(n,this.options.accessToken),Dn(r=>rr(r,"ClientSideSessionLifetimeHandler - create")),An(r=>this.restToDomainMapper.mapToSessionId(r)),JC(()=>({type:nt.ConfigurationUnauthenticated})))}close(e){return m(this.engineApiClient.deleteSessionUsingJwtBearer(e,this.options.accessToken),Dn(n=>rr(n,"ClientSideSessionLifetimeHandler - close")),ve(()=>Ar()))}};function yw(t){var e=[];if(t.length===0)return"";if(typeof t[0]!="string")throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var i=t[r];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(r>0&&(i=i.replace(/^[\/]+/,"")),r<t.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/");o=o.replace(/\/(\?|&|#[^!])/g,"$1");var a=o.split("?");return o=a.shift()+(a.length>0?"?":"")+a.join("&"),o}function mw(){var t;return typeof arguments[0]=="object"?t=arguments[0]:t=[].slice.call(arguments),yw(t)}var Lp=(t=>(t[t.Ok=200]="Ok",t[t.NoContent=204]="NoContent",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.NotFound=404]="NotFound",t[t.Conflict=409]="Conflict",t))(Lp||{});function tr(t,e,n){const r=m(Array.isArray(t)?t:[t],mw);return m(Sd(()=>fetch(r,e),i=>({type:"error"})),An(i=>m(Sd(async()=>{const o=await i.json();return{response:i,data:o}},()=>i))),Dp(i=>i.status===401?or({type:sa.ConfigurationEngineRestApiUnauthorized,status:401}):i.status===204?vo({response:i,data:{}}):i.type==="error"?or({type:sa.LowLevelCommunicationError}):or({type:sa.UnhandledResponseStatus})),An(i=>m(n(i),sf(()=>i.data))))}function Wc(t,e){return tr(t,e,n=>{if(n.response.status===200)return _r(n.data);if(n.response.status===409){const r=n.data;return K(r).with({type:"ConfigurationModelInvalid"},i=>_r(r)).with({type:"ConfigurationModelNotFeasible"},i=>_r(r)).otherwise(()=>et)}return et})}let gw=class{constructor(e){this.baseUrl=e}createSessionUsingApiKey(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-API-KEY":n},body:JSON.stringify(e)};return Wc([this.baseUrl,"v2/session"],r)}createSessionUsingJwtBearer(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify(e)};return Wc([this.baseUrl,"v2/session"],r)}setMany(e,n){const r={method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return tr([this.baseUrl,"v2/session/configuration/decision/many"],r,i=>i.response.status===200||i.response.status===409?wt(i.data):et)}makeDecision(e,n){const r={method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return tr([this.baseUrl,"v2/session/configuration/decision"],r,i=>i.response.status===200?wt(i.data):et)}getDecisions(e){const n={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}};return tr([this.baseUrl,"v2/session/configuration/decision"],n,r=>r.response.status===200?wt(r.data):et)}getWhyStateNotPossible(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return tr([this.baseUrl,"v2/session/configuration/consequence/explain/why-state-not-possible"],r,i=>i.response.status===200?wt(i.data):et)}getWhyNotSatisfied(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return tr([this.baseUrl,"v2/session/configuration/consequence/explain/why-not-satisfied"],r,i=>i.response.status===200?wt(i.data):et)}getConsequence(e){const n={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}};return tr([this.baseUrl,"v2/session/configuration/consequence"],n,r=>r.response.status===200?wt(r.data):et)}deleteSessionUsingJwtBearer(e,n){const r={method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`}};return tr([this.baseUrl,`v2/session/${e}`],r,i=>i.response.status===204?wt({}):et)}};var Si=(t=>(t.Included="Included",t.Excluded="Excluded",t))(Si||{}),Kc=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(Kc||{}),Yc=(t=>(t.Always="Always",t.Optional="Optional",t))(Yc||{}),ma=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(ma||{}),ar=(t=>(t.Included="Included",t.Excluded="Excluded",t.Undefined="Undefined",t))(ar||{}),cn=(t=>(t.Choice="Choice",t.Numeric="Numeric",t.Boolean="Boolean",t.Component="Component",t))(cn||{}),Jc=(t=>(t.NotAvailable="NotAvailable",t.StateNotPossible="StateNotPossible",t))(Jc||{}),Xc=(t=>(t.Attribute="Attribute",t.Configuration="Configuration",t))(Xc||{}),Wo=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.ChoiceValue="ChoiceValue",t.Component="Component",t))(Wo||{});const sn=Xn({localId:Xt,componentPath:Ma(Xt),sharedConfigurationModelId:uf(Xt)});let Gp=class{mapToDecisions(e){return{}}mapToSessionId(e){return K(e).with({sessionId:Kt.string},n=>vo(n.sessionId)).with({type:"ConfigurationModelNotFeasible"},n=>{const r=m(n.constraintExplanations,_(i=>this.mapToConstraintExplanation(i)));return or({type:nt.ConfigurationModelNotFeasible,constraintExplanations:r})}).with({type:"ConfigurationModelInvalid"},()=>or({type:nt.ConfigurationModelInvalid})).otherwise(()=>or({type:nt.Unknown}))}mapToExplainAnswer(e,n){const r=K(n).with({question:hn.whyIsStateNotPossible,subject:Re.boolean},a=>[{type:ot.Boolean,attributeId:a.attributeId,value:wt(a.state)}]).with({question:hn.whyIsStateNotPossible,subject:Re.numeric},a=>[{type:ot.Numeric,attributeId:a.attributeId,value:wt(a.state)}]).with({question:hn.whyIsStateNotPossible,subject:Re.component},a=>[{type:ot.Component,attributeId:a.attributeId,state:wt(a.state)}]).with({question:hn.whyIsStateNotPossible,subject:Re.choiceValue},a=>[{type:ot.ChoiceValue,attributeId:a.attributeId,choiceValueId:a.choiceValueId,state:wt(a.state)}]).otherwise(()=>[]),i=m(e.decisionExplanations,_(a=>this.mapToDecisionExplanation(a,r,{type:"Default"}))),o=m(e.constraintExplanations,_(a=>this.mapToConstraintExplanation(a)));return K(n).with({answerType:di.decisions},()=>({decisionExplanations:i})).with({answerType:di.constraints},()=>({constraintExplanations:o})).with({answerType:di.all},()=>({constraintExplanations:o,decisionExplanations:i})).exhaustive()}mapToConfigurationSetManyConflictFailure(e,n,r){const i=this.mapToExplicitDecisions(n);return{type:nt.ConfigurationSetManyConflict,decisionExplanations:m(e.decisionExplanations,_(o=>this.mapToDecisionExplanation(o,i,r))),constraintExplanations:m(e.constraintExplanations,_(o=>this.mapToConstraintExplanation(o)))}}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}mapToConfigurationModel(e,n){const r=this.mapToAttributes(e,n);return{isSatisfied:n.isConfigurationSatisfied??!1,attributes:r}}mapToBooleanDecision(e){return{type:ot.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),value:st(e.state)}}mapToNumericDecision(e){return{type:ot.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),value:st(e.state)}}mapToComponentDecision(e){return{type:ot.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToDecisionState(e.state)}}mapToExplicitChoiceValueDecision(e){return{type:ot.ChoiceValue,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToDecisionState(e.state)}}mapToGlobalAttributeId(e){return{localId:e.localId,sharedConfigurationModel:e.sharedConfigurationModelId,componentPath:e.componentPath??[]}}mapToChoiceValueDecision(e){return m(this.mapToDecisionState(e.state),F(n=>({kind:this.mapToDecisionKind(e.kind),state:n})))}mapToConstraintExplanation(e){return{causedByRules:m(e.causedByRules,_(n=>this.mapToRuleConstraint(n))),causedByCardinalities:m(e.causedByCardinalities,_(n=>this.mapToCardinalityConstraint(n)))}}mapToRuleConstraint(e){return{type:to.Rule,ruleId:this.mapToGlobalConstraintId(e.constraintId)}}mapToCardinalityConstraint(e){return{type:to.Cardinality,attributeId:this.mapToGlobalAttributeId(e.attributeId)}}mapToExplicitDecisions(e){const n=m(e.booleanDecisions??[],_(a=>({type:ot.Boolean,attributeId:this.mapToGlobalAttributeId(a.attributeId),value:st(a.state)}))),r=m(e.numericDecisions??[],_(a=>({type:ot.Numeric,attributeId:this.mapToGlobalAttributeId(a.attributeId),value:st(a.state)}))),i=m(e.componentDecisions??[],_(a=>({type:ot.Component,attributeId:this.mapToGlobalAttributeId(a.attributeId),state:m(st(a.state),F(u=>this.mapToDecisionState(u)),Lc)}))),o=m(e.choiceDecisions??[],_(a=>({type:ot.ChoiceValue,attributeId:this.mapToGlobalAttributeId(a.attributeId),choiceValueId:a.choiceValueId,state:m(st(a.state),F(u=>this.mapToDecisionState(u)),Lc)})));return m([],dt(n),dt(r),dt(i),dt(o))}mapToDecisionExplanation(e,n,r){const i=m(e.causedByBooleanDecisions,_(v=>this.mapToCausedByBooleanDecision(v))),o=m(e.causedByNumericDecisions,_(v=>this.mapToCausedByNumericDecision(v))),a=m(e.causedByComponentDecisions,_(v=>this.mapToCausedByComponentDecision(v))),u=m(e.causedByChoiceDecisions,_(v=>this.mapToCausedByChoiceValueDecision(v))),s=m(i,_(v=>({type:ot.Boolean,attributeId:v.attributeId,value:et}))),c=m(o,_(v=>({type:ot.Numeric,attributeId:v.attributeId,value:et}))),l=m(a,_(v=>({type:ot.Component,attributeId:v.attributeId,state:et}))),d=m(u,_(v=>({type:ot.ChoiceValue,attributeId:v.attributeId,choiceValueId:v.choiceValueId,state:et}))),f=m([],dt(s),dt(c),dt(l),dt(d)),h=wp(ho((v,p)=>{const S=Fe.equals(v.attributeId,p.attributeId);return K({a:v,b:p}).with({a:{type:ot.ChoiceValue},b:{type:ot.ChoiceValue}},C=>S&&C.a.choiceValueId===C.b.choiceValueId).otherwise(()=>S)}))(f)(n);return{causedByBooleanDecisions:i,causedByNumericDecisions:o,causedByComponentDecisions:a,causedByChoiceDecisions:u,solution:{decisions:m([],dt(f),dt(h)),mode:r}}}mapToCausedByBooleanDecision(e){return{type:ot.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state,reason:this.mapToReason(e.reason)}}mapToReason(e){return K(e).with(Jc.NotAvailable,()=>Hc.NotAvailable).with(Jc.StateNotPossible,()=>Hc.StateNotPossible).exhaustive()}mapToCausedByNumericDecision(e){return{type:ot.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state,reason:this.mapToReason(e.reason)}}mapToCausedByComponentDecision(e){return{type:ot.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToPossibleDecisionState(e.state),reason:this.mapToReason(e.reason)}}mapToCausedByChoiceValueDecision(e){return{type:ot.ChoiceValue,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToPossibleDecisionState(e.state),reason:this.mapToReason(e.reason)}}mapToAttributes(e,n){function r(f){return m(n.canAttributeContributeToConfigurationSatisfaction,Me(h=>sn.equals(h,f)),Ho)}const i=m([],dt(m(e.choiceValueDecisions,_(f=>f.attributeId))),dt(m(n.choiceConsequences,_(f=>f.attributeId))),Yi(sn)),o=m(i,_(f=>{const h=m(e.choiceValueDecisions??[],mS(p=>sn.equals(p.attributeId,f))),v=m(n.choiceConsequences??[],ii(p=>sn.equals(p.attributeId,f)));return m(v,F(p=>this.mapToChoiceAttributes(p,h,r(f))))}),Gn),a=m([],dt(m(e.numericDecisions,_(f=>f.attributeId))),dt(m(n.numericConsequences,_(f=>f.attributeId))),Yi(sn)),u=m(a,_(f=>{const h=m(e.numericDecisions??[],ii(p=>sn.equals(p.attributeId,f))),v=m(n.numericConsequences??[],ii(p=>sn.equals(p.attributeId,f)));return m(v,F(p=>this.mapToNumericAttribute(p,h,r(f))))}),Gn),s=m([],dt(m(e.booleanDecisions,_(f=>f.attributeId))),dt(m(n.booleanConsequences,_(f=>f.attributeId))),Yi(sn)),c=m(s,_(f=>{const h=m(e.booleanDecisions??[],ii(p=>sn.equals(p.attributeId,f))),v=m(n.booleanConsequences??[],ii(p=>sn.equals(p.attributeId,f)));return m(v,F(p=>this.mapToBooleanAttribute(p,h,r(f))))}),Gn),l=m([],dt(m(e.componentDecisions,_(f=>f.attributeId))),dt(m(n.componentConsequences,_(f=>f.attributeId))),Yi(sn)),d=m(l,_(f=>{const h=m(e.componentDecisions??[],ii(p=>sn.equals(p.attributeId,f))),v=m(n.componentConsequences??[],ii(p=>sn.equals(p.attributeId,f)));return m(v,F(p=>this.mapToComponentAttribute(p,h,r(f))))}),Gn);return m([],dt(o),dt(d),dt(u),dt(c))}mapToComponentAttribute(e,n,r){return{type:Ut.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,possibleDecisionStates:m(e.possibleDecisionStates,vs(i=>this.mapToPossibleDecisionState(i))),decision:m(n,bn(i=>m(this.mapToDecisionState(i.state),F(o=>({state:o,kind:i.kind}))))),inclusion:this.mapToInclusion(e.inclusion),selection:m(e.selection,st,F(i=>this.mapToSelection(i)),ie),canContributeToConfigurationSatisfaction:r}}mapToChoiceAttributes(e,n,r){const i=m(e.values,vs(o=>{const a=m(n,Me(u=>u.choiceValueId==o.choiceValueId));return this.mapToChoiceValue(o,a)}));return{type:Ut.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,cardinality:this.mapToCardinality(e.cardinality),values:i,canContributeToConfigurationSatisfaction:r}}mapToBooleanAttribute(e,n,r){return{type:Ut.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,selection:this.mapToSelection(e.selection),possibleDecisionStates:e.possibleDecisionStates,decision:m(n,bn(i=>m(i.state,st,F(o=>({kind:this.mapToDecisionKind(i.kind),state:o}))))),canContributeToConfigurationSatisfaction:r}}mapToNumericAttribute(e,n,r){return{type:Ut.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,range:{min:e.range.min,max:e.range.max},selection:this.mapToSelection(e.selection),decimalPlaces:e.decimalPlaces,decision:m(n,bn(i=>m(i.state,st,F(o=>({kind:this.mapToDecisionKind(i.kind),state:o}))))),canContributeToConfigurationSatisfaction:r}}mapToChoiceValue(e,n){const r=m(e.possibleDecisionStates,vs(i=>this.mapToPossibleDecisionState(i)));return{choiceValueId:e.choiceValueId,decision:m(n,bn(i=>this.mapToChoiceValueDecision(i))),possibleDecisionStates:r}}mapToDecisionKind(e){return K(e).with(ma.Implicit,()=>ue.Implicit).with(ma.Explicit,()=>ue.Explicit).exhaustive()}mapToDecisionState(e){return K(e).with(ar.Included,()=>wt(me.Included)).with(ar.Excluded,()=>wt(me.Excluded)).with(ar.Undefined,()=>et).exhaustive()}mapToPossibleDecisionState(e){return K(e).with(Si.Included,()=>me.Included).with(Si.Excluded,()=>me.Excluded).exhaustive()}mapToSelection(e){return K(e).with(Kc.Mandatory,()=>gi.Mandatory).with(Kc.Optional,()=>gi.Optional).exhaustive()}mapToInclusion(e){return K(e).with(Yc.Always,()=>bi.Always).with(Yc.Optional,()=>bi.Optional).exhaustive()}mapToCardinality(e){return{lowerBound:e.lowerBound,upperBound:e.upperBound}}},zp=class{constructor(e,n){this.restToDomainMapper=new Gp,this.contractToRestMapper=e,this.options=n}create(e){const n=this.contractToRestMapper.mapToCreateSessionRequest(e),r=Wc(this.options.sessionCreateUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(n)});return m(r,Dn(i=>rr(i,"ServerSideSessionLifetimeHandler - create")),An(i=>this.restToDomainMapper.mapToSessionId(i)))}close(e){return m(tr(this.options.sessionDeleteUrl,{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}},n=>n.response.status===Lp.NoContent?wt({}):et),Dn(n=>rr(n,"ServerSideSessionLifetimeHandler - close")),ve(Ar))}},bw=class{constructor(e,n,r){this.inner=e,this.contractToDomainMapper=n,this.domainToContractMapper=r,this.onConfigurationChangedHandler=et}setOnConfigurationChangedHandler(e){const n=m(e,st,F(r=>i=>{const o=this.domainToContractMapper.mapToConfiguration(i);r(o)}));this.inner.setOnConfigurationChangedHandler(n)}getConfiguration(){const e=this.inner.getConfiguration();return this.domainToContractMapper.mapToConfiguration(e)}getSessionContext(){const e=this.inner.getSessionContext();return this.domainToContractMapper.mapToSessionContext(e)}async setSessionContext(e){const n=this.contractToDomainMapper.mapToSessionContext(e);return await m(this.inner.setSessionContext(n),ve(Ar),this.adaptToContractPromise())()}async restoreConfiguration(e){const n=this.contractToDomainMapper.mapToConfiguration(e);return await m(this.inner.restoreConfiguration(n),ve(Ar),this.adaptToContractPromise())()}async makeDecision(e){const n=this.contractToDomainMapper.mapToAttributeDecision(e);return await m(this.inner.makeDecision(n),ve(Ar),this.adaptToContractPromise())()}async setMany(e,n){const r=this.contractToDomainMapper.mapToAttributeDecisions(e),i=this.contractToDomainMapper.mapToMode(n);return await m(this.inner.setMany(r,i),ve(Ar),this.adaptToContractPromise())()}async applySolution(e){const n=this.contractToDomainMapper.mapToSolution(e);return await m(this.inner.applySolution(n),ve(Ar),this.adaptToContractPromise())()}async explain(e,n){const r=this.contractToDomainMapper.mapToExplainQuestion(e,n);return await m(this.inner.explain(r),ve(i=>this.domainToContractMapper.mapToExplainAnswer(i)),this.adaptToContractPromise())()}async close(){return await m(this.inner.close(),Dn(e=>this.domainToContractMapper.mapToFailureResult(e)),_s(Promise.reject,e=>Promise.resolve()))()}adaptToContractPromise(){return Pn(Dn(e=>this.domainToContractMapper.mapToFailureResult(e)),_s(e=>Promise.reject(e),e=>Promise.resolve(e)))}},Sw=class{mapToExplainQuestion(e,n){const r={answerType:K(n).with("decisions",()=>di.decisions).with("constraints",()=>di.constraints).with("full",()=>di.all).exhaustive()};return K(e).with({question:ze.whyIsNotSatisfied,subject:He.configuration},i=>({...r,question:hn.whyIsNotSatisfied,subject:Re.configuration})).with({question:ze.whyIsNotSatisfied,subject:He.attribute},i=>({...r,question:hn.whyIsNotSatisfied,subject:Re.attribute,attributeId:this.mapToGlobalAttributeId(i.attributeId)})).with({question:ze.whyIsStateNotPossible,subject:He.choiceValue},i=>({...r,question:hn.whyIsStateNotPossible,subject:Re.choiceValue,attributeId:this.mapToGlobalAttributeId(i.attributeId),choiceValueId:i.choiceValueId,state:this.mapToDecisionState(i.state)})).with({question:ze.whyIsStateNotPossible,subject:He.component},i=>({...r,question:hn.whyIsStateNotPossible,subject:Re.component,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:this.mapToDecisionState(i.state)})).with({question:ze.whyIsStateNotPossible,subject:He.numeric},i=>({...r,question:hn.whyIsStateNotPossible,subject:Re.numeric,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:i.state})).with({question:ze.whyIsStateNotPossible,subject:He.boolean},i=>({...r,question:hn.whyIsStateNotPossible,subject:Re.boolean,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:i.state})).exhaustive()}mapToConfiguration(e){return{isSatisfied:e.isSatisfied,attributes:m(e.attributes,_(n=>this.mapToAttribute(n)))}}mapToAttributeDecisions(e){return m(e,_(n=>this.mapToAttributeDecision(n)))}mapToSessionContext(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),decisionsToRespect:this.mapToDecisionsToRespect(e.attributeRelations),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters)}}mapToAttributeDecision(e){return K(e).with({type:kt.Choice,choiceValueId:Kt.string},n=>({type:ot.ChoiceValue,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToDecisionStateOption(n.state)})).with({type:kt.Numeric},n=>({type:ot.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),value:st(n.state)})).with({type:kt.Boolean},n=>({type:ot.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),value:st(n.state)})).with({type:kt.Component},n=>({type:ot.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(st(n.state),bn(r=>this.mapToDecisionStateOption(r)))})).exhaustive()}mapToDecisionsToRespect(e){return m(st(e),F(n=>m(n,_(r=>({attributeId:this.mapToGlobalAttributeId(r.attributeId),decisions:m(r.decisions,_(i=>this.mapToGlobalAttributeId(i)))})))))}mapToMode(e){return K(e).with({type:"DropExistingDecisions"},n=>({type:"DropExistingDecisions",conflictHandling:this.mapToConflictHandling(n.conflictHandling)})).otherwise(()=>({type:"Default"}))}mapToConflictHandling(e){return K(e).with({type:"Manual"},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).with({type:"Automatic"},n=>({type:"Automatic"})).exhaustive()}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:e.componentPath??[],sharedConfigurationModel:e.sharedConfigurationModelId}}mapToConfigurationModelSource(e){return K(e).with({type:fr.Package},n=>({type:ya.Package,configurationModelPackage:n.configurationModelPackage})).with({type:fr.Channel},n=>({type:ya.Channel,deploymentName:n.deploymentName,channel:n.channel})).exhaustive()}mapToSolution(e){return{decisions:m(e.decisions,_(n=>this.mapToAttributeDecision(n))),mode:this.mapToMode(e.mode)}}mapToAttribute(e){return K(e).with({type:kt.Boolean},n=>({type:Ut.Boolean,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,possibleDecisionStates:n.possibleDecisionStates,selection:this.mapToSelection(n.selection),decision:m(n.decision,st,F(r=>({kind:this.mapToDecisionKind(r.kind),state:r.state}))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:kt.Numeric},n=>({type:Ut.Numeric,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,range:{min:n.range.min,max:n.range.max},decimalPlaces:n.decimalPlaces,selection:this.mapToSelection(n.selection),decision:m(n.decision,st,F(r=>({kind:this.mapToDecisionKind(r.kind),state:r.state}))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:kt.Choice},n=>({type:Ut.Choice,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,cardinality:{lowerBound:n.cardinality.lowerBound,upperBound:n.cardinality.upperBound},values:m(n.values,_(r=>this.mapToChoiceValue(r))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:kt.Component},n=>({type:Ut.Component,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,decision:m(n.decision,st,bn(r=>m(this.mapToDecisionStateOption(r.state),F(i=>({kind:this.mapToDecisionKind(r.kind),state:i}))))),possibleDecisionStates:m(n.possibleDecisionStates,_(r=>this.mapToDecisionStateOption(r)),Gn),selection:m(n.selection,st,F(r=>this.mapToSelection(r)),ie),inclusion:this.mapToInclusion(n.inclusion),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).exhaustive()}mapToChoiceValue(e){return{choiceValueId:e.id,decision:this.mapToChoiceValueDecision(e),possibleDecisionStates:m(e.possibleDecisionStates,_(n=>this.mapToDecisionStateOption(n)),Gn)}}mapToChoiceValueDecision(e){return m(e.decision,st,bn(n=>m(this.mapToDecisionStateOption(n.state),F(r=>({state:r,kind:this.mapToDecisionKind(n.kind)})))))}mapToDecisionKind(e){return K(e).with(hr.Implicit,()=>ue.Implicit).with(hr.Explicit,()=>ue.Explicit).exhaustive()}mapToSelection(e){return K(e).with(yi.Mandatory,()=>gi.Mandatory).with(yi.Optional,()=>gi.Optional).exhaustive()}mapToInclusion(e){return K(e).with(mi.Always,()=>bi.Always).with(mi.Optional,()=>bi.Optional).exhaustive()}mapToDecisionState(e){return K(e).with(Kt.union(dr.Included,Br.Included),()=>me.Included).with(Kt.union(dr.Excluded,Br.Excluded),()=>me.Excluded).exhaustive()}mapToDecisionStateOption(e){return m(st(e),F(n=>this.mapToDecisionState(n)))}mapToUsageRuleParameters(e){return e??{}}},Hp=class{mapToExplainAnswer(e){const n=K(e).with({decisionExplanations:Kt.array(Kt.any)},i=>m(i.decisionExplanations,_(o=>this.mapToDecisionExplanation(o)))).otherwise(()=>[]),r=K(e).with({constraintExplanations:Kt.array(Kt.any)},i=>m(i.constraintExplanations,_(o=>this.mapToConstraintExplanation(o)))).otherwise(()=>[]);return{decisionExplanations:n,constraintExplanations:r}}mapToConstraintExplanation(e){return{causedByCardinalities:m(e.causedByCardinalities,_(n=>this.mapToGlobalAttributeId(n.attributeId))),causedByRules:m(e.causedByRules,_(n=>this.mapToGlobalConstraintId(n.ruleId)))}}mapToDecisionExplanation(e){const n=m(e.causedByChoiceDecisions,_(a=>this.mapToCausedByChoiceAttributeDecision(a))),r=m(e.causedByComponentDecisions,_(a=>this.mapToCausedByComponentAttributeDecision(a))),i=m(e.causedByNumericDecisions,_(a=>this.mapToCausedByNumericAttributeDecision(a))),o=m(e.causedByBooleanDecisions,_(a=>this.mapToCausedByBooleanAttributeDecision(a)));return{causedByDecisions:m([],dt(n),dt(r),dt(i),dt(o)),solution:this.mapToSolution(e.solution)}}mapToSolution(e){return{decisions:m(e.decisions,_(n=>this.mapToExplicitDecision(n))),mode:this.mapToMode(e.mode)}}mapToMode(e){return K(e).with({type:"DropExistingDecisions"},n=>({type:"DropExistingDecisions",conflictHandling:this.mapToConflictHandling(n.conflictHandling)})).otherwise(()=>({type:"Default"}))}mapToConflictHandling(e){return K(e).with({type:"Manual"},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).with({type:"Automatic"},n=>({type:"Automatic"})).exhaustive()}mapToSessionContext(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),attributeRelations:this.mapToDecisionsToRespect(e.decisionsToRespect),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters)}}mapToFailureResult(e){return K(e).with({type:nt.ConfigurationConflict},n=>({type:pe.ConfigurationConflict,reason:K(n.reason).with(cf.NumericDecisionOutOfRange,()=>hu.NumericDecisionOutOfRange).otherwise(()=>{})})).with({type:nt.ConfigurationApplicationError},()=>({type:pe.ConfigurationApplicationError})).with({type:nt.ConfigurationUnauthenticated},()=>({type:pe.ConfigurationUnauthenticated})).with({type:nt.ConfigurationModelNotFound},()=>({type:pe.ConfigurationModelNotFound})).with({type:nt.ConfigurationTimeout},()=>({type:pe.ConfigurationTimeout})).with({type:nt.ConfigurationAttributeNotFound},()=>({type:pe.ConfigurationAttributeNotFound})).with({type:nt.ConfigurationChoiceValueNotFound},()=>({type:pe.ConfigurationChoiceValueNotFound})).with({type:nt.ConfigurationSolutionNotAvailable},()=>({type:pe.ConfigurationSolutionNotAvailable})).with({type:nt.ConfigurationRejectedDecisionsConflict},n=>{const r=m(n.rejectedDecisions,_(i=>this.mapToExplicitDecision(i)));return Up.createConfigurationRejectedDecisionsConflict(r)}).with({type:nt.DecisionsToRespectInvalid},()=>({type:pe.DecisionsToRespectInvalid})).with({type:nt.ServiceError},()=>({type:pe.ServiceError})).with({type:nt.CommunicationError},()=>({type:pe.CommunicationError})).with({type:nt.Unknown},()=>({type:pe.Unknown})).with({type:nt.ConfigurationModelInvalid},()=>({type:pe.ConfigurationModelInvalid})).with({type:nt.ConfigurationInitializationFailure},()=>({type:pe.ConfigurationInitializationFailure})).with({type:nt.ConfigurationModelNotFeasible},n=>({type:pe.ConfigurationModelNotFeasible,constraintExplanations:m(n.constraintExplanations,_(r=>this.mapToConstraintExplanation(r)))})).with({type:nt.ConfigurationSetManyConflict},n=>({type:pe.ConfigurationSetManyConflict,decisionExplanations:m(n.decisionExplanations,_(r=>this.mapToDecisionExplanation(r))),constraintExplanations:m(n.constraintExplanations,_(r=>this.mapToConstraintExplanation(r)))})).exhaustive()}mapToConfiguration(e){return{isSatisfied:e.isSatisfied,attributes:m(e.attributes,_(n=>this.mapToAttribute(n)))}}mapToDecisionsToRespect(e){return m(e,F(Pn(_(n=>({attributeId:this.mapToGlobalAttributeId(n.attributeId),decisions:m(n.decisions,_(r=>this.mapToGlobalAttributeId(r)))})))),ie)}mapToGlobalAttributeId(e){return{localId:e.localId,sharedConfigurationModelId:e.sharedConfigurationModel,componentPath:[...e.componentPath??[]]}}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}mapToConfigurationModelSource(e){return K(e).with({type:ya.Package},n=>({type:fr.Package,configurationModelPackage:n.configurationModelPackage})).with({type:ya.Channel},n=>({type:fr.Channel,deploymentName:n.deploymentName,channel:n.channel})).exhaustive()}mapToExplicitDecision(e){return K(e).with({type:ot.ChoiceValue},n=>({type:kt.Choice,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.state,F(r=>this.mapToChoiceValueDecisionState(r)),ie),choiceValueId:n.choiceValueId})).with({type:ot.Component},n=>({type:kt.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.state,F(r=>this.mapToComponentDecisionState(r)),ie)})).with({type:ot.Numeric},n=>({type:kt.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.value,ie)})).with({type:ot.Boolean},n=>({type:kt.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.value,ie)})).exhaustive()}mapToCardinality(e){return K(e).with(to.Cardinality,()=>Qi.Cardinality).with(to.Component,()=>Qi.Component).with(to.Rule,()=>Qi.Rule).exhaustive()}mapToCausedByAttributeDecision(e){return K(e).with({type:ot.ChoiceValue},n=>this.mapToCausedByChoiceAttributeDecision(n)).with({type:ot.Numeric},n=>this.mapToCausedByNumericAttributeDecision(n)).with({type:ot.Boolean},n=>this.mapToCausedByBooleanAttributeDecision(n)).with({type:ot.Component},n=>this.mapToCausedByComponentAttributeDecision(n)).exhaustive()}mapToCausedByChoiceAttributeDecision(e){return{type:kt.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToChoiceValueDecisionState(e.state)}}mapToCausedByNumericAttributeDecision(e){return{type:kt.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state}}mapToCausedByBooleanAttributeDecision(e){return{type:kt.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state}}mapToCausedByComponentAttributeDecision(e){return{type:kt.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToComponentDecisionState(e.state)}}mapToSelection(e){return K(e).with(gi.Mandatory,()=>yi.Mandatory).with(gi.Optional,()=>yi.Optional).exhaustive()}mapToAttribute(e){const n={id:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,canContributeToConfigurationSatisfaction:e.canContributeToConfigurationSatisfaction};return K(e).with({type:Ut.Boolean},r=>({...n,type:kt.Boolean,decision:m(r.decision,F(i=>({state:i.state,kind:this.mapToDecisionKind(i.kind)})),Mr),selection:this.mapToSelection(r.selection),possibleDecisionStates:r.possibleDecisionStates})).with({type:Ut.Numeric},r=>({...n,type:kt.Numeric,decision:m(r.decision,F(i=>({state:i.state,kind:this.mapToDecisionKind(i.kind)})),Mr),range:r.range,decimalPlaces:r.decimalPlaces,selection:this.mapToSelection(r.selection)})).with({type:Ut.Choice},r=>({...n,type:kt.Choice,cardinality:r.cardinality,values:m(r.values,_(i=>{const o=m(i.decision,F(a=>({state:this.mapToChoiceValueDecisionState(a.state),kind:this.mapToDecisionKind(a.kind)})),Mr);return{id:i.choiceValueId,possibleDecisionStates:m(i.possibleDecisionStates,_(a=>this.mapToChoiceValueDecisionState(a))),decision:o}}))})).with({type:Ut.Component},r=>({...n,type:kt.Component,decision:m(r.decision,F(i=>({state:this.mapToComponentDecisionState(i.state),kind:this.mapToDecisionKind(i.kind)})),Mr),possibleDecisionStates:m(r.possibleDecisionStates,_(i=>this.mapToComponentDecisionState(i))),selection:m(r.selection,st,F(i=>this.mapToSelection(i)),ie),inclusion:this.mapToInclusion(r.inclusion)})).exhaustive()}mapToInclusion(e){return K(e).with(bi.Always,()=>mi.Always).with(bi.Optional,()=>mi.Optional).exhaustive()}mapToComponentDecisionState(e){return K(e).with(me.Included,()=>Br.Included).with(me.Excluded,()=>Br.Excluded).exhaustive()}mapToChoiceValueDecisionState(e){return K(e).with(me.Included,()=>dr.Included).with(me.Excluded,()=>dr.Excluded).exhaustive()}mapToDecisionKind(e){return K(e).with(ue.Explicit,()=>hr.Explicit).with(ue.Implicit,()=>hr.Implicit).exhaustive()}mapToUsageRuleParameters(e){return e}},Wp=class{constructor(e,n){this.contractToDomainMapper=new Sw,this.domainToContractMapper=new Hp,this.sessionHandler=e,this.internalConfigurationSessionCreator=n}async createSession(e){const n=this.configurationSessionFrom(e);return await m(this.sessionHandler.recreate(n),ve(r=>{const i=this.internalConfigurationSessionCreator(this.sessionHandler,r);return new bw(i,this.contractToDomainMapper,this.domainToContractMapper)}),_s(r=>{const i=this.domainToContractMapper.mapToFailureResult(r);return Promise.reject(i)},r=>Promise.resolve(r)))()}configurationSessionFrom(e){return{context:this.contractToDomainMapper.mapToSessionContext(e),sessionId:et,configuration:{isSatisfied:!1,attributes:[]},solutions:[]}}};function lf(t){return t.possibleDecisionStates.some(e=>e===dr.Included)}function Kp(t){return!lf(t)}const Cw=Object.freeze(Object.defineProperty({__proto__:null,isAllowed:lf,isBlocked:Kp},Symbol.toStringTag,{value:"Module"}));function ww(t){return K(t).with({type:kt.Choice},e=>e.cardinality.lowerBound>0).otherwise(()=>!0)}function Tw(t){return K(t).with({type:kt.Choice},e=>e.cardinality.upperBound>1).otherwise(()=>!1)}function Iw(t){return m(t.values,on(lf))}function Ew(t){return m(t.values,on(Kp))}function Yp(t,e){return m(t.values,po(n=>m(n.decision,st,Te(r=>r.kind===e))))}function Jp(t){return m(t.values,on(e=>m(e.decision,st,F(n=>n.state===dr.Included),Gt(()=>!1))))}const xw=Jp;function Xp(t){return m(t.decision,st,Te(e=>e.kind===hr.Explicit),Mr)}function Zp(t){return m(t.decision,st,Te(e=>e.kind===hr.Explicit),Mr)}function Aw(t,e){return t.possibleDecisionStates.some(n=>n===e)}function Qp(t){return m(t.decision,st,Mr)}function tv(t){return ev(t,Br.Included)}function $w(t){return!tv(t)}function ev(t,e){return t.possibleDecisionStates.some(n=>n===e)}const Dw=Object.freeze(Object.defineProperty({__proto__:null,getAllowedChoiceValues:Iw,getBlockedChoiceValues:Ew,getBooleanDecision:Zp,getChoiceDecisions:Yp,getComponentDecision:Qp,getIncludedChoiceValues:Jp,getNumericDecision:Xp,getSelectedChoiceValues:xw,isBooleanValuePossible:Aw,isComponentAllowed:tv,isComponentBlocked:$w,isComponentStatePossible:ev,isMandatory:ww,isMultiSelect:Tw},Symbol.toStringTag,{value:"Module"})),nv=t=>t.type===kt.Boolean,rv=t=>t.type===kt.Choice,iv=t=>t.type===kt.Numeric,ov=t=>t.type===kt.Component,Ow=Ma(Xt);function Nw(t,e,n){var r;const i=((r=e.componentPath)==null?void 0:r.length)??0;return m(t,on(o=>{var a;const u=((a=o.id.componentPath)==null?void 0:a.length)??0;return n?i>u?!1:m(o.id.componentPath??[],Sp(e.componentPath??[]),iS(([s,c])=>s===c)):Ow.equals(o.id.componentPath,e.componentPath)}))}function Pw(t,e,n){return[]}function Mw(t){return m(t,on(e=>{const n=m(e.id.componentPath,st,F(i=>i.length===0),Gt(()=>!0)),r=m(e.id.sharedConfigurationModelId,st,lr(()=>!0,()=>!1));return n&&r}))}function Rw(t,e){return m(av(t),_(n=>Yp(n,e)),Tp,po(n=>st(n)))}function _w(t,e){return m(uv(t),on(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),_(n=>Xp(n)),po(n=>st(n)))}function jw(t,e){return m(cv(t),on(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),_(n=>Zp(n)),po(n=>st(n)))}function qw(t,e){return m(sv(t),on(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),_(n=>Qp(n)),po(n=>st(n)))}function av(t){return m(t.attributes,on(rv))}function sv(t){return m(t.attributes,on(ov))}function uv(t){return m(t.attributes,on(iv))}function cv(t){return m(t.attributes,on(nv))}function kw(t,e){return m(Ra(t,e),ie)}function Uw(t,e){return m(lv(t,e),ie)}function Bw(t,e,n){return m(lv(t,e),F(r=>r.values),bn(Pn(Me(r=>r.id===n))),ie)}function Vw(t,e){return m(Ra(t,e),Te(iv),ie)}function Fw(t,e){return m(Ra(t,e),Te(nv),ie)}function Lw(t,e){return m(Ra(t,e),Te(ov),ie)}function Ra(t,e){return m(t.attributes,Me(n=>Oi.equals(n.id,e)))}function lv(t,e){return m(Ra(t,e),Te(rv))}const Gw=Object.freeze(Object.defineProperty({__proto__:null,filterAttributesOfComponent:Nw,filterAttributesOfRoot:Mw,filterAttributesOfShared:Pw,getAttribute:kw,getBooleanAttribute:Fw,getBooleanAttributes:cv,getBooleanDecisions:jw,getChoiceAttribute:Uw,getChoiceAttributes:av,getChoiceDecisions:Rw,getChoiceValue:Bw,getComponentAttribute:Lw,getComponentAttributes:sv,getComponentDecisions:qw,getNumericAttribute:Vw,getNumericAttributes:uv,getNumericDecisions:_w},Symbol.toStringTag,{value:"Module"})),fv={whyIsNotSatisfied:{configuration:{question:ze.whyIsNotSatisfied,subject:He.configuration},attribute:t=>({question:ze.whyIsNotSatisfied,subject:He.attribute,attributeId:t})},whyIsStateNotPossible:{choice:t=>({choiceValue:e=>({state:n=>({question:ze.whyIsStateNotPossible,subject:He.choiceValue,attributeId:t,choiceValueId:e,state:n})})}),boolean:t=>({state:e=>({question:ze.whyIsStateNotPossible,subject:He.boolean,attributeId:t,state:e})}),numeric:t=>({state:e=>({question:ze.whyIsStateNotPossible,subject:He.numeric,attributeId:t,state:e})}),component:t=>({state:e=>({question:ze.whyIsStateNotPossible,subject:He.component,attributeId:t,state:e})})}},zw=Object.freeze(Object.defineProperty({__proto__:null,explainQuestionBuilder:fv},Symbol.toStringTag,{value:"Module"})),Hw="https://spc.cloud.ceventis.de/api/engine",Ww={hcaEngineBaseUrl:Hw};function Kw(t){return{hcaEngineBaseUrl:t.hcaEngineBaseUrl??Ww.hcaEngineBaseUrl,sessionHandler:t.sessionHandler}}function ko(t){if(t==null)throw new Error("Implementation Error: Unexpected null value encountered");return t}const dv=t=>e=>n=>m(n,Yb(r=>t.equals(r,e)),F(r=>m(n,Jb(r,i=>e))),Lc,Gt(()=>m(n,dt(Qb(e))))),Ja=dv({equals:(t,e)=>Fe.equals(t.attributeId,e.attributeId)}),Yw=dv({equals:(t,e)=>t.choiceValueId===e.choiceValueId});let Jw=class{constructor(e){this.restToDomainMapper=e}updateConfigurationSession(e,n){const r=this.updateConfigurationModel(e.configuration,n);return{...e,configuration:r}}updateConfigurationModel(e,n){var r,i,o,a,u,s,c,l,d;const f=m(((r=n.affectedDecisions)==null?void 0:r.choiceValueDecisions)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),h=m(((i=n.consequences)==null?void 0:i.choiceConsequences)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),v=m(((o=n.affectedDecisions)==null?void 0:o.componentDecisions)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),p=m(((a=n.consequences)==null?void 0:a.componentConsequences)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),S=m(((u=n.affectedDecisions)==null?void 0:u.numericDecisions)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),C=m(((s=n.consequences)==null?void 0:s.numericConsequences)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),w=m(((c=n.affectedDecisions)==null?void 0:c.booleanDecisions)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),T=m(((l=n.consequences)==null?void 0:l.booleanConsequences)??[],_(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),I=m([],dt(m(w,_(b=>b.attributeId))),dt(m(T,_(b=>b.attributeId))),dt(m(S,_(b=>b.attributeId))),dt(m(C,_(b=>b.attributeId))),dt(m(f,_(b=>b.attributeId))),dt(m(h,_(b=>b.attributeId))),dt(m(v,_(b=>b.attributeId))),dt(m(p,_(b=>b.attributeId))),Yi(Fe)),x=m(I,Gc(e.attributes,(b,E)=>{const P=e.attributes.find(A=>Fe.equals(A.attributeId,E));return K(P).with({type:Ut.Choice},(A,U)=>{const M=this.mergeChoice(U,m(h,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)),m(f,on($=>Fe.equals($.attributeId,E)),_($=>$.payload)));return Ja(M)(b)}).with({type:Ut.Numeric},(A,U)=>{const M=this.mergeNumeric(U,m(C,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)),m(S,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)));return Ja(M)(b)}).with({type:Ut.Boolean},(A,U)=>{const M=this.mergeBoolean(U,m(T,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)),m(w,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)));return Ja(M)(b)}).with({type:Ut.Component},(A,U)=>{const M=this.mergeComponent(U,m(p,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)),m(v,Me($=>Fe.equals($.attributeId,E)),F($=>$.payload)));return Ja(M)(b)}).exhaustive()}));return{...e,isSatisfied:m((d=n.consequences)==null?void 0:d.isConfigurationSatisfied,st,Gt(()=>e.isSatisfied)),attributes:x}}mergeChoice(e,n,r){const i=m(n,F(s=>s.values??[]),Gt(()=>[])),o=m(r),a=m([],dt(m(i,_(s=>s.choiceValueId))),dt(m(o,_(s=>s.choiceValueId))),_(ko),Yi(Xt)),u=m(a,Gc(e.values,(s,c)=>{const l=m(i,Me(v=>v.choiceValueId===c)),d=m(o,Me(v=>v.choiceValueId===c)),f=m(e.values.find(v=>v.choiceValueId===c),st),h=this.mergeChoiceValue(c,f,l,d);return Yw(h)(s)}));return{...e,isSatisfied:m(n,F(s=>ko(s.isSatisfied)),Gt(()=>e.isSatisfied)),values:u}}mergeChoiceValue(e,n,r,i){const o=m(i,F(u=>({state:this.toDecisionState(ko(u.state)),kind:this.toDecisionKind(ko(u.kind))})),Gt(()=>({state:m(n,bn(u=>m(u.decision,F(s=>s.state)))),kind:m(n,bn(u=>m(u.decision,F(s=>s.kind))),Gt(()=>ue.Explicit))}))),a=m(r,F(u=>m(dd(u.possibleDecisionStates??[]),_(s=>this.toPossibleDecisionState(s)),Gn)),Gt(()=>m(n,F(u=>u.possibleDecisionStates??[]),Gt(()=>[]))));return{choiceValueId:e,decision:m(o.state,F(u=>({state:u,kind:o.kind}))),possibleDecisionStates:a}}mergeComponent(e,n,r){const i=m(r,F(a=>{const u=this.toDecisionState(ko(a.state));return m(u,F(s=>({state:s,kind:this.toDecisionKind(a.kind)})))}),Gt(()=>m(e.decision,F(a=>({state:a.state,kind:a.kind}))))),o=m(n,F(a=>m(dd(a.possibleDecisionStates??[]),_(u=>this.toPossibleDecisionState(u)),Gn)),Gt(()=>e.possibleDecisionStates));return{...e,isSatisfied:m(n,F(a=>a.isSatisfied),Gt(()=>e.isSatisfied)),possibleDecisionStates:o,decision:i}}mergeNumeric(e,n,r){return{...e,isSatisfied:m(n,bn(i=>st(i.isSatisfied)),Gt(()=>e.isSatisfied)),decision:m(r,lr(()=>e.decision,i=>m(i.state,st,F(o=>({kind:this.toDecisionKind(i.kind),state:o})))))}}mergeBoolean(e,n,r){return{...e,isSatisfied:m(n,bn(i=>st(i.isSatisfied)),Gt(()=>e.isSatisfied)),decision:m(r,lr(()=>e.decision,i=>m(i.state,st,F(o=>({kind:this.toDecisionKind(i.kind),state:o}))))),possibleDecisionStates:m(n,F(i=>i.possibleDecisionStates),Gt(()=>e.possibleDecisionStates))}}toPossibleDecisionState(e){return K(e).with(Si.Included,()=>wt(me.Included)).with(Si.Excluded,()=>wt(me.Excluded)).otherwise(()=>et)}toDecisionState(e){return K(e).with(ar.Included,()=>wt(me.Included)).with(ar.Excluded,()=>wt(me.Excluded)).otherwise(()=>et)}toDecisionKind(e){return K(e).with(ma.Implicit,()=>ue.Implicit).with(ma.Explicit,()=>ue.Explicit).exhaustive()}},Xw=class{mapSessionToExplicitDecisions(e){return this.mapToExplicitDecisionsInner(e.configuration.attributes)}mapToExplicitDecision(e){return K(e).with({type:ot.ChoiceValue},n=>({type:cn.Choice,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToDecisionState(n.state)})).with({type:ot.Component},n=>({type:cn.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:this.mapToDecisionState(n.state)})).with({type:ot.Numeric},n=>({type:cn.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.value,ie)})).with({type:ot.Boolean},n=>({type:cn.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:m(n.value,ie)})).exhaustive()}mapToExplicitDecisions(e,n){const r=this.mapToMode(n),i=m([...e],Sr(s=>s.type!==ot.Boolean?et:wt({type:cn.Boolean,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:m(s.value,ie)}))),o=m([...e],Sr(s=>s.type!==ot.Numeric?et:wt({type:cn.Numeric,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:m(s.value,ie)}))),a=m([...e],Sr(s=>s.type!==ot.ChoiceValue?et:wt({type:cn.Choice,attributeId:this.mapToGlobalAttributeId(s.attributeId),choiceValueId:s.choiceValueId,state:this.mapToDecisionState(s.state)}))),u=m([...e],Sr(s=>s.type!==ot.Component?et:wt({type:cn.Component,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:this.mapToDecisionState(s.state)})));return{mode:r,choiceDecisions:a,numericDecisions:o,booleanDecisions:i,componentDecisions:u}}mapToExplicitDecisionsInner(e){const n=m([...e],Sr(a=>a.type!==Ut.Boolean?et:m(a.decision,Te(u=>u.kind===ue.Explicit),F(()=>this.mapToExplicitBooleanDecision(a))))),r=m([...e],Sr(a=>a.type!==Ut.Numeric?et:m(a.decision,Te(u=>u.kind===ue.Explicit),F(()=>this.mapToExplicitNumericDecision(a))))),i=m([...e],Sr(a=>a.type!==Ut.Component?et:m(a.decision,Te(u=>u.kind===ue.Explicit),F(()=>this.mapToExplicitComponentDecision(a))))),o=m([...e],Sr(a=>a.type!==Ut.Choice?et:m(this.mapToExplicitChoiceDecisions(a),xb(u=>m(u,cu)))),vS);return{booleanDecisions:n,numericDecisions:r,choiceDecisions:o,componentDecisions:i}}mapToMode(e){return K(e).with({type:"Default"},n=>({type:"Default"})).with({type:"DropExistingDecisions"},n=>this.mapToDropExistingDecisionsMode(n)).exhaustive()}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:m(e.componentPath,st,F(fd),Mr),sharedConfigurationModelId:e.sharedConfigurationModel}}mapToDropExistingDecisionsMode(e){return{type:"DropExistingDecisions",conflictResolution:K(e.conflictHandling).with({type:"Manual",includeConstraintsInConflictExplanation:Kt.boolean},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).otherwise(()=>({type:"Automatic"}))}}mapToExplicitBooleanDecision(e){return{type:cn.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:m(e.decision,F(n=>n.state),ie)}}mapToExplicitNumericDecision(e){return{type:cn.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:m(e.decision,F(n=>n.state),ie)}}mapToExplicitComponentDecision(e){return{type:cn.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToDecisionState(m(e.decision,F(n=>n.state)))}}mapToExplicitChoiceDecisions(e){function n(r){return m(r.decision,F(i=>i.kind===ue.Explicit),Gt(()=>!1))}return m(e.values,on(n),_(r=>({type:cn.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:r.choiceValueId,state:this.mapToDecisionState(m(r.decision,F(i=>i.state)))})),fd)}mapToDecisionState(e){return m(e,F(n=>K(n).with(me.Included,()=>ar.Included).with(me.Excluded,()=>ar.Excluded).exhaustive()),Gt(()=>ar.Undefined))}mapToPossibleDecisionState(e){return K(e).with(me.Included,()=>Si.Included).with(me.Excluded,()=>Si.Excluded).exhaustive()}mapToWhyNotSatisfiedRequest(e){return K(e).with({subject:Re.attribute},n=>({type:Xc.Attribute,attributeId:this.mapToGlobalAttributeId(n.attributeId)})).with({subject:Re.configuration},()=>({type:Xc.Configuration})).exhaustive()}mapToWhyStateNotPossibleRequest(e){return K(e).with({subject:Re.boolean},n=>({type:Wo.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:n.state})).with({subject:Re.numeric},n=>({type:Wo.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:n.state})).with({subject:Re.component},n=>({type:Wo.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:this.mapToPossibleDecisionState(n.state)})).with({subject:Re.choiceValue},n=>({type:Wo.ChoiceValue,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToPossibleDecisionState(n.state)})).exhaustive()}},Zw=class{constructor(){this.configurationSession={hasExplicitDecisions(e){return m(e.configuration.attributes,Me(n=>K(n).with({type:Ut.Boolean},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),Ho)).with({type:Ut.Numeric},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),Ho)).with({type:Ut.Choice},r=>m(r.values,Me(i=>m(i.decision,F(o=>o.kind===ue.Explicit),Gt(()=>!1))),Ho)).with({type:Ut.Component},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),Ho)).exhaustive()),lr(()=>!1,()=>!0))},getExplicitDecisions(e){return m(e.configuration.attributes,_(n=>K(n).with({type:Ut.Boolean},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),F(i=>({type:ot.Boolean,attributeId:r.attributeId,value:st(i.state)})),F(i=>[i]))).with({type:Ut.Numeric},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),F(i=>({type:ot.Numeric,attributeId:r.attributeId,value:st(i.state)})),F(i=>[i]))).with({type:Ut.Choice},r=>m(r.values,_(i=>m(i.decision,Te(o=>o.kind===ue.Explicit),F(o=>({type:ot.ChoiceValue,attributeId:r.attributeId,choiceValueId:i.choiceValueId,state:st(o.state)})))),Gn,_r)).with({type:Ut.Component},r=>m(r.decision,Te(i=>i.kind===ue.Explicit),F(i=>({type:ot.Component,attributeId:r.attributeId,state:st(i.state)})),F(i=>[i]))).exhaustive()),Gn,Tp)}}}},Qw=class{constructor(e,n,r,i,o,a){this.engineApiClient=n,this.domainToRestMapper=i,this.restToDomainMapper=r,this.domainToContractMapper=o,this.domainUpdater=a,this.sessionHandler=e,this.interpreter=new Zw}close(e){return this.sessionHandler.close(e)}recreate(e){return this.initializeInner(e,!1)}reinitialize(e){return this.initializeInner(e,!0)}makeDecision(e,n){const r=this.domainToRestMapper.mapToExplicitDecision(e);return this.withSession(n,(i,o)=>m(this.engineApiClient.makeDecision(i,r),Dn(rr),ve(a=>this.domainUpdater.updateConfigurationSession(o,a))))}explain(e,n){return this.withSession(n,r=>{const i=K(e).with({question:hn.whyIsNotSatisfied},o=>this.explainWhyNotSatisfied(o,r)).with({question:hn.whyIsStateNotPossible},o=>this.explainWhyStateNotPossible(o,r)).exhaustive();return m(i,Dn(rr),ve(o=>this.restToDomainMapper.mapToExplainAnswer(o,e)))})}setMany(e,n,r){return this.withSession(r,(i,o)=>{const a=this.setManyInner(e,n,i);return m(a,An(u=>{var s,c,l,d;const f=m([],dt(m(((s=u.rejectedDecisions)==null?void 0:s.booleanDecisions)??[],_(h=>this.restToDomainMapper.mapToBooleanDecision(h)))),dt(m(((c=u.rejectedDecisions)==null?void 0:c.numericDecisions)??[],_(h=>this.restToDomainMapper.mapToNumericDecision(h)))),dt(m(((l=u.rejectedDecisions)==null?void 0:l.componentDecisions)??[],_(h=>this.restToDomainMapper.mapToComponentDecision(h)))),dt(m(((d=u.rejectedDecisions)==null?void 0:d.choiceValueDecisions)??[],_(h=>this.restToDomainMapper.mapToExplicitChoiceValueDecision(h)))));return m(f,cu)?or(uw.createConfigurationRejectedDecisionsConflict(f)):Ji(this.domainUpdater.updateConfigurationSession(o,u))}))})}replaceDecisions(e,n){const r=this.interpreter.configurationSession.getExplicitDecisions(n),i=this.setManyInner(r,{type:"DropExistingDecisions",conflictHandling:{type:"Automatic"}},e);return m(i,ve(o=>({})))}setManyInner(e,n,r){const i=this.domainToRestMapper.mapToExplicitDecisions(e,n),o=this.engineApiClient.setMany(r,i);return m(o,Dn(rr),An(a=>{const u={rejectedDecisions:{booleanDecisions:Kt.array(Kt.any)}},s={decisionExplanations:Kt.array(Kt.any)};return K(a).with(u,c=>vo(c)).with(s,c=>or(this.restToDomainMapper.mapToConfigurationSetManyConflictFailure(c,i,n))).otherwise(()=>or({type:nt.Unknown}))}))}explainWhyStateNotPossible(e,n){const r=this.domainToRestMapper.mapToWhyStateNotPossibleRequest(e);return this.engineApiClient.getWhyStateNotPossible(n,r)}explainWhyNotSatisfied(e,n){const r=this.domainToRestMapper.mapToWhyNotSatisfiedRequest(e);return this.engineApiClient.getWhyNotSatisfied(n,r)}withSession(e,n){return m(Ji(e),An(r=>m(r.sessionId,lr(()=>this.initializeInner(r,!1),()=>Ji(r)))),An(r=>m(r.sessionId,sf(()=>({type:nt.ConfigurationUnauthenticated})),An(i=>n(i,r)))))}initializeInner(e,n){return m(XS,()=>m(e.sessionId,DC,NC(r=>n?$C(r):m(this.sessionHandler.close(r),_s(()=>et,()=>et)))),r=>{const i=this.domainToContractMapper.mapToSessionContext(e.context);return m(r,zS(()=>({type:nt.ConfigurationUnauthenticated})),Dp(()=>this.sessionHandler.create(i)))},r=>m(r,ZS(i=>m(_r(e),Te(this.interpreter.configurationSession.hasExplicitDecisions),F(o=>this.replaceDecisions(i,o)),Gt(()=>Ji({}))))),r=>m(r,An(i=>{const o=this.determineConsequences(i),a=this.determineDecisions(i),u=pb(KS)({consequences:o,decisions:a});return m(u,ve(({decisions:s,consequences:c})=>this.restToDomainMapper.mapToConfigurationModel(s,c)),ve(s=>({sessionId:_r(i),configuration:s,context:e.context,solutions:[]})))})))}determineDecisions(e){return m(this.engineApiClient.getDecisions(e),Dn(rr))}determineConsequences(e){return m(this.engineApiClient.getConsequence(e),Dn(rr))}},tT=class{constructor(e,n){this.onConfigurationChangedHandler=et,this.sessionHandler=e,this.configurationSession=n}setOnConfigurationChangedHandler(e){this.onConfigurationChangedHandler=e}getSessionContext(){return this.configurationSession.context}getConfiguration(){return this.configurationSession.configuration}explain(e){return m(this.sessionHandler.explain(e,this.configurationSession),this.updateAvailableSolutionsIfRight(n=>this.deriveSolutionsFromExplainAnswer(n)),this.invalidateAvailableSolutionsIfLeft())}setSessionContext(e){return m(this.sessionHandler.recreate({...this.configurationSession,context:e}),this.updateSession())}invalidateSessionId(){this.configurationSession={...this.configurationSession,sessionId:et}}restoreConfiguration(e){return m(this.sessionHandler.reinitialize({...this.configurationSession,configuration:e}),this.updateSession())}makeDecision(e){return m(this.sessionHandler.makeDecision(e,this.configurationSession),this.updateSession())}close(){return m(this.configurationSession.sessionId,F(e=>this.sessionHandler.close(e)),F(Pn(ve(e=>{this.configurationSession={...this.configurationSession,sessionId:et}}))),Gt(ru(XC())))}applySolution(e){return m(this.configurationSession.solutions,Me(n=>aw.equals(n,e)),sf(()=>({type:nt.ConfigurationSolutionNotAvailable})),ve(n=>n.decisions),An(n=>this.setMany(n,e.mode)))}setMany(e,n){return m(this.sessionHandler.setMany(e,n,this.configurationSession),this.updateSession(),js(r=>()=>{const i=K(r).with({decisionExplanations:Kt.array(Kt.any)},o=>wt(o.decisionExplanations)).otherwise(()=>et);this.configurationSession={...this.configurationSession,solutions:m(i,F(Pn(_(o=>o.solution))),Gt(()=>[]))}}))}deriveSolutionsFromExplainAnswer(e){const n=K(e).with({decisionExplanations:Kt.array(Kt.any)},r=>r.decisionExplanations).otherwise(()=>[]);return m(n,_(r=>r.solution))}invalidateAvailableSolutions(){return VC(()=>()=>{this.configurationSession={...this.configurationSession,solutions:[]}})}invalidateAvailableSolutionsIfLeft(){return js(()=>()=>{this.configurationSession={...this.configurationSession,solutions:[]}})}updateAvailableSolutionsIfRight(e){return pa(n=>()=>{this.configurationSession={...this.configurationSession,solutions:e(n)}})}updateSession(){return Pn(pa(e=>()=>{this.configurationSession=e,m(this.onConfigurationChangedHandler,LC(n=>()=>n(this.configurationSession.configuration)))}),ve(e=>e.configuration),this.invalidateAvailableSolutions())}},eT=class{constructor(e){this.inner=e;const n=3,r=2e3,i=200;this.policy=_C(r,MC.concat(jC(i),RC(n)))}getSessionContext(){return this.inner.getSessionContext()}close(){return this.inner.close()}setSessionContext(e){const n=()=>this.inner.setSessionContext(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}makeDecision(e){const n=()=>this.inner.makeDecision(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}restoreConfiguration(e){const n=()=>this.inner.restoreConfiguration(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}explain(e){const n=()=>this.inner.explain(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}applySolution(e){const n=()=>this.inner.applySolution(e);return Mi(this.policy,n,r=>m(r,ai(i=>this.determineAndPrepareRetry(i),()=>!1)))}setMany(e,n){const r=()=>this.inner.setMany(e,n);return Mi(this.policy,r,i=>m(i,ai(o=>this.determineAndPrepareRetry(o),()=>!1)))}setOnConfigurationChangedHandler(e){this.inner.setOnConfigurationChangedHandler(e)}invalidateSessionId(){this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}determineAndPrepareRetry(e){return K(e).with({type:nt.ConfigurationUnauthenticated},()=>(this.invalidateSessionId(),!0)).with({type:nt.ConfigurationTimeout},()=>!0).otherwise(()=>!1)}},nT=class{constructor(){this.queue=[],this.operating=et}push(e){const n=new rT(e);return this.queue.push(n),this.operating=m(this.operating,Gt(()=>this.start()),_r),n.promise}async start(){for(;this.queue.length;){const e=[...this.queue];this.queue=[];const n=m(e,_(r=>r.argument),Gc(et,(r,i)=>this.reduce(r,i)),F(Pn(r=>this.execute(r),r=>r.then(i=>{m(e,_(o=>{o.resolve(i)}))}).catch(i=>{m(e,_(o=>{o.reject(i)}))}))),ie);n&&await n}this.operating=et}async flush(){return this.operating||Promise.resolve()}size(){return this.queue.length}},rT=class{constructor(e){this.resolve=()=>{},this.reject=()=>{},this.argument=e,this.promise=new Promise((n,r)=>{this.resolve=n,this.reject=r})}},iT=class extends nT{constructor(e){super(),this.inner=e}reduce(e,n){return wt(n)}async execute(e){return await this.inner.setSessionContext(e)()}},oT=class{constructor(e){this.inner=e,this.setContextReducingTaskExecutor=new iT(e)}getSessionContext(){return this.inner.getSessionContext()}setSessionContext(e){const n=this.inner.getSessionContext();if(QC.equals(n,e))return vo(this.getConfiguration());const r=this.setContextReducingTaskExecutor.push(e);return()=>r}applySolution(e){return this.inner.applySolution(e)}close(){return this.inner.close()}makeDecision(e){return this.inner.makeDecision(e)}restoreConfiguration(e){return this.inner.restoreConfiguration(e)}setMany(e,n){return this.inner.setMany(e,n)}explain(e){return this.inner.explain(e)}invalidateSessionId(){return this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}setOnConfigurationChangedHandler(e){return this.inner.setOnConfigurationChangedHandler(e)}},aT=class{constructor(e,n=!1){this.stringify=n,this.inner=e,this.durationNumberFormat=new Intl.NumberFormat("en-EN",{maximumFractionDigits:3})}withLogging(e,n,r){const i=performance.now(),o=()=>{const a=performance.now()-i;return this.durationNumberFormat.format(a)};return console.debug(`Operation ${e} started with`,this.renderAsRequired(n)),m(r(),js(a=>()=>{console.debug(`Operation ${e} completed after ${o()}ms with failure`,this.renderAsRequired(a))}),pa(a=>()=>{console.debug(`Operation ${e} completed after ${o()}ms with success`,this.renderAsRequired(a))}))}renderAsRequired(e){return this.stringify?JSON.stringify(e,null,2):e}explain(e){return this.withLogging("explain",[e],()=>this.inner.explain(e))}getSessionContext(){return this.inner.getSessionContext()}setSessionContext(e){return this.withLogging("setSessionContext",[e],()=>this.inner.setSessionContext(e))}applySolution(e){return this.withLogging("applySolution",[e],()=>this.inner.applySolution(e))}close(){return this.inner.close()}makeDecision(e){return this.withLogging("makeDecision",[e],()=>this.inner.makeDecision(e))}restoreConfiguration(e){return this.withLogging("restoreConfiguration",[e],()=>this.inner.restoreConfiguration(e))}setMany(e,n){return this.withLogging("setMany",[e,n],()=>this.inner.setMany(e,n))}invalidateSessionId(){return this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}setOnConfigurationChangedHandler(e){return this.inner.setOnConfigurationChangedHandler(e)}};function sT(t){t=Kw(t);const e=new gw(t.hcaEngineBaseUrl),n=new Gp,r=new Xw,i=new Hp,o=new Bp,a=new Jw(n),u=K(t.sessionHandler).with({create:Kt.any,close:Kt.any},l=>l).with({accessToken:Kt.string},l=>new Fp(e,o,n,l)).with({sessionCreateUrl:Kt.string,sessionDeleteUrl:Kt.string},l=>new zp(o,l)).exhaustive(),s=new Qw(u,e,n,r,i,a),c=(l,d)=>m(new tT(l,d),f=>new eT(f),f=>new oT(f),f=>new aT(f,!1));return new Wp(s,c)}const uT=Oi.equals,cT=qp.equals,lT=kp.equals,fT=Object.freeze(Object.defineProperty({__proto__:null,AllowedRulesInExplainType:va,AttributeInterpreter:Dw,AttributeType:kt,ChoiceValueDecisionState:dr,ChoiceValueInterpreter:Cw,ClientSideSessionLifetimeHandler:Fp,ComponentDecisionState:Br,ConfigurationConflictReason:hu,ConfigurationInterpreter:Gw,ConfigurationModelSourceType:fr,ConfiguratorClient:Wp,ConstraintType:Qi,ContractToRestMapper:Bp,DecisionKind:hr,ExplainQuestionSubject:He,ExplainQuestionType:ze,FailureType:pe,Inclusion:mi,QuestionBuilder:zw,Results:YC,Selection:yi,ServerSideSessionLifetimeHandler:zp,Types:KC,causedByDecisionEquals:lT,createClient:sT,explainQuestionBuilder:fv,globalAttributeIdEquals:uT,globalConstraintIdEquals:cT},Symbol.toStringTag,{value:"Module"}));function hv(t){return function(n,r,i,o,a,u,s){return t(n,r,s)}}function pu(t){return function(n,r,i,o){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i,o);var a=o.get(n),u=o.get(r);if(a&&u)return a===r&&u===n;o.set(n,r),o.set(r,n);var s=t(n,r,i,o);return o.delete(n),o.delete(r),s}}function pv(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n}function Od(t){return t.constructor===Object||t.constructor==null}function Nd(t){return typeof t.then=="function"}function vu(t,e){return t===e||t!==t&&e!==e}var dT="[object Arguments]",hT="[object Boolean]",pT="[object Date]",vT="[object RegExp]",yT="[object Map]",mT="[object Number]",gT="[object Object]",bT="[object Set]",ST="[object String]",Pd=Object.prototype.toString;function yu(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.areRegExpsEqual,a=t.areSetsEqual,u=t.createIsNestedEqual,s=u(c);function c(l,d,f){if(l===d)return!0;if(!l||!d||typeof l!="object"||typeof d!="object")return l!==l&&d!==d;if(Od(l)&&Od(d))return i(l,d,s,f);var h=Array.isArray(l),v=Array.isArray(d);if(h||v)return h===v&&e(l,d,s,f);var p=Pd.call(l);return p!==Pd.call(d)?!1:p===pT?n(l,d,s,f):p===vT?o(l,d,s,f):p===yT?r(l,d,s,f):p===bT?a(l,d,s,f):p===gT||p===dT?Nd(l)||Nd(d)?!1:i(l,d,s,f):p===hT||p===mT||p===ST?vu(l.valueOf(),d.valueOf()):!1}return c}function vv(t,e,n,r){var i=t.length;if(e.length!==i)return!1;for(;i-- >0;)if(!n(t[i],e[i],i,i,t,e,r))return!1;return!0}var CT=pu(vv);function yv(t,e){return vu(t.valueOf(),e.valueOf())}function mv(t,e,n,r){var i=t.size===e.size;if(!i)return!1;if(!t.size)return!0;var o={},a=0;return t.forEach(function(u,s){if(i){var c=!1,l=0;e.forEach(function(d,f){!c&&!o[l]&&(c=n(s,f,a,l,t,e,r)&&n(u,d,s,f,t,e,r))&&(o[l]=!0),l++}),a++,i=c}}),i}var wT=pu(mv),TT="_owner",IT=Object.prototype.hasOwnProperty;function gv(t,e,n,r){var i=Object.keys(t),o=i.length;if(Object.keys(e).length!==o)return!1;for(var a;o-- >0;){if(a=i[o],a===TT){var u=!!t.$$typeof,s=!!e.$$typeof;if((u||s)&&u!==s)return!1}if(!IT.call(e,a)||!n(t[a],e[a],a,a,t,e,r))return!1}return!0}var ET=pu(gv);function bv(t,e){return t.source===e.source&&t.flags===e.flags}function Sv(t,e,n,r){var i=t.size===e.size;if(!i)return!1;if(!t.size)return!0;var o={};return t.forEach(function(a,u){if(i){var s=!1,c=0;e.forEach(function(l,d){!s&&!o[c]&&(s=n(a,l,u,d,t,e,r))&&(o[c]=!0),c++}),i=s}}),i}var xT=pu(Sv),Cv=Object.freeze({areArraysEqual:vv,areDatesEqual:yv,areMapsEqual:mv,areObjectsEqual:gv,areRegExpsEqual:bv,areSetsEqual:Sv,createIsNestedEqual:hv}),wv=Object.freeze({areArraysEqual:CT,areDatesEqual:yv,areMapsEqual:wT,areObjectsEqual:ET,areRegExpsEqual:bv,areSetsEqual:xT,createIsNestedEqual:hv}),AT=yu(Cv);function $T(t,e){return AT(t,e,void 0)}yu(pv(Cv,{createIsNestedEqual:function(){return vu}}));yu(wv);yu(pv(wv,{createIsNestedEqual:function(){return vu}}));/*! *****************************************************************************
5
5
  Copyright (c) Microsoft Corporation.
6
6
 
7
7
  Permission to use, copy, modify, and/or distribute this software for any
@@ -14,12 +14,12 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
14
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
15
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
16
  PERFORMANCE OF THIS SOFTWARE.
17
- ***************************************************************************** */var B=function(){return B=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},B.apply(this,arguments)};function ff(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function St(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function It(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}function zt(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Ft;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(Ft||(Ft={}));var Ci;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ci||(Ci={}));var Zc=Ft.Start,df=Ft.Stop,_a=Ft.Raise,mu=Ft.Send,Tv=Ft.Cancel,$T=Ft.NullEvent,hf=Ft.Assign;Ft.After;Ft.DoneState;var Iv=Ft.Log,DT=Ft.Init,Qc=Ft.Invoke;Ft.ErrorExecution;var Md=Ft.ErrorPlatform,OT=Ft.ErrorCustom,Ev=Ft.Update,NT=Ft.Choose,PT=Ft.Pure,xv=".",Rd={},tl="xstate.guard",MT="",ne=process.env.NODE_ENV==="production",Xa;function pf(t,e,n){n===void 0&&(n=xv);var r=ua(t,n),i=ua(e,n);return xt(i)?xt(r)?i===r:!1:xt(r)?r in i:Object.keys(r).every(function(o){return o in i?pf(r[o],i[o]):!1})}function Av(t){try{return xt(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function el(t,e){try{return mo(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function RT(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function ua(t,e){if(RT(t))return t.value;if(mo(t))return qs(t);if(typeof t!="string")return t;var n=el(t,e);return qs(n)}function qs(t){if(t.length===1)return t[0];for(var e={},n=e,r=0;r<t.length-1;r++)r===t.length-2?n[t[r]]=t[r+1]:(n[t[r]]={},n=n[t[r]]);return e}function Ko(t,e){for(var n={},r=Object.keys(t),i=0;i<r.length;i++){var o=r[i];n[o]=e(t[o],o,t,i)}return n}function _d(t,e,n){var r,i,o={};try{for(var a=St(Object.keys(t)),u=a.next();!u.done;u=a.next()){var s=u.value,c=t[s];n(c)&&(o[s]=e(c,s,t))}}catch(l){r={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}var _T=function(t){return function(e){var n,r,i=e;try{for(var o=St(t),a=o.next();!a.done;a=o.next()){var u=a.value;i=i[u]}}catch(s){n={error:s}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}};function jT(t,e){return function(n){var r,i,o=n;try{for(var a=St(t),u=a.next();!u.done;u=a.next()){var s=u.value;o=o[e][s]}}catch(c){r={error:c}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}}function ys(t){if(!t)return[[]];if(xt(t))return[[t]];var e=Qt(Object.keys(t).map(function(n){var r=t[n];return typeof r!="string"&&(!r||!Object.keys(r).length)?[[n]]:ys(t[n]).map(function(i){return[n].concat(i)})}));return e}function Qt(t){var e;return(e=[]).concat.apply(e,zt([],It(t),!1))}function $v(t){return mo(t)?t:[t]}function En(t){return t===void 0?[]:$v(t)}function ks(t,e,n){var r,i;if(Pt(t))return t(e,n.data);var o={};try{for(var a=St(Object.keys(t)),u=a.next();!u.done;u=a.next()){var s=u.value,c=t[s];Pt(c)?o[s]=c(e,n.data):o[s]=c}}catch(l){r={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}function qT(t){return/^(done|error)\./.test(t)}function jd(t){return!!(t instanceof Promise||t!==null&&(Pt(t)||typeof t=="object")&&Pt(t.then))}function kT(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function UT(t,e){var n,r,i=It([[],[]],2),o=i[0],a=i[1];try{for(var u=St(t),s=u.next();!s.done;s=u.next()){var c=s.value;e(c)?o.push(c):a.push(c)}}catch(l){n={error:l}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return[o,a]}function Dv(t,e){return Ko(t.states,function(n,r){if(n){var i=(xt(e)?void 0:e[r])||(n?n.current:void 0);if(i)return{current:i,states:Dv(n,i)}}})}function BT(t,e){return{current:e,states:Dv(t,e)}}function qd(t,e,n,r){ne||Se(!!t,"Attempting to update undefined context");var i=t&&n.reduce(function(o,a){var u,s,c=a.assignment,l={state:r,action:a,_event:e},d={};if(Pt(c))d=c(o,e.data,l);else try{for(var f=St(Object.keys(c)),h=f.next();!h.done;h=f.next()){var v=h.value,p=c[v];d[v]=Pt(p)?p(o,e.data,l):p}}catch(S){u={error:S}}finally{try{h&&!h.done&&(s=f.return)&&s.call(f)}finally{if(u)throw u.error}}return Object.assign({},o,d)},t);return i}var Se=function(){};ne||(Se=function(t,e){var n=t instanceof Error?t:void 0;if(!(!n&&t)&&console!==void 0){var r=["Warning: ".concat(e)];n&&r.push(n),console.warn.apply(console,r)}});function mo(t){return Array.isArray(t)}function Pt(t){return typeof t=="function"}function xt(t){return typeof t=="string"}function Ov(t,e){if(t)return xt(t)?{type:tl,name:t,predicate:e?e[t]:void 0}:Pt(t)?{type:tl,name:t.name,predicate:t}:t}function VT(t){try{return"subscribe"in t&&Pt(t.subscribe)}catch{return!1}}var $r=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();Xa={},Xa[$r]=function(){return this},Xa[Symbol.observable]=function(){return this};function pr(t){return!!t&&"__xstatenode"in t}function FT(t){return!!t&&typeof t.send=="function"}var LT=function(){var t=0;return function(){return t++,t.toString(16)}}();function gu(t,e){return xt(t)||typeof t=="number"?B({type:t},e):t}function Ne(t,e){if(!xt(t)&&"$$type"in t&&t.$$type==="scxml")return t;var n=gu(t);return B({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function Ri(t,e){var n=$v(e).map(function(r){return typeof r>"u"||typeof r=="string"||pr(r)?{target:r,event:t}:B(B({},r),{event:t})});return n}function GT(t){if(!(t===void 0||t===MT))return En(t)}function zT(t,e,n){if(!ne){var r=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(n,"', error was '").concat(t,"'.").concat(r));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(n,"'. ")+"Original error: '".concat(t,"'. ").concat(r," Current error is '").concat(e,"'.").concat(i))}}}function Nv(t,e,n,r,i){var o=t.options.guards,a={state:i,cond:e,_event:r};if(e.type===tl)return((o==null?void 0:o[e.name])||e.predicate)(n,r.data,a);var u=o==null?void 0:o[e.type];if(!u)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return u(n,r.data,a)}function Pv(t){return typeof t=="string"?{type:t}:t}function ms(t,e,n){var r=function(){},i=typeof t=="object",o=i?t:null;return{next:((i?t.next:t)||r).bind(o),error:((i?t.error:e)||r).bind(o),complete:((i?t.complete:n)||r).bind(o)}}function Za(t,e){return"".concat(t,":invocation[").concat(e,"]")}function nl(t){return(t.type===_a||t.type===mu&&t.to===Ci.Internal)&&typeof t.delay!="number"}var eo=Ne({type:DT});function rl(t,e){return e&&e[t]||void 0}function ga(t,e){var n;if(xt(t)||typeof t=="number"){var r=rl(t,e);Pt(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(Pt(t))n={type:t.name||t.toString(),exec:t};else{var r=rl(t.type,e);if(Pt(r))n=B(B({},t),{exec:r});else if(r){var i=r.type||t.type;n=B(B(B({},r),t),{type:i})}else n=t}return n}var Dr=function(t,e){if(!t)return[];var n=mo(t)?t:[t];return n.map(function(r){return ga(r,e)})};function vf(t){var e=ga(t);return B(B({id:xt(t)?t:e.id},e),{type:e.type})}function HT(t,e){return{type:_a,event:typeof t=="function"?t:gu(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function WT(t,e,n,r){var i={_event:n},o=Ne(Pt(t.event)?t.event(e,n.data,i):t.event),a;if(xt(t.delay)){var u=r&&r[t.delay];a=Pt(u)?u(e,n.data,i):u}else a=Pt(t.delay)?t.delay(e,n.data,i):t.delay;return B(B({},t),{type:_a,_event:o,delay:a})}function bu(t,e){return{to:e?e.to:void 0,type:mu,event:Pt(t)?t:gu(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:Pt(t)?t.name:Av(t)}}function KT(t,e,n,r){var i={_event:n},o=Ne(Pt(t.event)?t.event(e,n.data,i):t.event),a;if(xt(t.delay)){var u=r&&r[t.delay];a=Pt(u)?u(e,n.data,i):u}else a=Pt(t.delay)?t.delay(e,n.data,i):t.delay;var s=Pt(t.to)?t.to(e,n.data,i):t.to;return B(B({},t),{to:s,_event:o,event:o.data,delay:a})}function JT(t,e){return bu(t,B(B({},e),{to:Ci.Parent}))}var YT=function(t,e,n){return B(B({},t),{value:xt(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},XT=function(t){return{type:Tv,sendId:t}};function ZT(t){var e=vf(t);return{type:Ft.Start,activity:e,exec:void 0}}function QT(t){var e=Pt(t)?t:vf(t);return{type:Ft.Stop,activity:e,exec:void 0}}function tI(t,e,n){var r=Pt(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,o={type:Ft.Stop,activity:i};return o}var eI=function(t){return{type:hf,assignment:t}};function nI(t,e){var n=e?"#".concat(e):"";return"".concat(Ft.After,"(").concat(t,")").concat(n)}function Qa(t,e){var n="".concat(Ft.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function gs(t,e){var n="".concat(Ft.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function Jo(t,e){var n="".concat(Ft.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function rI(t,e){if(!ne&&(!t||typeof t=="function")){var n=t;t=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=typeof n=="function"?n.apply(void 0,zt([],It(r),!1)):n;if(!o)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return o}}return bu(function(r,i){return i},B(B({},e),{to:t}))}var iI=function(t){var e,n,r=[];try{for(var i=St(t),o=i.next();!o.done;o=i.next())for(var a=o.value,u=0;u<a.actions.length;){if(a.actions[u].type===hf){r.push(a.actions[u]),a.actions.splice(u,1);continue}u++}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function Us(t,e,n,r,i,o,a){a===void 0&&(a=!1);var u=a?[]:iI(i),s=u.length?qd(n,r,u,e):n,c=a?[n]:void 0,l=[];function d(v,p){var S;switch(p.type){case _a:{var C=WT(p,s,r,t.options.delays);return o&&typeof C.delay=="number"&&o(C,s,r),C}case mu:var w=KT(p,s,r,t.options.delays);if(!ne){var T=p.delay;Se(!xt(T)||typeof w.delay=="number","No delay reference for delay expression '".concat(T,"' was found on machine '").concat(t.id,"'"))}return o&&w.to!==Ci.Internal&&(v==="entry"?l.push(w):o(w,s,r)),w;case Iv:{var I=YT(p,s,r);return o==null||o(I,s,r),I}case NT:{var x=p,b=(S=x.conds.find(function(Y){var J=Ov(Y.cond,t.options.guards);return!J||Nv(t,J,s,r,o?void 0:e)}))===null||S===void 0?void 0:S.actions;if(!b)return[];var E=It(Us(t,e,s,r,[{type:v,actions:Dr(En(b),t.options.actions)}],o,a),2),P=E[0],A=E[1];return s=A,c==null||c.push(s),P}case PT:{var b=p.get(s,r.data);if(!b)return[];var U=It(Us(t,e,s,r,[{type:v,actions:Dr(En(b),t.options.actions)}],o,a),2),M=U[0],$=U[1];return s=$,c==null||c.push(s),M}case df:{var I=tI(p,s,r);return o==null||o(I,n,r),I}case hf:{s=qd(s,r,[p],o?void 0:e),c==null||c.push(s);break}default:var z=ga(p,t.options.actions),Z=z.exec;if(o)o(z,s,r);else if(Z&&c){var Vt=c.length-1,bt=B(B({},z),{exec:function(Y){for(var J=[],ut=1;ut<arguments.length;ut++)J[ut-1]=arguments[ut];Z.apply(void 0,zt([c[Vt]],It(J),!1))}});z=bt}return z}}function f(v){var p,S,C=[];try{for(var w=St(v.actions),T=w.next();!T.done;T=w.next()){var I=T.value,x=d(v.type,I);x&&(C=C.concat(x))}}catch(b){p={error:b}}finally{try{T&&!T.done&&(S=w.return)&&S.call(w)}finally{if(p)throw p.error}}return l.forEach(function(b){o(b,s,r)}),l.length=0,C}var h=Qt(i.map(f));return[h,s]}var Bs=[],zi=function(t,e){Bs.push(t);var n=e(t);return Bs.pop(),n},oI=function(t){return t(Bs[Bs.length-1])};function Mv(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[$r]=function(){return this},e}function aI(t,e,n,r){var i,o=Pv(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[o.type],u=t.data?ks(t.data,n,r):void 0,s=a?yf(a,t.id,u):Mv(t.id);return s.meta=t,s}function yf(t,e,n){var r=Mv(e);if(r.deferred=!0,pr(t)){var i=r.state=zi(void 0,function(){return(n?t.withContext(n):t).initialState});r.getSnapshot=function(){return i}}return r}function sI(t){try{return typeof t.send=="function"}catch{return!1}}function uI(t){return sI(t)&&"id"in t}function cI(t){var e;return B((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[$r]=function(){return this},e),t)}var Vs=function(t){return t.type==="atomic"||t.type==="final"};function Rv(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function ba(t){return Rv(t).filter(function(e){return e.type!=="history"})}function _v(t){var e=[t];return Vs(t)?e:e.concat(Qt(ba(t).map(_v)))}function Yo(t,e){var n,r,i,o,a,u,s,c,l=new Set(t),d=il(l),f=new Set(e);try{for(var h=St(f),v=h.next();!v.done;v=h.next())for(var p=v.value,S=p.parent;S&&!f.has(S);)f.add(S),S=S.parent}catch(A){n={error:A}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var C=il(f);try{for(var w=St(f),T=w.next();!T.done;T=w.next()){var p=T.value;if(p.type==="compound"&&(!C.get(p)||!C.get(p).length))d.get(p)?d.get(p).forEach(function(U){return f.add(U)}):p.initialStateNodes.forEach(function(U){return f.add(U)});else if(p.type==="parallel")try{for(var I=(a=void 0,St(ba(p))),x=I.next();!x.done;x=I.next()){var b=x.value;f.has(b)||(f.add(b),d.get(b)?d.get(b).forEach(function(U){return f.add(U)}):b.initialStateNodes.forEach(function(U){return f.add(U)}))}}catch(U){a={error:U}}finally{try{x&&!x.done&&(u=I.return)&&u.call(I)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}try{for(var E=St(f),P=E.next();!P.done;P=E.next())for(var p=P.value,S=p.parent;S&&!f.has(S);)f.add(S),S=S.parent}catch(A){s={error:A}}finally{try{P&&!P.done&&(c=E.return)&&c.call(E)}finally{if(s)throw s.error}}return f}function jv(t,e){var n=e.get(t);if(!n)return{};if(t.type==="compound"){var r=n[0];if(r){if(Vs(r))return r.key}else return{}}var i={};return n.forEach(function(o){i[o.key]=jv(o,e)}),i}function il(t){var e,n,r=new Map;try{for(var i=St(t),o=i.next();!o.done;o=i.next()){var a=o.value;r.has(a)||r.set(a,[]),a.parent&&(r.has(a.parent)||r.set(a.parent,[]),r.get(a.parent).push(a))}}catch(u){e={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function lI(t,e){var n=Yo([t],e);return jv(t,il(n))}function Xo(t,e){return Array.isArray(t)?t.some(function(n){return n===e}):t instanceof Set?t.has(e):!1}function fI(t){return zt([],It(new Set(Qt(zt([],It(t.map(function(e){return e.ownEvents})),!1)))),!1)}function bs(t,e){return e.type==="compound"?ba(e).some(function(n){return n.type==="final"&&Xo(t,n)}):e.type==="parallel"?ba(e).every(function(n){return bs(t,n)}):!1}function dI(t){return t===void 0&&(t=[]),t.reduce(function(e,n){return n.meta!==void 0&&(e[n.id]=n.meta),e},{})}function kd(t){return new Set(Qt(t.map(function(e){return e.tags})))}function qv(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(xt(t)||xt(e))return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(i){return qv(t[i],e[i])})}function hI(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function pI(t,e){var n=t.exec,r=B(B({},t),{exec:n!==void 0?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return r}var mn=function(){function t(e){var n=this,r;this.actions=[],this.activities=Rd,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||Rd,this.meta=dI(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(r=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&r!==void 0?r:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return fI(n.configuration)}})}return t.from=function(e,n){if(e instanceof t)return e.context!==n?new t({value:e.value,context:n,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var r=eo;return new t({value:e,context:n,_event:r,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,n){if(e instanceof t){if(!e.actions.length)return e;var r=eo;return new t({value:e.value,context:n,_event:r,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,n)},t.prototype.toStrings=function(e,n){var r=this;if(e===void 0&&(e=this.value),n===void 0&&(n="."),xt(e))return[e];var i=Object.keys(e);return i.concat.apply(i,zt([],It(i.map(function(o){return r.toStrings(e[o],n).map(function(a){return o+n+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var n=e.tags;e.machine;var r=ff(e,["configuration","transitions","tags","machine"]);return B(B({},r),{tags:Array.from(n)})},t.prototype.matches=function(e){return pf(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var n;ne&&Se(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var r=(n=this.machine)===null||n===void 0?void 0:n.getTransitionData(this,e);return!!(r!=null&&r.transitions.length)&&r.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}(),vI={deferEvents:!1},Ud=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=B(B({},vI),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(n){throw this.clear(),n}finally{this.processingEvent=!1}},t}(),vc=new Map,yI=0,Uo={bookId:function(){return"x:".concat(yI++)},register:function(t,e){return vc.set(t,e),t},get:function(t){return vc.get(t)},free:function(t){vc.delete(t)}};function mf(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;ne||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function mI(){var t=mf();if(t&&"__xstate__"in t)return t.__xstate__}function gI(t){if(mf()){var e=mI();e&&e.register(t)}}function bI(t,e){e===void 0&&(e={});var n=t.initialState,r=new Set,i=[],o=!1,a=function(){if(!o){for(o=!0;i.length>0;){var c=i.shift();n=t.transition(n,c,s),r.forEach(function(l){return l.next(n)})}o=!1}},u=cI({id:e.id,send:function(c){i.push(c),a()},getSnapshot:function(){return n},subscribe:function(c,l,d){var f=ms(c,l,d);return r.add(f),f.next(n),{unsubscribe:function(){r.delete(f)}}}}),s={parent:e.parent,self:u,id:e.id||"anonymous",observers:r};return n=t.start?t.start(s):n,u}var ol={sync:!1,autoForward:!1},ae;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(ae||(ae={}));var SI=function(){function t(e,n){n===void 0&&(n=t.defaultOptions);var r=this;this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=ae.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(l,d){if(mo(l))return r.batch(l),r.state;var f=Ne(gu(l,d));if(r.status===ae.Stopped)return ne||Se(!1,'Event "'.concat(f.name,'" was sent to stopped service "').concat(r.machine.id,`". This service has already reached its final state, and will not transition.
17
+ ***************************************************************************** */var B=function(){return B=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},B.apply(this,arguments)};function ff(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function St(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function It(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}function zt(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Ft;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(Ft||(Ft={}));var Ci;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ci||(Ci={}));var Zc=Ft.Start,df=Ft.Stop,_a=Ft.Raise,mu=Ft.Send,Tv=Ft.Cancel,DT=Ft.NullEvent,hf=Ft.Assign;Ft.After;Ft.DoneState;var Iv=Ft.Log,OT=Ft.Init,Qc=Ft.Invoke;Ft.ErrorExecution;var Md=Ft.ErrorPlatform,NT=Ft.ErrorCustom,Ev=Ft.Update,PT=Ft.Choose,MT=Ft.Pure,xv=".",Rd={},tl="xstate.guard",RT="",ne=process.env.NODE_ENV==="production",Xa;function pf(t,e,n){n===void 0&&(n=xv);var r=ua(t,n),i=ua(e,n);return xt(i)?xt(r)?i===r:!1:xt(r)?r in i:Object.keys(r).every(function(o){return o in i?pf(r[o],i[o]):!1})}function Av(t){try{return xt(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function el(t,e){try{return mo(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function _T(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function ua(t,e){if(_T(t))return t.value;if(mo(t))return qs(t);if(typeof t!="string")return t;var n=el(t,e);return qs(n)}function qs(t){if(t.length===1)return t[0];for(var e={},n=e,r=0;r<t.length-1;r++)r===t.length-2?n[t[r]]=t[r+1]:(n[t[r]]={},n=n[t[r]]);return e}function Ko(t,e){for(var n={},r=Object.keys(t),i=0;i<r.length;i++){var o=r[i];n[o]=e(t[o],o,t,i)}return n}function _d(t,e,n){var r,i,o={};try{for(var a=St(Object.keys(t)),u=a.next();!u.done;u=a.next()){var s=u.value,c=t[s];n(c)&&(o[s]=e(c,s,t))}}catch(l){r={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}var jT=function(t){return function(e){var n,r,i=e;try{for(var o=St(t),a=o.next();!a.done;a=o.next()){var u=a.value;i=i[u]}}catch(s){n={error:s}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}};function qT(t,e){return function(n){var r,i,o=n;try{for(var a=St(t),u=a.next();!u.done;u=a.next()){var s=u.value;o=o[e][s]}}catch(c){r={error:c}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}}function ys(t){if(!t)return[[]];if(xt(t))return[[t]];var e=Qt(Object.keys(t).map(function(n){var r=t[n];return typeof r!="string"&&(!r||!Object.keys(r).length)?[[n]]:ys(t[n]).map(function(i){return[n].concat(i)})}));return e}function Qt(t){var e;return(e=[]).concat.apply(e,zt([],It(t),!1))}function $v(t){return mo(t)?t:[t]}function En(t){return t===void 0?[]:$v(t)}function ks(t,e,n){var r,i;if(Pt(t))return t(e,n.data);var o={};try{for(var a=St(Object.keys(t)),u=a.next();!u.done;u=a.next()){var s=u.value,c=t[s];Pt(c)?o[s]=c(e,n.data):o[s]=c}}catch(l){r={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}function kT(t){return/^(done|error)\./.test(t)}function jd(t){return!!(t instanceof Promise||t!==null&&(Pt(t)||typeof t=="object")&&Pt(t.then))}function UT(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function BT(t,e){var n,r,i=It([[],[]],2),o=i[0],a=i[1];try{for(var u=St(t),s=u.next();!s.done;s=u.next()){var c=s.value;e(c)?o.push(c):a.push(c)}}catch(l){n={error:l}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return[o,a]}function Dv(t,e){return Ko(t.states,function(n,r){if(n){var i=(xt(e)?void 0:e[r])||(n?n.current:void 0);if(i)return{current:i,states:Dv(n,i)}}})}function VT(t,e){return{current:e,states:Dv(t,e)}}function qd(t,e,n,r){ne||Se(!!t,"Attempting to update undefined context");var i=t&&n.reduce(function(o,a){var u,s,c=a.assignment,l={state:r,action:a,_event:e},d={};if(Pt(c))d=c(o,e.data,l);else try{for(var f=St(Object.keys(c)),h=f.next();!h.done;h=f.next()){var v=h.value,p=c[v];d[v]=Pt(p)?p(o,e.data,l):p}}catch(S){u={error:S}}finally{try{h&&!h.done&&(s=f.return)&&s.call(f)}finally{if(u)throw u.error}}return Object.assign({},o,d)},t);return i}var Se=function(){};ne||(Se=function(t,e){var n=t instanceof Error?t:void 0;if(!(!n&&t)&&console!==void 0){var r=["Warning: ".concat(e)];n&&r.push(n),console.warn.apply(console,r)}});function mo(t){return Array.isArray(t)}function Pt(t){return typeof t=="function"}function xt(t){return typeof t=="string"}function Ov(t,e){if(t)return xt(t)?{type:tl,name:t,predicate:e?e[t]:void 0}:Pt(t)?{type:tl,name:t.name,predicate:t}:t}function FT(t){try{return"subscribe"in t&&Pt(t.subscribe)}catch{return!1}}var $r=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();Xa={},Xa[$r]=function(){return this},Xa[Symbol.observable]=function(){return this};function pr(t){return!!t&&"__xstatenode"in t}function LT(t){return!!t&&typeof t.send=="function"}var GT=function(){var t=0;return function(){return t++,t.toString(16)}}();function gu(t,e){return xt(t)||typeof t=="number"?B({type:t},e):t}function Ne(t,e){if(!xt(t)&&"$$type"in t&&t.$$type==="scxml")return t;var n=gu(t);return B({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function Ri(t,e){var n=$v(e).map(function(r){return typeof r>"u"||typeof r=="string"||pr(r)?{target:r,event:t}:B(B({},r),{event:t})});return n}function zT(t){if(!(t===void 0||t===RT))return En(t)}function HT(t,e,n){if(!ne){var r=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(n,"', error was '").concat(t,"'.").concat(r));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(n,"'. ")+"Original error: '".concat(t,"'. ").concat(r," Current error is '").concat(e,"'.").concat(i))}}}function Nv(t,e,n,r,i){var o=t.options.guards,a={state:i,cond:e,_event:r};if(e.type===tl)return((o==null?void 0:o[e.name])||e.predicate)(n,r.data,a);var u=o==null?void 0:o[e.type];if(!u)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return u(n,r.data,a)}function Pv(t){return typeof t=="string"?{type:t}:t}function ms(t,e,n){var r=function(){},i=typeof t=="object",o=i?t:null;return{next:((i?t.next:t)||r).bind(o),error:((i?t.error:e)||r).bind(o),complete:((i?t.complete:n)||r).bind(o)}}function Za(t,e){return"".concat(t,":invocation[").concat(e,"]")}function nl(t){return(t.type===_a||t.type===mu&&t.to===Ci.Internal)&&typeof t.delay!="number"}var eo=Ne({type:OT});function rl(t,e){return e&&e[t]||void 0}function ga(t,e){var n;if(xt(t)||typeof t=="number"){var r=rl(t,e);Pt(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(Pt(t))n={type:t.name||t.toString(),exec:t};else{var r=rl(t.type,e);if(Pt(r))n=B(B({},t),{exec:r});else if(r){var i=r.type||t.type;n=B(B(B({},r),t),{type:i})}else n=t}return n}var Dr=function(t,e){if(!t)return[];var n=mo(t)?t:[t];return n.map(function(r){return ga(r,e)})};function vf(t){var e=ga(t);return B(B({id:xt(t)?t:e.id},e),{type:e.type})}function WT(t,e){return{type:_a,event:typeof t=="function"?t:gu(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function KT(t,e,n,r){var i={_event:n},o=Ne(Pt(t.event)?t.event(e,n.data,i):t.event),a;if(xt(t.delay)){var u=r&&r[t.delay];a=Pt(u)?u(e,n.data,i):u}else a=Pt(t.delay)?t.delay(e,n.data,i):t.delay;return B(B({},t),{type:_a,_event:o,delay:a})}function bu(t,e){return{to:e?e.to:void 0,type:mu,event:Pt(t)?t:gu(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:Pt(t)?t.name:Av(t)}}function YT(t,e,n,r){var i={_event:n},o=Ne(Pt(t.event)?t.event(e,n.data,i):t.event),a;if(xt(t.delay)){var u=r&&r[t.delay];a=Pt(u)?u(e,n.data,i):u}else a=Pt(t.delay)?t.delay(e,n.data,i):t.delay;var s=Pt(t.to)?t.to(e,n.data,i):t.to;return B(B({},t),{to:s,_event:o,event:o.data,delay:a})}function JT(t,e){return bu(t,B(B({},e),{to:Ci.Parent}))}var XT=function(t,e,n){return B(B({},t),{value:xt(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},ZT=function(t){return{type:Tv,sendId:t}};function QT(t){var e=vf(t);return{type:Ft.Start,activity:e,exec:void 0}}function tI(t){var e=Pt(t)?t:vf(t);return{type:Ft.Stop,activity:e,exec:void 0}}function eI(t,e,n){var r=Pt(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,o={type:Ft.Stop,activity:i};return o}var nI=function(t){return{type:hf,assignment:t}};function rI(t,e){var n=e?"#".concat(e):"";return"".concat(Ft.After,"(").concat(t,")").concat(n)}function Qa(t,e){var n="".concat(Ft.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function gs(t,e){var n="".concat(Ft.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function Yo(t,e){var n="".concat(Ft.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function iI(t,e){if(!ne&&(!t||typeof t=="function")){var n=t;t=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=typeof n=="function"?n.apply(void 0,zt([],It(r),!1)):n;if(!o)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return o}}return bu(function(r,i){return i},B(B({},e),{to:t}))}var oI=function(t){var e,n,r=[];try{for(var i=St(t),o=i.next();!o.done;o=i.next())for(var a=o.value,u=0;u<a.actions.length;){if(a.actions[u].type===hf){r.push(a.actions[u]),a.actions.splice(u,1);continue}u++}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function Us(t,e,n,r,i,o,a){a===void 0&&(a=!1);var u=a?[]:oI(i),s=u.length?qd(n,r,u,e):n,c=a?[n]:void 0,l=[];function d(v,p){var S;switch(p.type){case _a:{var C=KT(p,s,r,t.options.delays);return o&&typeof C.delay=="number"&&o(C,s,r),C}case mu:var w=YT(p,s,r,t.options.delays);if(!ne){var T=p.delay;Se(!xt(T)||typeof w.delay=="number","No delay reference for delay expression '".concat(T,"' was found on machine '").concat(t.id,"'"))}return o&&w.to!==Ci.Internal&&(v==="entry"?l.push(w):o(w,s,r)),w;case Iv:{var I=XT(p,s,r);return o==null||o(I,s,r),I}case PT:{var x=p,b=(S=x.conds.find(function(J){var Y=Ov(J.cond,t.options.guards);return!Y||Nv(t,Y,s,r,o?void 0:e)}))===null||S===void 0?void 0:S.actions;if(!b)return[];var E=It(Us(t,e,s,r,[{type:v,actions:Dr(En(b),t.options.actions)}],o,a),2),P=E[0],A=E[1];return s=A,c==null||c.push(s),P}case MT:{var b=p.get(s,r.data);if(!b)return[];var U=It(Us(t,e,s,r,[{type:v,actions:Dr(En(b),t.options.actions)}],o,a),2),M=U[0],$=U[1];return s=$,c==null||c.push(s),M}case df:{var I=eI(p,s,r);return o==null||o(I,n,r),I}case hf:{s=qd(s,r,[p],o?void 0:e),c==null||c.push(s);break}default:var z=ga(p,t.options.actions),Z=z.exec;if(o)o(z,s,r);else if(Z&&c){var Vt=c.length-1,bt=B(B({},z),{exec:function(J){for(var Y=[],ut=1;ut<arguments.length;ut++)Y[ut-1]=arguments[ut];Z.apply(void 0,zt([c[Vt]],It(Y),!1))}});z=bt}return z}}function f(v){var p,S,C=[];try{for(var w=St(v.actions),T=w.next();!T.done;T=w.next()){var I=T.value,x=d(v.type,I);x&&(C=C.concat(x))}}catch(b){p={error:b}}finally{try{T&&!T.done&&(S=w.return)&&S.call(w)}finally{if(p)throw p.error}}return l.forEach(function(b){o(b,s,r)}),l.length=0,C}var h=Qt(i.map(f));return[h,s]}var Bs=[],zi=function(t,e){Bs.push(t);var n=e(t);return Bs.pop(),n},aI=function(t){return t(Bs[Bs.length-1])};function Mv(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[$r]=function(){return this},e}function sI(t,e,n,r){var i,o=Pv(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[o.type],u=t.data?ks(t.data,n,r):void 0,s=a?yf(a,t.id,u):Mv(t.id);return s.meta=t,s}function yf(t,e,n){var r=Mv(e);if(r.deferred=!0,pr(t)){var i=r.state=zi(void 0,function(){return(n?t.withContext(n):t).initialState});r.getSnapshot=function(){return i}}return r}function uI(t){try{return typeof t.send=="function"}catch{return!1}}function cI(t){return uI(t)&&"id"in t}function lI(t){var e;return B((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[$r]=function(){return this},e),t)}var Vs=function(t){return t.type==="atomic"||t.type==="final"};function Rv(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function ba(t){return Rv(t).filter(function(e){return e.type!=="history"})}function _v(t){var e=[t];return Vs(t)?e:e.concat(Qt(ba(t).map(_v)))}function Jo(t,e){var n,r,i,o,a,u,s,c,l=new Set(t),d=il(l),f=new Set(e);try{for(var h=St(f),v=h.next();!v.done;v=h.next())for(var p=v.value,S=p.parent;S&&!f.has(S);)f.add(S),S=S.parent}catch(A){n={error:A}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var C=il(f);try{for(var w=St(f),T=w.next();!T.done;T=w.next()){var p=T.value;if(p.type==="compound"&&(!C.get(p)||!C.get(p).length))d.get(p)?d.get(p).forEach(function(U){return f.add(U)}):p.initialStateNodes.forEach(function(U){return f.add(U)});else if(p.type==="parallel")try{for(var I=(a=void 0,St(ba(p))),x=I.next();!x.done;x=I.next()){var b=x.value;f.has(b)||(f.add(b),d.get(b)?d.get(b).forEach(function(U){return f.add(U)}):b.initialStateNodes.forEach(function(U){return f.add(U)}))}}catch(U){a={error:U}}finally{try{x&&!x.done&&(u=I.return)&&u.call(I)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}try{for(var E=St(f),P=E.next();!P.done;P=E.next())for(var p=P.value,S=p.parent;S&&!f.has(S);)f.add(S),S=S.parent}catch(A){s={error:A}}finally{try{P&&!P.done&&(c=E.return)&&c.call(E)}finally{if(s)throw s.error}}return f}function jv(t,e){var n=e.get(t);if(!n)return{};if(t.type==="compound"){var r=n[0];if(r){if(Vs(r))return r.key}else return{}}var i={};return n.forEach(function(o){i[o.key]=jv(o,e)}),i}function il(t){var e,n,r=new Map;try{for(var i=St(t),o=i.next();!o.done;o=i.next()){var a=o.value;r.has(a)||r.set(a,[]),a.parent&&(r.has(a.parent)||r.set(a.parent,[]),r.get(a.parent).push(a))}}catch(u){e={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function fI(t,e){var n=Jo([t],e);return jv(t,il(n))}function Xo(t,e){return Array.isArray(t)?t.some(function(n){return n===e}):t instanceof Set?t.has(e):!1}function dI(t){return zt([],It(new Set(Qt(zt([],It(t.map(function(e){return e.ownEvents})),!1)))),!1)}function bs(t,e){return e.type==="compound"?ba(e).some(function(n){return n.type==="final"&&Xo(t,n)}):e.type==="parallel"?ba(e).every(function(n){return bs(t,n)}):!1}function hI(t){return t===void 0&&(t=[]),t.reduce(function(e,n){return n.meta!==void 0&&(e[n.id]=n.meta),e},{})}function kd(t){return new Set(Qt(t.map(function(e){return e.tags})))}function qv(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(xt(t)||xt(e))return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(i){return qv(t[i],e[i])})}function pI(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function vI(t,e){var n=t.exec,r=B(B({},t),{exec:n!==void 0?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return r}var mn=function(){function t(e){var n=this,r;this.actions=[],this.activities=Rd,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||Rd,this.meta=hI(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(r=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&r!==void 0?r:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return dI(n.configuration)}})}return t.from=function(e,n){if(e instanceof t)return e.context!==n?new t({value:e.value,context:n,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var r=eo;return new t({value:e,context:n,_event:r,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,n){if(e instanceof t){if(!e.actions.length)return e;var r=eo;return new t({value:e.value,context:n,_event:r,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,n)},t.prototype.toStrings=function(e,n){var r=this;if(e===void 0&&(e=this.value),n===void 0&&(n="."),xt(e))return[e];var i=Object.keys(e);return i.concat.apply(i,zt([],It(i.map(function(o){return r.toStrings(e[o],n).map(function(a){return o+n+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var n=e.tags;e.machine;var r=ff(e,["configuration","transitions","tags","machine"]);return B(B({},r),{tags:Array.from(n)})},t.prototype.matches=function(e){return pf(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var n;ne&&Se(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var r=(n=this.machine)===null||n===void 0?void 0:n.getTransitionData(this,e);return!!(r!=null&&r.transitions.length)&&r.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}(),yI={deferEvents:!1},Ud=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=B(B({},yI),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(n){throw this.clear(),n}finally{this.processingEvent=!1}},t}(),vc=new Map,mI=0,Uo={bookId:function(){return"x:".concat(mI++)},register:function(t,e){return vc.set(t,e),t},get:function(t){return vc.get(t)},free:function(t){vc.delete(t)}};function mf(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;ne||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function gI(){var t=mf();if(t&&"__xstate__"in t)return t.__xstate__}function bI(t){if(mf()){var e=gI();e&&e.register(t)}}function SI(t,e){e===void 0&&(e={});var n=t.initialState,r=new Set,i=[],o=!1,a=function(){if(!o){for(o=!0;i.length>0;){var c=i.shift();n=t.transition(n,c,s),r.forEach(function(l){return l.next(n)})}o=!1}},u=lI({id:e.id,send:function(c){i.push(c),a()},getSnapshot:function(){return n},subscribe:function(c,l,d){var f=ms(c,l,d);return r.add(f),f.next(n),{unsubscribe:function(){r.delete(f)}}}}),s={parent:e.parent,self:u,id:e.id||"anonymous",observers:r};return n=t.start?t.start(s):n,u}var ol={sync:!1,autoForward:!1},ae;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(ae||(ae={}));var CI=function(){function t(e,n){n===void 0&&(n=t.defaultOptions);var r=this;this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=ae.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(l,d){if(mo(l))return r.batch(l),r.state;var f=Ne(gu(l,d));if(r.status===ae.Stopped)return ne||Se(!1,'Event "'.concat(f.name,'" was sent to stopped service "').concat(r.machine.id,`". This service has already reached its final state, and will not transition.
18
18
  Event: `).concat(JSON.stringify(f.data))),r.state;if(r.status!==ae.Running&&!r.options.deferEvents)throw new Error('Event "'.concat(f.name,'" was sent to uninitialized service "').concat(r.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
19
- Event: `).concat(JSON.stringify(f.data)));return r.scheduler.schedule(function(){r.forward(f);var h=r._nextState(f);r.update(h,f)}),r._state},this.sendTo=function(l,d,f){var h=r.parent&&(d===Ci.Parent||r.parent.id===d),v=h?r.parent:xt(d)?d===Ci.Internal?r:r.children.get(d)||Uo.get(d):FT(d)?d:void 0;if(!v){if(!h)throw new Error("Unable to send event to child '".concat(d,"' from service '").concat(r.id,"'."));ne||Se(!1,"Service '".concat(r.id,"' has no parent: unable to send event ").concat(l.type));return}if("machine"in v){if(r.status!==ae.Stopped||r.parent!==v||r.state.done){var p=B(B({},l),{name:l.name===OT?"".concat(Jo(r.id)):l.name,origin:r.sessionId});!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([v,p]):v.send(p)}}else!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([v,l.data]):v.send(l.data)},this._exec=function(l,d,f,h){h===void 0&&(h=r.machine.options.actions);var v=l.exec||rl(l.type,h),p=Pt(v)?v:v?v.exec:l.exec;if(p)try{return p(d,f.data,r.machine.config.predictableActionArguments?{action:l,_event:f}:{action:l,state:r.state,_event:f})}catch(Z){throw r.parent&&r.parent.send({type:"xstate.error",data:Z}),Z}switch(l.type){case _a:{var S=l;r.defer(S);break}case mu:var C=l;if(typeof C.delay=="number"){r.defer(C);return}else C.to?r.sendTo(C._event,C.to,f===eo):r.send(C._event);break;case Tv:r.cancel(l.sendId);break;case Zc:{if(r.status!==ae.Running)return;var w=l.activity;if(!r.machine.config.predictableActionArguments&&!r.state.activities[w.id||w.type])break;if(w.type===Ft.Invoke){var T=Pv(w.src),I=r.machine.options.services?r.machine.options.services[T.type]:void 0,x=w.id,b=w.data;ne||Se(!("forward"in w),"`forward` property is deprecated (found in invocation of '".concat(w.src,"' in in machine '").concat(r.machine.id,"'). ")+"Please use `autoForward` instead.");var E="autoForward"in w?w.autoForward:!!w.forward;if(!I){ne||Se(!1,"No service found for invocation '".concat(w.src,"' in machine '").concat(r.machine.id,"'."));return}var P=b?ks(b,d,f):void 0;if(typeof I=="string")return;var A=Pt(I)?I(d,f.data,{data:P,src:T,meta:w.meta}):I;if(!A)return;var U=void 0;pr(A)&&(A=P?A.withContext(P):A,U={autoForward:E}),r.spawn(A,x,U)}else r.spawnActivity(w);break}case df:{r.stopChild(l.activity.id);break}case Iv:var M=l,$=M.label,z=M.value;$?r.logger($,z):r.logger(z);break;default:ne||Se(!1,"No implementation found for action type '".concat(l.type,"'"));break}};var i=B(B({},t.defaultOptions),n),o=i.clock,a=i.logger,u=i.parent,s=i.id,c=s!==void 0?s:e.id;this.id=c,this.logger=a,this.clock=o,this.parent=u,this.options=i,this.scheduler=new Ud({deferEvents:this.options.deferEvents}),this.sessionId=Uo.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:zi(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return ne||Se(this.status!==ae.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,n){var r,i;try{for(var o=St(e.actions),a=o.next();!a.done;a=o.next()){var u=a.value;this.exec(u,e,n)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},t.prototype.update=function(e,n){var r,i,o,a,u,s,c,l,d=this;if(e._sessionid=this.sessionId,this._state=e,(!this.machine.config.predictableActionArguments||n===eo)&&this.options.execute)this.execute(this.state);else for(var f=void 0;f=this._outgoingQueue.shift();)f[0].send(f[1]);if(this.children.forEach(function(A){d.state.children[A.id]=A}),this.devTools&&this.devTools.send(n.data,e),e.event)try{for(var h=St(this.eventListeners),v=h.next();!v.done;v=h.next()){var p=v.value;p(e.event)}}catch(A){r={error:A}}finally{try{v&&!v.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}try{for(var S=St(this.listeners),C=S.next();!C.done;C=S.next()){var p=C.value;p(e,e.event)}}catch(A){o={error:A}}finally{try{C&&!C.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}try{for(var w=St(this.contextListeners),T=w.next();!T.done;T=w.next()){var I=T.value;I(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(u)throw u.error}}if(this.state.done){var x=e.configuration.find(function(A){return A.type==="final"&&A.parent===d.machine}),b=x&&x.doneData?ks(x.doneData,e.context,n):void 0;this._doneEvent=gs(this.id,b);try{for(var E=St(this.doneListeners),P=E.next();!P.done;P=E.next()){var p=P.value;p(this._doneEvent)}}catch(A){c={error:A}}finally{try{P&&!P.done&&(l=E.return)&&l.call(E)}finally{if(c)throw c.error}}this._stop(),this._stopChildren(),Uo.free(this.sessionId)}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===ae.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,n,r){var i=this,o=ms(e,n,r);this.listeners.add(o.next),this.status!==ae.NotStarted&&o.next(this.state);var a=function(){i.doneListeners.delete(a),i.stopListeners.delete(a),o.complete()};return this.status===ae.Stopped?o.complete():(this.onDone(a),this.onStop(a)),{unsubscribe:function(){i.listeners.delete(o.next),i.doneListeners.delete(a),i.stopListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.status===ae.Stopped&&this._doneEvent?e(this._doneEvent):this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var n=this;if(this.status===ae.Running)return this;this.machine._init(),Uo.register(this.sessionId,this),this.initialized=!0,this.status=ae.Running;var r=e===void 0?this.initialState:zi(this,function(){return hI(e)?n.machine.resolveState(e):n.machine.resolveState(mn.from(e,n.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){n.update(r,eo)}),this},t.prototype._stopChildren=function(){this.children.forEach(function(e){Pt(e.stop)&&e.stop()}),this.children.clear()},t.prototype._stop=function(){var e,n,r,i,o,a,u,s,c,l;try{for(var d=St(this.listeners),f=d.next();!f.done;f=d.next()){var h=f.value;this.listeners.delete(h)}}catch(E){e={error:E}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}try{for(var v=St(this.stopListeners),p=v.next();!p.done;p=v.next()){var h=p.value;h(),this.stopListeners.delete(h)}}catch(E){r={error:E}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}try{for(var S=St(this.contextListeners),C=S.next();!C.done;C=S.next()){var h=C.value;this.contextListeners.delete(h)}}catch(E){o={error:E}}finally{try{C&&!C.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}try{for(var w=St(this.doneListeners),T=w.next();!T.done;T=w.next()){var h=T.value;this.doneListeners.delete(h)}}catch(E){u={error:E}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(u)throw u.error}}if(!this.initialized)return this;this.initialized=!1,this.status=ae.Stopped,this._initialState=void 0;try{for(var I=St(Object.keys(this.delayedEventsMap)),x=I.next();!x.done;x=I.next()){var b=x.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(E){c={error:E}}finally{try{x&&!x.done&&(l=I.return)&&l.call(I)}finally{if(c)throw c.error}}this.scheduler.clear(),this.scheduler=new Ud({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var e=this,n=this.scheduler;return this._stop(),n.schedule(function(){var r;if(!(!((r=e._state)===null||r===void 0)&&r.done)){var i=Ne({type:"xstate.stop"}),o=zi(e,function(){var a=Qt(zt([],It(e.state.configuration),!1).sort(function(d,f){return f.order-d.order}).map(function(d){return Dr(d.onExit,e.machine.options.actions)})),u=It(Us(e.machine,e.state,e.state.context,i,[{type:"exit",actions:a}],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),s=u[0],c=u[1],l=new mn({value:e.state.value,context:c,_event:i,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:s.filter(function(d){return!nl(d)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return l.changed=!0,l});e.update(o,i),e._stopChildren(),Uo.free(e.sessionId)}}),this},t.prototype.batch=function(e){var n=this;if(this.status===ae.NotStarted&&this.options.deferEvents)ne||Se(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
20
- Event: `).concat(JSON.stringify(event)));else if(this.status!==ae.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));if(e.length){var r=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var i,o,a=n.state,u=!1,s=[],c=function(h){var v=Ne(h);n.forward(v),a=zi(n,function(){return n.machine.transition(a,v,void 0,r||void 0)}),s.push.apply(s,zt([],It(n.machine.config.predictableActionArguments?a.actions:a.actions.map(function(p){return pI(p,a)})),!1)),u=u||!!a.changed};try{for(var l=St(e),d=l.next();!d.done;d=l.next()){var f=d.value;c(f)}}catch(h){i={error:h}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}a.changed=u,a.actions=s,n.update(a,Ne(e[e.length-1]))})}},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype._nextState=function(e,n){var r=this;n===void 0&&(n=!!this.machine.config.predictableActionArguments&&this._exec);var i=Ne(e);if(i.name.indexOf(Md)===0&&!this.state.nextEvents.some(function(a){return a.indexOf(Md)===0}))throw i.data.data;var o=zi(this,function(){return r.machine.transition(r.state,i,void 0,n||void 0)});return o},t.prototype.nextState=function(e){return this._nextState(e,!1)},t.prototype.forward=function(e){var n,r;try{for(var i=St(this.forwardTo),o=i.next();!o.done;o=i.next()){var a=o.value,u=this.children.get(a);if(!u)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));u.send(e)}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},t.prototype.defer=function(e){var n=this,r=this.clock.setTimeout(function(){"to"in e&&e.to?n.sendTo(e._event,e.to,!0):n.send(e._event)},e.delay);e.id&&(this.delayedEventsMap[e.id]=r)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,n,r){r===void 0&&(r=this.machine.options.actions),this._exec(e,n.context,n._event,r)},t.prototype.removeChild=function(e){var n;this.children.delete(e),this.forwardTo.delete(e),(n=this.state)===null||n===void 0||delete n.children[e]},t.prototype.stopChild=function(e){var n=this.children.get(e);n&&(this.removeChild(e),Pt(n.stop)&&n.stop())},t.prototype.spawn=function(e,n,r){if(this.status!==ae.Running)return yf(e,n);if(jd(e))return this.spawnPromise(Promise.resolve(e),n);if(Pt(e))return this.spawnCallback(e,n);if(uI(e))return this.spawnActor(e,n);if(VT(e))return this.spawnObservable(e,n);if(pr(e))return this.spawnMachine(e,B(B({},r),{id:n}));if(kT(e))return this.spawnBehavior(e,n);throw new Error('Unable to spawn entity "'.concat(n,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,n){var r=this;n===void 0&&(n={});var i=new t(e,B(B({},this.options),{parent:this,id:n.id||e.id})),o=B(B({},ol),n);o.sync&&i.onTransition(function(u){r.send(Ev,{state:u,id:i.id})});var a=i;return this.children.set(i.id,a),o.autoForward&&this.forwardTo.add(i.id),i.onDone(function(u){r.removeChild(i.id),r.send(Ne(u,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,n){var r=bI(e,{id:n,parent:this});return this.children.set(n,r),r},t.prototype.spawnPromise=function(e,n){var r,i=this,o=!1,a;e.then(function(s){o||(a=s,i.removeChild(n),i.send(Ne(gs(n,s),{origin:n})))},function(s){if(!o){i.removeChild(n);var c=Jo(n,s);try{i.send(Ne(c,{origin:n}))}catch(l){zT(s,l,n),i.devTools&&i.devTools.send(c,i.state),i.machine.strict&&i.stop()}}});var u=(r={id:n,send:function(){},subscribe:function(s,c,l){var d=ms(s,c,l),f=!1;return e.then(function(h){f||(d.next(h),!f&&d.complete())},function(h){f||d.error(h)}),{unsubscribe:function(){return f=!0}}},stop:function(){o=!0},toJSON:function(){return{id:n}},getSnapshot:function(){return a}},r[$r]=function(){return this},r);return this.children.set(n,u),u},t.prototype.spawnCallback=function(e,n){var r,i=this,o=!1,a=new Set,u=new Set,s,c=function(f){s=f,u.forEach(function(h){return h(f)}),!o&&i.send(Ne(f,{origin:n}))},l;try{l=e(c,function(f){a.add(f)})}catch(f){this.send(Jo(n,f))}if(jd(l))return this.spawnPromise(l,n);var d=(r={id:n,send:function(f){return a.forEach(function(h){return h(f)})},subscribe:function(f){var h=ms(f);return u.add(h.next),{unsubscribe:function(){u.delete(h.next)}}},stop:function(){o=!0,Pt(l)&&l()},toJSON:function(){return{id:n}},getSnapshot:function(){return s}},r[$r]=function(){return this},r);return this.children.set(n,d),d},t.prototype.spawnObservable=function(e,n){var r,i=this,o,a=e.subscribe(function(s){o=s,i.send(Ne(s,{origin:n}))},function(s){i.removeChild(n),i.send(Ne(Jo(n,s),{origin:n}))},function(){i.removeChild(n),i.send(Ne(gs(n),{origin:n}))}),u=(r={id:n,send:function(){},subscribe:function(s,c,l){return e.subscribe(s,c,l)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return o},toJSON:function(){return{id:n}}},r[$r]=function(){return this},r);return this.children.set(n,u),u},t.prototype.spawnActor=function(e,n){return this.children.set(n,e),e},t.prototype.spawnActivity=function(e){var n=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!n){ne||Se(!1,"No implementation found for activity '".concat(e.type,"'"));return}var r=n(this.state.context,e);this.spawnEffect(e.id,r)},t.prototype.spawnEffect=function(e,n){var r;this.children.set(e,(r={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:n||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},r[$r]=function(){return this},r))},t.prototype.attachDev=function(){var e=mf();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var n=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(B(B({name:this.id,autoPause:!0,stateSanitizer:function(r){return{value:r.value,context:r.context,actions:r.actions}}},n),{features:B({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}gI(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[$r]=function(){return this},t.prototype.getSnapshot=function(){return this.status===ae.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,n){return setTimeout(e,n)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=kv,t}(),CI=function(t){return xt(t)?B(B({},ol),{name:t}):B(B(B({},ol),{name:LT()}),t)};function Bd(t,e){var n=CI(e);return oI(function(r){if(!ne){var i=pr(t)||Pt(t);Se(!!r||i,'Attempted to spawn an Actor (ID: "'.concat(pr(t)?t.id:"undefined",'") outside of a service. This will have no effect.'))}return r?r.spawn(t,n.name,n):yf(t,n.name)})}function kv(t,e){var n=new SI(t,e);return n}function wI(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function ts(t){return B(B({type:Qc},t),{toJSON:function(){t.onDone,t.onError;var e=ff(t,["onDone","onError"]);return B(B({},e),{type:Qc,src:wI(t.src)})}})}var Hi="",al="#",Bo="*",_i={},ji=function(t){return t[0]===al},TI=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},II=function(t,e,n){var r=n.slice(0,-1).some(function(o){return!("cond"in o)&&!("in"in o)&&(xt(o.target)||pr(o.target))}),i=e===Hi?"the transient event":"event '".concat(e,"'");Se(!r,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},EI=function(){function t(e,n,r,i){r===void 0&&(r="context"in e?e.context:void 0);var o=this,a;this.config=e,this._context=r,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(TI(),n),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:xv),this.id=this.config.id||zt([this.machine.key],It(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,ne||Se(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Ko(this.config.states,function(c,l){var d,f=new t(c,{},void 0,{parent:o,key:l});return Object.assign(o.idMap,B((d={},d[f.id]=f,d),f.idMap)),f}):_i;var u=0;function s(c){var l,d;c.order=u++;try{for(var f=St(Rv(c)),h=f.next();!h.done;h=f.next()){var v=h.value;s(v)}}catch(p){l={error:p}}finally{try{h&&!h.done&&(d=f.return)&&d.call(f)}finally{if(l)throw l.error}}}s(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(c){var l=c.event;return l===Hi}):Hi in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=En(this.config.entry||this.config.onEntry).map(function(c){return ga(c)}),this.onExit=En(this.config.exit||this.config.onExit).map(function(c){return ga(c)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=En(this.config.invoke).map(function(c,l){var d,f;if(pr(c)){var h=Za(o.id,l);return o.machine.options.services=B((d={},d[h]=c,d),o.machine.options.services),ts({src:h,id:h})}else if(xt(c.src)){var h=c.id||Za(o.id,l);return ts(B(B({},c),{id:h,src:c.src}))}else if(pr(c.src)||Pt(c.src)){var h=c.id||Za(o.id,l);return o.machine.options.services=B((f={},f[h]=c.src,f),o.machine.options.services),ts(B(B({id:h},c),{src:h}))}else{var v=c.src;return ts(B(B({id:Za(o.id,l)},c),{src:v}))}}),this.activities=En(this.config.activities).concat(this.invoke).map(function(c){return vf(c)}),this.transition=this.transition.bind(this),this.tags=En(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||_v(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,n){var r=this.options,i=r.actions,o=r.activities,a=r.guards,u=r.services,s=r.delays;return new t(this.config,{actions:B(B({},i),e.actions),activities:B(B({},o),e.activities),guards:B(B({},a),e.guards),services:B(B({},u),e.services),delays:B(B({},s),e.delays)},n??this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return Pt(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Ko(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(n,r){return n[r.eventType]=n[r.eventType]||[],n[r.eventType].push(r),n},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var n=e===Hi,r=this.transitions.filter(function(i){var o=i.eventType===e;return n?o:o||i.eventType===Bo});return this.__cache.candidates[e]=r,r},t.prototype.getDelayedTransitions=function(){var e=this,n=this.config.after;if(!n)return[];var r=function(o,a){var u=Pt(o)?"".concat(e.id,":delay[").concat(a,"]"):o,s=nI(u,e.id);return e.onEntry.push(bu(s,{delay:o})),e.onExit.push(XT(s)),s},i=mo(n)?n.map(function(o,a){var u=r(o.delay,a);return B(B({},o),{event:u})}):Qt(Object.keys(n).map(function(o,a){var u=n[o],s=xt(u)?{target:u}:u,c=isNaN(+o)?o:+o,l=r(c,a);return En(s).map(function(d){return B(B({},d),{event:l,delay:c})})}));return i.map(function(o){var a=o.delay;return B(B({},e.formatTransition(o)),{delay:a})})},t.prototype.getStateNodes=function(e){var n,r=this;if(!e)return[];var i=e instanceof mn?e.value:ua(e,this.delimiter);if(xt(i)){var o=this.getStateNode(i).initial;return o!==void 0?this.getStateNodes((n={},n[i]=o,n)):[this,this.states[i]]}var a=Object.keys(i),u=[this];return u.push.apply(u,zt([],It(Qt(a.map(function(s){return r.getStateNode(s).getStateNodes(i[s])}))),!1)),u},t.prototype.handles=function(e){var n=Av(e);return this.events.includes(n)},t.prototype.resolveState=function(e){var n=e instanceof mn?e:mn.create(e),r=Array.from(Yo([],this.getStateNodes(n.value)));return new mn(B(B({},n),{value:this.resolve(n.value),configuration:r,done:bs(r,this),tags:kd(r),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,n,r){var i=this.getStateNode(e),o=i.next(n,r);return!o||!o.transitions.length?this.next(n,r):o},t.prototype.transitionCompoundNode=function(e,n,r){var i=Object.keys(e),o=this.getStateNode(i[0]),a=o._transition(e[i[0]],n,r);return!a||!a.transitions.length?this.next(n,r):a},t.prototype.transitionParallelNode=function(e,n,r){var i,o,a={};try{for(var u=St(Object.keys(e)),s=u.next();!s.done;s=u.next()){var c=s.value,l=e[c];if(l){var d=this.getStateNode(c),f=d._transition(l,n,r);f&&(a[c]=f)}}}catch(C){i={error:C}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}var h=Object.keys(a).map(function(C){return a[C]}),v=Qt(h.map(function(C){return C.transitions})),p=h.some(function(C){return C.transitions.length>0});if(!p)return this.next(n,r);var S=Qt(Object.keys(a).map(function(C){return a[C].configuration}));return{transitions:v,exitSet:Qt(h.map(function(C){return C.exitSet})),configuration:S,source:n,actions:Qt(Object.keys(a).map(function(C){return a[C].actions}))}},t.prototype._transition=function(e,n,r){return xt(e)?this.transitionLeafNode(e,n,r):Object.keys(e).length===1?this.transitionCompoundNode(e,n,r):this.transitionParallelNode(e,n,r)},t.prototype.getTransitionData=function(e,n){return this._transition(e.value,e,Ne(n))},t.prototype.next=function(e,n){var r,i,o=this,a=n.name,u=[],s=[],c;try{for(var l=St(this.getCandidates(a)),d=l.next();!d.done;d=l.next()){var f=d.value,h=f.cond,v=f.in,p=e.context,S=v?xt(v)&&ji(v)?e.matches(ua(this.getStateNodeById(v).path,this.delimiter)):pf(ua(v,this.delimiter),_T(this.path.slice(0,-2))(e.value)):!0,C=!1;try{C=!h||Nv(this.machine,h,p,n,e)}catch(I){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
21
- `).concat(I.message))}if(C&&S){f.target!==void 0&&(s=f.target),u.push.apply(u,zt([],It(f.actions),!1)),c=f;break}}}catch(I){r={error:I}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}if(c){if(!s.length)return{transitions:[c],exitSet:[],configuration:e.value?[this]:[],source:e,actions:u};var w=Qt(s.map(function(I){return o.getRelativeStateNodes(I,e.historyValue)})),T=!!c.internal;return{transitions:[c],exitSet:T?[]:Qt(s.map(function(I){return o.getPotentiallyReenteringNodes(I)})),configuration:w,source:e,actions:u}}},t.prototype.getPotentiallyReenteringNodes=function(e){if(this.order<e.order)return[this];for(var n=[],r=this,i=e;r&&r!==i;)n.push(r),r=r.parent;return r!==i?[]:(n.push(i),n)},t.prototype.getActions=function(e,n,r,i,o,a,u){var s,c,l,d,f=this,h=a?Yo([],this.getStateNodes(a.value)):[],v=new Set;try{for(var p=St(Array.from(e).sort(function(M,$){return M.order-$.order})),S=p.next();!S.done;S=p.next()){var C=S.value;(!Xo(h,C)||Xo(r.exitSet,C)||C.parent&&v.has(C.parent))&&v.add(C)}}catch(M){s={error:M}}finally{try{S&&!S.done&&(c=p.return)&&c.call(p)}finally{if(s)throw s.error}}try{for(var w=St(h),T=w.next();!T.done;T=w.next()){var C=T.value;(!Xo(e,C)||Xo(r.exitSet,C.parent))&&r.exitSet.push(C)}}catch(M){l={error:M}}finally{try{T&&!T.done&&(d=w.return)&&d.call(w)}finally{if(l)throw l.error}}r.exitSet.sort(function(M,$){return $.order-M.order});var I=Array.from(v).sort(function(M,$){return M.order-$.order}),x=new Set(r.exitSet),b=Qt(I.map(function(M){var $=[];if(M.type!=="final")return $;var z=M.parent;if(!z.parent)return $;$.push(Qa(M.id,M.doneData),Qa(z.id,M.doneData?ks(M.doneData,i,o):void 0));var Z=z.parent;return Z.type==="parallel"&&ba(Z).every(function(Vt){return bs(r.configuration,Vt)})&&$.push(Qa(Z.id)),$})),E=I.map(function(M){var $=M.onEntry,z=M.activities.map(function(Z){return ZT(Z)});return{type:"entry",actions:Dr(u?zt(zt([],It($),!1),It(z),!1):zt(zt([],It(z),!1),It($),!1),f.machine.options.actions)}}).concat({type:"state_done",actions:b.map(function(M){return HT(M)})}),P=Array.from(x).map(function(M){return{type:"exit",actions:Dr(zt(zt([],It(M.onExit),!1),It(M.activities.map(function($){return QT($)})),!1),f.machine.options.actions)}}),A=P.concat({type:"transition",actions:Dr(r.actions,this.machine.options.actions)}).concat(E);if(n){var U=Dr(Qt(zt([],It(e),!1).sort(function(M,$){return $.order-M.order}).map(function(M){return M.onExit})),this.machine.options.actions).filter(function(M){return!nl(M)});return A.concat({type:"stop",actions:U})}return A},t.prototype.transition=function(e,n,r,i){e===void 0&&(e=this.initialState);var o=Ne(n),a;if(e instanceof mn)a=r===void 0?e:this.resolveState(mn.from(e,r));else{var u=xt(e)?this.resolve(qs(this.getResolvedPath(e))):this.resolve(e),s=r??this.machine.context;a=this.resolveState(mn.from(u,s))}if(!ne&&o.name===Bo)throw new Error("An event cannot have the wildcard type ('".concat(Bo,"')"));if(this.strict&&!this.events.includes(o.name)&&!qT(o.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var c=this._transition(a.value,a,o)||{transitions:[],configuration:[],exitSet:[],source:a,actions:[]},l=Yo([],this.getStateNodes(a.value)),d=c.configuration.length?Yo(l,c.configuration):l;return c.configuration=zt([],It(d),!1),this.resolveTransition(c,a,a.context,i,o)},t.prototype.resolveRaisedTransition=function(e,n,r,i){var o,a=e.actions;return e=this.transition(e,n,void 0,i),e._event=r,e.event=r.data,(o=e.actions).unshift.apply(o,zt([],It(a),!1)),e},t.prototype.resolveTransition=function(e,n,r,i,o){var a,u,s,c,l=this;o===void 0&&(o=eo);var d=e.configuration,f=!n||e.transitions.length>0,h=f?e.configuration:n?n.configuration:[],v=bs(h,this),p=f?lI(this.machine,d):void 0,S=n?n.historyValue?n.historyValue:e.source?this.machine.historyValue(n.value):void 0:void 0,C=this.getActions(new Set(h),v,e,r,o,n,i),w=n?B({},n.activities):{};try{for(var T=St(C),I=T.next();!I.done;I=T.next()){var x=I.value;try{for(var b=(s=void 0,St(x.actions)),E=b.next();!E.done;E=b.next()){var P=E.value;P.type===Zc?w[P.activity.id||P.activity.type]=P:P.type===df&&(w[P.activity.id||P.activity.type]=!1)}}catch(Ot){s={error:Ot}}finally{try{E&&!E.done&&(c=b.return)&&c.call(b)}finally{if(s)throw s.error}}}}catch(Ot){a={error:Ot}}finally{try{I&&!I.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}var A=It(Us(this,n,r,o,C,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),U=A[0],M=A[1],$=It(UT(U,nl),2),z=$[0],Z=$[1],Vt=U.filter(function(Ot){var Zt;return Ot.type===Zc&&((Zt=Ot.activity)===null||Zt===void 0?void 0:Zt.type)===Qc}),bt=Vt.reduce(function(Ot,Zt){return Ot[Zt.activity.id]=aI(Zt.activity,l.machine,M,o),Ot},n?B({},n.children):{}),Y=new mn({value:p||n.value,context:M,_event:o,_sessionid:n?n._sessionid:null,historyValue:p?S?BT(S,p):void 0:n?n.historyValue:void 0,history:!p||e.source?n:void 0,actions:p?Z:[],activities:p?w:n?n.activities:{},events:[],configuration:h,transitions:e.transitions,children:bt,done:v,tags:kd(h),machine:this}),J=r!==M;Y.changed=o.name===Ev||J;var ut=Y.history;ut&&delete ut.history;var $e=!v&&(this._transient||d.some(function(Ot){return Ot._transient}));if(!f&&(!$e||o.name===Hi))return Y;var tt=Y;if(!v)for($e&&(tt=this.resolveRaisedTransition(tt,{type:$T},o,i));z.length;){var De=z.shift();tt=this.resolveRaisedTransition(tt,De._event,o,i)}var an=tt.changed||(ut?!!tt.actions.length||J||typeof ut.value!=typeof tt.value||!qv(tt.value,ut.value):void 0);return tt.changed=an,tt.history=ut,tt},t.prototype.getStateNode=function(e){if(ji(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var n=this.states[e];if(!n)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return n},t.prototype.getStateNodeById=function(e){var n=ji(e)?e.slice(al.length):e;if(n===this.id)return this;var r=this.machine.idMap[n];if(!r)throw new Error("Child state node '#".concat(n,"' does not exist on machine '").concat(this.id,"'"));return r},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&ji(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var n=el(e,this.delimiter).slice(),r=this;n.length;){var i=n.shift();if(!i.length)break;r=r.getStateNode(i)}return r},t.prototype.resolve=function(e){var n,r=this;if(!e)return this.initialStateValue||_i;switch(this.type){case"parallel":return Ko(this.initialStateValue,function(o,a){return o?r.getStateNode(a).resolve(e[a]||o):_i});case"compound":if(xt(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(n={},n[e]=i.initialStateValue,n):e}return Object.keys(e).length?Ko(e,function(o,a){return o?r.getStateNode(a).resolve(o):_i}):this.initialStateValue||{};default:return e||_i}},t.prototype.getResolvedPath=function(e){if(ji(e)){var n=this.machine.idMap[e.slice(al.length)];if(!n)throw new Error("Unable to find state node '".concat(e,"'"));return n.path}return el(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var n;if(this.type==="parallel")n=_d(this.states,function(r){return r.initialStateValue||_i},function(r){return r.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));n=Vs(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else n={};return this.__cache.initialStateValue=n,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,n){this._init();var r=this.getStateNodes(e);return this.resolveTransition({configuration:r,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,n??this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var n=this.config;xt(n.target)?e=ji(n.target)?qs(this.machine.getStateNodeById(n.target).path.slice(this.path.length-1)):n.target:e=n.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,n,r){return r===void 0&&(r=!0),r?e.type==="history"?e.resolveHistory(n):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(Vs(this))return[this];if(this.type==="compound"&&!this.initial)return ne||Se(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var n=ys(this.initialStateValue);return Qt(n.map(function(r){return e.getFromRelativePath(r)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var n=It(e),r=n[0],i=n.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(r,"' from node with no states"));var o=this.getStateNode(r);if(o.type==="history")return o.resolveHistory();if(!this.states[r])throw new Error("Child state '".concat(r,"' does not exist on '").concat(this.id,"'"));return this.states[r].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:_d(this.states,function(n,r){if(!e)return n.historyValue();var i=xt(e)?void 0:e[r];return n.historyValue(i||n.initialStateValue)},function(n){return!n.history})}},t.prototype.resolveHistory=function(e){var n=this;if(this.type!=="history")return[this];var r=this.parent;if(!e){var i=this.target;return i?Qt(ys(i).map(function(a){return r.getFromRelativePath(a)})):r.initialStateNodes}var o=jT(r.path,"states")(e).current;return xt(o)?[r.getStateNode(o)]:Qt(ys(o).map(function(a){return n.history==="deep"?r.getFromRelativePath(a):[r.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,n=Qt(Object.keys(this.states).map(function(r){return e.states[r].stateIds}));return[this.id].concat(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,n,r,i;if(this.__cache.events)return this.__cache.events;var o=this.states,a=new Set(this.ownEvents);if(o)try{for(var u=St(Object.keys(o)),s=u.next();!s.done;s=u.next()){var c=s.value,l=o[c];if(l.states)try{for(var d=(r=void 0,St(l.events)),f=d.next();!f.done;f=d.next()){var h=f.value;a.add("".concat(h))}}catch(v){r={error:v}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}}catch(v){e={error:v}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(n){return!(!n.target&&!n.actions.length&&n.internal)}).map(function(n){return n.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var n=this;if(e!==void 0)return e.map(function(r){if(!xt(r))return r;var i=r[0]===n.delimiter;if(i&&!n.parent)return n.getStateNodeByPath(r.slice(1));var o=i?n.key+r:r;if(n.parent)try{var a=n.parent.getStateNodeByPath(o);return a}catch(u){throw new Error("Invalid transition definition for state node '".concat(n.id,`':
22
- `).concat(u.message))}else return n.getStateNodeByPath(o)})},t.prototype.formatTransition=function(e){var n=this,r=GT(e.target),i="internal"in e?e.internal:r?r.some(function(s){return xt(s)&&s[0]===n.delimiter}):!0,o=this.machine.options.guards,a=this.resolveTarget(r),u=B(B({},e),{actions:Dr(En(e.actions)),cond:Ov(e.cond,o),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return B(B({},u),{target:u.target?u.target.map(function(s){return"#".concat(s.id)}):void 0,source:"#".concat(n.id)})}});return u},t.prototype.formatTransitions=function(){var e,n,r=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var o=this.config.on,a=Bo,u=o[a],s=u===void 0?[]:u,c=ff(o,[typeof a=="symbol"?a:a+""]);i=Qt(Object.keys(c).map(function(w){!ne&&w===Hi&&Se(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(r.id,'".'));var T=Ri(w,c[w]);return ne||II(r,w,T),T}).concat(Ri(Bo,s)))}var l=this.config.always?Ri("",this.config.always):[],d=this.config.onDone?Ri(String(Qa(this.id)),this.config.onDone):[];ne||Se(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var f=Qt(this.invoke.map(function(w){var T=[];return w.onDone&&T.push.apply(T,zt([],It(Ri(String(gs(w.id)),w.onDone)),!1)),w.onError&&T.push.apply(T,zt([],It(Ri(String(Jo(w.id)),w.onError)),!1)),T})),h=this.after,v=Qt(zt(zt(zt(zt([],It(d),!1),It(f),!1),It(i),!1),It(l),!1).map(function(w){return En(w).map(function(T){return r.formatTransition(T)})}));try{for(var p=St(h),S=p.next();!S.done;S=p.next()){var C=S.value;v.push(C)}}catch(w){e={error:w}}finally{try{S&&!S.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}return v},t}(),Vd=!1;function gf(t,e){return!ne&&!("predictableActionArguments"in t)&&!Vd&&(Vd=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new EI(t,e)}var Ye=eI,xI=bu,Uv=JT,es=rI,_t={},bf={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});/*! *****************************************************************************
19
+ Event: `).concat(JSON.stringify(f.data)));return r.scheduler.schedule(function(){r.forward(f);var h=r._nextState(f);r.update(h,f)}),r._state},this.sendTo=function(l,d,f){var h=r.parent&&(d===Ci.Parent||r.parent.id===d),v=h?r.parent:xt(d)?d===Ci.Internal?r:r.children.get(d)||Uo.get(d):LT(d)?d:void 0;if(!v){if(!h)throw new Error("Unable to send event to child '".concat(d,"' from service '").concat(r.id,"'."));ne||Se(!1,"Service '".concat(r.id,"' has no parent: unable to send event ").concat(l.type));return}if("machine"in v){if(r.status!==ae.Stopped||r.parent!==v||r.state.done){var p=B(B({},l),{name:l.name===NT?"".concat(Yo(r.id)):l.name,origin:r.sessionId});!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([v,p]):v.send(p)}}else!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([v,l.data]):v.send(l.data)},this._exec=function(l,d,f,h){h===void 0&&(h=r.machine.options.actions);var v=l.exec||rl(l.type,h),p=Pt(v)?v:v?v.exec:l.exec;if(p)try{return p(d,f.data,r.machine.config.predictableActionArguments?{action:l,_event:f}:{action:l,state:r.state,_event:f})}catch(Z){throw r.parent&&r.parent.send({type:"xstate.error",data:Z}),Z}switch(l.type){case _a:{var S=l;r.defer(S);break}case mu:var C=l;if(typeof C.delay=="number"){r.defer(C);return}else C.to?r.sendTo(C._event,C.to,f===eo):r.send(C._event);break;case Tv:r.cancel(l.sendId);break;case Zc:{if(r.status!==ae.Running)return;var w=l.activity;if(!r.machine.config.predictableActionArguments&&!r.state.activities[w.id||w.type])break;if(w.type===Ft.Invoke){var T=Pv(w.src),I=r.machine.options.services?r.machine.options.services[T.type]:void 0,x=w.id,b=w.data;ne||Se(!("forward"in w),"`forward` property is deprecated (found in invocation of '".concat(w.src,"' in in machine '").concat(r.machine.id,"'). ")+"Please use `autoForward` instead.");var E="autoForward"in w?w.autoForward:!!w.forward;if(!I){ne||Se(!1,"No service found for invocation '".concat(w.src,"' in machine '").concat(r.machine.id,"'."));return}var P=b?ks(b,d,f):void 0;if(typeof I=="string")return;var A=Pt(I)?I(d,f.data,{data:P,src:T,meta:w.meta}):I;if(!A)return;var U=void 0;pr(A)&&(A=P?A.withContext(P):A,U={autoForward:E}),r.spawn(A,x,U)}else r.spawnActivity(w);break}case df:{r.stopChild(l.activity.id);break}case Iv:var M=l,$=M.label,z=M.value;$?r.logger($,z):r.logger(z);break;default:ne||Se(!1,"No implementation found for action type '".concat(l.type,"'"));break}};var i=B(B({},t.defaultOptions),n),o=i.clock,a=i.logger,u=i.parent,s=i.id,c=s!==void 0?s:e.id;this.id=c,this.logger=a,this.clock=o,this.parent=u,this.options=i,this.scheduler=new Ud({deferEvents:this.options.deferEvents}),this.sessionId=Uo.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:zi(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return ne||Se(this.status!==ae.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,n){var r,i;try{for(var o=St(e.actions),a=o.next();!a.done;a=o.next()){var u=a.value;this.exec(u,e,n)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},t.prototype.update=function(e,n){var r,i,o,a,u,s,c,l,d=this;if(e._sessionid=this.sessionId,this._state=e,(!this.machine.config.predictableActionArguments||n===eo)&&this.options.execute)this.execute(this.state);else for(var f=void 0;f=this._outgoingQueue.shift();)f[0].send(f[1]);if(this.children.forEach(function(A){d.state.children[A.id]=A}),this.devTools&&this.devTools.send(n.data,e),e.event)try{for(var h=St(this.eventListeners),v=h.next();!v.done;v=h.next()){var p=v.value;p(e.event)}}catch(A){r={error:A}}finally{try{v&&!v.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}try{for(var S=St(this.listeners),C=S.next();!C.done;C=S.next()){var p=C.value;p(e,e.event)}}catch(A){o={error:A}}finally{try{C&&!C.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}try{for(var w=St(this.contextListeners),T=w.next();!T.done;T=w.next()){var I=T.value;I(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(u)throw u.error}}if(this.state.done){var x=e.configuration.find(function(A){return A.type==="final"&&A.parent===d.machine}),b=x&&x.doneData?ks(x.doneData,e.context,n):void 0;this._doneEvent=gs(this.id,b);try{for(var E=St(this.doneListeners),P=E.next();!P.done;P=E.next()){var p=P.value;p(this._doneEvent)}}catch(A){c={error:A}}finally{try{P&&!P.done&&(l=E.return)&&l.call(E)}finally{if(c)throw c.error}}this._stop(),this._stopChildren(),Uo.free(this.sessionId)}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===ae.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,n,r){var i=this,o=ms(e,n,r);this.listeners.add(o.next),this.status!==ae.NotStarted&&o.next(this.state);var a=function(){i.doneListeners.delete(a),i.stopListeners.delete(a),o.complete()};return this.status===ae.Stopped?o.complete():(this.onDone(a),this.onStop(a)),{unsubscribe:function(){i.listeners.delete(o.next),i.doneListeners.delete(a),i.stopListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.status===ae.Stopped&&this._doneEvent?e(this._doneEvent):this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var n=this;if(this.status===ae.Running)return this;this.machine._init(),Uo.register(this.sessionId,this),this.initialized=!0,this.status=ae.Running;var r=e===void 0?this.initialState:zi(this,function(){return pI(e)?n.machine.resolveState(e):n.machine.resolveState(mn.from(e,n.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){n.update(r,eo)}),this},t.prototype._stopChildren=function(){this.children.forEach(function(e){Pt(e.stop)&&e.stop()}),this.children.clear()},t.prototype._stop=function(){var e,n,r,i,o,a,u,s,c,l;try{for(var d=St(this.listeners),f=d.next();!f.done;f=d.next()){var h=f.value;this.listeners.delete(h)}}catch(E){e={error:E}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}try{for(var v=St(this.stopListeners),p=v.next();!p.done;p=v.next()){var h=p.value;h(),this.stopListeners.delete(h)}}catch(E){r={error:E}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}try{for(var S=St(this.contextListeners),C=S.next();!C.done;C=S.next()){var h=C.value;this.contextListeners.delete(h)}}catch(E){o={error:E}}finally{try{C&&!C.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}try{for(var w=St(this.doneListeners),T=w.next();!T.done;T=w.next()){var h=T.value;this.doneListeners.delete(h)}}catch(E){u={error:E}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(u)throw u.error}}if(!this.initialized)return this;this.initialized=!1,this.status=ae.Stopped,this._initialState=void 0;try{for(var I=St(Object.keys(this.delayedEventsMap)),x=I.next();!x.done;x=I.next()){var b=x.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(E){c={error:E}}finally{try{x&&!x.done&&(l=I.return)&&l.call(I)}finally{if(c)throw c.error}}this.scheduler.clear(),this.scheduler=new Ud({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var e=this,n=this.scheduler;return this._stop(),n.schedule(function(){var r;if(!(!((r=e._state)===null||r===void 0)&&r.done)){var i=Ne({type:"xstate.stop"}),o=zi(e,function(){var a=Qt(zt([],It(e.state.configuration),!1).sort(function(d,f){return f.order-d.order}).map(function(d){return Dr(d.onExit,e.machine.options.actions)})),u=It(Us(e.machine,e.state,e.state.context,i,[{type:"exit",actions:a}],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),s=u[0],c=u[1],l=new mn({value:e.state.value,context:c,_event:i,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:s.filter(function(d){return!nl(d)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return l.changed=!0,l});e.update(o,i),e._stopChildren(),Uo.free(e.sessionId)}}),this},t.prototype.batch=function(e){var n=this;if(this.status===ae.NotStarted&&this.options.deferEvents)ne||Se(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
20
+ Event: `).concat(JSON.stringify(event)));else if(this.status!==ae.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));if(e.length){var r=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var i,o,a=n.state,u=!1,s=[],c=function(h){var v=Ne(h);n.forward(v),a=zi(n,function(){return n.machine.transition(a,v,void 0,r||void 0)}),s.push.apply(s,zt([],It(n.machine.config.predictableActionArguments?a.actions:a.actions.map(function(p){return vI(p,a)})),!1)),u=u||!!a.changed};try{for(var l=St(e),d=l.next();!d.done;d=l.next()){var f=d.value;c(f)}}catch(h){i={error:h}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}a.changed=u,a.actions=s,n.update(a,Ne(e[e.length-1]))})}},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype._nextState=function(e,n){var r=this;n===void 0&&(n=!!this.machine.config.predictableActionArguments&&this._exec);var i=Ne(e);if(i.name.indexOf(Md)===0&&!this.state.nextEvents.some(function(a){return a.indexOf(Md)===0}))throw i.data.data;var o=zi(this,function(){return r.machine.transition(r.state,i,void 0,n||void 0)});return o},t.prototype.nextState=function(e){return this._nextState(e,!1)},t.prototype.forward=function(e){var n,r;try{for(var i=St(this.forwardTo),o=i.next();!o.done;o=i.next()){var a=o.value,u=this.children.get(a);if(!u)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));u.send(e)}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},t.prototype.defer=function(e){var n=this,r=this.clock.setTimeout(function(){"to"in e&&e.to?n.sendTo(e._event,e.to,!0):n.send(e._event)},e.delay);e.id&&(this.delayedEventsMap[e.id]=r)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,n,r){r===void 0&&(r=this.machine.options.actions),this._exec(e,n.context,n._event,r)},t.prototype.removeChild=function(e){var n;this.children.delete(e),this.forwardTo.delete(e),(n=this.state)===null||n===void 0||delete n.children[e]},t.prototype.stopChild=function(e){var n=this.children.get(e);n&&(this.removeChild(e),Pt(n.stop)&&n.stop())},t.prototype.spawn=function(e,n,r){if(this.status!==ae.Running)return yf(e,n);if(jd(e))return this.spawnPromise(Promise.resolve(e),n);if(Pt(e))return this.spawnCallback(e,n);if(cI(e))return this.spawnActor(e,n);if(FT(e))return this.spawnObservable(e,n);if(pr(e))return this.spawnMachine(e,B(B({},r),{id:n}));if(UT(e))return this.spawnBehavior(e,n);throw new Error('Unable to spawn entity "'.concat(n,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,n){var r=this;n===void 0&&(n={});var i=new t(e,B(B({},this.options),{parent:this,id:n.id||e.id})),o=B(B({},ol),n);o.sync&&i.onTransition(function(u){r.send(Ev,{state:u,id:i.id})});var a=i;return this.children.set(i.id,a),o.autoForward&&this.forwardTo.add(i.id),i.onDone(function(u){r.removeChild(i.id),r.send(Ne(u,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,n){var r=SI(e,{id:n,parent:this});return this.children.set(n,r),r},t.prototype.spawnPromise=function(e,n){var r,i=this,o=!1,a;e.then(function(s){o||(a=s,i.removeChild(n),i.send(Ne(gs(n,s),{origin:n})))},function(s){if(!o){i.removeChild(n);var c=Yo(n,s);try{i.send(Ne(c,{origin:n}))}catch(l){HT(s,l,n),i.devTools&&i.devTools.send(c,i.state),i.machine.strict&&i.stop()}}});var u=(r={id:n,send:function(){},subscribe:function(s,c,l){var d=ms(s,c,l),f=!1;return e.then(function(h){f||(d.next(h),!f&&d.complete())},function(h){f||d.error(h)}),{unsubscribe:function(){return f=!0}}},stop:function(){o=!0},toJSON:function(){return{id:n}},getSnapshot:function(){return a}},r[$r]=function(){return this},r);return this.children.set(n,u),u},t.prototype.spawnCallback=function(e,n){var r,i=this,o=!1,a=new Set,u=new Set,s,c=function(f){s=f,u.forEach(function(h){return h(f)}),!o&&i.send(Ne(f,{origin:n}))},l;try{l=e(c,function(f){a.add(f)})}catch(f){this.send(Yo(n,f))}if(jd(l))return this.spawnPromise(l,n);var d=(r={id:n,send:function(f){return a.forEach(function(h){return h(f)})},subscribe:function(f){var h=ms(f);return u.add(h.next),{unsubscribe:function(){u.delete(h.next)}}},stop:function(){o=!0,Pt(l)&&l()},toJSON:function(){return{id:n}},getSnapshot:function(){return s}},r[$r]=function(){return this},r);return this.children.set(n,d),d},t.prototype.spawnObservable=function(e,n){var r,i=this,o,a=e.subscribe(function(s){o=s,i.send(Ne(s,{origin:n}))},function(s){i.removeChild(n),i.send(Ne(Yo(n,s),{origin:n}))},function(){i.removeChild(n),i.send(Ne(gs(n),{origin:n}))}),u=(r={id:n,send:function(){},subscribe:function(s,c,l){return e.subscribe(s,c,l)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return o},toJSON:function(){return{id:n}}},r[$r]=function(){return this},r);return this.children.set(n,u),u},t.prototype.spawnActor=function(e,n){return this.children.set(n,e),e},t.prototype.spawnActivity=function(e){var n=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!n){ne||Se(!1,"No implementation found for activity '".concat(e.type,"'"));return}var r=n(this.state.context,e);this.spawnEffect(e.id,r)},t.prototype.spawnEffect=function(e,n){var r;this.children.set(e,(r={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:n||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},r[$r]=function(){return this},r))},t.prototype.attachDev=function(){var e=mf();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var n=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(B(B({name:this.id,autoPause:!0,stateSanitizer:function(r){return{value:r.value,context:r.context,actions:r.actions}}},n),{features:B({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}bI(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[$r]=function(){return this},t.prototype.getSnapshot=function(){return this.status===ae.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,n){return setTimeout(e,n)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=kv,t}(),wI=function(t){return xt(t)?B(B({},ol),{name:t}):B(B(B({},ol),{name:GT()}),t)};function Bd(t,e){var n=wI(e);return aI(function(r){if(!ne){var i=pr(t)||Pt(t);Se(!!r||i,'Attempted to spawn an Actor (ID: "'.concat(pr(t)?t.id:"undefined",'") outside of a service. This will have no effect.'))}return r?r.spawn(t,n.name,n):yf(t,n.name)})}function kv(t,e){var n=new CI(t,e);return n}function TI(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function ts(t){return B(B({type:Qc},t),{toJSON:function(){t.onDone,t.onError;var e=ff(t,["onDone","onError"]);return B(B({},e),{type:Qc,src:TI(t.src)})}})}var Hi="",al="#",Bo="*",_i={},ji=function(t){return t[0]===al},II=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},EI=function(t,e,n){var r=n.slice(0,-1).some(function(o){return!("cond"in o)&&!("in"in o)&&(xt(o.target)||pr(o.target))}),i=e===Hi?"the transient event":"event '".concat(e,"'");Se(!r,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},xI=function(){function t(e,n,r,i){r===void 0&&(r="context"in e?e.context:void 0);var o=this,a;this.config=e,this._context=r,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(II(),n),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:xv),this.id=this.config.id||zt([this.machine.key],It(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,ne||Se(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Ko(this.config.states,function(c,l){var d,f=new t(c,{},void 0,{parent:o,key:l});return Object.assign(o.idMap,B((d={},d[f.id]=f,d),f.idMap)),f}):_i;var u=0;function s(c){var l,d;c.order=u++;try{for(var f=St(Rv(c)),h=f.next();!h.done;h=f.next()){var v=h.value;s(v)}}catch(p){l={error:p}}finally{try{h&&!h.done&&(d=f.return)&&d.call(f)}finally{if(l)throw l.error}}}s(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(c){var l=c.event;return l===Hi}):Hi in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=En(this.config.entry||this.config.onEntry).map(function(c){return ga(c)}),this.onExit=En(this.config.exit||this.config.onExit).map(function(c){return ga(c)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=En(this.config.invoke).map(function(c,l){var d,f;if(pr(c)){var h=Za(o.id,l);return o.machine.options.services=B((d={},d[h]=c,d),o.machine.options.services),ts({src:h,id:h})}else if(xt(c.src)){var h=c.id||Za(o.id,l);return ts(B(B({},c),{id:h,src:c.src}))}else if(pr(c.src)||Pt(c.src)){var h=c.id||Za(o.id,l);return o.machine.options.services=B((f={},f[h]=c.src,f),o.machine.options.services),ts(B(B({id:h},c),{src:h}))}else{var v=c.src;return ts(B(B({id:Za(o.id,l)},c),{src:v}))}}),this.activities=En(this.config.activities).concat(this.invoke).map(function(c){return vf(c)}),this.transition=this.transition.bind(this),this.tags=En(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||_v(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,n){var r=this.options,i=r.actions,o=r.activities,a=r.guards,u=r.services,s=r.delays;return new t(this.config,{actions:B(B({},i),e.actions),activities:B(B({},o),e.activities),guards:B(B({},a),e.guards),services:B(B({},u),e.services),delays:B(B({},s),e.delays)},n??this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return Pt(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Ko(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(n,r){return n[r.eventType]=n[r.eventType]||[],n[r.eventType].push(r),n},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var n=e===Hi,r=this.transitions.filter(function(i){var o=i.eventType===e;return n?o:o||i.eventType===Bo});return this.__cache.candidates[e]=r,r},t.prototype.getDelayedTransitions=function(){var e=this,n=this.config.after;if(!n)return[];var r=function(o,a){var u=Pt(o)?"".concat(e.id,":delay[").concat(a,"]"):o,s=rI(u,e.id);return e.onEntry.push(bu(s,{delay:o})),e.onExit.push(ZT(s)),s},i=mo(n)?n.map(function(o,a){var u=r(o.delay,a);return B(B({},o),{event:u})}):Qt(Object.keys(n).map(function(o,a){var u=n[o],s=xt(u)?{target:u}:u,c=isNaN(+o)?o:+o,l=r(c,a);return En(s).map(function(d){return B(B({},d),{event:l,delay:c})})}));return i.map(function(o){var a=o.delay;return B(B({},e.formatTransition(o)),{delay:a})})},t.prototype.getStateNodes=function(e){var n,r=this;if(!e)return[];var i=e instanceof mn?e.value:ua(e,this.delimiter);if(xt(i)){var o=this.getStateNode(i).initial;return o!==void 0?this.getStateNodes((n={},n[i]=o,n)):[this,this.states[i]]}var a=Object.keys(i),u=[this];return u.push.apply(u,zt([],It(Qt(a.map(function(s){return r.getStateNode(s).getStateNodes(i[s])}))),!1)),u},t.prototype.handles=function(e){var n=Av(e);return this.events.includes(n)},t.prototype.resolveState=function(e){var n=e instanceof mn?e:mn.create(e),r=Array.from(Jo([],this.getStateNodes(n.value)));return new mn(B(B({},n),{value:this.resolve(n.value),configuration:r,done:bs(r,this),tags:kd(r),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,n,r){var i=this.getStateNode(e),o=i.next(n,r);return!o||!o.transitions.length?this.next(n,r):o},t.prototype.transitionCompoundNode=function(e,n,r){var i=Object.keys(e),o=this.getStateNode(i[0]),a=o._transition(e[i[0]],n,r);return!a||!a.transitions.length?this.next(n,r):a},t.prototype.transitionParallelNode=function(e,n,r){var i,o,a={};try{for(var u=St(Object.keys(e)),s=u.next();!s.done;s=u.next()){var c=s.value,l=e[c];if(l){var d=this.getStateNode(c),f=d._transition(l,n,r);f&&(a[c]=f)}}}catch(C){i={error:C}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}var h=Object.keys(a).map(function(C){return a[C]}),v=Qt(h.map(function(C){return C.transitions})),p=h.some(function(C){return C.transitions.length>0});if(!p)return this.next(n,r);var S=Qt(Object.keys(a).map(function(C){return a[C].configuration}));return{transitions:v,exitSet:Qt(h.map(function(C){return C.exitSet})),configuration:S,source:n,actions:Qt(Object.keys(a).map(function(C){return a[C].actions}))}},t.prototype._transition=function(e,n,r){return xt(e)?this.transitionLeafNode(e,n,r):Object.keys(e).length===1?this.transitionCompoundNode(e,n,r):this.transitionParallelNode(e,n,r)},t.prototype.getTransitionData=function(e,n){return this._transition(e.value,e,Ne(n))},t.prototype.next=function(e,n){var r,i,o=this,a=n.name,u=[],s=[],c;try{for(var l=St(this.getCandidates(a)),d=l.next();!d.done;d=l.next()){var f=d.value,h=f.cond,v=f.in,p=e.context,S=v?xt(v)&&ji(v)?e.matches(ua(this.getStateNodeById(v).path,this.delimiter)):pf(ua(v,this.delimiter),jT(this.path.slice(0,-2))(e.value)):!0,C=!1;try{C=!h||Nv(this.machine,h,p,n,e)}catch(I){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
21
+ `).concat(I.message))}if(C&&S){f.target!==void 0&&(s=f.target),u.push.apply(u,zt([],It(f.actions),!1)),c=f;break}}}catch(I){r={error:I}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}if(c){if(!s.length)return{transitions:[c],exitSet:[],configuration:e.value?[this]:[],source:e,actions:u};var w=Qt(s.map(function(I){return o.getRelativeStateNodes(I,e.historyValue)})),T=!!c.internal;return{transitions:[c],exitSet:T?[]:Qt(s.map(function(I){return o.getPotentiallyReenteringNodes(I)})),configuration:w,source:e,actions:u}}},t.prototype.getPotentiallyReenteringNodes=function(e){if(this.order<e.order)return[this];for(var n=[],r=this,i=e;r&&r!==i;)n.push(r),r=r.parent;return r!==i?[]:(n.push(i),n)},t.prototype.getActions=function(e,n,r,i,o,a,u){var s,c,l,d,f=this,h=a?Jo([],this.getStateNodes(a.value)):[],v=new Set;try{for(var p=St(Array.from(e).sort(function(M,$){return M.order-$.order})),S=p.next();!S.done;S=p.next()){var C=S.value;(!Xo(h,C)||Xo(r.exitSet,C)||C.parent&&v.has(C.parent))&&v.add(C)}}catch(M){s={error:M}}finally{try{S&&!S.done&&(c=p.return)&&c.call(p)}finally{if(s)throw s.error}}try{for(var w=St(h),T=w.next();!T.done;T=w.next()){var C=T.value;(!Xo(e,C)||Xo(r.exitSet,C.parent))&&r.exitSet.push(C)}}catch(M){l={error:M}}finally{try{T&&!T.done&&(d=w.return)&&d.call(w)}finally{if(l)throw l.error}}r.exitSet.sort(function(M,$){return $.order-M.order});var I=Array.from(v).sort(function(M,$){return M.order-$.order}),x=new Set(r.exitSet),b=Qt(I.map(function(M){var $=[];if(M.type!=="final")return $;var z=M.parent;if(!z.parent)return $;$.push(Qa(M.id,M.doneData),Qa(z.id,M.doneData?ks(M.doneData,i,o):void 0));var Z=z.parent;return Z.type==="parallel"&&ba(Z).every(function(Vt){return bs(r.configuration,Vt)})&&$.push(Qa(Z.id)),$})),E=I.map(function(M){var $=M.onEntry,z=M.activities.map(function(Z){return QT(Z)});return{type:"entry",actions:Dr(u?zt(zt([],It($),!1),It(z),!1):zt(zt([],It(z),!1),It($),!1),f.machine.options.actions)}}).concat({type:"state_done",actions:b.map(function(M){return WT(M)})}),P=Array.from(x).map(function(M){return{type:"exit",actions:Dr(zt(zt([],It(M.onExit),!1),It(M.activities.map(function($){return tI($)})),!1),f.machine.options.actions)}}),A=P.concat({type:"transition",actions:Dr(r.actions,this.machine.options.actions)}).concat(E);if(n){var U=Dr(Qt(zt([],It(e),!1).sort(function(M,$){return $.order-M.order}).map(function(M){return M.onExit})),this.machine.options.actions).filter(function(M){return!nl(M)});return A.concat({type:"stop",actions:U})}return A},t.prototype.transition=function(e,n,r,i){e===void 0&&(e=this.initialState);var o=Ne(n),a;if(e instanceof mn)a=r===void 0?e:this.resolveState(mn.from(e,r));else{var u=xt(e)?this.resolve(qs(this.getResolvedPath(e))):this.resolve(e),s=r??this.machine.context;a=this.resolveState(mn.from(u,s))}if(!ne&&o.name===Bo)throw new Error("An event cannot have the wildcard type ('".concat(Bo,"')"));if(this.strict&&!this.events.includes(o.name)&&!kT(o.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var c=this._transition(a.value,a,o)||{transitions:[],configuration:[],exitSet:[],source:a,actions:[]},l=Jo([],this.getStateNodes(a.value)),d=c.configuration.length?Jo(l,c.configuration):l;return c.configuration=zt([],It(d),!1),this.resolveTransition(c,a,a.context,i,o)},t.prototype.resolveRaisedTransition=function(e,n,r,i){var o,a=e.actions;return e=this.transition(e,n,void 0,i),e._event=r,e.event=r.data,(o=e.actions).unshift.apply(o,zt([],It(a),!1)),e},t.prototype.resolveTransition=function(e,n,r,i,o){var a,u,s,c,l=this;o===void 0&&(o=eo);var d=e.configuration,f=!n||e.transitions.length>0,h=f?e.configuration:n?n.configuration:[],v=bs(h,this),p=f?fI(this.machine,d):void 0,S=n?n.historyValue?n.historyValue:e.source?this.machine.historyValue(n.value):void 0:void 0,C=this.getActions(new Set(h),v,e,r,o,n,i),w=n?B({},n.activities):{};try{for(var T=St(C),I=T.next();!I.done;I=T.next()){var x=I.value;try{for(var b=(s=void 0,St(x.actions)),E=b.next();!E.done;E=b.next()){var P=E.value;P.type===Zc?w[P.activity.id||P.activity.type]=P:P.type===df&&(w[P.activity.id||P.activity.type]=!1)}}catch(Ot){s={error:Ot}}finally{try{E&&!E.done&&(c=b.return)&&c.call(b)}finally{if(s)throw s.error}}}}catch(Ot){a={error:Ot}}finally{try{I&&!I.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}var A=It(Us(this,n,r,o,C,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),U=A[0],M=A[1],$=It(BT(U,nl),2),z=$[0],Z=$[1],Vt=U.filter(function(Ot){var Zt;return Ot.type===Zc&&((Zt=Ot.activity)===null||Zt===void 0?void 0:Zt.type)===Qc}),bt=Vt.reduce(function(Ot,Zt){return Ot[Zt.activity.id]=sI(Zt.activity,l.machine,M,o),Ot},n?B({},n.children):{}),J=new mn({value:p||n.value,context:M,_event:o,_sessionid:n?n._sessionid:null,historyValue:p?S?VT(S,p):void 0:n?n.historyValue:void 0,history:!p||e.source?n:void 0,actions:p?Z:[],activities:p?w:n?n.activities:{},events:[],configuration:h,transitions:e.transitions,children:bt,done:v,tags:kd(h),machine:this}),Y=r!==M;J.changed=o.name===Ev||Y;var ut=J.history;ut&&delete ut.history;var $e=!v&&(this._transient||d.some(function(Ot){return Ot._transient}));if(!f&&(!$e||o.name===Hi))return J;var tt=J;if(!v)for($e&&(tt=this.resolveRaisedTransition(tt,{type:DT},o,i));z.length;){var De=z.shift();tt=this.resolveRaisedTransition(tt,De._event,o,i)}var an=tt.changed||(ut?!!tt.actions.length||Y||typeof ut.value!=typeof tt.value||!qv(tt.value,ut.value):void 0);return tt.changed=an,tt.history=ut,tt},t.prototype.getStateNode=function(e){if(ji(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var n=this.states[e];if(!n)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return n},t.prototype.getStateNodeById=function(e){var n=ji(e)?e.slice(al.length):e;if(n===this.id)return this;var r=this.machine.idMap[n];if(!r)throw new Error("Child state node '#".concat(n,"' does not exist on machine '").concat(this.id,"'"));return r},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&ji(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var n=el(e,this.delimiter).slice(),r=this;n.length;){var i=n.shift();if(!i.length)break;r=r.getStateNode(i)}return r},t.prototype.resolve=function(e){var n,r=this;if(!e)return this.initialStateValue||_i;switch(this.type){case"parallel":return Ko(this.initialStateValue,function(o,a){return o?r.getStateNode(a).resolve(e[a]||o):_i});case"compound":if(xt(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(n={},n[e]=i.initialStateValue,n):e}return Object.keys(e).length?Ko(e,function(o,a){return o?r.getStateNode(a).resolve(o):_i}):this.initialStateValue||{};default:return e||_i}},t.prototype.getResolvedPath=function(e){if(ji(e)){var n=this.machine.idMap[e.slice(al.length)];if(!n)throw new Error("Unable to find state node '".concat(e,"'"));return n.path}return el(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var n;if(this.type==="parallel")n=_d(this.states,function(r){return r.initialStateValue||_i},function(r){return r.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));n=Vs(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else n={};return this.__cache.initialStateValue=n,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,n){this._init();var r=this.getStateNodes(e);return this.resolveTransition({configuration:r,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,n??this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var n=this.config;xt(n.target)?e=ji(n.target)?qs(this.machine.getStateNodeById(n.target).path.slice(this.path.length-1)):n.target:e=n.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,n,r){return r===void 0&&(r=!0),r?e.type==="history"?e.resolveHistory(n):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(Vs(this))return[this];if(this.type==="compound"&&!this.initial)return ne||Se(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var n=ys(this.initialStateValue);return Qt(n.map(function(r){return e.getFromRelativePath(r)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var n=It(e),r=n[0],i=n.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(r,"' from node with no states"));var o=this.getStateNode(r);if(o.type==="history")return o.resolveHistory();if(!this.states[r])throw new Error("Child state '".concat(r,"' does not exist on '").concat(this.id,"'"));return this.states[r].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:_d(this.states,function(n,r){if(!e)return n.historyValue();var i=xt(e)?void 0:e[r];return n.historyValue(i||n.initialStateValue)},function(n){return!n.history})}},t.prototype.resolveHistory=function(e){var n=this;if(this.type!=="history")return[this];var r=this.parent;if(!e){var i=this.target;return i?Qt(ys(i).map(function(a){return r.getFromRelativePath(a)})):r.initialStateNodes}var o=qT(r.path,"states")(e).current;return xt(o)?[r.getStateNode(o)]:Qt(ys(o).map(function(a){return n.history==="deep"?r.getFromRelativePath(a):[r.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,n=Qt(Object.keys(this.states).map(function(r){return e.states[r].stateIds}));return[this.id].concat(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,n,r,i;if(this.__cache.events)return this.__cache.events;var o=this.states,a=new Set(this.ownEvents);if(o)try{for(var u=St(Object.keys(o)),s=u.next();!s.done;s=u.next()){var c=s.value,l=o[c];if(l.states)try{for(var d=(r=void 0,St(l.events)),f=d.next();!f.done;f=d.next()){var h=f.value;a.add("".concat(h))}}catch(v){r={error:v}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}}catch(v){e={error:v}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(n){return!(!n.target&&!n.actions.length&&n.internal)}).map(function(n){return n.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var n=this;if(e!==void 0)return e.map(function(r){if(!xt(r))return r;var i=r[0]===n.delimiter;if(i&&!n.parent)return n.getStateNodeByPath(r.slice(1));var o=i?n.key+r:r;if(n.parent)try{var a=n.parent.getStateNodeByPath(o);return a}catch(u){throw new Error("Invalid transition definition for state node '".concat(n.id,`':
22
+ `).concat(u.message))}else return n.getStateNodeByPath(o)})},t.prototype.formatTransition=function(e){var n=this,r=zT(e.target),i="internal"in e?e.internal:r?r.some(function(s){return xt(s)&&s[0]===n.delimiter}):!0,o=this.machine.options.guards,a=this.resolveTarget(r),u=B(B({},e),{actions:Dr(En(e.actions)),cond:Ov(e.cond,o),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return B(B({},u),{target:u.target?u.target.map(function(s){return"#".concat(s.id)}):void 0,source:"#".concat(n.id)})}});return u},t.prototype.formatTransitions=function(){var e,n,r=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var o=this.config.on,a=Bo,u=o[a],s=u===void 0?[]:u,c=ff(o,[typeof a=="symbol"?a:a+""]);i=Qt(Object.keys(c).map(function(w){!ne&&w===Hi&&Se(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(r.id,'".'));var T=Ri(w,c[w]);return ne||EI(r,w,T),T}).concat(Ri(Bo,s)))}var l=this.config.always?Ri("",this.config.always):[],d=this.config.onDone?Ri(String(Qa(this.id)),this.config.onDone):[];ne||Se(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var f=Qt(this.invoke.map(function(w){var T=[];return w.onDone&&T.push.apply(T,zt([],It(Ri(String(gs(w.id)),w.onDone)),!1)),w.onError&&T.push.apply(T,zt([],It(Ri(String(Yo(w.id)),w.onError)),!1)),T})),h=this.after,v=Qt(zt(zt(zt(zt([],It(d),!1),It(f),!1),It(i),!1),It(l),!1).map(function(w){return En(w).map(function(T){return r.formatTransition(T)})}));try{for(var p=St(h),S=p.next();!S.done;S=p.next()){var C=S.value;v.push(C)}}catch(w){e={error:w}}finally{try{S&&!S.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}return v},t}(),Vd=!1;function gf(t,e){return!ne&&!("predictableActionArguments"in t)&&!Vd&&(Vd=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new xI(t,e)}var Je=nI,AI=bu,Uv=JT,es=iI,_t={},bf={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});/*! *****************************************************************************
23
23
  Copyright (c) Microsoft Corporation.
24
24
 
25
25
  Permission to use, copy, modify, and/or distribute this software for any
@@ -32,7 +32,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==ae.Running)throw
32
32
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
33
33
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34
34
  PERFORMANCE OF THIS SOFTWARE.
35
- ***************************************************************************** */t.__assign=function(){return t.__assign=Object.assign||function(a){for(var u,s=1,c=arguments.length;s<c;s++){u=arguments[s];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(a[l]=u[l])}return a},t.__assign.apply(this,arguments)};function e(o,a){var u={};for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&a.indexOf(s)<0&&(u[s]=o[s]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,s=Object.getOwnPropertySymbols(o);c<s.length;c++)a.indexOf(s[c])<0&&Object.prototype.propertyIsEnumerable.call(o,s[c])&&(u[s[c]]=o[s[c]]);return u}function n(o){var a=typeof Symbol=="function"&&Symbol.iterator,u=a&&o[a],s=0;if(u)return u.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&s>=o.length&&(o=void 0),{value:o&&o[s++],done:!o}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(o,a){var u=typeof Symbol=="function"&&o[Symbol.iterator];if(!u)return o;var s=u.call(o),c,l=[],d;try{for(;(a===void 0||a-- >0)&&!(c=s.next()).done;)l.push(c.value)}catch(f){d={error:f}}finally{try{c&&!c.done&&(u=s.return)&&u.call(s)}finally{if(d)throw d.error}}return l}function i(o,a,u){if(u||arguments.length===2)for(var s=0,c=a.length,l;s<c;s++)(l||!(s in a))&&(l||(l=Array.prototype.slice.call(a,0,s)),l[s]=a[s]);return o.concat(l||Array.prototype.slice.call(a))}t.__read=r,t.__rest=e,t.__spreadArray=i,t.__values=n})(bf);var Su={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ActionTypes=void 0,function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"}(t.ActionTypes||(t.ActionTypes={})),t.SpecialTargets=void 0,function(e){e.Parent="#_parent",e.Internal="#_internal"}(t.SpecialTargets||(t.SpecialTargets={}))})(Su);var fe={};Object.defineProperty(fe,"__esModule",{value:!0});var xe=Su,AI=xe.ActionTypes.Start,$I=xe.ActionTypes.Stop,DI=xe.ActionTypes.Raise,OI=xe.ActionTypes.Send,NI=xe.ActionTypes.Cancel,PI=xe.ActionTypes.NullEvent,MI=xe.ActionTypes.Assign,RI=xe.ActionTypes.After,_I=xe.ActionTypes.DoneState,jI=xe.ActionTypes.Log,qI=xe.ActionTypes.Init,kI=xe.ActionTypes.Invoke,UI=xe.ActionTypes.ErrorExecution,BI=xe.ActionTypes.ErrorPlatform,VI=xe.ActionTypes.ErrorCustom,FI=xe.ActionTypes.Update,LI=xe.ActionTypes.Choose,GI=xe.ActionTypes.Pure;fe.after=RI;fe.assign=MI;fe.cancel=NI;fe.choose=LI;fe.doneState=_I;fe.error=VI;fe.errorExecution=UI;fe.errorPlatform=BI;fe.init=qI;fe.invoke=kI;fe.log=jI;fe.nullEvent=PI;fe.pure=GI;fe.raise=DI;fe.send=OI;fe.start=AI;fe.stop=$I;fe.update=FI;var Bv={},go={};Object.defineProperty(go,"__esModule",{value:!0});var zI=".",HI={},WI="xstate.guard",KI="";go.DEFAULT_GUARD_TYPE=WI;go.EMPTY_ACTIVITY_MAP=HI;go.STATE_DELIMITER=zI;go.TARGETLESS_KEY=KI;var Cu={};Object.defineProperty(Cu,"__esModule",{value:!0});var JI=process.env.NODE_ENV==="production";Cu.IS_PRODUCTION=JI;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=bf,n=Su,r=fe,i=go,o=Cu,a;function u(y){return Object.keys(y)}function s(y,D,N){N===void 0&&(N=i.STATE_DELIMITER);var O=h(y,N),j=h(D,N);return J(j)?J(O)?j===O:!1:J(O)?O in j:Object.keys(O).every(function(q){return q in j?s(O[q],j[q]):!1})}function c(y){try{return J(y)||typeof y=="number"?"".concat(y):y.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function l(y){try{return J(y)||typeof y=="number"?"".concat(y):Y(y)?y.name:y.type}catch{throw new Error("Actions must be strings or objects with a string action.type property.")}}function d(y,D){try{return bt(y)?y:y.toString().split(D)}catch{throw new Error("'".concat(y,"' is not a valid state path."))}}function f(y){return typeof y=="object"&&"value"in y&&"context"in y&&"event"in y&&"_event"in y}function h(y,D){if(f(y))return y.value;if(bt(y))return v(y);if(typeof y!="string")return y;var N=d(y,D);return v(N)}function v(y){if(y.length===1)return y[0];for(var D={},N=D,O=0;O<y.length-1;O++)O===y.length-2?N[y[O]]=y[O+1]:(N[y[O]]={},N=N[y[O]]);return D}function p(y,D){for(var N={},O=Object.keys(y),j=0;j<O.length;j++){var q=O[j];N[q]=D(y[q],q,y,j)}return N}function S(y,D,N){var O,j,q={};try{for(var W=e.__values(Object.keys(y)),G=W.next();!G.done;G=W.next()){var Q=G.value,ct=y[Q];N(ct)&&(q[Q]=D(ct,Q,y))}}catch(le){O={error:le}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}var C=function(y){return function(D){var N,O,j=D;try{for(var q=e.__values(y),W=q.next();!W.done;W=q.next()){var G=W.value;j=j[G]}}catch(Q){N={error:Q}}finally{try{W&&!W.done&&(O=q.return)&&O.call(q)}finally{if(N)throw N.error}}return j}};function w(y,D){return function(N){var O,j,q=N;try{for(var W=e.__values(y),G=W.next();!G.done;G=W.next()){var Q=G.value;q=q[D][Q]}}catch(ct){O={error:ct}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}}function T(y){if(!y)return[[]];if(J(y))return[[y]];var D=x(Object.keys(y).map(function(N){var O=y[N];return typeof O!="string"&&(!O||!Object.keys(O).length)?[[N]]:T(y[N]).map(function(j){return[N].concat(j)})}));return D}function I(y){var D,N,O={};if(y&&y.length===1&&y[0].length===1)return y[0][0];try{for(var j=e.__values(y),q=j.next();!q.done;q=j.next())for(var W=q.value,G=O,Q=0;Q<W.length;Q++){var ct=W[Q];if(Q===W.length-2){G[ct]=W[Q+1];break}G[ct]=G[ct]||{},G=G[ct]}}catch(le){D={error:le}}finally{try{q&&!q.done&&(N=j.return)&&N.call(j)}finally{if(D)throw D.error}}return O}function x(y){var D;return(D=[]).concat.apply(D,e.__spreadArray([],e.__read(y),!1))}function b(y){return bt(y)?y:[y]}function E(y){return y===void 0?[]:b(y)}function P(y,D,N){var O,j;if(Y(y))return y(D,N.data);var q={};try{for(var W=e.__values(Object.keys(y)),G=W.next();!G.done;G=W.next()){var Q=G.value,ct=y[Q];Y(ct)?q[Q]=ct(D,N.data):q[Q]=ct}}catch(le){O={error:le}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}function A(y){return/^(done|error)\./.test(y)}function U(y){return!!(y instanceof Promise||y!==null&&(Y(y)||typeof y=="object")&&Y(y.then))}function M(y){return y!==null&&typeof y=="object"&&"transition"in y&&typeof y.transition=="function"}function $(y,D){var N,O,j=e.__read([[],[]],2),q=j[0],W=j[1];try{for(var G=e.__values(y),Q=G.next();!Q.done;Q=G.next()){var ct=Q.value;D(ct)?q.push(ct):W.push(ct)}}catch(le){N={error:le}}finally{try{Q&&!Q.done&&(O=G.return)&&O.call(G)}finally{if(N)throw N.error}}return[q,W]}function z(y,D){return p(y.states,function(N,O){if(N){var j=(J(D)?void 0:D[O])||(N?N.current:void 0);if(j)return{current:j,states:z(N,j)}}})}function Z(y,D){return{current:D,states:z(y,D)}}function Vt(y,D,N,O){o.IS_PRODUCTION||t.warn(!!y,"Attempting to update undefined context");var j=y&&N.reduce(function(q,W){var G,Q,ct=W.assignment,le={state:O,action:W,_event:D},ni={};if(Y(ct))ni=ct(q,D.data,le);else try{for(var Qn=e.__values(Object.keys(ct)),In=Qn.next();!In.done;In=Qn.next()){var jo=In.value,ri=ct[jo];ni[jo]=Y(ri)?ri(q,D.data,le):ri}}catch(pc){G={error:pc}}finally{try{In&&!In.done&&(Q=Qn.return)&&Q.call(Qn)}finally{if(G)throw G.error}}return Object.assign({},q,ni)},y);return j}t.warn=function(){},o.IS_PRODUCTION||(t.warn=function(y,D){var N=y instanceof Error?y:void 0;if(!(!N&&y)&&console!==void 0){var O=["Warning: ".concat(D)];N&&O.push(N),console.warn.apply(console,O)}});function bt(y){return Array.isArray(y)}function Y(y){return typeof y=="function"}function J(y){return typeof y=="string"}function ut(y,D){if(y)return J(y)?{type:i.DEFAULT_GUARD_TYPE,name:y,predicate:D?D[y]:void 0}:Y(y)?{type:i.DEFAULT_GUARD_TYPE,name:y.name,predicate:y}:y}function $e(y){try{return"subscribe"in y&&Y(y.subscribe)}catch{return!1}}var tt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),De=(a={},a[tt]=function(){return this},a[Symbol.observable]=function(){return this},a);function an(y){return!!y&&"__xstatenode"in y}function Ot(y){return!!y&&typeof y.send=="function"}var Zt=function(){var y=0;return function(){return y++,y.toString(16)}}();function Un(y,D){return J(y)||typeof y=="number"?e.__assign({type:y},D):y}function Bn(y,D){if(!J(y)&&"$$type"in y&&y.$$type==="scxml")return y;var N=Un(y);return e.__assign({name:N.type,data:N,$$type:"scxml",type:"external"},D)}function Tn(y,D){var N=b(D).map(function(O){return typeof O>"u"||typeof O=="string"||an(O)?{target:O,event:y}:e.__assign(e.__assign({},O),{event:y})});return N}function ei(y){if(!(y===void 0||y===i.TARGETLESS_KEY))return E(y)}function br(y,D,N){if(!o.IS_PRODUCTION){var O=y.stack?" Stacktrace was '".concat(y.stack,"'"):"";if(y===D)console.error("Missing onError handler for invocation '".concat(N,"', error was '").concat(y,"'.").concat(O));else{var j=D.stack?" Stacktrace was '".concat(D.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(N,"'. ")+"Original error: '".concat(y,"'. ").concat(O," Current error is '").concat(D,"'.").concat(j))}}}function yn(y,D,N,O,j){var q=y.options.guards,W={state:j,cond:D,_event:O};if(D.type===i.DEFAULT_GUARD_TYPE)return((q==null?void 0:q[D.name])||D.predicate)(N,O.data,W);var G=q==null?void 0:q[D.type];if(!G)throw new Error("Guard '".concat(D.type,"' is not implemented on machine '").concat(y.id,"'."));return G(N,O.data,W)}function lc(y){return typeof y=="string"?{type:y}:y}function fc(y,D,N){var O=function(){},j=typeof y=="object",q=j?y:null;return{next:((j?y.next:y)||O).bind(q),error:((j?y.error:D)||O).bind(q),complete:((j?y.complete:N)||O).bind(q)}}function dc(y,D){return"".concat(y,":invocation[").concat(D,"]")}function hc(y){return(y.type===r.raise||y.type===r.send&&y.to===n.SpecialTargets.Internal)&&typeof y.delay!="number"}t.createInvokeId=dc,t.evaluateGuard=yn,t.flatten=x,t.getActionType=l,t.getEventType=c,t.interopSymbols=De,t.isActor=Ot,t.isArray=bt,t.isBehavior=M,t.isBuiltInEvent=A,t.isFunction=Y,t.isMachine=an,t.isObservable=$e,t.isPromiseLike=U,t.isRaisableAction=hc,t.isStateLike=f,t.isString=J,t.keys=u,t.mapContext=P,t.mapFilterValues=S,t.mapValues=p,t.matchesState=s,t.nestedPath=w,t.normalizeTarget=ei,t.partition=$,t.path=C,t.pathToStateValue=v,t.pathsToStateValue=I,t.reportUnhandledExceptionOnInvocation=br,t.symbolObservable=tt,t.toArray=E,t.toArrayStrict=b,t.toEventObject=Un,t.toGuard=ut,t.toInvokeSource=lc,t.toObserver=fc,t.toSCXMLEvent=Bn,t.toStatePath=d,t.toStatePaths=T,t.toStateValue=h,t.toTransitionConfigArray=Tn,t.uniqueId=Zt,t.updateContext=Vt,t.updateHistoryStates=z,t.updateHistoryValue=Z})(Bv);Object.defineProperty(_t,"__esModule",{value:!0});var $t=bf,Cn=Su,Ie=fe,mt=Bv,Vv=Cu,YI=mt.toSCXMLEvent({type:Ie.init});function sl(t,e){return e&&e[t]||void 0}function wu(t,e){var n;if(mt.isString(t)||typeof t=="number"){var r=sl(t,e);mt.isFunction(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(mt.isFunction(t))n={type:t.name||t.toString(),exec:t};else{var r=sl(t.type,e);if(mt.isFunction(r))n=$t.__assign($t.__assign({},t),{exec:r});else if(r){var i=r.type||t.type;n=$t.__assign($t.__assign($t.__assign({},r),t),{type:i})}else n=t}return n}var ul=function(t,e){if(!t)return[];var n=mt.isArray(t)?t:[t];return n.map(function(r){return wu(r,e)})};function Sf(t){var e=wu(t);return $t.__assign($t.__assign({id:mt.isString(t)?t:e.id},e),{type:e.type})}function XI(t,e){return{type:Ie.raise,event:typeof t=="function"?t:mt.toEventObject(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function Fv(t,e,n,r){var i={_event:n},o=mt.toSCXMLEvent(mt.isFunction(t.event)?t.event(e,n.data,i):t.event),a;if(mt.isString(t.delay)){var u=r&&r[t.delay];a=mt.isFunction(u)?u(e,n.data,i):u}else a=mt.isFunction(t.delay)?t.delay(e,n.data,i):t.delay;return $t.__assign($t.__assign({},t),{type:Ie.raise,_event:o,delay:a})}function ja(t,e){return{to:e?e.to:void 0,type:Ie.send,event:mt.isFunction(t)?t:mt.toEventObject(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:mt.isFunction(t)?t.name:mt.getEventType(t)}}function Lv(t,e,n,r){var i={_event:n},o=mt.toSCXMLEvent(mt.isFunction(t.event)?t.event(e,n.data,i):t.event),a;if(mt.isString(t.delay)){var u=r&&r[t.delay];a=mt.isFunction(u)?u(e,n.data,i):u}else a=mt.isFunction(t.delay)?t.delay(e,n.data,i):t.delay;var s=mt.isFunction(t.to)?t.to(e,n.data,i):t.to;return $t.__assign($t.__assign({},t),{to:s,_event:o,event:o.data,delay:a})}function Cf(t,e){return ja(t,$t.__assign($t.__assign({},e),{to:Cn.SpecialTargets.Parent}))}function ZI(t,e,n){return ja(e,$t.__assign($t.__assign({},n),{to:t}))}function QI(){return Cf(Ie.update)}function tE(t,e){return ja(t,$t.__assign($t.__assign({},e),{to:function(n,r,i){var o=i._event;return o.origin}}))}var eE=function(t,e){return{context:t,event:e}};function nE(t,e){return t===void 0&&(t=eE),{type:Ie.log,label:e,expr:t}}var Gv=function(t,e,n){return $t.__assign($t.__assign({},t),{value:mt.isString(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},rE=function(t){return{type:Ie.cancel,sendId:t}};function iE(t){var e=Sf(t);return{type:Cn.ActionTypes.Start,activity:e,exec:void 0}}function oE(t){var e=mt.isFunction(t)?t:Sf(t);return{type:Cn.ActionTypes.Stop,activity:e,exec:void 0}}function zv(t,e,n){var r=mt.isFunction(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,o={type:Cn.ActionTypes.Stop,activity:i};return o}var aE=function(t){return{type:Ie.assign,assignment:t}};function sE(t){return typeof t=="object"&&"type"in t}function uE(t,e){var n=e?"#".concat(e):"";return"".concat(Cn.ActionTypes.After,"(").concat(t,")").concat(n)}function cE(t,e){var n="".concat(Cn.ActionTypes.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function lE(t,e){var n="".concat(Cn.ActionTypes.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function fE(t,e){var n="".concat(Cn.ActionTypes.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function dE(t){return{type:Cn.ActionTypes.Pure,get:t}}function hE(t,e){if(!Vv.IS_PRODUCTION&&(!t||typeof t=="function")){var n=t;t=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=typeof n=="function"?n.apply(void 0,$t.__spreadArray([],$t.__read(r),!1)):n;if(!o)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return o}}return ja(function(r,i){return i},$t.__assign($t.__assign({},e),{to:t}))}function pE(t,e){return Cf(function(n,r,i){return{type:Ie.error,data:mt.isFunction(t)?t(n,r,i):t}},$t.__assign($t.__assign({},e),{to:Cn.SpecialTargets.Parent}))}function vE(t){return{type:Cn.ActionTypes.Choose,conds:t}}var yE=function(t){var e,n,r=[];try{for(var i=$t.__values(t),o=i.next();!o.done;o=i.next())for(var a=o.value,u=0;u<a.actions.length;){if(a.actions[u].type===Ie.assign){r.push(a.actions[u]),a.actions.splice(u,1);continue}u++}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function cl(t,e,n,r,i,o,a){a===void 0&&(a=!1);var u=a?[]:yE(i),s=u.length?mt.updateContext(n,r,u,e):n,c=a?[n]:void 0,l=[];function d(v,p){var S;switch(p.type){case Ie.raise:{var C=Fv(p,s,r,t.options.delays);return o&&typeof C.delay=="number"&&o(C,s,r),C}case Ie.send:var w=Lv(p,s,r,t.options.delays);if(!Vv.IS_PRODUCTION){var T=p.delay;mt.warn(!mt.isString(T)||typeof w.delay=="number","No delay reference for delay expression '".concat(T,"' was found on machine '").concat(t.id,"'"))}return o&&w.to!==Cn.SpecialTargets.Internal&&(v==="entry"?l.push(w):o(w,s,r)),w;case Ie.log:{var I=Gv(p,s,r);return o==null||o(I,s,r),I}case Ie.choose:{var x=p,b=(S=x.conds.find(function(Y){var J=mt.toGuard(Y.cond,t.options.guards);return!J||mt.evaluateGuard(t,J,s,r,o?void 0:e)}))===null||S===void 0?void 0:S.actions;if(!b)return[];var E=$t.__read(cl(t,e,s,r,[{type:v,actions:ul(mt.toArray(b),t.options.actions)}],o,a),2),P=E[0],A=E[1];return s=A,c==null||c.push(s),P}case Ie.pure:{var b=p.get(s,r.data);if(!b)return[];var U=$t.__read(cl(t,e,s,r,[{type:v,actions:ul(mt.toArray(b),t.options.actions)}],o,a),2),M=U[0],$=U[1];return s=$,c==null||c.push(s),M}case Ie.stop:{var I=zv(p,s,r);return o==null||o(I,n,r),I}case Ie.assign:{s=mt.updateContext(s,r,[p],o?void 0:e),c==null||c.push(s);break}default:var z=wu(p,t.options.actions),Z=z.exec;if(o)o(z,s,r);else if(Z&&c){var Vt=c.length-1,bt=$t.__assign($t.__assign({},z),{exec:function(Y){for(var J=[],ut=1;ut<arguments.length;ut++)J[ut-1]=arguments[ut];Z.apply(void 0,$t.__spreadArray([c[Vt]],$t.__read(J),!1))}});z=bt}return z}}function f(v){var p,S,C=[];try{for(var w=$t.__values(v.actions),T=w.next();!T.done;T=w.next()){var I=T.value,x=d(v.type,I);x&&(C=C.concat(x))}}catch(b){p={error:b}}finally{try{T&&!T.done&&(S=w.return)&&S.call(w)}finally{if(p)throw p.error}}return l.forEach(function(b){o(b,s,r)}),l.length=0,C}var h=mt.flatten(i.map(f));return[h,s]}_t.actionTypes=Ie;_t.after=uE;_t.assign=aE;_t.cancel=rE;_t.choose=vE;_t.done=cE;_t.doneInvoke=lE;_t.error=fE;_t.escalate=pE;_t.forwardTo=hE;_t.getActionFunction=sl;_t.initEvent=YI;_t.isActionObject=sE;var fn=_t.log=nE,mE=_t.pure=dE;_t.raise=XI;_t.resolveActions=cl;_t.resolveLog=Gv;_t.resolveRaise=Fv;_t.resolveSend=Lv;_t.resolveStop=zv;_t.respond=tE;_t.send=ja;_t.sendParent=Cf;_t.sendTo=ZI;_t.sendUpdate=QI;_t.start=iE;var Fd=_t.stop=oE;_t.toActionObject=wu;_t.toActionObjects=ul;_t.toActivityDefinition=Sf;var ll={exports:{}},yc={},ns={exports:{}},mc={};/**
35
+ ***************************************************************************** */t.__assign=function(){return t.__assign=Object.assign||function(a){for(var u,s=1,c=arguments.length;s<c;s++){u=arguments[s];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(a[l]=u[l])}return a},t.__assign.apply(this,arguments)};function e(o,a){var u={};for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&a.indexOf(s)<0&&(u[s]=o[s]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,s=Object.getOwnPropertySymbols(o);c<s.length;c++)a.indexOf(s[c])<0&&Object.prototype.propertyIsEnumerable.call(o,s[c])&&(u[s[c]]=o[s[c]]);return u}function n(o){var a=typeof Symbol=="function"&&Symbol.iterator,u=a&&o[a],s=0;if(u)return u.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&s>=o.length&&(o=void 0),{value:o&&o[s++],done:!o}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(o,a){var u=typeof Symbol=="function"&&o[Symbol.iterator];if(!u)return o;var s=u.call(o),c,l=[],d;try{for(;(a===void 0||a-- >0)&&!(c=s.next()).done;)l.push(c.value)}catch(f){d={error:f}}finally{try{c&&!c.done&&(u=s.return)&&u.call(s)}finally{if(d)throw d.error}}return l}function i(o,a,u){if(u||arguments.length===2)for(var s=0,c=a.length,l;s<c;s++)(l||!(s in a))&&(l||(l=Array.prototype.slice.call(a,0,s)),l[s]=a[s]);return o.concat(l||Array.prototype.slice.call(a))}t.__read=r,t.__rest=e,t.__spreadArray=i,t.__values=n})(bf);var Su={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ActionTypes=void 0,function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"}(t.ActionTypes||(t.ActionTypes={})),t.SpecialTargets=void 0,function(e){e.Parent="#_parent",e.Internal="#_internal"}(t.SpecialTargets||(t.SpecialTargets={}))})(Su);var fe={};Object.defineProperty(fe,"__esModule",{value:!0});var xe=Su,$I=xe.ActionTypes.Start,DI=xe.ActionTypes.Stop,OI=xe.ActionTypes.Raise,NI=xe.ActionTypes.Send,PI=xe.ActionTypes.Cancel,MI=xe.ActionTypes.NullEvent,RI=xe.ActionTypes.Assign,_I=xe.ActionTypes.After,jI=xe.ActionTypes.DoneState,qI=xe.ActionTypes.Log,kI=xe.ActionTypes.Init,UI=xe.ActionTypes.Invoke,BI=xe.ActionTypes.ErrorExecution,VI=xe.ActionTypes.ErrorPlatform,FI=xe.ActionTypes.ErrorCustom,LI=xe.ActionTypes.Update,GI=xe.ActionTypes.Choose,zI=xe.ActionTypes.Pure;fe.after=_I;fe.assign=RI;fe.cancel=PI;fe.choose=GI;fe.doneState=jI;fe.error=FI;fe.errorExecution=BI;fe.errorPlatform=VI;fe.init=kI;fe.invoke=UI;fe.log=qI;fe.nullEvent=MI;fe.pure=zI;fe.raise=OI;fe.send=NI;fe.start=$I;fe.stop=DI;fe.update=LI;var Bv={},go={};Object.defineProperty(go,"__esModule",{value:!0});var HI=".",WI={},KI="xstate.guard",YI="";go.DEFAULT_GUARD_TYPE=KI;go.EMPTY_ACTIVITY_MAP=WI;go.STATE_DELIMITER=HI;go.TARGETLESS_KEY=YI;var Cu={};Object.defineProperty(Cu,"__esModule",{value:!0});var JI=process.env.NODE_ENV==="production";Cu.IS_PRODUCTION=JI;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=bf,n=Su,r=fe,i=go,o=Cu,a;function u(y){return Object.keys(y)}function s(y,D,N){N===void 0&&(N=i.STATE_DELIMITER);var O=h(y,N),j=h(D,N);return Y(j)?Y(O)?j===O:!1:Y(O)?O in j:Object.keys(O).every(function(q){return q in j?s(O[q],j[q]):!1})}function c(y){try{return Y(y)||typeof y=="number"?"".concat(y):y.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function l(y){try{return Y(y)||typeof y=="number"?"".concat(y):J(y)?y.name:y.type}catch{throw new Error("Actions must be strings or objects with a string action.type property.")}}function d(y,D){try{return bt(y)?y:y.toString().split(D)}catch{throw new Error("'".concat(y,"' is not a valid state path."))}}function f(y){return typeof y=="object"&&"value"in y&&"context"in y&&"event"in y&&"_event"in y}function h(y,D){if(f(y))return y.value;if(bt(y))return v(y);if(typeof y!="string")return y;var N=d(y,D);return v(N)}function v(y){if(y.length===1)return y[0];for(var D={},N=D,O=0;O<y.length-1;O++)O===y.length-2?N[y[O]]=y[O+1]:(N[y[O]]={},N=N[y[O]]);return D}function p(y,D){for(var N={},O=Object.keys(y),j=0;j<O.length;j++){var q=O[j];N[q]=D(y[q],q,y,j)}return N}function S(y,D,N){var O,j,q={};try{for(var W=e.__values(Object.keys(y)),G=W.next();!G.done;G=W.next()){var Q=G.value,ct=y[Q];N(ct)&&(q[Q]=D(ct,Q,y))}}catch(le){O={error:le}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}var C=function(y){return function(D){var N,O,j=D;try{for(var q=e.__values(y),W=q.next();!W.done;W=q.next()){var G=W.value;j=j[G]}}catch(Q){N={error:Q}}finally{try{W&&!W.done&&(O=q.return)&&O.call(q)}finally{if(N)throw N.error}}return j}};function w(y,D){return function(N){var O,j,q=N;try{for(var W=e.__values(y),G=W.next();!G.done;G=W.next()){var Q=G.value;q=q[D][Q]}}catch(ct){O={error:ct}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}}function T(y){if(!y)return[[]];if(Y(y))return[[y]];var D=x(Object.keys(y).map(function(N){var O=y[N];return typeof O!="string"&&(!O||!Object.keys(O).length)?[[N]]:T(y[N]).map(function(j){return[N].concat(j)})}));return D}function I(y){var D,N,O={};if(y&&y.length===1&&y[0].length===1)return y[0][0];try{for(var j=e.__values(y),q=j.next();!q.done;q=j.next())for(var W=q.value,G=O,Q=0;Q<W.length;Q++){var ct=W[Q];if(Q===W.length-2){G[ct]=W[Q+1];break}G[ct]=G[ct]||{},G=G[ct]}}catch(le){D={error:le}}finally{try{q&&!q.done&&(N=j.return)&&N.call(j)}finally{if(D)throw D.error}}return O}function x(y){var D;return(D=[]).concat.apply(D,e.__spreadArray([],e.__read(y),!1))}function b(y){return bt(y)?y:[y]}function E(y){return y===void 0?[]:b(y)}function P(y,D,N){var O,j;if(J(y))return y(D,N.data);var q={};try{for(var W=e.__values(Object.keys(y)),G=W.next();!G.done;G=W.next()){var Q=G.value,ct=y[Q];J(ct)?q[Q]=ct(D,N.data):q[Q]=ct}}catch(le){O={error:le}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}function A(y){return/^(done|error)\./.test(y)}function U(y){return!!(y instanceof Promise||y!==null&&(J(y)||typeof y=="object")&&J(y.then))}function M(y){return y!==null&&typeof y=="object"&&"transition"in y&&typeof y.transition=="function"}function $(y,D){var N,O,j=e.__read([[],[]],2),q=j[0],W=j[1];try{for(var G=e.__values(y),Q=G.next();!Q.done;Q=G.next()){var ct=Q.value;D(ct)?q.push(ct):W.push(ct)}}catch(le){N={error:le}}finally{try{Q&&!Q.done&&(O=G.return)&&O.call(G)}finally{if(N)throw N.error}}return[q,W]}function z(y,D){return p(y.states,function(N,O){if(N){var j=(Y(D)?void 0:D[O])||(N?N.current:void 0);if(j)return{current:j,states:z(N,j)}}})}function Z(y,D){return{current:D,states:z(y,D)}}function Vt(y,D,N,O){o.IS_PRODUCTION||t.warn(!!y,"Attempting to update undefined context");var j=y&&N.reduce(function(q,W){var G,Q,ct=W.assignment,le={state:O,action:W,_event:D},ni={};if(J(ct))ni=ct(q,D.data,le);else try{for(var Qn=e.__values(Object.keys(ct)),In=Qn.next();!In.done;In=Qn.next()){var jo=In.value,ri=ct[jo];ni[jo]=J(ri)?ri(q,D.data,le):ri}}catch(pc){G={error:pc}}finally{try{In&&!In.done&&(Q=Qn.return)&&Q.call(Qn)}finally{if(G)throw G.error}}return Object.assign({},q,ni)},y);return j}t.warn=function(){},o.IS_PRODUCTION||(t.warn=function(y,D){var N=y instanceof Error?y:void 0;if(!(!N&&y)&&console!==void 0){var O=["Warning: ".concat(D)];N&&O.push(N),console.warn.apply(console,O)}});function bt(y){return Array.isArray(y)}function J(y){return typeof y=="function"}function Y(y){return typeof y=="string"}function ut(y,D){if(y)return Y(y)?{type:i.DEFAULT_GUARD_TYPE,name:y,predicate:D?D[y]:void 0}:J(y)?{type:i.DEFAULT_GUARD_TYPE,name:y.name,predicate:y}:y}function $e(y){try{return"subscribe"in y&&J(y.subscribe)}catch{return!1}}var tt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),De=(a={},a[tt]=function(){return this},a[Symbol.observable]=function(){return this},a);function an(y){return!!y&&"__xstatenode"in y}function Ot(y){return!!y&&typeof y.send=="function"}var Zt=function(){var y=0;return function(){return y++,y.toString(16)}}();function Un(y,D){return Y(y)||typeof y=="number"?e.__assign({type:y},D):y}function Bn(y,D){if(!Y(y)&&"$$type"in y&&y.$$type==="scxml")return y;var N=Un(y);return e.__assign({name:N.type,data:N,$$type:"scxml",type:"external"},D)}function Tn(y,D){var N=b(D).map(function(O){return typeof O>"u"||typeof O=="string"||an(O)?{target:O,event:y}:e.__assign(e.__assign({},O),{event:y})});return N}function ei(y){if(!(y===void 0||y===i.TARGETLESS_KEY))return E(y)}function br(y,D,N){if(!o.IS_PRODUCTION){var O=y.stack?" Stacktrace was '".concat(y.stack,"'"):"";if(y===D)console.error("Missing onError handler for invocation '".concat(N,"', error was '").concat(y,"'.").concat(O));else{var j=D.stack?" Stacktrace was '".concat(D.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(N,"'. ")+"Original error: '".concat(y,"'. ").concat(O," Current error is '").concat(D,"'.").concat(j))}}}function yn(y,D,N,O,j){var q=y.options.guards,W={state:j,cond:D,_event:O};if(D.type===i.DEFAULT_GUARD_TYPE)return((q==null?void 0:q[D.name])||D.predicate)(N,O.data,W);var G=q==null?void 0:q[D.type];if(!G)throw new Error("Guard '".concat(D.type,"' is not implemented on machine '").concat(y.id,"'."));return G(N,O.data,W)}function lc(y){return typeof y=="string"?{type:y}:y}function fc(y,D,N){var O=function(){},j=typeof y=="object",q=j?y:null;return{next:((j?y.next:y)||O).bind(q),error:((j?y.error:D)||O).bind(q),complete:((j?y.complete:N)||O).bind(q)}}function dc(y,D){return"".concat(y,":invocation[").concat(D,"]")}function hc(y){return(y.type===r.raise||y.type===r.send&&y.to===n.SpecialTargets.Internal)&&typeof y.delay!="number"}t.createInvokeId=dc,t.evaluateGuard=yn,t.flatten=x,t.getActionType=l,t.getEventType=c,t.interopSymbols=De,t.isActor=Ot,t.isArray=bt,t.isBehavior=M,t.isBuiltInEvent=A,t.isFunction=J,t.isMachine=an,t.isObservable=$e,t.isPromiseLike=U,t.isRaisableAction=hc,t.isStateLike=f,t.isString=Y,t.keys=u,t.mapContext=P,t.mapFilterValues=S,t.mapValues=p,t.matchesState=s,t.nestedPath=w,t.normalizeTarget=ei,t.partition=$,t.path=C,t.pathToStateValue=v,t.pathsToStateValue=I,t.reportUnhandledExceptionOnInvocation=br,t.symbolObservable=tt,t.toArray=E,t.toArrayStrict=b,t.toEventObject=Un,t.toGuard=ut,t.toInvokeSource=lc,t.toObserver=fc,t.toSCXMLEvent=Bn,t.toStatePath=d,t.toStatePaths=T,t.toStateValue=h,t.toTransitionConfigArray=Tn,t.uniqueId=Zt,t.updateContext=Vt,t.updateHistoryStates=z,t.updateHistoryValue=Z})(Bv);Object.defineProperty(_t,"__esModule",{value:!0});var $t=bf,Cn=Su,Ie=fe,mt=Bv,Vv=Cu,XI=mt.toSCXMLEvent({type:Ie.init});function sl(t,e){return e&&e[t]||void 0}function wu(t,e){var n;if(mt.isString(t)||typeof t=="number"){var r=sl(t,e);mt.isFunction(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(mt.isFunction(t))n={type:t.name||t.toString(),exec:t};else{var r=sl(t.type,e);if(mt.isFunction(r))n=$t.__assign($t.__assign({},t),{exec:r});else if(r){var i=r.type||t.type;n=$t.__assign($t.__assign($t.__assign({},r),t),{type:i})}else n=t}return n}var ul=function(t,e){if(!t)return[];var n=mt.isArray(t)?t:[t];return n.map(function(r){return wu(r,e)})};function Sf(t){var e=wu(t);return $t.__assign($t.__assign({id:mt.isString(t)?t:e.id},e),{type:e.type})}function ZI(t,e){return{type:Ie.raise,event:typeof t=="function"?t:mt.toEventObject(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function Fv(t,e,n,r){var i={_event:n},o=mt.toSCXMLEvent(mt.isFunction(t.event)?t.event(e,n.data,i):t.event),a;if(mt.isString(t.delay)){var u=r&&r[t.delay];a=mt.isFunction(u)?u(e,n.data,i):u}else a=mt.isFunction(t.delay)?t.delay(e,n.data,i):t.delay;return $t.__assign($t.__assign({},t),{type:Ie.raise,_event:o,delay:a})}function ja(t,e){return{to:e?e.to:void 0,type:Ie.send,event:mt.isFunction(t)?t:mt.toEventObject(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:mt.isFunction(t)?t.name:mt.getEventType(t)}}function Lv(t,e,n,r){var i={_event:n},o=mt.toSCXMLEvent(mt.isFunction(t.event)?t.event(e,n.data,i):t.event),a;if(mt.isString(t.delay)){var u=r&&r[t.delay];a=mt.isFunction(u)?u(e,n.data,i):u}else a=mt.isFunction(t.delay)?t.delay(e,n.data,i):t.delay;var s=mt.isFunction(t.to)?t.to(e,n.data,i):t.to;return $t.__assign($t.__assign({},t),{to:s,_event:o,event:o.data,delay:a})}function Cf(t,e){return ja(t,$t.__assign($t.__assign({},e),{to:Cn.SpecialTargets.Parent}))}function QI(t,e,n){return ja(e,$t.__assign($t.__assign({},n),{to:t}))}function tE(){return Cf(Ie.update)}function eE(t,e){return ja(t,$t.__assign($t.__assign({},e),{to:function(n,r,i){var o=i._event;return o.origin}}))}var nE=function(t,e){return{context:t,event:e}};function rE(t,e){return t===void 0&&(t=nE),{type:Ie.log,label:e,expr:t}}var Gv=function(t,e,n){return $t.__assign($t.__assign({},t),{value:mt.isString(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},iE=function(t){return{type:Ie.cancel,sendId:t}};function oE(t){var e=Sf(t);return{type:Cn.ActionTypes.Start,activity:e,exec:void 0}}function aE(t){var e=mt.isFunction(t)?t:Sf(t);return{type:Cn.ActionTypes.Stop,activity:e,exec:void 0}}function zv(t,e,n){var r=mt.isFunction(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,o={type:Cn.ActionTypes.Stop,activity:i};return o}var sE=function(t){return{type:Ie.assign,assignment:t}};function uE(t){return typeof t=="object"&&"type"in t}function cE(t,e){var n=e?"#".concat(e):"";return"".concat(Cn.ActionTypes.After,"(").concat(t,")").concat(n)}function lE(t,e){var n="".concat(Cn.ActionTypes.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function fE(t,e){var n="".concat(Cn.ActionTypes.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function dE(t,e){var n="".concat(Cn.ActionTypes.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function hE(t){return{type:Cn.ActionTypes.Pure,get:t}}function pE(t,e){if(!Vv.IS_PRODUCTION&&(!t||typeof t=="function")){var n=t;t=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=typeof n=="function"?n.apply(void 0,$t.__spreadArray([],$t.__read(r),!1)):n;if(!o)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return o}}return ja(function(r,i){return i},$t.__assign($t.__assign({},e),{to:t}))}function vE(t,e){return Cf(function(n,r,i){return{type:Ie.error,data:mt.isFunction(t)?t(n,r,i):t}},$t.__assign($t.__assign({},e),{to:Cn.SpecialTargets.Parent}))}function yE(t){return{type:Cn.ActionTypes.Choose,conds:t}}var mE=function(t){var e,n,r=[];try{for(var i=$t.__values(t),o=i.next();!o.done;o=i.next())for(var a=o.value,u=0;u<a.actions.length;){if(a.actions[u].type===Ie.assign){r.push(a.actions[u]),a.actions.splice(u,1);continue}u++}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function cl(t,e,n,r,i,o,a){a===void 0&&(a=!1);var u=a?[]:mE(i),s=u.length?mt.updateContext(n,r,u,e):n,c=a?[n]:void 0,l=[];function d(v,p){var S;switch(p.type){case Ie.raise:{var C=Fv(p,s,r,t.options.delays);return o&&typeof C.delay=="number"&&o(C,s,r),C}case Ie.send:var w=Lv(p,s,r,t.options.delays);if(!Vv.IS_PRODUCTION){var T=p.delay;mt.warn(!mt.isString(T)||typeof w.delay=="number","No delay reference for delay expression '".concat(T,"' was found on machine '").concat(t.id,"'"))}return o&&w.to!==Cn.SpecialTargets.Internal&&(v==="entry"?l.push(w):o(w,s,r)),w;case Ie.log:{var I=Gv(p,s,r);return o==null||o(I,s,r),I}case Ie.choose:{var x=p,b=(S=x.conds.find(function(J){var Y=mt.toGuard(J.cond,t.options.guards);return!Y||mt.evaluateGuard(t,Y,s,r,o?void 0:e)}))===null||S===void 0?void 0:S.actions;if(!b)return[];var E=$t.__read(cl(t,e,s,r,[{type:v,actions:ul(mt.toArray(b),t.options.actions)}],o,a),2),P=E[0],A=E[1];return s=A,c==null||c.push(s),P}case Ie.pure:{var b=p.get(s,r.data);if(!b)return[];var U=$t.__read(cl(t,e,s,r,[{type:v,actions:ul(mt.toArray(b),t.options.actions)}],o,a),2),M=U[0],$=U[1];return s=$,c==null||c.push(s),M}case Ie.stop:{var I=zv(p,s,r);return o==null||o(I,n,r),I}case Ie.assign:{s=mt.updateContext(s,r,[p],o?void 0:e),c==null||c.push(s);break}default:var z=wu(p,t.options.actions),Z=z.exec;if(o)o(z,s,r);else if(Z&&c){var Vt=c.length-1,bt=$t.__assign($t.__assign({},z),{exec:function(J){for(var Y=[],ut=1;ut<arguments.length;ut++)Y[ut-1]=arguments[ut];Z.apply(void 0,$t.__spreadArray([c[Vt]],$t.__read(Y),!1))}});z=bt}return z}}function f(v){var p,S,C=[];try{for(var w=$t.__values(v.actions),T=w.next();!T.done;T=w.next()){var I=T.value,x=d(v.type,I);x&&(C=C.concat(x))}}catch(b){p={error:b}}finally{try{T&&!T.done&&(S=w.return)&&S.call(w)}finally{if(p)throw p.error}}return l.forEach(function(b){o(b,s,r)}),l.length=0,C}var h=mt.flatten(i.map(f));return[h,s]}_t.actionTypes=Ie;_t.after=cE;_t.assign=sE;_t.cancel=iE;_t.choose=yE;_t.done=lE;_t.doneInvoke=fE;_t.error=dE;_t.escalate=vE;_t.forwardTo=pE;_t.getActionFunction=sl;_t.initEvent=XI;_t.isActionObject=uE;var fn=_t.log=rE,gE=_t.pure=hE;_t.raise=ZI;_t.resolveActions=cl;_t.resolveLog=Gv;_t.resolveRaise=Fv;_t.resolveSend=Lv;_t.resolveStop=zv;_t.respond=eE;_t.send=ja;_t.sendParent=Cf;_t.sendTo=QI;_t.sendUpdate=tE;_t.start=oE;var Fd=_t.stop=aE;_t.toActionObject=wu;_t.toActionObjects=ul;_t.toActivityDefinition=Sf;var ll={exports:{}},yc={},ns={exports:{}},mc={};/**
36
36
  * @license React
37
37
  * use-sync-external-store-shim.production.min.js
38
38
  *
@@ -40,7 +40,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==ae.Running)throw
40
40
  *
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
- */var Ld;function gE(){if(Ld)return mc;Ld=1;var t=R;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,a=t.useDebugValue;function u(d,f){var h=f(),v=r({inst:{value:h,getSnapshot:f}}),p=v[0].inst,S=v[1];return o(function(){p.value=h,p.getSnapshot=f,s(p)&&S({inst:p})},[d,h,f]),i(function(){return s(p)&&S({inst:p}),d(function(){s(p)&&S({inst:p})})},[d]),a(h),h}function s(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:u;return mc.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:l,mc}var gc={};/**
43
+ */var Ld;function bE(){if(Ld)return mc;Ld=1;var t=R;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,a=t.useDebugValue;function u(d,f){var h=f(),v=r({inst:{value:h,getSnapshot:f}}),p=v[0].inst,S=v[1];return o(function(){p.value=h,p.getSnapshot=f,s(p)&&S({inst:p})},[d,h,f]),i(function(){return s(p)&&S({inst:p}),d(function(){s(p)&&S({inst:p})})},[d]),a(h),h}function s(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:u;return mc.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:l,mc}var gc={};/**
44
44
  * @license React
45
45
  * use-sync-external-store-shim.development.js
46
46
  *
@@ -48,7 +48,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==ae.Running)throw
48
48
  *
49
49
  * This source code is licensed under the MIT license found in the
50
50
  * LICENSE file in the root directory of this source tree.
51
- */var Gd;function bE(){return Gd||(Gd=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=R,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(T){{for(var I=arguments.length,x=new Array(I>1?I-1:0),b=1;b<I;b++)x[b-1]=arguments[b];r("error",T,x)}}function r(T,I,x){{var b=e.ReactDebugCurrentFrame,E=b.getStackAddendum();E!==""&&(I+="%s",x=x.concat([E]));var P=x.map(function(A){return String(A)});P.unshift("Warning: "+I),Function.prototype.apply.call(console[T],console,P)}}function i(T,I){return T===I&&(T!==0||1/T===1/I)||T!==T&&I!==I}var o=typeof Object.is=="function"?Object.is:i,a=t.useState,u=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue,l=!1,d=!1;function f(T,I,x){l||t.startTransition!==void 0&&(l=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=I();if(!d){var E=I();o(b,E)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var P=a({inst:{value:b,getSnapshot:I}}),A=P[0].inst,U=P[1];return s(function(){A.value=b,A.getSnapshot=I,h(A)&&U({inst:A})},[T,b,I]),u(function(){h(A)&&U({inst:A});var M=function(){h(A)&&U({inst:A})};return T(M)},[T]),c(b),b}function h(T){var I=T.getSnapshot,x=T.value;try{var b=I();return!o(x,b)}catch{return!0}}function v(T,I,x){return I()}var p=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",S=!p,C=S?v:f,w=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:C;gc.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),gc}var zd;function Hv(){return zd||(zd=1,process.env.NODE_ENV==="production"?ns.exports=gE():ns.exports=bE()),ns.exports}/**
51
+ */var Gd;function SE(){return Gd||(Gd=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=R,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(T){{for(var I=arguments.length,x=new Array(I>1?I-1:0),b=1;b<I;b++)x[b-1]=arguments[b];r("error",T,x)}}function r(T,I,x){{var b=e.ReactDebugCurrentFrame,E=b.getStackAddendum();E!==""&&(I+="%s",x=x.concat([E]));var P=x.map(function(A){return String(A)});P.unshift("Warning: "+I),Function.prototype.apply.call(console[T],console,P)}}function i(T,I){return T===I&&(T!==0||1/T===1/I)||T!==T&&I!==I}var o=typeof Object.is=="function"?Object.is:i,a=t.useState,u=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue,l=!1,d=!1;function f(T,I,x){l||t.startTransition!==void 0&&(l=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=I();if(!d){var E=I();o(b,E)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var P=a({inst:{value:b,getSnapshot:I}}),A=P[0].inst,U=P[1];return s(function(){A.value=b,A.getSnapshot=I,h(A)&&U({inst:A})},[T,b,I]),u(function(){h(A)&&U({inst:A});var M=function(){h(A)&&U({inst:A})};return T(M)},[T]),c(b),b}function h(T){var I=T.getSnapshot,x=T.value;try{var b=I();return!o(x,b)}catch{return!0}}function v(T,I,x){return I()}var p=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",S=!p,C=S?v:f,w=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:C;gc.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),gc}var zd;function Hv(){return zd||(zd=1,process.env.NODE_ENV==="production"?ns.exports=bE():ns.exports=SE()),ns.exports}/**
52
52
  * @license React
53
53
  * use-sync-external-store-shim/with-selector.production.min.js
54
54
  *
@@ -56,7 +56,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==ae.Running)throw
56
56
  *
57
57
  * This source code is licensed under the MIT license found in the
58
58
  * LICENSE file in the root directory of this source tree.
59
- */var Hd;function SE(){if(Hd)return yc;Hd=1;var t=R,e=Hv();function n(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,s=t.useDebugValue;return yc.useSyncExternalStoreWithSelector=function(c,l,d,f,h){var v=o(null);if(v.current===null){var p={hasValue:!1,value:null};v.current=p}else p=v.current;v=u(function(){function C(b){if(!w){if(w=!0,T=b,b=f(b),h!==void 0&&p.hasValue){var E=p.value;if(h(E,b))return I=E}return I=b}if(E=I,r(T,b))return E;var P=f(b);return h!==void 0&&h(E,P)?E:(T=b,I=P)}var w=!1,T,I,x=d===void 0?null:d;return[function(){return C(l())},x===null?void 0:function(){return C(x())}]},[l,d,f,h]);var S=i(c,v[0],v[1]);return a(function(){p.hasValue=!0,p.value=S},[S]),s(S),S},yc}var bc={};/**
59
+ */var Hd;function CE(){if(Hd)return yc;Hd=1;var t=R,e=Hv();function n(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,s=t.useDebugValue;return yc.useSyncExternalStoreWithSelector=function(c,l,d,f,h){var v=o(null);if(v.current===null){var p={hasValue:!1,value:null};v.current=p}else p=v.current;v=u(function(){function C(b){if(!w){if(w=!0,T=b,b=f(b),h!==void 0&&p.hasValue){var E=p.value;if(h(E,b))return I=E}return I=b}if(E=I,r(T,b))return E;var P=f(b);return h!==void 0&&h(E,P)?E:(T=b,I=P)}var w=!1,T,I,x=d===void 0?null:d;return[function(){return C(l())},x===null?void 0:function(){return C(x())}]},[l,d,f,h]);var S=i(c,v[0],v[1]);return a(function(){p.hasValue=!0,p.value=S},[S]),s(S),S},yc}var bc={};/**
60
60
  * @license React
61
61
  * use-sync-external-store-shim/with-selector.development.js
62
62
  *
@@ -64,7 +64,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==ae.Running)throw
64
64
  *
65
65
  * This source code is licensed under the MIT license found in the
66
66
  * LICENSE file in the root directory of this source tree.
67
- */var Wd;function CE(){return Wd||(Wd=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=R,e=Hv();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,s=t.useDebugValue;function c(l,d,f,h,v){var p=o(null),S;p.current===null?(S={hasValue:!1,value:null},p.current=S):S=p.current;var C=u(function(){var x=!1,b,E,P=function($){if(!x){x=!0,b=$;var z=h($);if(v!==void 0&&S.hasValue){var Z=S.value;if(v(Z,z))return E=Z,Z}return E=z,z}var Vt=b,bt=E;if(r(Vt,$))return bt;var Y=h($);return v!==void 0&&v(bt,Y)?bt:(b=$,E=Y,Y)},A=f===void 0?null:f,U=function(){return P(d())},M=A===null?void 0:function(){return P(A())};return[U,M]},[d,f,h,v]),w=C[0],T=C[1],I=i(l,w,T);return a(function(){S.hasValue=!0,S.value=I},[I]),s(I),I}bc.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),bc}process.env.NODE_ENV==="production"?ll.exports=SE():ll.exports=CE();var wE=ll.exports,TE=R.useLayoutEffect;function Kd(t){var e=pp.useRef();return e.current||(e.current={v:t()}),e.current.v}var Fs=globalThis&&globalThis.__assign||function(){return Fs=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Fs.apply(this,arguments)},IE=globalThis&&globalThis.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},EE=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o};function xE(t,e){var n=Kd(function(){return typeof t=="function"?t():t});if(process.env.NODE_ENV!=="production"&&typeof t!="function"){var r=EE(R.useState(n),1),i=r[0];t!==i&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var o=e.context,a=e.guards,u=e.actions,s=e.activities,c=e.services,l=e.delays;e.state;var d=IE(e,["context","guards","actions","activities","services","delays","state"]),f=Kd(function(){var h={context:o,guards:a,actions:u,activities:s,services:c,delays:l},v=n.withConfig(h,function(){return Fs(Fs({},n.context),o)});return kv(v,d)});return TE(function(){Object.assign(f.machine.options.actions,u),Object.assign(f.machine.options.guards,a),Object.assign(f.machine.options.activities,s),Object.assign(f.machine.options.services,c),Object.assign(f.machine.options.delays,l)},[u,a,s,c,l]),f}globalThis&&globalThis.__read;globalThis&&globalThis.__values;function AE(t,e,n){if(t.status===ae.NotStarted)return!0;var r=n.changed===void 0&&(Object.keys(n.children).length>0||typeof e.changed=="boolean");return!(n.changed||r)}var $E=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o};function DE(t){return t}function OE(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=$E(e,1),i=r[0],o=i===void 0?{}:i,a=xE(t,o),u=R.useCallback(function(){return a.status===ae.NotStarted?o.state?mn.create(o.state):a.machine.initialState:a.getSnapshot()},[a]),s=R.useCallback(function(d,f){return AE(a,d,f)},[a]),c=R.useCallback(function(d){var f=a.subscribe(d).unsubscribe;return f},[a]),l=wE.useSyncExternalStoreWithSelector(c,u,u,DE,s);return R.useEffect(function(){var d=o.state;return a.start(d?mn.create(d):void 0),function(){a.stop(),a.status=ae.NotStarted}},[]),[l,a.send,a]}var NE=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};function qa(t){return t}function Wv(t){return function(){return t}}var PE=Wv(null),Kv=Wv(void 0),ME=Kv;function Jv(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function lt(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return s(u(a(o(i(r(n(e(t))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var wf=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(i){return e.apply(void 0,NE([i],r,!1))}}},Yv=function(t){return t._tag==="Some"},Xv={_tag:"None"},Zv=function(t){return{_tag:"Some",value:t}},RE=function(t){return t.length>0},_E=[],jE=Object.prototype.hasOwnProperty;function qE(t){return function(e,n){return t.chain(e,function(r){return t.map(n(r),function(){return r})})}}var Kn=function(t){return{equals:function(e,n){return e===n||t(e,n)}}},Wr=function(t){return Kn(function(e,n){for(var r in t)if(!t[r].equals(e[r],n[r]))return!1;return!0})},Qv={equals:function(t,e){return t===e}};Qv.equals;var qn=Xv,Kr=Zv;function Tu(t){return function(e){return t(e)?Kr(e):qn}}var kE=function(t,e){return lt(t,Jn(e))},UE=function(t,e){return lt(t,VE(e))},BE="Option",Jn=function(t){return function(e){return wi(e)?qn:Kr(t(e.value))}},VE=function(t){return function(e){return wi(e)||wi(t)?qn:Kr(e.value(t.value))}},ty=wf(2,function(t,e){return wi(t)?qn:e(t.value)}),FE={URI:BE,map:kE,ap:UE,chain:ty},Jr=function(t){return function(e){return wi(e)?qn:t(e.value)?e:qn}},wi=function(t){return t._tag==="None"},LE=function(t,e){return function(n){return wi(n)?t():e(n.value)}},Tf=LE,GE=function(t){return function(e){return wi(e)?t():e.value}},io=GE,zE=wf(2,qE(FE)),ke=function(t){return t==null?qn:Kr(t)},Iu=Tf(PE,qa),bo=Tf(Kv,qa),HE=ty,WE=zE,If={equals:function(t,e){return t===e}};If.equals;If.equals;var KE=_E,JE=RE,YE=function(t){return t.length===0},ey=JE,XE=function(t){return function(e){if(YE(e))return tx;for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}};function ny(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return Zv(e[n]);return Xv}}var ZE=function(t,e,n){for(var r=[],i=Math.min(t.length,e.length),o=0;o<i;o++)r[o]=n(t[o],e[o]);return r};function ry(t,e){return e===void 0?function(n){return ry(n,t)}:ZE(t,e,function(n,r){return[n,r]})}var iy=wf(2,function(t,e){return lt(t,XE(function(n,r){return e(r,n)}))}),oy=iy(qa),sr=function(t){return function(e){return e.map(function(n){return t(n)})}},en=function(t){return function(e){return e.filter(t)}},QE=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Yv(i)&&n.push(i.value)}return n}},Ni=function(t){return QE(function(e,n){return t(n)})},Sc=Ni(qa),Ef=function(t){return Kn(function(e,n){return e.length===n.length&&e.every(function(r,i){return t.equals(r,n[i])})})},tx=KE;function ex(t){return function(e){return e.every(t)}}var nx=iy,We={equals:function(t,e){return t===e}};We.equals;var ay={equals:function(t,e){return t===e}};ay.equals;function sy(t){return function(e,n){if(n===void 0){var r=sy(t);return function(o){return r(o,e)}}for(var i in e)if(!jE.call(n,i)||!t.equals(e[i],n[i]))return!1;return!0}}function rx(t){var e=sy(t);return Kn(function(n,r){return e(n)(r)&&e(r)(n)})}function ix(t){return{equals(e,n){return e==null&&n==null?!0:e==null||n===null||n===void 0?!1:t.equals(e,n)}}}function uy(t){return{equals(e,n){const r=lt(ke(e),io(()=>[])),i=lt(ke(n),io(()=>[]));return Ef(t).equals(r,i)}}}const So=Wr({localId:We,componentPath:uy(We),sharedConfigurationModelId:ix(We)}),ox=Wr({localId:We,configurationModelId:We}),ax=Kn((t,e)=>K({x:t,y:e}).with({x:{type:"Choice"},y:{type:"Choice"}},n=>sx.equals(n.x,n.y)).with({x:{type:"Component"},y:{type:"Component"}},n=>ux.equals(n.x,n.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},n=>cx.equals(n.x,n.y)).with({x:{type:"Boolean"},y:{type:"Boolean"}},n=>lx.equals(n.x,n.y)).otherwise(()=>!1)),sx=Wr({type:We,attributeId:So,state:We,choiceValueId:We}),ux=Wr({type:We,attributeId:So,state:We}),cx=Wr({type:We,attributeId:So,state:If}),lx=Wr({type:We,attributeId:So,state:ay});var cy=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(cy||{}),ly=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(ly||{}),Ue=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(Ue||{}),Eu=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(Eu||{});function fx(t,e){return lt(t.values,Ni(n=>lt(n.decision,ke,Jr(r=>r.kind===e))))}function dx(t){return lt(t.decision,ke,Jr(e=>e.kind===Eu.Explicit),Iu)}function hx(t){return lt(t.decision,ke,Jr(e=>e.kind===Eu.Explicit),Iu)}function px(t){return lt(t.decision,ke,Iu)}const fy=t=>t.type===Ue.Boolean,dy=t=>t.type===Ue.Choice,hy=t=>t.type===Ue.Numeric,py=t=>t.type===Ue.Component,vx=uy(We);function yx(t,e,n){var r;const i=((r=e.componentPath)==null?void 0:r.length)??0;return lt(t,en(o=>{var a;const u=((a=o.id.componentPath)==null?void 0:a.length)??0;return n?i>u?!1:lt(o.id.componentPath??[],ry(e.componentPath??[]),ex(([s,c])=>s===c)):vx.equals(o.id.componentPath,e.componentPath)}))}function mx(t,e,n){return[]}function gx(t){return lt(t,en(e=>{const n=lt(e.id.componentPath,ke,Jn(i=>i.length===0),io(()=>!0)),r=lt(e.id.sharedConfigurationModelId,ke,Tf(()=>!0,()=>!1));return n&&r}))}function bx(t,e){return lt(vy(t),sr(n=>fx(n,e)),oy,Ni(n=>ke(n)))}function Sx(t,e){return lt(my(t),en(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),sr(n=>dx(n)),Ni(n=>ke(n)))}function Cx(t,e){return lt(gy(t),en(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),sr(n=>hx(n)),Ni(n=>ke(n)))}function wx(t,e){return lt(yy(t),en(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),sr(n=>px(n)),Ni(n=>ke(n)))}function vy(t){return lt(t.attributes,en(dy))}function yy(t){return lt(t.attributes,en(py))}function my(t){return lt(t.attributes,en(hy))}function gy(t){return lt(t.attributes,en(fy))}function Tx(t,e){return lt(ka(t,e),bo)}function Ix(t,e){return lt(by(t,e),bo)}function Ex(t,e,n){return lt(by(t,e),Jn(r=>r.values),HE(Jv(ny(r=>r.id===n))),bo)}function xx(t,e){return lt(ka(t,e),Jr(hy),bo)}function Ax(t,e){return lt(ka(t,e),Jr(fy),bo)}function $x(t,e){return lt(ka(t,e),Jr(py),bo)}function ka(t,e){return lt(t.attributes,ny(n=>So.equals(n.id,e)))}function by(t,e){return lt(ka(t,e),Jr(dy))}const Co=Object.freeze(Object.defineProperty({__proto__:null,filterAttributesOfComponent:yx,filterAttributesOfRoot:gx,filterAttributesOfShared:mx,getAttribute:Tx,getBooleanAttribute:Ax,getBooleanAttributes:gy,getBooleanDecisions:Cx,getChoiceAttribute:Ix,getChoiceAttributes:vy,getChoiceDecisions:bx,getChoiceValue:Ex,getComponentAttribute:$x,getComponentAttributes:yy,getComponentDecisions:wx,getNumericAttribute:xx,getNumericAttributes:my,getNumericDecisions:Sx},Symbol.toStringTag,{value:"Module"}));cy.whyIsNotSatisfied,ly.configuration;const Jd=So.equals;ox.equals;ax.equals;function fl(t){return Kn((e,n)=>{const r=e==null,i=n==null;return r&&i||!r&&!i&&t.equals(e,n)})}const Sy=R.createContext(null),Cy=R.createContext(null),wy=R.createContext(null),Ty=R.createContext(null),xf=()=>R.useContext(Sy),wo=()=>R.useContext(Ty),Iy="The configuration is not initialized. Consider using the ConfigurationSuspender or unload components manually that make use of any unsafe hook while the configuration is initializing. Check the hooks documentation to see if it is safe to use while the configuration is initializing.";function Af(t){if(!t)throw new Error(Iy)}function To(t){if(!t)throw new Error(Iy)}function Ua(){const t=xf();return Af(t),R.useMemo(()=>({makeDecision:e=>t.makeDecision(e),setManyDecision:(e,n)=>t.setMany(e,n)}),[t])}var xu=function(t){return function(e){return Yv(t(e))}};const Dx=xu(t=>t.type===Ue.Choice?Kr(t):qn),Ox=xu(t=>t.type===Ue.Numeric?Kr(t):qn),Nx=xu(t=>t.type===Ue.Boolean?Kr(t):qn),Px=xu(t=>t.type===Ue.Component?Kr(t):qn);function Au(t){return t.decision!=null&&t.decision.kind===Eu.Explicit}function Ey(t){return lt(t.values,en(Au),sr(e=>({type:Ue.Choice,attributeId:t.id,choiceValueId:e.id,state:null})))}function Mx(t){return lt(t,Tu(Au),Jn(()=>({type:Ue.Numeric,attributeId:t.id,state:null})))}function Rx(t){return lt(t,Tu(Au),Jn(()=>({type:Ue.Boolean,attributeId:t.id,state:null})))}function _x(t){return lt(t,Tu(Au),Jn(()=>({type:Ue.Component,attributeId:t.id,state:null})))}function jx(t,e){return lt(Co.filterAttributesOfComponent(e,t,!0),n=>[lt(n,en(Dx),nx(Ey)),lt(n,en(Ox),sr(Mx),Sc),lt(n,en(Nx),sr(Rx),Sc),lt(n,en(Px),sr(_x),Sc)],oy)}function qx(t,e){const n=wo();return To(n),R.useMemo(()=>lt(ke(t),Jn(Jv(sr(r=>Co.getAttribute(n,r)),e??!1?qa:Ni(ke))),io(()=>n.attributes)),[t,n,e])}function kx(t){const e=wo(),{makeDecision:n,setManyDecision:r}=Ua();To(e);const i=Co.getChoiceAttribute(e,t),o=R.useMemo(()=>({makeDecision:(u,s)=>n({type:Ue.Choice,attributeId:t,choiceValueId:u,state:s}),clearDecisions:lt(i,ke,Jn(Ey),Jr(ey),Jn(u=>()=>r(u,{type:"Default"})),io(()=>()=>Promise.resolve()))}),[t,i,n,r]),a=R.useMemo(()=>({...o,attribute:i}),[i,o]);if(i)return a}function Ux(t){const e=wo(),{makeDecision:n}=Ua();To(e);const r=Co.getNumericAttribute(e,t),i=R.useMemo(()=>({makeDecision:a=>n({type:Ue.Numeric,attributeId:t,state:a})}),[t,n]),o=R.useMemo(()=>({...i,attribute:r}),[r,i]);if(r)return o}function Bx(t){const e=wo(),{makeDecision:n}=Ua();To(e);const r=Co.getBooleanAttribute(e,t),i=R.useMemo(()=>({makeDecision:a=>n({type:Ue.Boolean,attributeId:t,state:a})}),[t,n]),o=R.useMemo(()=>({...i,attribute:r}),[r,i]);if(r)return o}function Vx(t){const e=wo(),{makeDecision:n,setManyDecision:r}=Ua();To(e);const i=e.attributes,o=Co.getComponentAttribute(e,t),a=R.useMemo(()=>({makeDecision:s=>n({type:Ue.Component,attributeId:t,state:s}),clearSubtree:lt(jx(t,i),Tu(ey),Jn(s=>()=>r(s,{type:"Default"})),io(()=>()=>Promise.resolve()))}),[t,n,i,r]),u=R.useMemo(()=>({...a,attribute:o}),[o,a]);if(o)return u}const Fx=Kn((t,e)=>rx(We).equals(t??{},e??{})),Lx=Wr({attributeId:Kn(Jd),decisions:Ef(Kn(Jd))}),Gx=Kn((t,e)=>Ef(Lx).equals(t??[],e??[])),Cc=Wr({configurationModelSource:Kn((t,e)=>AT(t,e)),attributeRelations:Gx,usageRuleParameters:Fx}),zx=Qv,wc=fl(zx),Hx=()=>gf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{desiredClient:null,desiredSessionContext:null,actualClient:null,session:null,sessionCreationError:null,sessionUpdateError:null,hasEverSuccessfullyCreatedSession:!1},initial:"ProcessChanges",on:{ChangeConfigurationClient:{actions:["saveDesiredClient"]},ChangeSessionContext:{actions:["saveDesiredSessionContext"]}},exit:[fn("Shutting down","SessionManagement:"),"disposeOldSession"],states:{ProcessChanges:{entry:[fn("Entering ProcessChanges","SessionManagement:"),qi(2)],always:[{target:"DisposeSession",cond:"shallDisposeSession"},{target:"CreateSession",cond:"shallCreateSession"},{target:"UpdateSession",cond:"shallUpdateSession"}]},DisposeSession:{entry:[fn("Entering DisposeSession","SessionManagement:"),qi(2)],always:{actions:["disposeOldSession"],target:"ProcessChanges"}},CreateSession:{entry:[fn("Entering CreateSession","SessionManagement:"),qi(0)],invoke:{id:"getNewSession",src:"createSession",onDone:{actions:["setSessionCreationResult","setHasEverSuccessfullyCreatedSession"],target:"ProcessChanges"},onError:{actions:"setSessionCreationError",target:"SessionCreationFailed"}}},SessionCreationFailed:{entry:[fn("Entering SessionCreationFailed","SessionManagement:"),qi(2)],always:{target:"ProcessChanges",cond:"shallImmediatelyProcessChangesAfterSessionCreationError"},exit:[fn("Exiting SessionCreationFailed","SessionManagement:"),"clearSessionCreationError"],on:{RetrySessionCreation:{target:"ProcessChanges",actions:fn("Retrying session creation","SessionManagement:")}}},UpdateSession:{entry:[fn("Entering UpdateSession","SessionManagement:"),qi(1)],invoke:{id:"updateExistingSession",src:"updateSession",onDone:{target:"ProcessChanges"},onError:{actions:"setSessionUpdateError",target:"SessionUpdateFailed"}}},SessionUpdateFailed:{entry:[fn("Entering SessionUpdateFailed","SessionManagement:"),qi(2)],always:{target:"ProcessChanges",cond:"shallImmediatelyProcessChangesAfterSessionUpdateError"},exit:[fn("Exiting SessionUpdateFailed","SessionManagement:"),"clearSessionUpdateError"],on:{RetrySessionUpdate:{target:"ProcessChanges",actions:fn("Retrying session update","SessionManagement:")}}}}},{actions:{saveDesiredClient:Ye({desiredClient:(t,e)=>e.client}),saveDesiredSessionContext:Ye({desiredSessionContext:(t,e)=>e.sessionContext}),disposeOldSession:Ye((t,e)=>(t.session&&t.session.close().then(ME).catch(n=>{}),{session:null,actualClient:null})),setSessionCreationResult:Ye((t,e)=>({session:e.data.session,actualClient:e.data.client})),setSessionCreationError:Ye((t,e)=>({sessionCreationError:e.data})),clearSessionCreationError:Ye({sessionCreationError:()=>null}),setSessionUpdateError:Ye((t,e)=>({sessionUpdateError:e.data})),clearSessionUpdateError:Ye({sessionUpdateError:()=>null}),setHasEverSuccessfullyCreatedSession:Ye({hasEverSuccessfullyCreatedSession:()=>!0})},services:{createSession:t=>t.desiredClient.createSession(t.desiredSessionContext).then(e=>({session:e,client:t.desiredClient})).catch(e=>Promise.reject({type:e.type,client:t.desiredClient,sessionContext:t.desiredSessionContext})),updateSession:t=>t.session.setSessionContext(t.desiredSessionContext).catch(e=>Promise.reject({type:e.type,sessionContext:t.desiredSessionContext}))},guards:{shallDisposeSession:t=>t.session!=null&&(t.desiredSessionContext==null||t.desiredClient==null||!wc.equals(t.actualClient,t.desiredClient)),shallCreateSession:t=>t.session==null&&t.desiredClient!=null&&t.desiredSessionContext!=null,shallUpdateSession:t=>t.session!=null&&!Cc.equals(t.session.getSessionContext(),t.desiredSessionContext),shallImmediatelyProcessChangesAfterSessionCreationError:t=>!wc.equals(t.desiredClient,t.sessionCreationError.client)||!fl(Cc).equals(t.desiredSessionContext,t.sessionCreationError.sessionContext),shallImmediatelyProcessChangesAfterSessionUpdateError:t=>!wc.equals(t.desiredClient,t.actualClient)||!fl(Cc).equals(t.desiredSessionContext,t.sessionUpdateError.sessionContext)}});function qi(t){const e=t===0,n=t===1;return mE((r,i)=>{const o={isInitializing:(!r.hasEverSuccessfullyCreatedSession||e)&&r.sessionCreationError==null,errorType:r.sessionCreationError&&r.sessionCreationError.type},a={isUpdating:n&&r.sessionUpdateError==null,errorType:r.sessionUpdateError&&r.sessionUpdateError.type};return Uv({type:"SessionManagementStateChanged",sessionInitialization:o,sessionUpdating:a,session:r.session})})}const Wx=t=>e=>(e({type:"ConfigurationChanged",session:t,configuration:t.getConfiguration()}),t.setOnConfigurationChangedHandler(n=>{e({type:"ConfigurationChanged",session:t,configuration:n})}),()=>{t.setOnConfigurationChangedHandler(null)}),Kx=()=>gf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{session:null},on:{ConfigurationChanged:{actions:[Uv((t,e)=>e)]}},initial:"ProcessChanges",states:{ProcessChanges:{entry:[fn("Entering ProcessChanges","ConfigurationSubscriptionManagement:")],on:{ChangeSession:{actions:["saveSession"]}},always:[{target:"Subscribe",cond:(t,e)=>t.session!=null}]},Subscribe:{entry:[fn("Entering Subscribe","ConfigurationSubscriptionManagement:")],on:{ChangeSession:{target:"ProcessChanges",cond:(t,e)=>e.session==null||t.session!==e.session,actions:["saveSession"]}},invoke:{id:"configurationSubscriptionActor",src:(t,e)=>Wx(t.session)}}}},{actions:{saveSession:Ye((t,e)=>({session:e.session}))}}),Jx=()=>{let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}},Yd=()=>{const t=Jx();return{capsule:{promise:t.promise},resolve:t.resolve,reject:t.reject}},Yx=()=>gf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{sessionManagementActor:null,configurationSubscriptionManagementActor:null,sessionInitialization:null,sessionUpdating:null,session:null,configuration:null,isReadyPromise:Yd()},entry:[Ye({sessionManagementActor:()=>Bd(Hx()),configurationSubscriptionManagementActor:()=>Bd(Kx())})],exit:[Fd(t=>t.sessionManagementActor),Fd(t=>t.configurationSubscriptionManagementActor)],on:{ChangeConfigurationClient:{actions:[es(t=>t.sessionManagementActor)]},ChangeSessionContext:{actions:[es(t=>t.sessionManagementActor)]},RetrySessionCreation:{actions:[es(t=>t.sessionManagementActor)]},RetrySessionUpdate:{actions:[es(t=>t.sessionManagementActor)]},SessionManagementStateChanged:{actions:[Ye((t,e)=>({session:e.session,sessionInitialization:e.sessionInitialization,sessionUpdating:e.sessionUpdating})),xI(t=>({type:"ChangeSession",session:t.session}),{to:t=>t.configurationSubscriptionManagementActor}),"calculateReadyState"]},ConfigurationChanged:{actions:[Ye((t,e)=>({configuration:{session:e.session,configuration:e.configuration}})),"calculateReadyState"]}},initial:"Idle",states:{Idle:{}}},{actions:{calculateReadyState:Ye((t,e)=>{var n;const r=!((n=t.sessionInitialization)!=null&&n.isInitializing)&&t.session!=null&&t.configuration!=null&&t.configuration.session===t.session;return t.isReadyPromise&&r&&(t.isReadyPromise.resolve(),t.isReadyPromise.capsule.promise=null),{isReadyPromise:(()=>r?null:t.isReadyPromise!=null?t.isReadyPromise:Yd())()}})}});function Xx(t){var e,n;const[r,i]=OE(Yx,{logger:(...s)=>console.log("ConfigurationManagement:",...s)});R.useEffect(()=>{i({type:"ChangeConfigurationClient",client:t.configuratorClient}),t.configuratorClient||console.warn("The configurator client is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass a valid client.")},[t.configuratorClient]),R.useEffect(()=>{const s=lt(ke(t.sessionContext),WE(c=>ke(c.configurationModelSource)),Iu);i({type:"ChangeSessionContext",sessionContext:s}),s||console.warn("The session context is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass valid session context data.")},[t.sessionContext]);const o=R.useMemo(()=>{var s,c,l,d;return{isInitializing:((c=(s=r.context.isReadyPromise)==null?void 0:s.capsule)==null?void 0:c.promise)!=null,isInitializingPromise:(l=r.context.isReadyPromise)==null?void 0:l.capsule,error:((d=r.context.sessionInitialization)==null?void 0:d.errorType)&&{type:r.context.sessionInitialization.errorType,retry:()=>i({type:"RetrySessionCreation"})}}},[r.context.sessionInitialization,r.context.isReadyPromise]),a=R.useMemo(()=>{var s,c;return{isUpdating:(s=r.context.sessionUpdating)==null?void 0:s.isUpdating,error:((c=r.context.sessionUpdating)==null?void 0:c.errorType)&&{type:r.context.sessionUpdating.errorType,retry:()=>i({type:"RetrySessionUpdate"})}}},[r.context.sessionUpdating]),u=((e=r.context.configuration)==null?void 0:e.session)===r.context.session?(n=r.context.configuration)==null?void 0:n.configuration:null;return{configurationInitialization:o,configurationUpdating:a,session:r.context.session,configuration:u}}function Zx(t){const{configurationInitialization:e,configurationUpdating:n,session:r,configuration:i}=Xx({configuratorClient:t.configuratorClient,sessionContext:t});return X.jsx(Cy.Provider,{value:e,children:X.jsx(wy.Provider,{value:n,children:X.jsx(Sy.Provider,{value:r,children:X.jsx(Ty.Provider,{value:i,children:t.children})})})})}function xy(){return R.useContext(Cy)}function Qx(){return R.useContext(wy)}function t0(t){const{children:e}=t,{isInitializingPromise:n}=xy();if(n!=null&&n.promise)throw n.promise;return X.jsx(X.Fragment,{children:e})}function e0(){const t=xf();return Af(t),R.useMemo(()=>({}),[t])}function n0(){const t=xf(),e=wo();return Af(t),To(e),R.useMemo(()=>({configuration:e,restoreConfiguration:n=>t.restoreConfiguration(n)}),[e,t])}const r0=Object.freeze(Object.defineProperty({__proto__:null,Configuration:Zx,ConfigurationSuspender:t0,useAttributes:qx,useBooleanAttribute:Bx,useChoiceAttribute:kx,useComponentAttribute:Vx,useConfiguration:n0,useConfigurationInitialization:xy,useConfigurationUpdating:Qx,useDecision:Ua,useExplain:e0,useNumericAttribute:Ux},Symbol.toStringTag,{value:"Module"})),tn=Symbol.for("@ts-pattern/matcher"),Ay=Symbol.for("@ts-pattern/isVariadic"),Ls="@ts-pattern/anonymous-select-key",dl=t=>!!(t&&typeof t=="object"),Ss=t=>t&&!!t[tn],qe=(t,e,n)=>{if(Ss(t)){const r=t[tn](),{matched:i,selections:o}=r.match(e);return i&&o&&Object.keys(o).forEach(a=>n(a,o[a])),i}if(dl(t)){if(!dl(e))return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let r=[],i=[],o=[];for(const a of t.keys()){const u=t[a];Ss(u)&&u[Ay]?o.push(u):o.length?i.push(u):r.push(u)}if(o.length){if(o.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(e.length<r.length+i.length)return!1;const a=e.slice(0,r.length),u=i.length===0?[]:e.slice(-i.length),s=e.slice(r.length,i.length===0?1/0:-i.length);return r.every((c,l)=>qe(c,a[l],n))&&i.every((c,l)=>qe(c,u[l],n))&&(o.length===0||qe(o[0],s,n))}return t.length===e.length&&t.every((a,u)=>qe(a,e[u],n))}return Object.keys(t).every(r=>{const i=t[r];return(r in e||Ss(o=i)&&o[tn]().matcherType==="optional")&&qe(i,e[r],n);var o})}return Object.is(e,t)},vn=t=>{var e,n,r;return dl(t)?Ss(t)?(e=(n=(r=t[tn]()).getSelectionKeys)==null?void 0:n.call(r))!=null?e:[]:Array.isArray(t)?Sa(t,vn):Sa(Object.values(t),vn):[]},Sa=(t,e)=>t.reduce((n,r)=>n.concat(e(r)),[]);function i0(...t){if(t.length===1){const[e]=t;return n=>qe(e,n,()=>{})}if(t.length===2){const[e,n]=t;return qe(e,n,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`)}function Ve(t){return Object.assign(t,{optional:()=>$f(t),and:e=>Yt(t,e),or:e=>$y(t,e),select:e=>e===void 0?Ca(t):Ca(e,t)})}function hl(t){return Object.assign((e=>Object.assign(e,{*[Symbol.iterator](){yield Object.assign(e,{[Ay]:!0})}}))(t),{optional:()=>hl($f(t)),select:e=>hl(e===void 0?Ca(t):Ca(e,t))})}function $f(t){return Ve({[tn]:()=>({match:e=>{let n={};const r=(i,o)=>{n[i]=o};return e===void 0?(vn(t).forEach(i=>r(i,void 0)),{matched:!0,selections:n}):{matched:qe(t,e,r),selections:n}},getSelectionKeys:()=>vn(t),matcherType:"optional"})})}const o0=(t,e)=>{for(const n of t)if(!e(n))return!1;return!0},a0=(t,e)=>{for(const[n,r]of t.entries())if(!e(r,n))return!1;return!0};function Yt(...t){return Ve({[tn]:()=>({match:e=>{let n={};const r=(i,o)=>{n[i]=o};return{matched:t.every(i=>qe(i,e,r)),selections:n}},getSelectionKeys:()=>Sa(t,vn),matcherType:"and"})})}function $y(...t){return Ve({[tn]:()=>({match:e=>{let n={};const r=(i,o)=>{n[i]=o};return Sa(t,vn).forEach(i=>r(i,void 0)),{matched:t.some(i=>qe(i,e,r)),selections:n}},getSelectionKeys:()=>Sa(t,vn),matcherType:"or"})})}function Nt(t){return{[tn]:()=>({match:e=>({matched:!!t(e)})})}}function Ca(...t){const e=typeof t[0]=="string"?t[0]:void 0,n=t.length===2?t[1]:typeof t[0]=="string"?void 0:t[0];return Ve({[tn]:()=>({match:r=>{let i={[e??Ls]:r};return{matched:n===void 0||qe(n,r,(o,a)=>{i[o]=a}),selections:i}},getSelectionKeys:()=>[e??Ls].concat(n===void 0?[]:vn(n))})})}function Vn(t){return typeof t=="number"}function si(t){return typeof t=="string"}function wr(t){return typeof t=="bigint"}const Dy=Ve(Nt(function(t){return!0})),s0=Dy,ui=t=>Object.assign(Ve(t),{startsWith:e=>{return ui(Yt(t,(n=e,Nt(r=>si(r)&&r.startsWith(n)))));var n},endsWith:e=>{return ui(Yt(t,(n=e,Nt(r=>si(r)&&r.endsWith(n)))));var n},minLength:e=>ui(Yt(t,(n=>Nt(r=>si(r)&&r.length>=n))(e))),maxLength:e=>ui(Yt(t,(n=>Nt(r=>si(r)&&r.length<=n))(e))),includes:e=>{return ui(Yt(t,(n=e,Nt(r=>si(r)&&r.includes(n)))));var n},regex:e=>{return ui(Yt(t,(n=e,Nt(r=>si(r)&&!!r.match(n)))));var n}}),u0=ui(Nt(si)),Fn=t=>Object.assign(Ve(t),{between:(e,n)=>Fn(Yt(t,((r,i)=>Nt(o=>Vn(o)&&r<=o&&i>=o))(e,n))),lt:e=>Fn(Yt(t,(n=>Nt(r=>Vn(r)&&r<n))(e))),gt:e=>Fn(Yt(t,(n=>Nt(r=>Vn(r)&&r>n))(e))),lte:e=>Fn(Yt(t,(n=>Nt(r=>Vn(r)&&r<=n))(e))),gte:e=>Fn(Yt(t,(n=>Nt(r=>Vn(r)&&r>=n))(e))),int:()=>Fn(Yt(t,Nt(e=>Vn(e)&&Number.isInteger(e)))),finite:()=>Fn(Yt(t,Nt(e=>Vn(e)&&Number.isFinite(e)))),positive:()=>Fn(Yt(t,Nt(e=>Vn(e)&&e>0))),negative:()=>Fn(Yt(t,Nt(e=>Vn(e)&&e<0)))}),c0=Fn(Nt(Vn)),Tr=t=>Object.assign(Ve(t),{between:(e,n)=>Tr(Yt(t,((r,i)=>Nt(o=>wr(o)&&r<=o&&i>=o))(e,n))),lt:e=>Tr(Yt(t,(n=>Nt(r=>wr(r)&&r<n))(e))),gt:e=>Tr(Yt(t,(n=>Nt(r=>wr(r)&&r>n))(e))),lte:e=>Tr(Yt(t,(n=>Nt(r=>wr(r)&&r<=n))(e))),gte:e=>Tr(Yt(t,(n=>Nt(r=>wr(r)&&r>=n))(e))),positive:()=>Tr(Yt(t,Nt(e=>wr(e)&&e>0))),negative:()=>Tr(Yt(t,Nt(e=>wr(e)&&e<0)))}),l0=Tr(Nt(wr)),f0=Ve(Nt(function(t){return typeof t=="boolean"})),d0=Ve(Nt(function(t){return typeof t=="symbol"})),h0=Ve(Nt(function(t){return t==null}));var Mt={__proto__:null,matcher:tn,optional:$f,array:function(...t){return hl({[tn]:()=>({match:e=>{if(!Array.isArray(e))return{matched:!1};if(t.length===0)return{matched:!0};const n=t[0];let r={};if(e.length===0)return vn(n).forEach(o=>{r[o]=[]}),{matched:!0,selections:r};const i=(o,a)=>{r[o]=(r[o]||[]).concat([a])};return{matched:e.every(o=>qe(n,o,i)),selections:r}},getSelectionKeys:()=>t.length===0?[]:vn(t[0])})})},set:function(...t){return Ve({[tn]:()=>({match:e=>{if(!(e instanceof Set))return{matched:!1};let n={};if(e.size===0)return{matched:!0,selections:n};if(t.length===0)return{matched:!0};const r=(o,a)=>{n[o]=(n[o]||[]).concat([a])},i=t[0];return{matched:o0(e,o=>qe(i,o,r)),selections:n}},getSelectionKeys:()=>t.length===0?[]:vn(t[0])})})},map:function(...t){return Ve({[tn]:()=>({match:e=>{if(!(e instanceof Map))return{matched:!1};let n={};if(e.size===0)return{matched:!0,selections:n};const r=(u,s)=>{n[u]=(n[u]||[]).concat([s])};if(t.length===0)return{matched:!0};var i;if(t.length===1)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(i=t[0])==null?void 0:i.toString()}`);const[o,a]=t;return{matched:a0(e,(u,s)=>{const c=qe(o,s,r),l=qe(a,u,r);return c&&l}),selections:n}},getSelectionKeys:()=>t.length===0?[]:[...vn(t[0]),...vn(t[1])]})})},intersection:Yt,union:$y,not:function(t){return Ve({[tn]:()=>({match:e=>({matched:!qe(t,e,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:Nt,select:Ca,any:Dy,_:s0,string:u0,number:c0,bigint:l0,boolean:f0,symbol:d0,nullish:h0,instanceOf:function(t){return Ve(Nt(function(e){return n=>n instanceof e}(t)))},shape:function(t){return Ve(Nt(i0(t)))}};const pl={matched:!1,value:void 0};function H(t){return new p0(t,pl)}let p0=class vl{constructor(e,n){this.input=void 0,this.state=void 0,this.input=e,this.state=n}with(...e){if(this.state.matched)return this;const n=e[e.length-1],r=[e[0]];let i;e.length===3&&typeof e[1]=="function"?i=e[1]:e.length>2&&r.push(...e.slice(1,e.length-1));let o=!1,a={};const u=(c,l)=>{o=!0,a[c]=l},s=!r.some(c=>qe(c,this.input,u))||i&&!i(this.input)?pl:{matched:!0,value:n(o?Ls in a?a[Ls]:a:this.input,this.input)};return new vl(this.input,s)}when(e,n){if(this.state.matched)return this;const r=!!e(this.input);return new vl(this.input,r?{matched:!0,value:n(this.input,this.input)}:pl)}otherwise(e){return this.state.matched?this.state.value:e(this.input)}exhaustive(){if(this.state.matched)return this.state.value;let e;try{e=JSON.stringify(this.input)}catch{e=this.input}throw new Error(`Pattern matching error: no pattern matches value ${e}`)}run(){return this.exhaustive()}returnType(){return this}};var Gs=Symbol("@ts-pattern/matcher"),Xd="@ts-pattern/anonymous-select-key",Zd=function(t){return!!(t&&typeof t=="object")},Tc=function(t){return t&&!!t[Gs]},v0=function t(e,n,r){if(Zd(e)){if(Tc(e)){var i=e[Gs]().match(n),o=i.matched,a=i.selections;return o&&a&&Object.keys(a).forEach(function(s){return r(s,a[s])}),o}if(!Zd(n))return!1;if(Array.isArray(e))return!!Array.isArray(n)&&e.length===n.length&&e.every(function(s,c){return t(s,n[c],r)});if(e instanceof Map)return n instanceof Map&&Array.from(e.keys()).every(function(s){return t(e.get(s),n.get(s),r)});if(e instanceof Set){if(!(n instanceof Set))return!1;if(e.size===0)return n.size===0;if(e.size===1){var u=Array.from(e.values())[0];return Tc(u)?Array.from(n.values()).every(function(s){return t(u,s,r)}):n.has(u)}return Array.from(e.values()).every(function(s){return n.has(s)})}return Object.keys(e).every(function(s){var c,l=e[s];return(s in n||Tc(c=l)&&c[Gs]().matcherType==="optional")&&t(l,n[s],r)})}return Object.is(n,e)};function Pi(t){var e;return(e={})[Gs]=function(){return{match:function(n){return{matched:!!t(n)}}}},e}Pi(function(t){return!0});Pi(function(t){return typeof t=="string"});Pi(function(t){return typeof t=="number"});Pi(function(t){return typeof t=="boolean"});Pi(function(t){return typeof t=="bigint"});Pi(function(t){return typeof t=="symbol"});Pi(function(t){return t==null});function y0(t){return new m0(t,[])}var m0=function(){function t(n,r){this.value=void 0,this.cases=void 0,this.value=n,this.cases=r}var e=t.prototype;return e.with=function(){var n=[].slice.call(arguments),r=n[n.length-1],i=[n[0]],o=[];return n.length===3&&typeof n[1]=="function"?(i.push(n[0]),o.push(n[1])):n.length>2&&i.push.apply(i,n.slice(1,n.length-1)),new t(this.value,this.cases.concat([{match:function(a){var u={},s=!!(i.some(function(c){return v0(c,a,function(l,d){u[l]=d})})&&o.every(function(c){return c(a)}));return{matched:s,value:s&&Object.keys(u).length?Xd in u?u[Xd]:u:a}},handler:r}]))},e.when=function(n,r){return new t(this.value,this.cases.concat([{match:function(i){return{matched:!!n(i),value:i}},handler:r}]))},e.otherwise=function(n){return new t(this.value,this.cases.concat([{match:function(r){return{matched:!0,value:r}},handler:n}])).run()},e.exhaustive=function(){return this.run()},e.run=function(){for(var n=this.value,r=void 0,i=0;i<this.cases.length;i++){var o=this.cases[i],a=o.match(this.value);if(a.matched){n=a.value,r=o.handler;break}}if(!r){var u;try{u=JSON.stringify(this.value)}catch{u=this.value}throw new Error("Pattern matching error: no pattern matches value "+u)}return r(n,this.value)},t}();function Oy(t){return function(n,r,i,o,a,u,s){return t(n,r,s)}}function $u(t){return function(n,r,i,o){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i,o);var a=o.get(n),u=o.get(r);if(a&&u)return a===r&&u===n;o.set(n,r),o.set(r,n);var s=t(n,r,i,o);return o.delete(n),o.delete(r),s}}function Ny(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n}function Qd(t){return t.constructor===Object||t.constructor==null}function th(t){return typeof t.then=="function"}function Du(t,e){return t===e||t!==t&&e!==e}var g0="[object Arguments]",b0="[object Boolean]",S0="[object Date]",C0="[object RegExp]",w0="[object Map]",T0="[object Number]",I0="[object Object]",E0="[object Set]",x0="[object String]",eh=Object.prototype.toString;function Ou(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.areRegExpsEqual,a=t.areSetsEqual,u=t.createIsNestedEqual,s=u(c);function c(l,d,f){if(l===d)return!0;if(!l||!d||typeof l!="object"||typeof d!="object")return l!==l&&d!==d;if(Qd(l)&&Qd(d))return i(l,d,s,f);var h=Array.isArray(l),v=Array.isArray(d);if(h||v)return h===v&&e(l,d,s,f);var p=eh.call(l);return p!==eh.call(d)?!1:p===S0?n(l,d,s,f):p===C0?o(l,d,s,f):p===w0?r(l,d,s,f):p===E0?a(l,d,s,f):p===I0||p===g0?th(l)||th(d)?!1:i(l,d,s,f):p===b0||p===T0||p===x0?Du(l.valueOf(),d.valueOf()):!1}return c}function Py(t,e,n,r){var i=t.length;if(e.length!==i)return!1;for(;i-- >0;)if(!n(t[i],e[i],i,i,t,e,r))return!1;return!0}var A0=$u(Py);function My(t,e){return Du(t.valueOf(),e.valueOf())}function Ry(t,e,n,r){var i=t.size===e.size;if(!i)return!1;if(!t.size)return!0;var o={},a=0;return t.forEach(function(u,s){if(i){var c=!1,l=0;e.forEach(function(d,f){!c&&!o[l]&&(c=n(s,f,a,l,t,e,r)&&n(u,d,s,f,t,e,r))&&(o[l]=!0),l++}),a++,i=c}}),i}var $0=$u(Ry),D0="_owner",O0=Object.prototype.hasOwnProperty;function _y(t,e,n,r){var i=Object.keys(t),o=i.length;if(Object.keys(e).length!==o)return!1;for(var a;o-- >0;){if(a=i[o],a===D0){var u=!!t.$$typeof,s=!!e.$$typeof;if((u||s)&&u!==s)return!1}if(!O0.call(e,a)||!n(t[a],e[a],a,a,t,e,r))return!1}return!0}var N0=$u(_y);function jy(t,e){return t.source===e.source&&t.flags===e.flags}function qy(t,e,n,r){var i=t.size===e.size;if(!i)return!1;if(!t.size)return!0;var o={};return t.forEach(function(a,u){if(i){var s=!1,c=0;e.forEach(function(l,d){!s&&!o[c]&&(s=n(a,l,u,d,t,e,r))&&(o[c]=!0),c++}),i=s}}),i}var P0=$u(qy),ky=Object.freeze({areArraysEqual:Py,areDatesEqual:My,areMapsEqual:Ry,areObjectsEqual:_y,areRegExpsEqual:jy,areSetsEqual:qy,createIsNestedEqual:Oy}),Uy=Object.freeze({areArraysEqual:A0,areDatesEqual:My,areMapsEqual:$0,areObjectsEqual:N0,areRegExpsEqual:jy,areSetsEqual:P0,createIsNestedEqual:Oy}),M0=Ou(ky);function R0(t,e){return M0(t,e,void 0)}Ou(Ny(ky,{createIsNestedEqual:function(){return Du}}));Ou(Uy);Ou(Ny(Uy,{createIsNestedEqual:function(){return Du}}));/*! *****************************************************************************
67
+ */var Wd;function wE(){return Wd||(Wd=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=R,e=Hv();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,s=t.useDebugValue;function c(l,d,f,h,v){var p=o(null),S;p.current===null?(S={hasValue:!1,value:null},p.current=S):S=p.current;var C=u(function(){var x=!1,b,E,P=function($){if(!x){x=!0,b=$;var z=h($);if(v!==void 0&&S.hasValue){var Z=S.value;if(v(Z,z))return E=Z,Z}return E=z,z}var Vt=b,bt=E;if(r(Vt,$))return bt;var J=h($);return v!==void 0&&v(bt,J)?bt:(b=$,E=J,J)},A=f===void 0?null:f,U=function(){return P(d())},M=A===null?void 0:function(){return P(A())};return[U,M]},[d,f,h,v]),w=C[0],T=C[1],I=i(l,w,T);return a(function(){S.hasValue=!0,S.value=I},[I]),s(I),I}bc.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),bc}process.env.NODE_ENV==="production"?ll.exports=CE():ll.exports=wE();var TE=ll.exports,IE=R.useLayoutEffect;function Kd(t){var e=pp.useRef();return e.current||(e.current={v:t()}),e.current.v}var Fs=globalThis&&globalThis.__assign||function(){return Fs=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Fs.apply(this,arguments)},EE=globalThis&&globalThis.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},xE=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o};function AE(t,e){var n=Kd(function(){return typeof t=="function"?t():t});if(process.env.NODE_ENV!=="production"&&typeof t!="function"){var r=xE(R.useState(n),1),i=r[0];t!==i&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var o=e.context,a=e.guards,u=e.actions,s=e.activities,c=e.services,l=e.delays;e.state;var d=EE(e,["context","guards","actions","activities","services","delays","state"]),f=Kd(function(){var h={context:o,guards:a,actions:u,activities:s,services:c,delays:l},v=n.withConfig(h,function(){return Fs(Fs({},n.context),o)});return kv(v,d)});return IE(function(){Object.assign(f.machine.options.actions,u),Object.assign(f.machine.options.guards,a),Object.assign(f.machine.options.activities,s),Object.assign(f.machine.options.services,c),Object.assign(f.machine.options.delays,l)},[u,a,s,c,l]),f}globalThis&&globalThis.__read;globalThis&&globalThis.__values;function $E(t,e,n){if(t.status===ae.NotStarted)return!0;var r=n.changed===void 0&&(Object.keys(n.children).length>0||typeof e.changed=="boolean");return!(n.changed||r)}var DE=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o};function OE(t){return t}function NE(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=DE(e,1),i=r[0],o=i===void 0?{}:i,a=AE(t,o),u=R.useCallback(function(){return a.status===ae.NotStarted?o.state?mn.create(o.state):a.machine.initialState:a.getSnapshot()},[a]),s=R.useCallback(function(d,f){return $E(a,d,f)},[a]),c=R.useCallback(function(d){var f=a.subscribe(d).unsubscribe;return f},[a]),l=TE.useSyncExternalStoreWithSelector(c,u,u,OE,s);return R.useEffect(function(){var d=o.state;return a.start(d?mn.create(d):void 0),function(){a.stop(),a.status=ae.NotStarted}},[]),[l,a.send,a]}var PE=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};function qa(t){return t}function Wv(t){return function(){return t}}var ME=Wv(null),Kv=Wv(void 0),RE=Kv;function Yv(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function lt(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return s(u(a(o(i(r(n(e(t))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var wf=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(i){return e.apply(void 0,PE([i],r,!1))}}},Jv=function(t){return t._tag==="Some"},Xv={_tag:"None"},Zv=function(t){return{_tag:"Some",value:t}},_E=function(t){return t.length>0},jE=[],qE=Object.prototype.hasOwnProperty;function kE(t){return function(e,n){return t.chain(e,function(r){return t.map(n(r),function(){return r})})}}var Kn=function(t){return{equals:function(e,n){return e===n||t(e,n)}}},Wr=function(t){return Kn(function(e,n){for(var r in t)if(!t[r].equals(e[r],n[r]))return!1;return!0})},Qv={equals:function(t,e){return t===e}};Qv.equals;var qn=Xv,Kr=Zv;function Tu(t){return function(e){return t(e)?Kr(e):qn}}var UE=function(t,e){return lt(t,Yn(e))},BE=function(t,e){return lt(t,FE(e))},VE="Option",Yn=function(t){return function(e){return wi(e)?qn:Kr(t(e.value))}},FE=function(t){return function(e){return wi(e)||wi(t)?qn:Kr(e.value(t.value))}},ty=wf(2,function(t,e){return wi(t)?qn:e(t.value)}),LE={URI:VE,map:UE,ap:BE,chain:ty},Yr=function(t){return function(e){return wi(e)?qn:t(e.value)?e:qn}},wi=function(t){return t._tag==="None"},GE=function(t,e){return function(n){return wi(n)?t():e(n.value)}},Tf=GE,zE=function(t){return function(e){return wi(e)?t():e.value}},io=zE,HE=wf(2,kE(LE)),ke=function(t){return t==null?qn:Kr(t)},Iu=Tf(ME,qa),bo=Tf(Kv,qa),WE=ty,KE=HE,If={equals:function(t,e){return t===e}};If.equals;If.equals;var YE=jE,JE=_E,XE=function(t){return t.length===0},ey=JE,ZE=function(t){return function(e){if(XE(e))return ex;for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}};function ny(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return Zv(e[n]);return Xv}}var QE=function(t,e,n){for(var r=[],i=Math.min(t.length,e.length),o=0;o<i;o++)r[o]=n(t[o],e[o]);return r};function ry(t,e){return e===void 0?function(n){return ry(n,t)}:QE(t,e,function(n,r){return[n,r]})}var iy=wf(2,function(t,e){return lt(t,ZE(function(n,r){return e(r,n)}))}),oy=iy(qa),sr=function(t){return function(e){return e.map(function(n){return t(n)})}},en=function(t){return function(e){return e.filter(t)}},tx=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Jv(i)&&n.push(i.value)}return n}},Ni=function(t){return tx(function(e,n){return t(n)})},Sc=Ni(qa),Ef=function(t){return Kn(function(e,n){return e.length===n.length&&e.every(function(r,i){return t.equals(r,n[i])})})},ex=YE;function nx(t){return function(e){return e.every(t)}}var rx=iy,We={equals:function(t,e){return t===e}};We.equals;var ay={equals:function(t,e){return t===e}};ay.equals;function sy(t){return function(e,n){if(n===void 0){var r=sy(t);return function(o){return r(o,e)}}for(var i in e)if(!qE.call(n,i)||!t.equals(e[i],n[i]))return!1;return!0}}function ix(t){var e=sy(t);return Kn(function(n,r){return e(n)(r)&&e(r)(n)})}function ox(t){return{equals(e,n){return e==null&&n==null?!0:e==null||n===null||n===void 0?!1:t.equals(e,n)}}}function uy(t){return{equals(e,n){const r=lt(ke(e),io(()=>[])),i=lt(ke(n),io(()=>[]));return Ef(t).equals(r,i)}}}const So=Wr({localId:We,componentPath:uy(We),sharedConfigurationModelId:ox(We)}),ax=Wr({localId:We,configurationModelId:We}),sx=Kn((t,e)=>K({x:t,y:e}).with({x:{type:"Choice"},y:{type:"Choice"}},n=>ux.equals(n.x,n.y)).with({x:{type:"Component"},y:{type:"Component"}},n=>cx.equals(n.x,n.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},n=>lx.equals(n.x,n.y)).with({x:{type:"Boolean"},y:{type:"Boolean"}},n=>fx.equals(n.x,n.y)).otherwise(()=>!1)),ux=Wr({type:We,attributeId:So,state:We,choiceValueId:We}),cx=Wr({type:We,attributeId:So,state:We}),lx=Wr({type:We,attributeId:So,state:If}),fx=Wr({type:We,attributeId:So,state:ay});var cy=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(cy||{}),ly=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(ly||{}),Ue=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(Ue||{}),Eu=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(Eu||{});function dx(t,e){return lt(t.values,Ni(n=>lt(n.decision,ke,Yr(r=>r.kind===e))))}function hx(t){return lt(t.decision,ke,Yr(e=>e.kind===Eu.Explicit),Iu)}function px(t){return lt(t.decision,ke,Yr(e=>e.kind===Eu.Explicit),Iu)}function vx(t){return lt(t.decision,ke,Iu)}const fy=t=>t.type===Ue.Boolean,dy=t=>t.type===Ue.Choice,hy=t=>t.type===Ue.Numeric,py=t=>t.type===Ue.Component,yx=uy(We);function mx(t,e,n){var r;const i=((r=e.componentPath)==null?void 0:r.length)??0;return lt(t,en(o=>{var a;const u=((a=o.id.componentPath)==null?void 0:a.length)??0;return n?i>u?!1:lt(o.id.componentPath??[],ry(e.componentPath??[]),nx(([s,c])=>s===c)):yx.equals(o.id.componentPath,e.componentPath)}))}function gx(t,e,n){return[]}function bx(t){return lt(t,en(e=>{const n=lt(e.id.componentPath,ke,Yn(i=>i.length===0),io(()=>!0)),r=lt(e.id.sharedConfigurationModelId,ke,Tf(()=>!0,()=>!1));return n&&r}))}function Sx(t,e){return lt(vy(t),sr(n=>dx(n,e)),oy,Ni(n=>ke(n)))}function Cx(t,e){return lt(my(t),en(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),sr(n=>hx(n)),Ni(n=>ke(n)))}function wx(t,e){return lt(gy(t),en(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),sr(n=>px(n)),Ni(n=>ke(n)))}function Tx(t,e){return lt(yy(t),en(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),sr(n=>vx(n)),Ni(n=>ke(n)))}function vy(t){return lt(t.attributes,en(dy))}function yy(t){return lt(t.attributes,en(py))}function my(t){return lt(t.attributes,en(hy))}function gy(t){return lt(t.attributes,en(fy))}function Ix(t,e){return lt(ka(t,e),bo)}function Ex(t,e){return lt(by(t,e),bo)}function xx(t,e,n){return lt(by(t,e),Yn(r=>r.values),WE(Yv(ny(r=>r.id===n))),bo)}function Ax(t,e){return lt(ka(t,e),Yr(hy),bo)}function $x(t,e){return lt(ka(t,e),Yr(fy),bo)}function Dx(t,e){return lt(ka(t,e),Yr(py),bo)}function ka(t,e){return lt(t.attributes,ny(n=>So.equals(n.id,e)))}function by(t,e){return lt(ka(t,e),Yr(dy))}const Co=Object.freeze(Object.defineProperty({__proto__:null,filterAttributesOfComponent:mx,filterAttributesOfRoot:bx,filterAttributesOfShared:gx,getAttribute:Ix,getBooleanAttribute:$x,getBooleanAttributes:gy,getBooleanDecisions:wx,getChoiceAttribute:Ex,getChoiceAttributes:vy,getChoiceDecisions:Sx,getChoiceValue:xx,getComponentAttribute:Dx,getComponentAttributes:yy,getComponentDecisions:Tx,getNumericAttribute:Ax,getNumericAttributes:my,getNumericDecisions:Cx},Symbol.toStringTag,{value:"Module"}));cy.whyIsNotSatisfied,ly.configuration;const Yd=So.equals;ax.equals;sx.equals;function fl(t){return Kn((e,n)=>{const r=e==null,i=n==null;return r&&i||!r&&!i&&t.equals(e,n)})}const Sy=R.createContext(null),Cy=R.createContext(null),wy=R.createContext(null),Ty=R.createContext(null),xf=()=>R.useContext(Sy),wo=()=>R.useContext(Ty),Iy="The configuration is not initialized. Consider using the ConfigurationSuspender or unload components manually that make use of any unsafe hook while the configuration is initializing. Check the hooks documentation to see if it is safe to use while the configuration is initializing.";function Af(t){if(!t)throw new Error(Iy)}function To(t){if(!t)throw new Error(Iy)}function Ua(){const t=xf();return Af(t),R.useMemo(()=>({makeDecision:e=>t.makeDecision(e),setManyDecision:(e,n)=>t.setMany(e,n)}),[t])}var xu=function(t){return function(e){return Jv(t(e))}};const Ox=xu(t=>t.type===Ue.Choice?Kr(t):qn),Nx=xu(t=>t.type===Ue.Numeric?Kr(t):qn),Px=xu(t=>t.type===Ue.Boolean?Kr(t):qn),Mx=xu(t=>t.type===Ue.Component?Kr(t):qn);function Au(t){return t.decision!=null&&t.decision.kind===Eu.Explicit}function Ey(t){return lt(t.values,en(Au),sr(e=>({type:Ue.Choice,attributeId:t.id,choiceValueId:e.id,state:null})))}function Rx(t){return lt(t,Tu(Au),Yn(()=>({type:Ue.Numeric,attributeId:t.id,state:null})))}function _x(t){return lt(t,Tu(Au),Yn(()=>({type:Ue.Boolean,attributeId:t.id,state:null})))}function jx(t){return lt(t,Tu(Au),Yn(()=>({type:Ue.Component,attributeId:t.id,state:null})))}function qx(t,e){return lt(Co.filterAttributesOfComponent(e,t,!0),n=>[lt(n,en(Ox),rx(Ey)),lt(n,en(Nx),sr(Rx),Sc),lt(n,en(Px),sr(_x),Sc),lt(n,en(Mx),sr(jx),Sc)],oy)}function kx(t,e){const n=wo();return To(n),R.useMemo(()=>lt(ke(t),Yn(Yv(sr(r=>Co.getAttribute(n,r)),e??!1?qa:Ni(ke))),io(()=>n.attributes)),[t,n,e])}function Ux(t){const e=wo(),{makeDecision:n,setManyDecision:r}=Ua();To(e);const i=Co.getChoiceAttribute(e,t),o=R.useMemo(()=>({makeDecision:(u,s)=>n({type:Ue.Choice,attributeId:t,choiceValueId:u,state:s}),clearDecisions:lt(i,ke,Yn(Ey),Yr(ey),Yn(u=>()=>r(u,{type:"Default"})),io(()=>()=>Promise.resolve()))}),[t,i,n,r]),a=R.useMemo(()=>({...o,attribute:i}),[i,o]);if(i)return a}function Bx(t){const e=wo(),{makeDecision:n}=Ua();To(e);const r=Co.getNumericAttribute(e,t),i=R.useMemo(()=>({makeDecision:a=>n({type:Ue.Numeric,attributeId:t,state:a})}),[t,n]),o=R.useMemo(()=>({...i,attribute:r}),[r,i]);if(r)return o}function Vx(t){const e=wo(),{makeDecision:n}=Ua();To(e);const r=Co.getBooleanAttribute(e,t),i=R.useMemo(()=>({makeDecision:a=>n({type:Ue.Boolean,attributeId:t,state:a})}),[t,n]),o=R.useMemo(()=>({...i,attribute:r}),[r,i]);if(r)return o}function Fx(t){const e=wo(),{makeDecision:n,setManyDecision:r}=Ua();To(e);const i=e.attributes,o=Co.getComponentAttribute(e,t),a=R.useMemo(()=>({makeDecision:s=>n({type:Ue.Component,attributeId:t,state:s}),clearSubtree:lt(qx(t,i),Tu(ey),Yn(s=>()=>r(s,{type:"Default"})),io(()=>()=>Promise.resolve()))}),[t,n,i,r]),u=R.useMemo(()=>({...a,attribute:o}),[o,a]);if(o)return u}const Lx=Kn((t,e)=>ix(We).equals(t??{},e??{})),Gx=Wr({attributeId:Kn(Yd),decisions:Ef(Kn(Yd))}),zx=Kn((t,e)=>Ef(Gx).equals(t??[],e??[])),Cc=Wr({configurationModelSource:Kn((t,e)=>$T(t,e)),attributeRelations:zx,usageRuleParameters:Lx}),Hx=Qv,wc=fl(Hx),Wx=()=>gf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{desiredClient:null,desiredSessionContext:null,actualClient:null,session:null,sessionCreationError:null,sessionUpdateError:null,hasEverSuccessfullyCreatedSession:!1},initial:"ProcessChanges",on:{ChangeConfigurationClient:{actions:["saveDesiredClient"]},ChangeSessionContext:{actions:["saveDesiredSessionContext"]}},exit:[fn("Shutting down","SessionManagement:"),"disposeOldSession"],states:{ProcessChanges:{entry:[fn("Entering ProcessChanges","SessionManagement:"),qi(2)],always:[{target:"DisposeSession",cond:"shallDisposeSession"},{target:"CreateSession",cond:"shallCreateSession"},{target:"UpdateSession",cond:"shallUpdateSession"}]},DisposeSession:{entry:[fn("Entering DisposeSession","SessionManagement:"),qi(2)],always:{actions:["disposeOldSession"],target:"ProcessChanges"}},CreateSession:{entry:[fn("Entering CreateSession","SessionManagement:"),qi(0)],invoke:{id:"getNewSession",src:"createSession",onDone:{actions:["setSessionCreationResult","setHasEverSuccessfullyCreatedSession"],target:"ProcessChanges"},onError:{actions:"setSessionCreationError",target:"SessionCreationFailed"}}},SessionCreationFailed:{entry:[fn("Entering SessionCreationFailed","SessionManagement:"),qi(2)],always:{target:"ProcessChanges",cond:"shallImmediatelyProcessChangesAfterSessionCreationError"},exit:[fn("Exiting SessionCreationFailed","SessionManagement:"),"clearSessionCreationError"],on:{RetrySessionCreation:{target:"ProcessChanges",actions:fn("Retrying session creation","SessionManagement:")}}},UpdateSession:{entry:[fn("Entering UpdateSession","SessionManagement:"),qi(1)],invoke:{id:"updateExistingSession",src:"updateSession",onDone:{target:"ProcessChanges"},onError:{actions:"setSessionUpdateError",target:"SessionUpdateFailed"}}},SessionUpdateFailed:{entry:[fn("Entering SessionUpdateFailed","SessionManagement:"),qi(2)],always:{target:"ProcessChanges",cond:"shallImmediatelyProcessChangesAfterSessionUpdateError"},exit:[fn("Exiting SessionUpdateFailed","SessionManagement:"),"clearSessionUpdateError"],on:{RetrySessionUpdate:{target:"ProcessChanges",actions:fn("Retrying session update","SessionManagement:")}}}}},{actions:{saveDesiredClient:Je({desiredClient:(t,e)=>e.client}),saveDesiredSessionContext:Je({desiredSessionContext:(t,e)=>e.sessionContext}),disposeOldSession:Je((t,e)=>(t.session&&t.session.close().then(RE).catch(n=>{}),{session:null,actualClient:null})),setSessionCreationResult:Je((t,e)=>({session:e.data.session,actualClient:e.data.client})),setSessionCreationError:Je((t,e)=>({sessionCreationError:e.data})),clearSessionCreationError:Je({sessionCreationError:()=>null}),setSessionUpdateError:Je((t,e)=>({sessionUpdateError:e.data})),clearSessionUpdateError:Je({sessionUpdateError:()=>null}),setHasEverSuccessfullyCreatedSession:Je({hasEverSuccessfullyCreatedSession:()=>!0})},services:{createSession:t=>t.desiredClient.createSession(t.desiredSessionContext).then(e=>({session:e,client:t.desiredClient})).catch(e=>Promise.reject({type:e.type,client:t.desiredClient,sessionContext:t.desiredSessionContext})),updateSession:t=>t.session.setSessionContext(t.desiredSessionContext).catch(e=>Promise.reject({type:e.type,sessionContext:t.desiredSessionContext}))},guards:{shallDisposeSession:t=>t.session!=null&&(t.desiredSessionContext==null||t.desiredClient==null||!wc.equals(t.actualClient,t.desiredClient)),shallCreateSession:t=>t.session==null&&t.desiredClient!=null&&t.desiredSessionContext!=null,shallUpdateSession:t=>t.session!=null&&!Cc.equals(t.session.getSessionContext(),t.desiredSessionContext),shallImmediatelyProcessChangesAfterSessionCreationError:t=>!wc.equals(t.desiredClient,t.sessionCreationError.client)||!fl(Cc).equals(t.desiredSessionContext,t.sessionCreationError.sessionContext),shallImmediatelyProcessChangesAfterSessionUpdateError:t=>!wc.equals(t.desiredClient,t.actualClient)||!fl(Cc).equals(t.desiredSessionContext,t.sessionUpdateError.sessionContext)}});function qi(t){const e=t===0,n=t===1;return gE((r,i)=>{const o={isInitializing:(!r.hasEverSuccessfullyCreatedSession||e)&&r.sessionCreationError==null,errorType:r.sessionCreationError&&r.sessionCreationError.type},a={isUpdating:n&&r.sessionUpdateError==null,errorType:r.sessionUpdateError&&r.sessionUpdateError.type};return Uv({type:"SessionManagementStateChanged",sessionInitialization:o,sessionUpdating:a,session:r.session})})}const Kx=t=>e=>(e({type:"ConfigurationChanged",session:t,configuration:t.getConfiguration()}),t.setOnConfigurationChangedHandler(n=>{e({type:"ConfigurationChanged",session:t,configuration:n})}),()=>{t.setOnConfigurationChangedHandler(null)}),Yx=()=>gf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{session:null},on:{ConfigurationChanged:{actions:[Uv((t,e)=>e)]}},initial:"ProcessChanges",states:{ProcessChanges:{entry:[fn("Entering ProcessChanges","ConfigurationSubscriptionManagement:")],on:{ChangeSession:{actions:["saveSession"]}},always:[{target:"Subscribe",cond:(t,e)=>t.session!=null}]},Subscribe:{entry:[fn("Entering Subscribe","ConfigurationSubscriptionManagement:")],on:{ChangeSession:{target:"ProcessChanges",cond:(t,e)=>e.session==null||t.session!==e.session,actions:["saveSession"]}},invoke:{id:"configurationSubscriptionActor",src:(t,e)=>Kx(t.session)}}}},{actions:{saveSession:Je((t,e)=>({session:e.session}))}}),Jx=()=>{let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}},Jd=()=>{const t=Jx();return{capsule:{promise:t.promise},resolve:t.resolve,reject:t.reject}},Xx=()=>gf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{sessionManagementActor:null,configurationSubscriptionManagementActor:null,sessionInitialization:null,sessionUpdating:null,session:null,configuration:null,isReadyPromise:Jd()},entry:[Je({sessionManagementActor:()=>Bd(Wx()),configurationSubscriptionManagementActor:()=>Bd(Yx())})],exit:[Fd(t=>t.sessionManagementActor),Fd(t=>t.configurationSubscriptionManagementActor)],on:{ChangeConfigurationClient:{actions:[es(t=>t.sessionManagementActor)]},ChangeSessionContext:{actions:[es(t=>t.sessionManagementActor)]},RetrySessionCreation:{actions:[es(t=>t.sessionManagementActor)]},RetrySessionUpdate:{actions:[es(t=>t.sessionManagementActor)]},SessionManagementStateChanged:{actions:[Je((t,e)=>({session:e.session,sessionInitialization:e.sessionInitialization,sessionUpdating:e.sessionUpdating})),AI(t=>({type:"ChangeSession",session:t.session}),{to:t=>t.configurationSubscriptionManagementActor}),"calculateReadyState"]},ConfigurationChanged:{actions:[Je((t,e)=>({configuration:{session:e.session,configuration:e.configuration}})),"calculateReadyState"]}},initial:"Idle",states:{Idle:{}}},{actions:{calculateReadyState:Je((t,e)=>{var n;const r=!((n=t.sessionInitialization)!=null&&n.isInitializing)&&t.session!=null&&t.configuration!=null&&t.configuration.session===t.session;return t.isReadyPromise&&r&&(t.isReadyPromise.resolve(),t.isReadyPromise.capsule.promise=null),{isReadyPromise:(()=>r?null:t.isReadyPromise!=null?t.isReadyPromise:Jd())()}})}});function Zx(t){var e,n;const[r,i]=NE(Xx,{logger:(...s)=>console.log("ConfigurationManagement:",...s)});R.useEffect(()=>{i({type:"ChangeConfigurationClient",client:t.configuratorClient}),t.configuratorClient||console.warn("The configurator client is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass a valid client.")},[t.configuratorClient]),R.useEffect(()=>{const s=lt(ke(t.sessionContext),KE(c=>ke(c.configurationModelSource)),Iu);i({type:"ChangeSessionContext",sessionContext:s}),s||console.warn("The session context is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass valid session context data.")},[t.sessionContext]);const o=R.useMemo(()=>{var s,c,l,d;return{isInitializing:((c=(s=r.context.isReadyPromise)==null?void 0:s.capsule)==null?void 0:c.promise)!=null,isInitializingPromise:(l=r.context.isReadyPromise)==null?void 0:l.capsule,error:((d=r.context.sessionInitialization)==null?void 0:d.errorType)&&{type:r.context.sessionInitialization.errorType,retry:()=>i({type:"RetrySessionCreation"})}}},[r.context.sessionInitialization,r.context.isReadyPromise]),a=R.useMemo(()=>{var s,c;return{isUpdating:(s=r.context.sessionUpdating)==null?void 0:s.isUpdating,error:((c=r.context.sessionUpdating)==null?void 0:c.errorType)&&{type:r.context.sessionUpdating.errorType,retry:()=>i({type:"RetrySessionUpdate"})}}},[r.context.sessionUpdating]),u=((e=r.context.configuration)==null?void 0:e.session)===r.context.session?(n=r.context.configuration)==null?void 0:n.configuration:null;return{configurationInitialization:o,configurationUpdating:a,session:r.context.session,configuration:u}}function Qx(t){const{configurationInitialization:e,configurationUpdating:n,session:r,configuration:i}=Zx({configuratorClient:t.configuratorClient,sessionContext:t});return X.jsx(Cy.Provider,{value:e,children:X.jsx(wy.Provider,{value:n,children:X.jsx(Sy.Provider,{value:r,children:X.jsx(Ty.Provider,{value:i,children:t.children})})})})}function xy(){return R.useContext(Cy)}function t0(){return R.useContext(wy)}function e0(t){const{children:e}=t,{isInitializingPromise:n}=xy();if(n!=null&&n.promise)throw n.promise;return X.jsx(X.Fragment,{children:e})}function n0(){const t=xf();return Af(t),R.useMemo(()=>({}),[t])}function r0(){const t=xf(),e=wo();return Af(t),To(e),R.useMemo(()=>({configuration:e,restoreConfiguration:n=>t.restoreConfiguration(n)}),[e,t])}const i0=Object.freeze(Object.defineProperty({__proto__:null,Configuration:Qx,ConfigurationSuspender:e0,useAttributes:kx,useBooleanAttribute:Vx,useChoiceAttribute:Ux,useComponentAttribute:Fx,useConfiguration:r0,useConfigurationInitialization:xy,useConfigurationUpdating:t0,useDecision:Ua,useExplain:n0,useNumericAttribute:Bx},Symbol.toStringTag,{value:"Module"})),tn=Symbol.for("@ts-pattern/matcher"),Ay=Symbol.for("@ts-pattern/isVariadic"),Ls="@ts-pattern/anonymous-select-key",dl=t=>!!(t&&typeof t=="object"),Ss=t=>t&&!!t[tn],qe=(t,e,n)=>{if(Ss(t)){const r=t[tn](),{matched:i,selections:o}=r.match(e);return i&&o&&Object.keys(o).forEach(a=>n(a,o[a])),i}if(dl(t)){if(!dl(e))return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let r=[],i=[],o=[];for(const a of t.keys()){const u=t[a];Ss(u)&&u[Ay]?o.push(u):o.length?i.push(u):r.push(u)}if(o.length){if(o.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(e.length<r.length+i.length)return!1;const a=e.slice(0,r.length),u=i.length===0?[]:e.slice(-i.length),s=e.slice(r.length,i.length===0?1/0:-i.length);return r.every((c,l)=>qe(c,a[l],n))&&i.every((c,l)=>qe(c,u[l],n))&&(o.length===0||qe(o[0],s,n))}return t.length===e.length&&t.every((a,u)=>qe(a,e[u],n))}return Object.keys(t).every(r=>{const i=t[r];return(r in e||Ss(o=i)&&o[tn]().matcherType==="optional")&&qe(i,e[r],n);var o})}return Object.is(e,t)},vn=t=>{var e,n,r;return dl(t)?Ss(t)?(e=(n=(r=t[tn]()).getSelectionKeys)==null?void 0:n.call(r))!=null?e:[]:Array.isArray(t)?Sa(t,vn):Sa(Object.values(t),vn):[]},Sa=(t,e)=>t.reduce((n,r)=>n.concat(e(r)),[]);function o0(...t){if(t.length===1){const[e]=t;return n=>qe(e,n,()=>{})}if(t.length===2){const[e,n]=t;return qe(e,n,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`)}function Ve(t){return Object.assign(t,{optional:()=>$f(t),and:e=>Jt(t,e),or:e=>$y(t,e),select:e=>e===void 0?Ca(t):Ca(e,t)})}function hl(t){return Object.assign((e=>Object.assign(e,{*[Symbol.iterator](){yield Object.assign(e,{[Ay]:!0})}}))(t),{optional:()=>hl($f(t)),select:e=>hl(e===void 0?Ca(t):Ca(e,t))})}function $f(t){return Ve({[tn]:()=>({match:e=>{let n={};const r=(i,o)=>{n[i]=o};return e===void 0?(vn(t).forEach(i=>r(i,void 0)),{matched:!0,selections:n}):{matched:qe(t,e,r),selections:n}},getSelectionKeys:()=>vn(t),matcherType:"optional"})})}const a0=(t,e)=>{for(const n of t)if(!e(n))return!1;return!0},s0=(t,e)=>{for(const[n,r]of t.entries())if(!e(r,n))return!1;return!0};function Jt(...t){return Ve({[tn]:()=>({match:e=>{let n={};const r=(i,o)=>{n[i]=o};return{matched:t.every(i=>qe(i,e,r)),selections:n}},getSelectionKeys:()=>Sa(t,vn),matcherType:"and"})})}function $y(...t){return Ve({[tn]:()=>({match:e=>{let n={};const r=(i,o)=>{n[i]=o};return Sa(t,vn).forEach(i=>r(i,void 0)),{matched:t.some(i=>qe(i,e,r)),selections:n}},getSelectionKeys:()=>Sa(t,vn),matcherType:"or"})})}function Nt(t){return{[tn]:()=>({match:e=>({matched:!!t(e)})})}}function Ca(...t){const e=typeof t[0]=="string"?t[0]:void 0,n=t.length===2?t[1]:typeof t[0]=="string"?void 0:t[0];return Ve({[tn]:()=>({match:r=>{let i={[e??Ls]:r};return{matched:n===void 0||qe(n,r,(o,a)=>{i[o]=a}),selections:i}},getSelectionKeys:()=>[e??Ls].concat(n===void 0?[]:vn(n))})})}function Vn(t){return typeof t=="number"}function si(t){return typeof t=="string"}function wr(t){return typeof t=="bigint"}const Dy=Ve(Nt(function(t){return!0})),u0=Dy,ui=t=>Object.assign(Ve(t),{startsWith:e=>{return ui(Jt(t,(n=e,Nt(r=>si(r)&&r.startsWith(n)))));var n},endsWith:e=>{return ui(Jt(t,(n=e,Nt(r=>si(r)&&r.endsWith(n)))));var n},minLength:e=>ui(Jt(t,(n=>Nt(r=>si(r)&&r.length>=n))(e))),maxLength:e=>ui(Jt(t,(n=>Nt(r=>si(r)&&r.length<=n))(e))),includes:e=>{return ui(Jt(t,(n=e,Nt(r=>si(r)&&r.includes(n)))));var n},regex:e=>{return ui(Jt(t,(n=e,Nt(r=>si(r)&&!!r.match(n)))));var n}}),c0=ui(Nt(si)),Fn=t=>Object.assign(Ve(t),{between:(e,n)=>Fn(Jt(t,((r,i)=>Nt(o=>Vn(o)&&r<=o&&i>=o))(e,n))),lt:e=>Fn(Jt(t,(n=>Nt(r=>Vn(r)&&r<n))(e))),gt:e=>Fn(Jt(t,(n=>Nt(r=>Vn(r)&&r>n))(e))),lte:e=>Fn(Jt(t,(n=>Nt(r=>Vn(r)&&r<=n))(e))),gte:e=>Fn(Jt(t,(n=>Nt(r=>Vn(r)&&r>=n))(e))),int:()=>Fn(Jt(t,Nt(e=>Vn(e)&&Number.isInteger(e)))),finite:()=>Fn(Jt(t,Nt(e=>Vn(e)&&Number.isFinite(e)))),positive:()=>Fn(Jt(t,Nt(e=>Vn(e)&&e>0))),negative:()=>Fn(Jt(t,Nt(e=>Vn(e)&&e<0)))}),l0=Fn(Nt(Vn)),Tr=t=>Object.assign(Ve(t),{between:(e,n)=>Tr(Jt(t,((r,i)=>Nt(o=>wr(o)&&r<=o&&i>=o))(e,n))),lt:e=>Tr(Jt(t,(n=>Nt(r=>wr(r)&&r<n))(e))),gt:e=>Tr(Jt(t,(n=>Nt(r=>wr(r)&&r>n))(e))),lte:e=>Tr(Jt(t,(n=>Nt(r=>wr(r)&&r<=n))(e))),gte:e=>Tr(Jt(t,(n=>Nt(r=>wr(r)&&r>=n))(e))),positive:()=>Tr(Jt(t,Nt(e=>wr(e)&&e>0))),negative:()=>Tr(Jt(t,Nt(e=>wr(e)&&e<0)))}),f0=Tr(Nt(wr)),d0=Ve(Nt(function(t){return typeof t=="boolean"})),h0=Ve(Nt(function(t){return typeof t=="symbol"})),p0=Ve(Nt(function(t){return t==null}));var Mt={__proto__:null,matcher:tn,optional:$f,array:function(...t){return hl({[tn]:()=>({match:e=>{if(!Array.isArray(e))return{matched:!1};if(t.length===0)return{matched:!0};const n=t[0];let r={};if(e.length===0)return vn(n).forEach(o=>{r[o]=[]}),{matched:!0,selections:r};const i=(o,a)=>{r[o]=(r[o]||[]).concat([a])};return{matched:e.every(o=>qe(n,o,i)),selections:r}},getSelectionKeys:()=>t.length===0?[]:vn(t[0])})})},set:function(...t){return Ve({[tn]:()=>({match:e=>{if(!(e instanceof Set))return{matched:!1};let n={};if(e.size===0)return{matched:!0,selections:n};if(t.length===0)return{matched:!0};const r=(o,a)=>{n[o]=(n[o]||[]).concat([a])},i=t[0];return{matched:a0(e,o=>qe(i,o,r)),selections:n}},getSelectionKeys:()=>t.length===0?[]:vn(t[0])})})},map:function(...t){return Ve({[tn]:()=>({match:e=>{if(!(e instanceof Map))return{matched:!1};let n={};if(e.size===0)return{matched:!0,selections:n};const r=(u,s)=>{n[u]=(n[u]||[]).concat([s])};if(t.length===0)return{matched:!0};var i;if(t.length===1)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(i=t[0])==null?void 0:i.toString()}`);const[o,a]=t;return{matched:s0(e,(u,s)=>{const c=qe(o,s,r),l=qe(a,u,r);return c&&l}),selections:n}},getSelectionKeys:()=>t.length===0?[]:[...vn(t[0]),...vn(t[1])]})})},intersection:Jt,union:$y,not:function(t){return Ve({[tn]:()=>({match:e=>({matched:!qe(t,e,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:Nt,select:Ca,any:Dy,_:u0,string:c0,number:l0,bigint:f0,boolean:d0,symbol:h0,nullish:p0,instanceOf:function(t){return Ve(Nt(function(e){return n=>n instanceof e}(t)))},shape:function(t){return Ve(Nt(o0(t)))}};const pl={matched:!1,value:void 0};function H(t){return new v0(t,pl)}let v0=class vl{constructor(e,n){this.input=void 0,this.state=void 0,this.input=e,this.state=n}with(...e){if(this.state.matched)return this;const n=e[e.length-1],r=[e[0]];let i;e.length===3&&typeof e[1]=="function"?i=e[1]:e.length>2&&r.push(...e.slice(1,e.length-1));let o=!1,a={};const u=(c,l)=>{o=!0,a[c]=l},s=!r.some(c=>qe(c,this.input,u))||i&&!i(this.input)?pl:{matched:!0,value:n(o?Ls in a?a[Ls]:a:this.input,this.input)};return new vl(this.input,s)}when(e,n){if(this.state.matched)return this;const r=!!e(this.input);return new vl(this.input,r?{matched:!0,value:n(this.input,this.input)}:pl)}otherwise(e){return this.state.matched?this.state.value:e(this.input)}exhaustive(){if(this.state.matched)return this.state.value;let e;try{e=JSON.stringify(this.input)}catch{e=this.input}throw new Error(`Pattern matching error: no pattern matches value ${e}`)}run(){return this.exhaustive()}returnType(){return this}};var Gs=Symbol("@ts-pattern/matcher"),Xd="@ts-pattern/anonymous-select-key",Zd=function(t){return!!(t&&typeof t=="object")},Tc=function(t){return t&&!!t[Gs]},y0=function t(e,n,r){if(Zd(e)){if(Tc(e)){var i=e[Gs]().match(n),o=i.matched,a=i.selections;return o&&a&&Object.keys(a).forEach(function(s){return r(s,a[s])}),o}if(!Zd(n))return!1;if(Array.isArray(e))return!!Array.isArray(n)&&e.length===n.length&&e.every(function(s,c){return t(s,n[c],r)});if(e instanceof Map)return n instanceof Map&&Array.from(e.keys()).every(function(s){return t(e.get(s),n.get(s),r)});if(e instanceof Set){if(!(n instanceof Set))return!1;if(e.size===0)return n.size===0;if(e.size===1){var u=Array.from(e.values())[0];return Tc(u)?Array.from(n.values()).every(function(s){return t(u,s,r)}):n.has(u)}return Array.from(e.values()).every(function(s){return n.has(s)})}return Object.keys(e).every(function(s){var c,l=e[s];return(s in n||Tc(c=l)&&c[Gs]().matcherType==="optional")&&t(l,n[s],r)})}return Object.is(n,e)};function Pi(t){var e;return(e={})[Gs]=function(){return{match:function(n){return{matched:!!t(n)}}}},e}Pi(function(t){return!0});Pi(function(t){return typeof t=="string"});Pi(function(t){return typeof t=="number"});Pi(function(t){return typeof t=="boolean"});Pi(function(t){return typeof t=="bigint"});Pi(function(t){return typeof t=="symbol"});Pi(function(t){return t==null});function m0(t){return new g0(t,[])}var g0=function(){function t(n,r){this.value=void 0,this.cases=void 0,this.value=n,this.cases=r}var e=t.prototype;return e.with=function(){var n=[].slice.call(arguments),r=n[n.length-1],i=[n[0]],o=[];return n.length===3&&typeof n[1]=="function"?(i.push(n[0]),o.push(n[1])):n.length>2&&i.push.apply(i,n.slice(1,n.length-1)),new t(this.value,this.cases.concat([{match:function(a){var u={},s=!!(i.some(function(c){return y0(c,a,function(l,d){u[l]=d})})&&o.every(function(c){return c(a)}));return{matched:s,value:s&&Object.keys(u).length?Xd in u?u[Xd]:u:a}},handler:r}]))},e.when=function(n,r){return new t(this.value,this.cases.concat([{match:function(i){return{matched:!!n(i),value:i}},handler:r}]))},e.otherwise=function(n){return new t(this.value,this.cases.concat([{match:function(r){return{matched:!0,value:r}},handler:n}])).run()},e.exhaustive=function(){return this.run()},e.run=function(){for(var n=this.value,r=void 0,i=0;i<this.cases.length;i++){var o=this.cases[i],a=o.match(this.value);if(a.matched){n=a.value,r=o.handler;break}}if(!r){var u;try{u=JSON.stringify(this.value)}catch{u=this.value}throw new Error("Pattern matching error: no pattern matches value "+u)}return r(n,this.value)},t}();function Oy(t){return function(n,r,i,o,a,u,s){return t(n,r,s)}}function $u(t){return function(n,r,i,o){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i,o);var a=o.get(n),u=o.get(r);if(a&&u)return a===r&&u===n;o.set(n,r),o.set(r,n);var s=t(n,r,i,o);return o.delete(n),o.delete(r),s}}function Ny(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n}function Qd(t){return t.constructor===Object||t.constructor==null}function th(t){return typeof t.then=="function"}function Du(t,e){return t===e||t!==t&&e!==e}var b0="[object Arguments]",S0="[object Boolean]",C0="[object Date]",w0="[object RegExp]",T0="[object Map]",I0="[object Number]",E0="[object Object]",x0="[object Set]",A0="[object String]",eh=Object.prototype.toString;function Ou(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.areRegExpsEqual,a=t.areSetsEqual,u=t.createIsNestedEqual,s=u(c);function c(l,d,f){if(l===d)return!0;if(!l||!d||typeof l!="object"||typeof d!="object")return l!==l&&d!==d;if(Qd(l)&&Qd(d))return i(l,d,s,f);var h=Array.isArray(l),v=Array.isArray(d);if(h||v)return h===v&&e(l,d,s,f);var p=eh.call(l);return p!==eh.call(d)?!1:p===C0?n(l,d,s,f):p===w0?o(l,d,s,f):p===T0?r(l,d,s,f):p===x0?a(l,d,s,f):p===E0||p===b0?th(l)||th(d)?!1:i(l,d,s,f):p===S0||p===I0||p===A0?Du(l.valueOf(),d.valueOf()):!1}return c}function Py(t,e,n,r){var i=t.length;if(e.length!==i)return!1;for(;i-- >0;)if(!n(t[i],e[i],i,i,t,e,r))return!1;return!0}var $0=$u(Py);function My(t,e){return Du(t.valueOf(),e.valueOf())}function Ry(t,e,n,r){var i=t.size===e.size;if(!i)return!1;if(!t.size)return!0;var o={},a=0;return t.forEach(function(u,s){if(i){var c=!1,l=0;e.forEach(function(d,f){!c&&!o[l]&&(c=n(s,f,a,l,t,e,r)&&n(u,d,s,f,t,e,r))&&(o[l]=!0),l++}),a++,i=c}}),i}var D0=$u(Ry),O0="_owner",N0=Object.prototype.hasOwnProperty;function _y(t,e,n,r){var i=Object.keys(t),o=i.length;if(Object.keys(e).length!==o)return!1;for(var a;o-- >0;){if(a=i[o],a===O0){var u=!!t.$$typeof,s=!!e.$$typeof;if((u||s)&&u!==s)return!1}if(!N0.call(e,a)||!n(t[a],e[a],a,a,t,e,r))return!1}return!0}var P0=$u(_y);function jy(t,e){return t.source===e.source&&t.flags===e.flags}function qy(t,e,n,r){var i=t.size===e.size;if(!i)return!1;if(!t.size)return!0;var o={};return t.forEach(function(a,u){if(i){var s=!1,c=0;e.forEach(function(l,d){!s&&!o[c]&&(s=n(a,l,u,d,t,e,r))&&(o[c]=!0),c++}),i=s}}),i}var M0=$u(qy),ky=Object.freeze({areArraysEqual:Py,areDatesEqual:My,areMapsEqual:Ry,areObjectsEqual:_y,areRegExpsEqual:jy,areSetsEqual:qy,createIsNestedEqual:Oy}),Uy=Object.freeze({areArraysEqual:$0,areDatesEqual:My,areMapsEqual:D0,areObjectsEqual:P0,areRegExpsEqual:jy,areSetsEqual:M0,createIsNestedEqual:Oy}),R0=Ou(ky);function _0(t,e){return R0(t,e,void 0)}Ou(Ny(ky,{createIsNestedEqual:function(){return Du}}));Ou(Uy);Ou(Ny(Uy,{createIsNestedEqual:function(){return Du}}));/*! *****************************************************************************
68
68
  Copyright (c) Microsoft Corporation.
69
69
 
70
70
  Permission to use, copy, modify, and/or distribute this software for any
@@ -77,12 +77,12 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
77
77
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
78
78
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
79
79
  PERFORMANCE OF THIS SOFTWARE.
80
- ***************************************************************************** */var V=function(){return V=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},V.apply(this,arguments)};function Df(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Ct(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Et(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}function Ht(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Lt;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(Lt||(Lt={}));var Ti;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ti||(Ti={}));var yl=Lt.Start,Of=Lt.Stop,Ba=Lt.Raise,Nu=Lt.Send,By=Lt.Cancel,_0=Lt.NullEvent,Nf=Lt.Assign;Lt.After;Lt.DoneState;var Vy=Lt.Log,j0=Lt.Init,ml=Lt.Invoke;Lt.ErrorExecution;var nh=Lt.ErrorPlatform,q0=Lt.ErrorCustom,Fy=Lt.Update,k0=Lt.Choose,U0=Lt.Pure,Ly=".",rh={},gl="xstate.guard",B0="",re=process.env.NODE_ENV==="production",rs;function Pf(t,e,n){n===void 0&&(n=Ly);var r=ca(t,n),i=ca(e,n);return At(i)?At(r)?i===r:!1:At(r)?r in i:Object.keys(r).every(function(o){return o in i?Pf(r[o],i[o]):!1})}function Gy(t){try{return At(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function bl(t,e){try{return Io(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function V0(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function ca(t,e){if(V0(t))return t.value;if(Io(t))return zs(t);if(typeof t!="string")return t;var n=bl(t,e);return zs(n)}function zs(t){if(t.length===1)return t[0];for(var e={},n=e,r=0;r<t.length-1;r++)r===t.length-2?n[t[r]]=t[r+1]:(n[t[r]]={},n=n[t[r]]);return e}function Zo(t,e){for(var n={},r=Object.keys(t),i=0;i<r.length;i++){var o=r[i];n[o]=e(t[o],o,t,i)}return n}function ih(t,e,n){var r,i,o={};try{for(var a=Ct(Object.keys(t)),u=a.next();!u.done;u=a.next()){var s=u.value,c=t[s];n(c)&&(o[s]=e(c,s,t))}}catch(l){r={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}var F0=function(t){return function(e){var n,r,i=e;try{for(var o=Ct(t),a=o.next();!a.done;a=o.next()){var u=a.value;i=i[u]}}catch(s){n={error:s}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}};function L0(t,e){return function(n){var r,i,o=n;try{for(var a=Ct(t),u=a.next();!u.done;u=a.next()){var s=u.value;o=o[e][s]}}catch(c){r={error:c}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}}function Cs(t){if(!t)return[[]];if(At(t))return[[t]];var e=te(Object.keys(t).map(function(n){var r=t[n];return typeof r!="string"&&(!r||!Object.keys(r).length)?[[n]]:Cs(t[n]).map(function(i){return[n].concat(i)})}));return e}function te(t){var e;return(e=[]).concat.apply(e,Ht([],Et(t),!1))}function zy(t){return Io(t)?t:[t]}function xn(t){return t===void 0?[]:zy(t)}function Hs(t,e,n){var r,i;if(Rt(t))return t(e,n.data);var o={};try{for(var a=Ct(Object.keys(t)),u=a.next();!u.done;u=a.next()){var s=u.value,c=t[s];Rt(c)?o[s]=c(e,n.data):o[s]=c}}catch(l){r={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}function G0(t){return/^(done|error)\./.test(t)}function oh(t){return!!(t instanceof Promise||t!==null&&(Rt(t)||typeof t=="object")&&Rt(t.then))}function z0(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function H0(t,e){var n,r,i=Et([[],[]],2),o=i[0],a=i[1];try{for(var u=Ct(t),s=u.next();!s.done;s=u.next()){var c=s.value;e(c)?o.push(c):a.push(c)}}catch(l){n={error:l}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return[o,a]}function Hy(t,e){return Zo(t.states,function(n,r){if(n){var i=(At(e)?void 0:e[r])||(n?n.current:void 0);if(i)return{current:i,states:Hy(n,i)}}})}function W0(t,e){return{current:e,states:Hy(t,e)}}function ah(t,e,n,r){re||Ce(!!t,"Attempting to update undefined context");var i=t&&n.reduce(function(o,a){var u,s,c=a.assignment,l={state:r,action:a,_event:e},d={};if(Rt(c))d=c(o,e.data,l);else try{for(var f=Ct(Object.keys(c)),h=f.next();!h.done;h=f.next()){var v=h.value,p=c[v];d[v]=Rt(p)?p(o,e.data,l):p}}catch(S){u={error:S}}finally{try{h&&!h.done&&(s=f.return)&&s.call(f)}finally{if(u)throw u.error}}return Object.assign({},o,d)},t);return i}var Ce=function(){};re||(Ce=function(t,e){var n=t instanceof Error?t:void 0;if(!(!n&&t)&&console!==void 0){var r=["Warning: ".concat(e)];n&&r.push(n),console.warn.apply(console,r)}});function Io(t){return Array.isArray(t)}function Rt(t){return typeof t=="function"}function At(t){return typeof t=="string"}function Wy(t,e){if(t)return At(t)?{type:gl,name:t,predicate:e?e[t]:void 0}:Rt(t)?{type:gl,name:t.name,predicate:t}:t}function K0(t){try{return"subscribe"in t&&Rt(t.subscribe)}catch{return!1}}var Or=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();rs={},rs[Or]=function(){return this},rs[Symbol.observable]=function(){return this};function vr(t){return!!t&&"__xstatenode"in t}function J0(t){return!!t&&typeof t.send=="function"}var Y0=function(){var t=0;return function(){return t++,t.toString(16)}}();function Pu(t,e){return At(t)||typeof t=="number"?V({type:t},e):t}function Pe(t,e){if(!At(t)&&"$$type"in t&&t.$$type==="scxml")return t;var n=Pu(t);return V({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function ki(t,e){var n=zy(e).map(function(r){return typeof r>"u"||typeof r=="string"||vr(r)?{target:r,event:t}:V(V({},r),{event:t})});return n}function X0(t){if(!(t===void 0||t===B0))return xn(t)}function Z0(t,e,n){if(!re){var r=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(n,"', error was '").concat(t,"'.").concat(r));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(n,"'. ")+"Original error: '".concat(t,"'. ").concat(r," Current error is '").concat(e,"'.").concat(i))}}}function Ky(t,e,n,r,i){var o=t.options.guards,a={state:i,cond:e,_event:r};if(e.type===gl)return((o==null?void 0:o[e.name])||e.predicate)(n,r.data,a);var u=o==null?void 0:o[e.type];if(!u)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return u(n,r.data,a)}function Jy(t){return typeof t=="string"?{type:t}:t}function ws(t,e,n){var r=function(){},i=typeof t=="object",o=i?t:null;return{next:((i?t.next:t)||r).bind(o),error:((i?t.error:e)||r).bind(o),complete:((i?t.complete:n)||r).bind(o)}}function is(t,e){return"".concat(t,":invocation[").concat(e,"]")}function Sl(t){return(t.type===Ba||t.type===Nu&&t.to===Ti.Internal)&&typeof t.delay!="number"}var no=Pe({type:j0});function Cl(t,e){return e&&e[t]||void 0}function wa(t,e){var n;if(At(t)||typeof t=="number"){var r=Cl(t,e);Rt(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(Rt(t))n={type:t.name||t.toString(),exec:t};else{var r=Cl(t.type,e);if(Rt(r))n=V(V({},t),{exec:r});else if(r){var i=r.type||t.type;n=V(V(V({},r),t),{type:i})}else n=t}return n}var Nr=function(t,e){if(!t)return[];var n=Io(t)?t:[t];return n.map(function(r){return wa(r,e)})};function Mf(t){var e=wa(t);return V(V({id:At(t)?t:e.id},e),{type:e.type})}function Q0(t,e){return{type:Ba,event:typeof t=="function"?t:Pu(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function tA(t,e,n,r){var i={_event:n},o=Pe(Rt(t.event)?t.event(e,n.data,i):t.event),a;if(At(t.delay)){var u=r&&r[t.delay];a=Rt(u)?u(e,n.data,i):u}else a=Rt(t.delay)?t.delay(e,n.data,i):t.delay;return V(V({},t),{type:Ba,_event:o,delay:a})}function Mu(t,e){return{to:e?e.to:void 0,type:Nu,event:Rt(t)?t:Pu(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:Rt(t)?t.name:Gy(t)}}function eA(t,e,n,r){var i={_event:n},o=Pe(Rt(t.event)?t.event(e,n.data,i):t.event),a;if(At(t.delay)){var u=r&&r[t.delay];a=Rt(u)?u(e,n.data,i):u}else a=Rt(t.delay)?t.delay(e,n.data,i):t.delay;var s=Rt(t.to)?t.to(e,n.data,i):t.to;return V(V({},t),{to:s,_event:o,event:o.data,delay:a})}function nA(t,e){return Mu(t,V(V({},e),{to:Ti.Parent}))}var rA=function(t,e,n){return V(V({},t),{value:At(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},iA=function(t){return{type:By,sendId:t}};function oA(t){var e=Mf(t);return{type:Lt.Start,activity:e,exec:void 0}}function aA(t){var e=Rt(t)?t:Mf(t);return{type:Lt.Stop,activity:e,exec:void 0}}function sA(t,e,n){var r=Rt(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,o={type:Lt.Stop,activity:i};return o}var uA=function(t){return{type:Nf,assignment:t}};function cA(t,e){var n=e?"#".concat(e):"";return"".concat(Lt.After,"(").concat(t,")").concat(n)}function os(t,e){var n="".concat(Lt.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function Ts(t,e){var n="".concat(Lt.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function Qo(t,e){var n="".concat(Lt.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function lA(t,e){if(!re&&(!t||typeof t=="function")){var n=t;t=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=typeof n=="function"?n.apply(void 0,Ht([],Et(r),!1)):n;if(!o)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return o}}return Mu(function(r,i){return i},V(V({},e),{to:t}))}var fA=function(t){var e,n,r=[];try{for(var i=Ct(t),o=i.next();!o.done;o=i.next())for(var a=o.value,u=0;u<a.actions.length;){if(a.actions[u].type===Nf){r.push(a.actions[u]),a.actions.splice(u,1);continue}u++}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function Ws(t,e,n,r,i,o,a){a===void 0&&(a=!1);var u=a?[]:fA(i),s=u.length?ah(n,r,u,e):n,c=a?[n]:void 0,l=[];function d(v,p){var S;switch(p.type){case Ba:{var C=tA(p,s,r,t.options.delays);return o&&typeof C.delay=="number"&&o(C,s,r),C}case Nu:var w=eA(p,s,r,t.options.delays);if(!re){var T=p.delay;Ce(!At(T)||typeof w.delay=="number","No delay reference for delay expression '".concat(T,"' was found on machine '").concat(t.id,"'"))}return o&&w.to!==Ti.Internal&&(v==="entry"?l.push(w):o(w,s,r)),w;case Vy:{var I=rA(p,s,r);return o==null||o(I,s,r),I}case k0:{var x=p,b=(S=x.conds.find(function(Y){var J=Wy(Y.cond,t.options.guards);return!J||Ky(t,J,s,r,o?void 0:e)}))===null||S===void 0?void 0:S.actions;if(!b)return[];var E=Et(Ws(t,e,s,r,[{type:v,actions:Nr(xn(b),t.options.actions)}],o,a),2),P=E[0],A=E[1];return s=A,c==null||c.push(s),P}case U0:{var b=p.get(s,r.data);if(!b)return[];var U=Et(Ws(t,e,s,r,[{type:v,actions:Nr(xn(b),t.options.actions)}],o,a),2),M=U[0],$=U[1];return s=$,c==null||c.push(s),M}case Of:{var I=sA(p,s,r);return o==null||o(I,n,r),I}case Nf:{s=ah(s,r,[p],o?void 0:e),c==null||c.push(s);break}default:var z=wa(p,t.options.actions),Z=z.exec;if(o)o(z,s,r);else if(Z&&c){var Vt=c.length-1,bt=V(V({},z),{exec:function(Y){for(var J=[],ut=1;ut<arguments.length;ut++)J[ut-1]=arguments[ut];Z.apply(void 0,Ht([c[Vt]],Et(J),!1))}});z=bt}return z}}function f(v){var p,S,C=[];try{for(var w=Ct(v.actions),T=w.next();!T.done;T=w.next()){var I=T.value,x=d(v.type,I);x&&(C=C.concat(x))}}catch(b){p={error:b}}finally{try{T&&!T.done&&(S=w.return)&&S.call(w)}finally{if(p)throw p.error}}return l.forEach(function(b){o(b,s,r)}),l.length=0,C}var h=te(i.map(f));return[h,s]}var Ks=[],Wi=function(t,e){Ks.push(t);var n=e(t);return Ks.pop(),n},dA=function(t){return t(Ks[Ks.length-1])};function Yy(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[Or]=function(){return this},e}function hA(t,e,n,r){var i,o=Jy(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[o.type],u=t.data?Hs(t.data,n,r):void 0,s=a?Rf(a,t.id,u):Yy(t.id);return s.meta=t,s}function Rf(t,e,n){var r=Yy(e);if(r.deferred=!0,vr(t)){var i=r.state=Wi(void 0,function(){return(n?t.withContext(n):t).initialState});r.getSnapshot=function(){return i}}return r}function pA(t){try{return typeof t.send=="function"}catch{return!1}}function vA(t){return pA(t)&&"id"in t}function yA(t){var e;return V((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[Or]=function(){return this},e),t)}var Js=function(t){return t.type==="atomic"||t.type==="final"};function Xy(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function Ta(t){return Xy(t).filter(function(e){return e.type!=="history"})}function Zy(t){var e=[t];return Js(t)?e:e.concat(te(Ta(t).map(Zy)))}function ta(t,e){var n,r,i,o,a,u,s,c,l=new Set(t),d=wl(l),f=new Set(e);try{for(var h=Ct(f),v=h.next();!v.done;v=h.next())for(var p=v.value,S=p.parent;S&&!f.has(S);)f.add(S),S=S.parent}catch(A){n={error:A}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var C=wl(f);try{for(var w=Ct(f),T=w.next();!T.done;T=w.next()){var p=T.value;if(p.type==="compound"&&(!C.get(p)||!C.get(p).length))d.get(p)?d.get(p).forEach(function(U){return f.add(U)}):p.initialStateNodes.forEach(function(U){return f.add(U)});else if(p.type==="parallel")try{for(var I=(a=void 0,Ct(Ta(p))),x=I.next();!x.done;x=I.next()){var b=x.value;f.has(b)||(f.add(b),d.get(b)?d.get(b).forEach(function(U){return f.add(U)}):b.initialStateNodes.forEach(function(U){return f.add(U)}))}}catch(U){a={error:U}}finally{try{x&&!x.done&&(u=I.return)&&u.call(I)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}try{for(var E=Ct(f),P=E.next();!P.done;P=E.next())for(var p=P.value,S=p.parent;S&&!f.has(S);)f.add(S),S=S.parent}catch(A){s={error:A}}finally{try{P&&!P.done&&(c=E.return)&&c.call(E)}finally{if(s)throw s.error}}return f}function Qy(t,e){var n=e.get(t);if(!n)return{};if(t.type==="compound"){var r=n[0];if(r){if(Js(r))return r.key}else return{}}var i={};return n.forEach(function(o){i[o.key]=Qy(o,e)}),i}function wl(t){var e,n,r=new Map;try{for(var i=Ct(t),o=i.next();!o.done;o=i.next()){var a=o.value;r.has(a)||r.set(a,[]),a.parent&&(r.has(a.parent)||r.set(a.parent,[]),r.get(a.parent).push(a))}}catch(u){e={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function mA(t,e){var n=ta([t],e);return Qy(t,wl(n))}function ea(t,e){return Array.isArray(t)?t.some(function(n){return n===e}):t instanceof Set?t.has(e):!1}function gA(t){return Ht([],Et(new Set(te(Ht([],Et(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Is(t,e){return e.type==="compound"?Ta(e).some(function(n){return n.type==="final"&&ea(t,n)}):e.type==="parallel"?Ta(e).every(function(n){return Is(t,n)}):!1}function bA(t){return t===void 0&&(t=[]),t.reduce(function(e,n){return n.meta!==void 0&&(e[n.id]=n.meta),e},{})}function sh(t){return new Set(te(t.map(function(e){return e.tags})))}function tm(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(At(t)||At(e))return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(i){return tm(t[i],e[i])})}function SA(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function CA(t,e){var n=t.exec,r=V(V({},t),{exec:n!==void 0?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return r}var gn=function(){function t(e){var n=this,r;this.actions=[],this.activities=rh,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||rh,this.meta=bA(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(r=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&r!==void 0?r:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return gA(n.configuration)}})}return t.from=function(e,n){if(e instanceof t)return e.context!==n?new t({value:e.value,context:n,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var r=no;return new t({value:e,context:n,_event:r,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,n){if(e instanceof t){if(!e.actions.length)return e;var r=no;return new t({value:e.value,context:n,_event:r,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,n)},t.prototype.toStrings=function(e,n){var r=this;if(e===void 0&&(e=this.value),n===void 0&&(n="."),At(e))return[e];var i=Object.keys(e);return i.concat.apply(i,Ht([],Et(i.map(function(o){return r.toStrings(e[o],n).map(function(a){return o+n+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var n=e.tags;e.machine;var r=Df(e,["configuration","transitions","tags","machine"]);return V(V({},r),{tags:Array.from(n)})},t.prototype.matches=function(e){return Pf(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var n;re&&Ce(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var r=(n=this.machine)===null||n===void 0?void 0:n.getTransitionData(this,e);return!!(r!=null&&r.transitions.length)&&r.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}(),wA={deferEvents:!1},uh=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=V(V({},wA),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(n){throw this.clear(),n}finally{this.processingEvent=!1}},t}(),Ic=new Map,TA=0,Vo={bookId:function(){return"x:".concat(TA++)},register:function(t,e){return Ic.set(t,e),t},get:function(t){return Ic.get(t)},free:function(t){Ic.delete(t)}};function _f(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;re||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function IA(){var t=_f();if(t&&"__xstate__"in t)return t.__xstate__}function EA(t){if(_f()){var e=IA();e&&e.register(t)}}function xA(t,e){e===void 0&&(e={});var n=t.initialState,r=new Set,i=[],o=!1,a=function(){if(!o){for(o=!0;i.length>0;){var c=i.shift();n=t.transition(n,c,s),r.forEach(function(l){return l.next(n)})}o=!1}},u=yA({id:e.id,send:function(c){i.push(c),a()},getSnapshot:function(){return n},subscribe:function(c,l,d){var f=ws(c,l,d);return r.add(f),f.next(n),{unsubscribe:function(){r.delete(f)}}}}),s={parent:e.parent,self:u,id:e.id||"anonymous",observers:r};return n=t.start?t.start(s):n,u}var Tl={sync:!1,autoForward:!1},se;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(se||(se={}));var AA=function(){function t(e,n){n===void 0&&(n=t.defaultOptions);var r=this;this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=se.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(l,d){if(Io(l))return r.batch(l),r.state;var f=Pe(Pu(l,d));if(r.status===se.Stopped)return re||Ce(!1,'Event "'.concat(f.name,'" was sent to stopped service "').concat(r.machine.id,`". This service has already reached its final state, and will not transition.
80
+ ***************************************************************************** */var V=function(){return V=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},V.apply(this,arguments)};function Df(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Ct(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Et(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}function Ht(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Lt;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(Lt||(Lt={}));var Ti;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Ti||(Ti={}));var yl=Lt.Start,Of=Lt.Stop,Ba=Lt.Raise,Nu=Lt.Send,By=Lt.Cancel,j0=Lt.NullEvent,Nf=Lt.Assign;Lt.After;Lt.DoneState;var Vy=Lt.Log,q0=Lt.Init,ml=Lt.Invoke;Lt.ErrorExecution;var nh=Lt.ErrorPlatform,k0=Lt.ErrorCustom,Fy=Lt.Update,U0=Lt.Choose,B0=Lt.Pure,Ly=".",rh={},gl="xstate.guard",V0="",re=process.env.NODE_ENV==="production",rs;function Pf(t,e,n){n===void 0&&(n=Ly);var r=ca(t,n),i=ca(e,n);return At(i)?At(r)?i===r:!1:At(r)?r in i:Object.keys(r).every(function(o){return o in i?Pf(r[o],i[o]):!1})}function Gy(t){try{return At(t)||typeof t=="number"?"".concat(t):t.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function bl(t,e){try{return Io(t)?t:t.toString().split(e)}catch{throw new Error("'".concat(t,"' is not a valid state path."))}}function F0(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function ca(t,e){if(F0(t))return t.value;if(Io(t))return zs(t);if(typeof t!="string")return t;var n=bl(t,e);return zs(n)}function zs(t){if(t.length===1)return t[0];for(var e={},n=e,r=0;r<t.length-1;r++)r===t.length-2?n[t[r]]=t[r+1]:(n[t[r]]={},n=n[t[r]]);return e}function Zo(t,e){for(var n={},r=Object.keys(t),i=0;i<r.length;i++){var o=r[i];n[o]=e(t[o],o,t,i)}return n}function ih(t,e,n){var r,i,o={};try{for(var a=Ct(Object.keys(t)),u=a.next();!u.done;u=a.next()){var s=u.value,c=t[s];n(c)&&(o[s]=e(c,s,t))}}catch(l){r={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}var L0=function(t){return function(e){var n,r,i=e;try{for(var o=Ct(t),a=o.next();!a.done;a=o.next()){var u=a.value;i=i[u]}}catch(s){n={error:s}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}};function G0(t,e){return function(n){var r,i,o=n;try{for(var a=Ct(t),u=a.next();!u.done;u=a.next()){var s=u.value;o=o[e][s]}}catch(c){r={error:c}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}}function Cs(t){if(!t)return[[]];if(At(t))return[[t]];var e=te(Object.keys(t).map(function(n){var r=t[n];return typeof r!="string"&&(!r||!Object.keys(r).length)?[[n]]:Cs(t[n]).map(function(i){return[n].concat(i)})}));return e}function te(t){var e;return(e=[]).concat.apply(e,Ht([],Et(t),!1))}function zy(t){return Io(t)?t:[t]}function xn(t){return t===void 0?[]:zy(t)}function Hs(t,e,n){var r,i;if(Rt(t))return t(e,n.data);var o={};try{for(var a=Ct(Object.keys(t)),u=a.next();!u.done;u=a.next()){var s=u.value,c=t[s];Rt(c)?o[s]=c(e,n.data):o[s]=c}}catch(l){r={error:l}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}function z0(t){return/^(done|error)\./.test(t)}function oh(t){return!!(t instanceof Promise||t!==null&&(Rt(t)||typeof t=="object")&&Rt(t.then))}function H0(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function W0(t,e){var n,r,i=Et([[],[]],2),o=i[0],a=i[1];try{for(var u=Ct(t),s=u.next();!s.done;s=u.next()){var c=s.value;e(c)?o.push(c):a.push(c)}}catch(l){n={error:l}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return[o,a]}function Hy(t,e){return Zo(t.states,function(n,r){if(n){var i=(At(e)?void 0:e[r])||(n?n.current:void 0);if(i)return{current:i,states:Hy(n,i)}}})}function K0(t,e){return{current:e,states:Hy(t,e)}}function ah(t,e,n,r){re||Ce(!!t,"Attempting to update undefined context");var i=t&&n.reduce(function(o,a){var u,s,c=a.assignment,l={state:r,action:a,_event:e},d={};if(Rt(c))d=c(o,e.data,l);else try{for(var f=Ct(Object.keys(c)),h=f.next();!h.done;h=f.next()){var v=h.value,p=c[v];d[v]=Rt(p)?p(o,e.data,l):p}}catch(S){u={error:S}}finally{try{h&&!h.done&&(s=f.return)&&s.call(f)}finally{if(u)throw u.error}}return Object.assign({},o,d)},t);return i}var Ce=function(){};re||(Ce=function(t,e){var n=t instanceof Error?t:void 0;if(!(!n&&t)&&console!==void 0){var r=["Warning: ".concat(e)];n&&r.push(n),console.warn.apply(console,r)}});function Io(t){return Array.isArray(t)}function Rt(t){return typeof t=="function"}function At(t){return typeof t=="string"}function Wy(t,e){if(t)return At(t)?{type:gl,name:t,predicate:e?e[t]:void 0}:Rt(t)?{type:gl,name:t.name,predicate:t}:t}function Y0(t){try{return"subscribe"in t&&Rt(t.subscribe)}catch{return!1}}var Or=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();rs={},rs[Or]=function(){return this},rs[Symbol.observable]=function(){return this};function vr(t){return!!t&&"__xstatenode"in t}function J0(t){return!!t&&typeof t.send=="function"}var X0=function(){var t=0;return function(){return t++,t.toString(16)}}();function Pu(t,e){return At(t)||typeof t=="number"?V({type:t},e):t}function Pe(t,e){if(!At(t)&&"$$type"in t&&t.$$type==="scxml")return t;var n=Pu(t);return V({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function ki(t,e){var n=zy(e).map(function(r){return typeof r>"u"||typeof r=="string"||vr(r)?{target:r,event:t}:V(V({},r),{event:t})});return n}function Z0(t){if(!(t===void 0||t===V0))return xn(t)}function Q0(t,e,n){if(!re){var r=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";if(t===e)console.error("Missing onError handler for invocation '".concat(n,"', error was '").concat(t,"'.").concat(r));else{var i=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(n,"'. ")+"Original error: '".concat(t,"'. ").concat(r," Current error is '").concat(e,"'.").concat(i))}}}function Ky(t,e,n,r,i){var o=t.options.guards,a={state:i,cond:e,_event:r};if(e.type===gl)return((o==null?void 0:o[e.name])||e.predicate)(n,r.data,a);var u=o==null?void 0:o[e.type];if(!u)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return u(n,r.data,a)}function Yy(t){return typeof t=="string"?{type:t}:t}function ws(t,e,n){var r=function(){},i=typeof t=="object",o=i?t:null;return{next:((i?t.next:t)||r).bind(o),error:((i?t.error:e)||r).bind(o),complete:((i?t.complete:n)||r).bind(o)}}function is(t,e){return"".concat(t,":invocation[").concat(e,"]")}function Sl(t){return(t.type===Ba||t.type===Nu&&t.to===Ti.Internal)&&typeof t.delay!="number"}var no=Pe({type:q0});function Cl(t,e){return e&&e[t]||void 0}function wa(t,e){var n;if(At(t)||typeof t=="number"){var r=Cl(t,e);Rt(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(Rt(t))n={type:t.name||t.toString(),exec:t};else{var r=Cl(t.type,e);if(Rt(r))n=V(V({},t),{exec:r});else if(r){var i=r.type||t.type;n=V(V(V({},r),t),{type:i})}else n=t}return n}var Nr=function(t,e){if(!t)return[];var n=Io(t)?t:[t];return n.map(function(r){return wa(r,e)})};function Mf(t){var e=wa(t);return V(V({id:At(t)?t:e.id},e),{type:e.type})}function tA(t,e){return{type:Ba,event:typeof t=="function"?t:Pu(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function eA(t,e,n,r){var i={_event:n},o=Pe(Rt(t.event)?t.event(e,n.data,i):t.event),a;if(At(t.delay)){var u=r&&r[t.delay];a=Rt(u)?u(e,n.data,i):u}else a=Rt(t.delay)?t.delay(e,n.data,i):t.delay;return V(V({},t),{type:Ba,_event:o,delay:a})}function Mu(t,e){return{to:e?e.to:void 0,type:Nu,event:Rt(t)?t:Pu(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:Rt(t)?t.name:Gy(t)}}function nA(t,e,n,r){var i={_event:n},o=Pe(Rt(t.event)?t.event(e,n.data,i):t.event),a;if(At(t.delay)){var u=r&&r[t.delay];a=Rt(u)?u(e,n.data,i):u}else a=Rt(t.delay)?t.delay(e,n.data,i):t.delay;var s=Rt(t.to)?t.to(e,n.data,i):t.to;return V(V({},t),{to:s,_event:o,event:o.data,delay:a})}function rA(t,e){return Mu(t,V(V({},e),{to:Ti.Parent}))}var iA=function(t,e,n){return V(V({},t),{value:At(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},oA=function(t){return{type:By,sendId:t}};function aA(t){var e=Mf(t);return{type:Lt.Start,activity:e,exec:void 0}}function sA(t){var e=Rt(t)?t:Mf(t);return{type:Lt.Stop,activity:e,exec:void 0}}function uA(t,e,n){var r=Rt(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,o={type:Lt.Stop,activity:i};return o}var cA=function(t){return{type:Nf,assignment:t}};function lA(t,e){var n=e?"#".concat(e):"";return"".concat(Lt.After,"(").concat(t,")").concat(n)}function os(t,e){var n="".concat(Lt.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function Ts(t,e){var n="".concat(Lt.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function Qo(t,e){var n="".concat(Lt.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function fA(t,e){if(!re&&(!t||typeof t=="function")){var n=t;t=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=typeof n=="function"?n.apply(void 0,Ht([],Et(r),!1)):n;if(!o)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return o}}return Mu(function(r,i){return i},V(V({},e),{to:t}))}var dA=function(t){var e,n,r=[];try{for(var i=Ct(t),o=i.next();!o.done;o=i.next())for(var a=o.value,u=0;u<a.actions.length;){if(a.actions[u].type===Nf){r.push(a.actions[u]),a.actions.splice(u,1);continue}u++}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function Ws(t,e,n,r,i,o,a){a===void 0&&(a=!1);var u=a?[]:dA(i),s=u.length?ah(n,r,u,e):n,c=a?[n]:void 0,l=[];function d(v,p){var S;switch(p.type){case Ba:{var C=eA(p,s,r,t.options.delays);return o&&typeof C.delay=="number"&&o(C,s,r),C}case Nu:var w=nA(p,s,r,t.options.delays);if(!re){var T=p.delay;Ce(!At(T)||typeof w.delay=="number","No delay reference for delay expression '".concat(T,"' was found on machine '").concat(t.id,"'"))}return o&&w.to!==Ti.Internal&&(v==="entry"?l.push(w):o(w,s,r)),w;case Vy:{var I=iA(p,s,r);return o==null||o(I,s,r),I}case U0:{var x=p,b=(S=x.conds.find(function(J){var Y=Wy(J.cond,t.options.guards);return!Y||Ky(t,Y,s,r,o?void 0:e)}))===null||S===void 0?void 0:S.actions;if(!b)return[];var E=Et(Ws(t,e,s,r,[{type:v,actions:Nr(xn(b),t.options.actions)}],o,a),2),P=E[0],A=E[1];return s=A,c==null||c.push(s),P}case B0:{var b=p.get(s,r.data);if(!b)return[];var U=Et(Ws(t,e,s,r,[{type:v,actions:Nr(xn(b),t.options.actions)}],o,a),2),M=U[0],$=U[1];return s=$,c==null||c.push(s),M}case Of:{var I=uA(p,s,r);return o==null||o(I,n,r),I}case Nf:{s=ah(s,r,[p],o?void 0:e),c==null||c.push(s);break}default:var z=wa(p,t.options.actions),Z=z.exec;if(o)o(z,s,r);else if(Z&&c){var Vt=c.length-1,bt=V(V({},z),{exec:function(J){for(var Y=[],ut=1;ut<arguments.length;ut++)Y[ut-1]=arguments[ut];Z.apply(void 0,Ht([c[Vt]],Et(Y),!1))}});z=bt}return z}}function f(v){var p,S,C=[];try{for(var w=Ct(v.actions),T=w.next();!T.done;T=w.next()){var I=T.value,x=d(v.type,I);x&&(C=C.concat(x))}}catch(b){p={error:b}}finally{try{T&&!T.done&&(S=w.return)&&S.call(w)}finally{if(p)throw p.error}}return l.forEach(function(b){o(b,s,r)}),l.length=0,C}var h=te(i.map(f));return[h,s]}var Ks=[],Wi=function(t,e){Ks.push(t);var n=e(t);return Ks.pop(),n},hA=function(t){return t(Ks[Ks.length-1])};function Jy(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[Or]=function(){return this},e}function pA(t,e,n,r){var i,o=Yy(t.src),a=(i=e==null?void 0:e.options.services)===null||i===void 0?void 0:i[o.type],u=t.data?Hs(t.data,n,r):void 0,s=a?Rf(a,t.id,u):Jy(t.id);return s.meta=t,s}function Rf(t,e,n){var r=Jy(e);if(r.deferred=!0,vr(t)){var i=r.state=Wi(void 0,function(){return(n?t.withContext(n):t).initialState});r.getSnapshot=function(){return i}}return r}function vA(t){try{return typeof t.send=="function"}catch{return!1}}function yA(t){return vA(t)&&"id"in t}function mA(t){var e;return V((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[Or]=function(){return this},e),t)}var Ys=function(t){return t.type==="atomic"||t.type==="final"};function Xy(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function Ta(t){return Xy(t).filter(function(e){return e.type!=="history"})}function Zy(t){var e=[t];return Ys(t)?e:e.concat(te(Ta(t).map(Zy)))}function ta(t,e){var n,r,i,o,a,u,s,c,l=new Set(t),d=wl(l),f=new Set(e);try{for(var h=Ct(f),v=h.next();!v.done;v=h.next())for(var p=v.value,S=p.parent;S&&!f.has(S);)f.add(S),S=S.parent}catch(A){n={error:A}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var C=wl(f);try{for(var w=Ct(f),T=w.next();!T.done;T=w.next()){var p=T.value;if(p.type==="compound"&&(!C.get(p)||!C.get(p).length))d.get(p)?d.get(p).forEach(function(U){return f.add(U)}):p.initialStateNodes.forEach(function(U){return f.add(U)});else if(p.type==="parallel")try{for(var I=(a=void 0,Ct(Ta(p))),x=I.next();!x.done;x=I.next()){var b=x.value;f.has(b)||(f.add(b),d.get(b)?d.get(b).forEach(function(U){return f.add(U)}):b.initialStateNodes.forEach(function(U){return f.add(U)}))}}catch(U){a={error:U}}finally{try{x&&!x.done&&(u=I.return)&&u.call(I)}finally{if(a)throw a.error}}}}catch(A){i={error:A}}finally{try{T&&!T.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}try{for(var E=Ct(f),P=E.next();!P.done;P=E.next())for(var p=P.value,S=p.parent;S&&!f.has(S);)f.add(S),S=S.parent}catch(A){s={error:A}}finally{try{P&&!P.done&&(c=E.return)&&c.call(E)}finally{if(s)throw s.error}}return f}function Qy(t,e){var n=e.get(t);if(!n)return{};if(t.type==="compound"){var r=n[0];if(r){if(Ys(r))return r.key}else return{}}var i={};return n.forEach(function(o){i[o.key]=Qy(o,e)}),i}function wl(t){var e,n,r=new Map;try{for(var i=Ct(t),o=i.next();!o.done;o=i.next()){var a=o.value;r.has(a)||r.set(a,[]),a.parent&&(r.has(a.parent)||r.set(a.parent,[]),r.get(a.parent).push(a))}}catch(u){e={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function gA(t,e){var n=ta([t],e);return Qy(t,wl(n))}function ea(t,e){return Array.isArray(t)?t.some(function(n){return n===e}):t instanceof Set?t.has(e):!1}function bA(t){return Ht([],Et(new Set(te(Ht([],Et(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Is(t,e){return e.type==="compound"?Ta(e).some(function(n){return n.type==="final"&&ea(t,n)}):e.type==="parallel"?Ta(e).every(function(n){return Is(t,n)}):!1}function SA(t){return t===void 0&&(t=[]),t.reduce(function(e,n){return n.meta!==void 0&&(e[n.id]=n.meta),e},{})}function sh(t){return new Set(te(t.map(function(e){return e.tags})))}function tm(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(At(t)||At(e))return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(i){return tm(t[i],e[i])})}function CA(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function wA(t,e){var n=t.exec,r=V(V({},t),{exec:n!==void 0?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return r}var gn=function(){function t(e){var n=this,r;this.actions=[],this.activities=rh,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||rh,this.meta=SA(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(r=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&r!==void 0?r:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return bA(n.configuration)}})}return t.from=function(e,n){if(e instanceof t)return e.context!==n?new t({value:e.value,context:n,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var r=no;return new t({value:e,context:n,_event:r,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,n){if(e instanceof t){if(!e.actions.length)return e;var r=no;return new t({value:e.value,context:n,_event:r,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,n)},t.prototype.toStrings=function(e,n){var r=this;if(e===void 0&&(e=this.value),n===void 0&&(n="."),At(e))return[e];var i=Object.keys(e);return i.concat.apply(i,Ht([],Et(i.map(function(o){return r.toStrings(e[o],n).map(function(a){return o+n+a})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var n=e.tags;e.machine;var r=Df(e,["configuration","transitions","tags","machine"]);return V(V({},r),{tags:Array.from(n)})},t.prototype.matches=function(e){return Pf(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var n;re&&Ce(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var r=(n=this.machine)===null||n===void 0?void 0:n.getTransitionData(this,e);return!!(r!=null&&r.transitions.length)&&r.transitions.some(function(i){return i.target!==void 0||i.actions.length})},t}(),TA={deferEvents:!1},uh=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=V(V({},TA),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(n){throw this.clear(),n}finally{this.processingEvent=!1}},t}(),Ic=new Map,IA=0,Vo={bookId:function(){return"x:".concat(IA++)},register:function(t,e){return Ic.set(t,e),t},get:function(t){return Ic.get(t)},free:function(t){Ic.delete(t)}};function _f(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;re||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function EA(){var t=_f();if(t&&"__xstate__"in t)return t.__xstate__}function xA(t){if(_f()){var e=EA();e&&e.register(t)}}function AA(t,e){e===void 0&&(e={});var n=t.initialState,r=new Set,i=[],o=!1,a=function(){if(!o){for(o=!0;i.length>0;){var c=i.shift();n=t.transition(n,c,s),r.forEach(function(l){return l.next(n)})}o=!1}},u=mA({id:e.id,send:function(c){i.push(c),a()},getSnapshot:function(){return n},subscribe:function(c,l,d){var f=ws(c,l,d);return r.add(f),f.next(n),{unsubscribe:function(){r.delete(f)}}}}),s={parent:e.parent,self:u,id:e.id||"anonymous",observers:r};return n=t.start?t.start(s):n,u}var Tl={sync:!1,autoForward:!1},se;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(se||(se={}));var $A=function(){function t(e,n){n===void 0&&(n=t.defaultOptions);var r=this;this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=se.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(l,d){if(Io(l))return r.batch(l),r.state;var f=Pe(Pu(l,d));if(r.status===se.Stopped)return re||Ce(!1,'Event "'.concat(f.name,'" was sent to stopped service "').concat(r.machine.id,`". This service has already reached its final state, and will not transition.
81
81
  Event: `).concat(JSON.stringify(f.data))),r.state;if(r.status!==se.Running&&!r.options.deferEvents)throw new Error('Event "'.concat(f.name,'" was sent to uninitialized service "').concat(r.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
82
- Event: `).concat(JSON.stringify(f.data)));return r.scheduler.schedule(function(){r.forward(f);var h=r._nextState(f);r.update(h,f)}),r._state},this.sendTo=function(l,d,f){var h=r.parent&&(d===Ti.Parent||r.parent.id===d),v=h?r.parent:At(d)?d===Ti.Internal?r:r.children.get(d)||Vo.get(d):J0(d)?d:void 0;if(!v){if(!h)throw new Error("Unable to send event to child '".concat(d,"' from service '").concat(r.id,"'."));re||Ce(!1,"Service '".concat(r.id,"' has no parent: unable to send event ").concat(l.type));return}if("machine"in v){if(r.status!==se.Stopped||r.parent!==v||r.state.done){var p=V(V({},l),{name:l.name===q0?"".concat(Qo(r.id)):l.name,origin:r.sessionId});!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([v,p]):v.send(p)}}else!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([v,l.data]):v.send(l.data)},this._exec=function(l,d,f,h){h===void 0&&(h=r.machine.options.actions);var v=l.exec||Cl(l.type,h),p=Rt(v)?v:v?v.exec:l.exec;if(p)try{return p(d,f.data,r.machine.config.predictableActionArguments?{action:l,_event:f}:{action:l,state:r.state,_event:f})}catch(Z){throw r.parent&&r.parent.send({type:"xstate.error",data:Z}),Z}switch(l.type){case Ba:{var S=l;r.defer(S);break}case Nu:var C=l;if(typeof C.delay=="number"){r.defer(C);return}else C.to?r.sendTo(C._event,C.to,f===no):r.send(C._event);break;case By:r.cancel(l.sendId);break;case yl:{if(r.status!==se.Running)return;var w=l.activity;if(!r.machine.config.predictableActionArguments&&!r.state.activities[w.id||w.type])break;if(w.type===Lt.Invoke){var T=Jy(w.src),I=r.machine.options.services?r.machine.options.services[T.type]:void 0,x=w.id,b=w.data;re||Ce(!("forward"in w),"`forward` property is deprecated (found in invocation of '".concat(w.src,"' in in machine '").concat(r.machine.id,"'). ")+"Please use `autoForward` instead.");var E="autoForward"in w?w.autoForward:!!w.forward;if(!I){re||Ce(!1,"No service found for invocation '".concat(w.src,"' in machine '").concat(r.machine.id,"'."));return}var P=b?Hs(b,d,f):void 0;if(typeof I=="string")return;var A=Rt(I)?I(d,f.data,{data:P,src:T,meta:w.meta}):I;if(!A)return;var U=void 0;vr(A)&&(A=P?A.withContext(P):A,U={autoForward:E}),r.spawn(A,x,U)}else r.spawnActivity(w);break}case Of:{r.stopChild(l.activity.id);break}case Vy:var M=l,$=M.label,z=M.value;$?r.logger($,z):r.logger(z);break;default:re||Ce(!1,"No implementation found for action type '".concat(l.type,"'"));break}};var i=V(V({},t.defaultOptions),n),o=i.clock,a=i.logger,u=i.parent,s=i.id,c=s!==void 0?s:e.id;this.id=c,this.logger=a,this.clock=o,this.parent=u,this.options=i,this.scheduler=new uh({deferEvents:this.options.deferEvents}),this.sessionId=Vo.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Wi(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return re||Ce(this.status!==se.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,n){var r,i;try{for(var o=Ct(e.actions),a=o.next();!a.done;a=o.next()){var u=a.value;this.exec(u,e,n)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},t.prototype.update=function(e,n){var r,i,o,a,u,s,c,l,d=this;if(e._sessionid=this.sessionId,this._state=e,(!this.machine.config.predictableActionArguments||n===no)&&this.options.execute)this.execute(this.state);else for(var f=void 0;f=this._outgoingQueue.shift();)f[0].send(f[1]);if(this.children.forEach(function(A){d.state.children[A.id]=A}),this.devTools&&this.devTools.send(n.data,e),e.event)try{for(var h=Ct(this.eventListeners),v=h.next();!v.done;v=h.next()){var p=v.value;p(e.event)}}catch(A){r={error:A}}finally{try{v&&!v.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}try{for(var S=Ct(this.listeners),C=S.next();!C.done;C=S.next()){var p=C.value;p(e,e.event)}}catch(A){o={error:A}}finally{try{C&&!C.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}try{for(var w=Ct(this.contextListeners),T=w.next();!T.done;T=w.next()){var I=T.value;I(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(u)throw u.error}}if(this.state.done){var x=e.configuration.find(function(A){return A.type==="final"&&A.parent===d.machine}),b=x&&x.doneData?Hs(x.doneData,e.context,n):void 0;this._doneEvent=Ts(this.id,b);try{for(var E=Ct(this.doneListeners),P=E.next();!P.done;P=E.next()){var p=P.value;p(this._doneEvent)}}catch(A){c={error:A}}finally{try{P&&!P.done&&(l=E.return)&&l.call(E)}finally{if(c)throw c.error}}this._stop(),this._stopChildren(),Vo.free(this.sessionId)}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===se.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,n,r){var i=this,o=ws(e,n,r);this.listeners.add(o.next),this.status!==se.NotStarted&&o.next(this.state);var a=function(){i.doneListeners.delete(a),i.stopListeners.delete(a),o.complete()};return this.status===se.Stopped?o.complete():(this.onDone(a),this.onStop(a)),{unsubscribe:function(){i.listeners.delete(o.next),i.doneListeners.delete(a),i.stopListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.status===se.Stopped&&this._doneEvent?e(this._doneEvent):this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var n=this;if(this.status===se.Running)return this;this.machine._init(),Vo.register(this.sessionId,this),this.initialized=!0,this.status=se.Running;var r=e===void 0?this.initialState:Wi(this,function(){return SA(e)?n.machine.resolveState(e):n.machine.resolveState(gn.from(e,n.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){n.update(r,no)}),this},t.prototype._stopChildren=function(){this.children.forEach(function(e){Rt(e.stop)&&e.stop()}),this.children.clear()},t.prototype._stop=function(){var e,n,r,i,o,a,u,s,c,l;try{for(var d=Ct(this.listeners),f=d.next();!f.done;f=d.next()){var h=f.value;this.listeners.delete(h)}}catch(E){e={error:E}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}try{for(var v=Ct(this.stopListeners),p=v.next();!p.done;p=v.next()){var h=p.value;h(),this.stopListeners.delete(h)}}catch(E){r={error:E}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}try{for(var S=Ct(this.contextListeners),C=S.next();!C.done;C=S.next()){var h=C.value;this.contextListeners.delete(h)}}catch(E){o={error:E}}finally{try{C&&!C.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}try{for(var w=Ct(this.doneListeners),T=w.next();!T.done;T=w.next()){var h=T.value;this.doneListeners.delete(h)}}catch(E){u={error:E}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(u)throw u.error}}if(!this.initialized)return this;this.initialized=!1,this.status=se.Stopped,this._initialState=void 0;try{for(var I=Ct(Object.keys(this.delayedEventsMap)),x=I.next();!x.done;x=I.next()){var b=x.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(E){c={error:E}}finally{try{x&&!x.done&&(l=I.return)&&l.call(I)}finally{if(c)throw c.error}}this.scheduler.clear(),this.scheduler=new uh({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var e=this,n=this.scheduler;return this._stop(),n.schedule(function(){var r=Pe({type:"xstate.stop"}),i=Wi(e,function(){var o=te(Ht([],Et(e.state.configuration),!1).sort(function(l,d){return d.order-l.order}).map(function(l){return Nr(l.onExit,e.machine.options.actions)})),a=Et(Ws(e.machine,e.state,e.state.context,r,[{type:"exit",actions:o}],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),u=a[0],s=a[1],c=new gn({value:e.state.value,context:s,_event:r,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:u.filter(function(l){return!Sl(l)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return c.changed=!0,c});e.update(i,r),e._stopChildren(),Vo.free(e.sessionId)}),this},t.prototype.batch=function(e){var n=this;if(this.status===se.NotStarted&&this.options.deferEvents)re||Ce(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
83
- Event: `).concat(JSON.stringify(event)));else if(this.status!==se.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));if(e.length){var r=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var i,o,a=n.state,u=!1,s=[],c=function(h){var v=Pe(h);n.forward(v),a=Wi(n,function(){return n.machine.transition(a,v,void 0,r||void 0)}),s.push.apply(s,Ht([],Et(n.machine.config.predictableActionArguments?a.actions:a.actions.map(function(p){return CA(p,a)})),!1)),u=u||!!a.changed};try{for(var l=Ct(e),d=l.next();!d.done;d=l.next()){var f=d.value;c(f)}}catch(h){i={error:h}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}a.changed=u,a.actions=s,n.update(a,Pe(e[e.length-1]))})}},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype._nextState=function(e,n){var r=this;n===void 0&&(n=!!this.machine.config.predictableActionArguments&&this._exec);var i=Pe(e);if(i.name.indexOf(nh)===0&&!this.state.nextEvents.some(function(a){return a.indexOf(nh)===0}))throw i.data.data;var o=Wi(this,function(){return r.machine.transition(r.state,i,void 0,n||void 0)});return o},t.prototype.nextState=function(e){return this._nextState(e,!1)},t.prototype.forward=function(e){var n,r;try{for(var i=Ct(this.forwardTo),o=i.next();!o.done;o=i.next()){var a=o.value,u=this.children.get(a);if(!u)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));u.send(e)}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},t.prototype.defer=function(e){var n=this,r=this.clock.setTimeout(function(){"to"in e&&e.to?n.sendTo(e._event,e.to,!0):n.send(e._event)},e.delay);e.id&&(this.delayedEventsMap[e.id]=r)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,n,r){r===void 0&&(r=this.machine.options.actions),this._exec(e,n.context,n._event,r)},t.prototype.removeChild=function(e){var n;this.children.delete(e),this.forwardTo.delete(e),(n=this.state)===null||n===void 0||delete n.children[e]},t.prototype.stopChild=function(e){var n=this.children.get(e);n&&(this.removeChild(e),Rt(n.stop)&&n.stop())},t.prototype.spawn=function(e,n,r){if(this.status!==se.Running)return Rf(e,n);if(oh(e))return this.spawnPromise(Promise.resolve(e),n);if(Rt(e))return this.spawnCallback(e,n);if(vA(e))return this.spawnActor(e,n);if(K0(e))return this.spawnObservable(e,n);if(vr(e))return this.spawnMachine(e,V(V({},r),{id:n}));if(z0(e))return this.spawnBehavior(e,n);throw new Error('Unable to spawn entity "'.concat(n,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,n){var r=this;n===void 0&&(n={});var i=new t(e,V(V({},this.options),{parent:this,id:n.id||e.id})),o=V(V({},Tl),n);o.sync&&i.onTransition(function(u){r.send(Fy,{state:u,id:i.id})});var a=i;return this.children.set(i.id,a),o.autoForward&&this.forwardTo.add(i.id),i.onDone(function(u){r.removeChild(i.id),r.send(Pe(u,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,n){var r=xA(e,{id:n,parent:this});return this.children.set(n,r),r},t.prototype.spawnPromise=function(e,n){var r,i=this,o=!1,a;e.then(function(s){o||(a=s,i.removeChild(n),i.send(Pe(Ts(n,s),{origin:n})))},function(s){if(!o){i.removeChild(n);var c=Qo(n,s);try{i.send(Pe(c,{origin:n}))}catch(l){Z0(s,l,n),i.devTools&&i.devTools.send(c,i.state),i.machine.strict&&i.stop()}}});var u=(r={id:n,send:function(){},subscribe:function(s,c,l){var d=ws(s,c,l),f=!1;return e.then(function(h){f||(d.next(h),!f&&d.complete())},function(h){f||d.error(h)}),{unsubscribe:function(){return f=!0}}},stop:function(){o=!0},toJSON:function(){return{id:n}},getSnapshot:function(){return a}},r[Or]=function(){return this},r);return this.children.set(n,u),u},t.prototype.spawnCallback=function(e,n){var r,i=this,o=!1,a=new Set,u=new Set,s,c=function(f){s=f,u.forEach(function(h){return h(f)}),!o&&i.send(Pe(f,{origin:n}))},l;try{l=e(c,function(f){a.add(f)})}catch(f){this.send(Qo(n,f))}if(oh(l))return this.spawnPromise(l,n);var d=(r={id:n,send:function(f){return a.forEach(function(h){return h(f)})},subscribe:function(f){var h=ws(f);return u.add(h.next),{unsubscribe:function(){u.delete(h.next)}}},stop:function(){o=!0,Rt(l)&&l()},toJSON:function(){return{id:n}},getSnapshot:function(){return s}},r[Or]=function(){return this},r);return this.children.set(n,d),d},t.prototype.spawnObservable=function(e,n){var r,i=this,o,a=e.subscribe(function(s){o=s,i.send(Pe(s,{origin:n}))},function(s){i.removeChild(n),i.send(Pe(Qo(n,s),{origin:n}))},function(){i.removeChild(n),i.send(Pe(Ts(n),{origin:n}))}),u=(r={id:n,send:function(){},subscribe:function(s,c,l){return e.subscribe(s,c,l)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return o},toJSON:function(){return{id:n}}},r[Or]=function(){return this},r);return this.children.set(n,u),u},t.prototype.spawnActor=function(e,n){return this.children.set(n,e),e},t.prototype.spawnActivity=function(e){var n=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!n){re||Ce(!1,"No implementation found for activity '".concat(e.type,"'"));return}var r=n(this.state.context,e);this.spawnEffect(e.id,r)},t.prototype.spawnEffect=function(e,n){var r;this.children.set(e,(r={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:n||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},r[Or]=function(){return this},r))},t.prototype.attachDev=function(){var e=_f();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var n=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(V(V({name:this.id,autoPause:!0,stateSanitizer:function(r){return{value:r.value,context:r.context,actions:r.actions}}},n),{features:V({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}EA(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[Or]=function(){return this},t.prototype.getSnapshot=function(){return this.status===se.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,n){return setTimeout(e,n)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=em,t}(),$A=function(t){return At(t)?V(V({},Tl),{name:t}):V(V(V({},Tl),{name:Y0()}),t)};function ch(t,e){var n=$A(e);return dA(function(r){if(!re){var i=vr(t)||Rt(t);Ce(!!r||i,'Attempted to spawn an Actor (ID: "'.concat(vr(t)?t.id:"undefined",'") outside of a service. This will have no effect.'))}return r?r.spawn(t,n.name,n):Rf(t,n.name)})}function em(t,e){var n=new AA(t,e);return n}function DA(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function as(t){return V(V({type:ml},t),{toJSON:function(){t.onDone,t.onError;var e=Df(t,["onDone","onError"]);return V(V({},e),{type:ml,src:DA(t.src)})}})}var Ki="",Il="#",Fo="*",Ui={},Bi=function(t){return t[0]===Il},OA=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},NA=function(t,e,n){var r=n.slice(0,-1).some(function(o){return!("cond"in o)&&!("in"in o)&&(At(o.target)||vr(o.target))}),i=e===Ki?"the transient event":"event '".concat(e,"'");Ce(!r,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},PA=function(){function t(e,n,r,i){r===void 0&&(r="context"in e?e.context:void 0);var o=this,a;this.config=e,this._context=r,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(OA(),n),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:Ly),this.id=this.config.id||Ht([this.machine.key],Et(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,re||Ce(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Zo(this.config.states,function(c,l){var d,f=new t(c,{},void 0,{parent:o,key:l});return Object.assign(o.idMap,V((d={},d[f.id]=f,d),f.idMap)),f}):Ui;var u=0;function s(c){var l,d;c.order=u++;try{for(var f=Ct(Xy(c)),h=f.next();!h.done;h=f.next()){var v=h.value;s(v)}}catch(p){l={error:p}}finally{try{h&&!h.done&&(d=f.return)&&d.call(f)}finally{if(l)throw l.error}}}s(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(c){var l=c.event;return l===Ki}):Ki in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=xn(this.config.entry||this.config.onEntry).map(function(c){return wa(c)}),this.onExit=xn(this.config.exit||this.config.onExit).map(function(c){return wa(c)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=xn(this.config.invoke).map(function(c,l){var d,f;if(vr(c)){var h=is(o.id,l);return o.machine.options.services=V((d={},d[h]=c,d),o.machine.options.services),as({src:h,id:h})}else if(At(c.src)){var h=c.id||is(o.id,l);return as(V(V({},c),{id:h,src:c.src}))}else if(vr(c.src)||Rt(c.src)){var h=c.id||is(o.id,l);return o.machine.options.services=V((f={},f[h]=c.src,f),o.machine.options.services),as(V(V({id:h},c),{src:h}))}else{var v=c.src;return as(V(V({id:is(o.id,l)},c),{src:v}))}}),this.activities=xn(this.config.activities).concat(this.invoke).map(function(c){return Mf(c)}),this.transition=this.transition.bind(this),this.tags=xn(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Zy(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,n){var r=this.options,i=r.actions,o=r.activities,a=r.guards,u=r.services,s=r.delays;return new t(this.config,{actions:V(V({},i),e.actions),activities:V(V({},o),e.activities),guards:V(V({},a),e.guards),services:V(V({},u),e.services),delays:V(V({},s),e.delays)},n??this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return Rt(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Zo(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(n,r){return n[r.eventType]=n[r.eventType]||[],n[r.eventType].push(r),n},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var n=e===Ki,r=this.transitions.filter(function(i){var o=i.eventType===e;return n?o:o||i.eventType===Fo});return this.__cache.candidates[e]=r,r},t.prototype.getDelayedTransitions=function(){var e=this,n=this.config.after;if(!n)return[];var r=function(o,a){var u=Rt(o)?"".concat(e.id,":delay[").concat(a,"]"):o,s=cA(u,e.id);return e.onEntry.push(Mu(s,{delay:o})),e.onExit.push(iA(s)),s},i=Io(n)?n.map(function(o,a){var u=r(o.delay,a);return V(V({},o),{event:u})}):te(Object.keys(n).map(function(o,a){var u=n[o],s=At(u)?{target:u}:u,c=isNaN(+o)?o:+o,l=r(c,a);return xn(s).map(function(d){return V(V({},d),{event:l,delay:c})})}));return i.map(function(o){var a=o.delay;return V(V({},e.formatTransition(o)),{delay:a})})},t.prototype.getStateNodes=function(e){var n,r=this;if(!e)return[];var i=e instanceof gn?e.value:ca(e,this.delimiter);if(At(i)){var o=this.getStateNode(i).initial;return o!==void 0?this.getStateNodes((n={},n[i]=o,n)):[this,this.states[i]]}var a=Object.keys(i),u=[this];return u.push.apply(u,Ht([],Et(te(a.map(function(s){return r.getStateNode(s).getStateNodes(i[s])}))),!1)),u},t.prototype.handles=function(e){var n=Gy(e);return this.events.includes(n)},t.prototype.resolveState=function(e){var n=e instanceof gn?e:gn.create(e),r=Array.from(ta([],this.getStateNodes(n.value)));return new gn(V(V({},n),{value:this.resolve(n.value),configuration:r,done:Is(r,this),tags:sh(r),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,n,r){var i=this.getStateNode(e),o=i.next(n,r);return!o||!o.transitions.length?this.next(n,r):o},t.prototype.transitionCompoundNode=function(e,n,r){var i=Object.keys(e),o=this.getStateNode(i[0]),a=o._transition(e[i[0]],n,r);return!a||!a.transitions.length?this.next(n,r):a},t.prototype.transitionParallelNode=function(e,n,r){var i,o,a={};try{for(var u=Ct(Object.keys(e)),s=u.next();!s.done;s=u.next()){var c=s.value,l=e[c];if(l){var d=this.getStateNode(c),f=d._transition(l,n,r);f&&(a[c]=f)}}}catch(C){i={error:C}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}var h=Object.keys(a).map(function(C){return a[C]}),v=te(h.map(function(C){return C.transitions})),p=h.some(function(C){return C.transitions.length>0});if(!p)return this.next(n,r);var S=te(Object.keys(a).map(function(C){return a[C].configuration}));return{transitions:v,exitSet:te(h.map(function(C){return C.exitSet})),configuration:S,source:n,actions:te(Object.keys(a).map(function(C){return a[C].actions}))}},t.prototype._transition=function(e,n,r){return At(e)?this.transitionLeafNode(e,n,r):Object.keys(e).length===1?this.transitionCompoundNode(e,n,r):this.transitionParallelNode(e,n,r)},t.prototype.getTransitionData=function(e,n){return this._transition(e.value,e,Pe(n))},t.prototype.next=function(e,n){var r,i,o=this,a=n.name,u=[],s=[],c;try{for(var l=Ct(this.getCandidates(a)),d=l.next();!d.done;d=l.next()){var f=d.value,h=f.cond,v=f.in,p=e.context,S=v?At(v)&&Bi(v)?e.matches(ca(this.getStateNodeById(v).path,this.delimiter)):Pf(ca(v,this.delimiter),F0(this.path.slice(0,-2))(e.value)):!0,C=!1;try{C=!h||Ky(this.machine,h,p,n,e)}catch(I){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
84
- `).concat(I.message))}if(C&&S){f.target!==void 0&&(s=f.target),u.push.apply(u,Ht([],Et(f.actions),!1)),c=f;break}}}catch(I){r={error:I}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}if(c){if(!s.length)return{transitions:[c],exitSet:[],configuration:e.value?[this]:[],source:e,actions:u};var w=te(s.map(function(I){return o.getRelativeStateNodes(I,e.historyValue)})),T=!!c.internal;return{transitions:[c],exitSet:T?[]:te(s.map(function(I){return o.getPotentiallyReenteringNodes(I)})),configuration:w,source:e,actions:u}}},t.prototype.getPotentiallyReenteringNodes=function(e){if(this.order<e.order)return[this];for(var n=[],r=this,i=e;r&&r!==i;)n.push(r),r=r.parent;return r!==i?[]:(n.push(i),n)},t.prototype.getActions=function(e,n,r,i,o,a,u){var s,c,l,d,f=this,h=a?ta([],this.getStateNodes(a.value)):[],v=new Set;try{for(var p=Ct(Array.from(e).sort(function(M,$){return M.order-$.order})),S=p.next();!S.done;S=p.next()){var C=S.value;(!ea(h,C)||ea(r.exitSet,C)||C.parent&&v.has(C.parent))&&v.add(C)}}catch(M){s={error:M}}finally{try{S&&!S.done&&(c=p.return)&&c.call(p)}finally{if(s)throw s.error}}try{for(var w=Ct(h),T=w.next();!T.done;T=w.next()){var C=T.value;(!ea(e,C)||ea(r.exitSet,C.parent))&&r.exitSet.push(C)}}catch(M){l={error:M}}finally{try{T&&!T.done&&(d=w.return)&&d.call(w)}finally{if(l)throw l.error}}r.exitSet.sort(function(M,$){return $.order-M.order});var I=Array.from(v).sort(function(M,$){return M.order-$.order}),x=new Set(r.exitSet),b=te(I.map(function(M){var $=[];if(M.type!=="final")return $;var z=M.parent;if(!z.parent)return $;$.push(os(M.id,M.doneData),os(z.id,M.doneData?Hs(M.doneData,i,o):void 0));var Z=z.parent;return Z.type==="parallel"&&Ta(Z).every(function(Vt){return Is(r.configuration,Vt)})&&$.push(os(Z.id)),$})),E=I.map(function(M){var $=M.onEntry,z=M.activities.map(function(Z){return oA(Z)});return{type:"entry",actions:Nr(u?Ht(Ht([],Et($),!1),Et(z),!1):Ht(Ht([],Et(z),!1),Et($),!1),f.machine.options.actions)}}).concat({type:"state_done",actions:b.map(function(M){return Q0(M)})}),P=Array.from(x).map(function(M){return{type:"exit",actions:Nr(Ht(Ht([],Et(M.onExit),!1),Et(M.activities.map(function($){return aA($)})),!1),f.machine.options.actions)}}),A=P.concat({type:"transition",actions:Nr(r.actions,this.machine.options.actions)}).concat(E);if(n){var U=Nr(te(Ht([],Et(e),!1).sort(function(M,$){return $.order-M.order}).map(function(M){return M.onExit})),this.machine.options.actions).filter(function(M){return!Sl(M)});return A.concat({type:"stop",actions:U})}return A},t.prototype.transition=function(e,n,r,i){e===void 0&&(e=this.initialState);var o=Pe(n),a;if(e instanceof gn)a=r===void 0?e:this.resolveState(gn.from(e,r));else{var u=At(e)?this.resolve(zs(this.getResolvedPath(e))):this.resolve(e),s=r??this.machine.context;a=this.resolveState(gn.from(u,s))}if(!re&&o.name===Fo)throw new Error("An event cannot have the wildcard type ('".concat(Fo,"')"));if(this.strict&&!this.events.includes(o.name)&&!G0(o.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var c=this._transition(a.value,a,o)||{transitions:[],configuration:[],exitSet:[],source:a,actions:[]},l=ta([],this.getStateNodes(a.value)),d=c.configuration.length?ta(l,c.configuration):l;return c.configuration=Ht([],Et(d),!1),this.resolveTransition(c,a,a.context,i,o)},t.prototype.resolveRaisedTransition=function(e,n,r,i){var o,a=e.actions;return e=this.transition(e,n,void 0,i),e._event=r,e.event=r.data,(o=e.actions).unshift.apply(o,Ht([],Et(a),!1)),e},t.prototype.resolveTransition=function(e,n,r,i,o){var a,u,s,c,l=this;o===void 0&&(o=no);var d=e.configuration,f=!n||e.transitions.length>0,h=f?e.configuration:n?n.configuration:[],v=Is(h,this),p=f?mA(this.machine,d):void 0,S=n?n.historyValue?n.historyValue:e.source?this.machine.historyValue(n.value):void 0:void 0,C=this.getActions(new Set(h),v,e,r,o,n,i),w=n?V({},n.activities):{};try{for(var T=Ct(C),I=T.next();!I.done;I=T.next()){var x=I.value;try{for(var b=(s=void 0,Ct(x.actions)),E=b.next();!E.done;E=b.next()){var P=E.value;P.type===yl?w[P.activity.id||P.activity.type]=P:P.type===Of&&(w[P.activity.id||P.activity.type]=!1)}}catch(Ot){s={error:Ot}}finally{try{E&&!E.done&&(c=b.return)&&c.call(b)}finally{if(s)throw s.error}}}}catch(Ot){a={error:Ot}}finally{try{I&&!I.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}var A=Et(Ws(this,n,r,o,C,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),U=A[0],M=A[1],$=Et(H0(U,Sl),2),z=$[0],Z=$[1],Vt=U.filter(function(Ot){var Zt;return Ot.type===yl&&((Zt=Ot.activity)===null||Zt===void 0?void 0:Zt.type)===ml}),bt=Vt.reduce(function(Ot,Zt){return Ot[Zt.activity.id]=hA(Zt.activity,l.machine,M,o),Ot},n?V({},n.children):{}),Y=new gn({value:p||n.value,context:M,_event:o,_sessionid:n?n._sessionid:null,historyValue:p?S?W0(S,p):void 0:n?n.historyValue:void 0,history:!p||e.source?n:void 0,actions:p?Z:[],activities:p?w:n?n.activities:{},events:[],configuration:h,transitions:e.transitions,children:bt,done:v,tags:sh(h),machine:this}),J=r!==M;Y.changed=o.name===Fy||J;var ut=Y.history;ut&&delete ut.history;var $e=!v&&(this._transient||d.some(function(Ot){return Ot._transient}));if(!f&&(!$e||o.name===Ki))return Y;var tt=Y;if(!v)for($e&&(tt=this.resolveRaisedTransition(tt,{type:_0},o,i));z.length;){var De=z.shift();tt=this.resolveRaisedTransition(tt,De._event,o,i)}var an=tt.changed||(ut?!!tt.actions.length||J||typeof ut.value!=typeof tt.value||!tm(tt.value,ut.value):void 0);return tt.changed=an,tt.history=ut,tt},t.prototype.getStateNode=function(e){if(Bi(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var n=this.states[e];if(!n)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return n},t.prototype.getStateNodeById=function(e){var n=Bi(e)?e.slice(Il.length):e;if(n===this.id)return this;var r=this.machine.idMap[n];if(!r)throw new Error("Child state node '#".concat(n,"' does not exist on machine '").concat(this.id,"'"));return r},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Bi(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var n=bl(e,this.delimiter).slice(),r=this;n.length;){var i=n.shift();if(!i.length)break;r=r.getStateNode(i)}return r},t.prototype.resolve=function(e){var n,r=this;if(!e)return this.initialStateValue||Ui;switch(this.type){case"parallel":return Zo(this.initialStateValue,function(o,a){return o?r.getStateNode(a).resolve(e[a]||o):Ui});case"compound":if(At(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(n={},n[e]=i.initialStateValue,n):e}return Object.keys(e).length?Zo(e,function(o,a){return o?r.getStateNode(a).resolve(o):Ui}):this.initialStateValue||{};default:return e||Ui}},t.prototype.getResolvedPath=function(e){if(Bi(e)){var n=this.machine.idMap[e.slice(Il.length)];if(!n)throw new Error("Unable to find state node '".concat(e,"'"));return n.path}return bl(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var n;if(this.type==="parallel")n=ih(this.states,function(r){return r.initialStateValue||Ui},function(r){return r.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));n=Js(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else n={};return this.__cache.initialStateValue=n,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,n){this._init();var r=this.getStateNodes(e);return this.resolveTransition({configuration:r,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,n??this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var n=this.config;At(n.target)?e=Bi(n.target)?zs(this.machine.getStateNodeById(n.target).path.slice(this.path.length-1)):n.target:e=n.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,n,r){return r===void 0&&(r=!0),r?e.type==="history"?e.resolveHistory(n):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(Js(this))return[this];if(this.type==="compound"&&!this.initial)return re||Ce(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var n=Cs(this.initialStateValue);return te(n.map(function(r){return e.getFromRelativePath(r)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var n=Et(e),r=n[0],i=n.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(r,"' from node with no states"));var o=this.getStateNode(r);if(o.type==="history")return o.resolveHistory();if(!this.states[r])throw new Error("Child state '".concat(r,"' does not exist on '").concat(this.id,"'"));return this.states[r].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:ih(this.states,function(n,r){if(!e)return n.historyValue();var i=At(e)?void 0:e[r];return n.historyValue(i||n.initialStateValue)},function(n){return!n.history})}},t.prototype.resolveHistory=function(e){var n=this;if(this.type!=="history")return[this];var r=this.parent;if(!e){var i=this.target;return i?te(Cs(i).map(function(a){return r.getFromRelativePath(a)})):r.initialStateNodes}var o=L0(r.path,"states")(e).current;return At(o)?[r.getStateNode(o)]:te(Cs(o).map(function(a){return n.history==="deep"?r.getFromRelativePath(a):[r.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,n=te(Object.keys(this.states).map(function(r){return e.states[r].stateIds}));return[this.id].concat(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,n,r,i;if(this.__cache.events)return this.__cache.events;var o=this.states,a=new Set(this.ownEvents);if(o)try{for(var u=Ct(Object.keys(o)),s=u.next();!s.done;s=u.next()){var c=s.value,l=o[c];if(l.states)try{for(var d=(r=void 0,Ct(l.events)),f=d.next();!f.done;f=d.next()){var h=f.value;a.add("".concat(h))}}catch(v){r={error:v}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}}catch(v){e={error:v}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(n){return!(!n.target&&!n.actions.length&&n.internal)}).map(function(n){return n.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var n=this;if(e!==void 0)return e.map(function(r){if(!At(r))return r;var i=r[0]===n.delimiter;if(i&&!n.parent)return n.getStateNodeByPath(r.slice(1));var o=i?n.key+r:r;if(n.parent)try{var a=n.parent.getStateNodeByPath(o);return a}catch(u){throw new Error("Invalid transition definition for state node '".concat(n.id,`':
85
- `).concat(u.message))}else return n.getStateNodeByPath(o)})},t.prototype.formatTransition=function(e){var n=this,r=X0(e.target),i="internal"in e?e.internal:r?r.some(function(s){return At(s)&&s[0]===n.delimiter}):!0,o=this.machine.options.guards,a=this.resolveTarget(r),u=V(V({},e),{actions:Nr(xn(e.actions)),cond:Wy(e.cond,o),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return V(V({},u),{target:u.target?u.target.map(function(s){return"#".concat(s.id)}):void 0,source:"#".concat(n.id)})}});return u},t.prototype.formatTransitions=function(){var e,n,r=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var o=this.config.on,a=Fo,u=o[a],s=u===void 0?[]:u,c=Df(o,[typeof a=="symbol"?a:a+""]);i=te(Object.keys(c).map(function(w){!re&&w===Ki&&Ce(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(r.id,'".'));var T=ki(w,c[w]);return re||NA(r,w,T),T}).concat(ki(Fo,s)))}var l=this.config.always?ki("",this.config.always):[],d=this.config.onDone?ki(String(os(this.id)),this.config.onDone):[];re||Ce(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var f=te(this.invoke.map(function(w){var T=[];return w.onDone&&T.push.apply(T,Ht([],Et(ki(String(Ts(w.id)),w.onDone)),!1)),w.onError&&T.push.apply(T,Ht([],Et(ki(String(Qo(w.id)),w.onError)),!1)),T})),h=this.after,v=te(Ht(Ht(Ht(Ht([],Et(d),!1),Et(f),!1),Et(i),!1),Et(l),!1).map(function(w){return xn(w).map(function(T){return r.formatTransition(T)})}));try{for(var p=Ct(h),S=p.next();!S.done;S=p.next()){var C=S.value;v.push(C)}}catch(w){e={error:w}}finally{try{S&&!S.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}return v},t}(),lh=!1;function jf(t,e){return!re&&!("predictableActionArguments"in t)&&!lh&&(lh=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new PA(t,e)}var Xe=uA,MA=Mu,nm=nA,ss=lA,jt={},qf={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});/*! *****************************************************************************
82
+ Event: `).concat(JSON.stringify(f.data)));return r.scheduler.schedule(function(){r.forward(f);var h=r._nextState(f);r.update(h,f)}),r._state},this.sendTo=function(l,d,f){var h=r.parent&&(d===Ti.Parent||r.parent.id===d),v=h?r.parent:At(d)?d===Ti.Internal?r:r.children.get(d)||Vo.get(d):J0(d)?d:void 0;if(!v){if(!h)throw new Error("Unable to send event to child '".concat(d,"' from service '").concat(r.id,"'."));re||Ce(!1,"Service '".concat(r.id,"' has no parent: unable to send event ").concat(l.type));return}if("machine"in v){if(r.status!==se.Stopped||r.parent!==v||r.state.done){var p=V(V({},l),{name:l.name===k0?"".concat(Qo(r.id)):l.name,origin:r.sessionId});!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([v,p]):v.send(p)}}else!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([v,l.data]):v.send(l.data)},this._exec=function(l,d,f,h){h===void 0&&(h=r.machine.options.actions);var v=l.exec||Cl(l.type,h),p=Rt(v)?v:v?v.exec:l.exec;if(p)try{return p(d,f.data,r.machine.config.predictableActionArguments?{action:l,_event:f}:{action:l,state:r.state,_event:f})}catch(Z){throw r.parent&&r.parent.send({type:"xstate.error",data:Z}),Z}switch(l.type){case Ba:{var S=l;r.defer(S);break}case Nu:var C=l;if(typeof C.delay=="number"){r.defer(C);return}else C.to?r.sendTo(C._event,C.to,f===no):r.send(C._event);break;case By:r.cancel(l.sendId);break;case yl:{if(r.status!==se.Running)return;var w=l.activity;if(!r.machine.config.predictableActionArguments&&!r.state.activities[w.id||w.type])break;if(w.type===Lt.Invoke){var T=Yy(w.src),I=r.machine.options.services?r.machine.options.services[T.type]:void 0,x=w.id,b=w.data;re||Ce(!("forward"in w),"`forward` property is deprecated (found in invocation of '".concat(w.src,"' in in machine '").concat(r.machine.id,"'). ")+"Please use `autoForward` instead.");var E="autoForward"in w?w.autoForward:!!w.forward;if(!I){re||Ce(!1,"No service found for invocation '".concat(w.src,"' in machine '").concat(r.machine.id,"'."));return}var P=b?Hs(b,d,f):void 0;if(typeof I=="string")return;var A=Rt(I)?I(d,f.data,{data:P,src:T,meta:w.meta}):I;if(!A)return;var U=void 0;vr(A)&&(A=P?A.withContext(P):A,U={autoForward:E}),r.spawn(A,x,U)}else r.spawnActivity(w);break}case Of:{r.stopChild(l.activity.id);break}case Vy:var M=l,$=M.label,z=M.value;$?r.logger($,z):r.logger(z);break;default:re||Ce(!1,"No implementation found for action type '".concat(l.type,"'"));break}};var i=V(V({},t.defaultOptions),n),o=i.clock,a=i.logger,u=i.parent,s=i.id,c=s!==void 0?s:e.id;this.id=c,this.logger=a,this.clock=o,this.parent=u,this.options=i,this.scheduler=new uh({deferEvents:this.options.deferEvents}),this.sessionId=Vo.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Wi(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return re||Ce(this.status!==se.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,n){var r,i;try{for(var o=Ct(e.actions),a=o.next();!a.done;a=o.next()){var u=a.value;this.exec(u,e,n)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},t.prototype.update=function(e,n){var r,i,o,a,u,s,c,l,d=this;if(e._sessionid=this.sessionId,this._state=e,(!this.machine.config.predictableActionArguments||n===no)&&this.options.execute)this.execute(this.state);else for(var f=void 0;f=this._outgoingQueue.shift();)f[0].send(f[1]);if(this.children.forEach(function(A){d.state.children[A.id]=A}),this.devTools&&this.devTools.send(n.data,e),e.event)try{for(var h=Ct(this.eventListeners),v=h.next();!v.done;v=h.next()){var p=v.value;p(e.event)}}catch(A){r={error:A}}finally{try{v&&!v.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}try{for(var S=Ct(this.listeners),C=S.next();!C.done;C=S.next()){var p=C.value;p(e,e.event)}}catch(A){o={error:A}}finally{try{C&&!C.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}try{for(var w=Ct(this.contextListeners),T=w.next();!T.done;T=w.next()){var I=T.value;I(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(A){u={error:A}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(u)throw u.error}}if(this.state.done){var x=e.configuration.find(function(A){return A.type==="final"&&A.parent===d.machine}),b=x&&x.doneData?Hs(x.doneData,e.context,n):void 0;this._doneEvent=Ts(this.id,b);try{for(var E=Ct(this.doneListeners),P=E.next();!P.done;P=E.next()){var p=P.value;p(this._doneEvent)}}catch(A){c={error:A}}finally{try{P&&!P.done&&(l=E.return)&&l.call(E)}finally{if(c)throw c.error}}this._stop(),this._stopChildren(),Vo.free(this.sessionId)}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===se.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,n,r){var i=this,o=ws(e,n,r);this.listeners.add(o.next),this.status!==se.NotStarted&&o.next(this.state);var a=function(){i.doneListeners.delete(a),i.stopListeners.delete(a),o.complete()};return this.status===se.Stopped?o.complete():(this.onDone(a),this.onStop(a)),{unsubscribe:function(){i.listeners.delete(o.next),i.doneListeners.delete(a),i.stopListeners.delete(a)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.status===se.Stopped&&this._doneEvent?e(this._doneEvent):this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var n=this;if(this.status===se.Running)return this;this.machine._init(),Vo.register(this.sessionId,this),this.initialized=!0,this.status=se.Running;var r=e===void 0?this.initialState:Wi(this,function(){return CA(e)?n.machine.resolveState(e):n.machine.resolveState(gn.from(e,n.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){n.update(r,no)}),this},t.prototype._stopChildren=function(){this.children.forEach(function(e){Rt(e.stop)&&e.stop()}),this.children.clear()},t.prototype._stop=function(){var e,n,r,i,o,a,u,s,c,l;try{for(var d=Ct(this.listeners),f=d.next();!f.done;f=d.next()){var h=f.value;this.listeners.delete(h)}}catch(E){e={error:E}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}try{for(var v=Ct(this.stopListeners),p=v.next();!p.done;p=v.next()){var h=p.value;h(),this.stopListeners.delete(h)}}catch(E){r={error:E}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}try{for(var S=Ct(this.contextListeners),C=S.next();!C.done;C=S.next()){var h=C.value;this.contextListeners.delete(h)}}catch(E){o={error:E}}finally{try{C&&!C.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}try{for(var w=Ct(this.doneListeners),T=w.next();!T.done;T=w.next()){var h=T.value;this.doneListeners.delete(h)}}catch(E){u={error:E}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(u)throw u.error}}if(!this.initialized)return this;this.initialized=!1,this.status=se.Stopped,this._initialState=void 0;try{for(var I=Ct(Object.keys(this.delayedEventsMap)),x=I.next();!x.done;x=I.next()){var b=x.value;this.clock.clearTimeout(this.delayedEventsMap[b])}}catch(E){c={error:E}}finally{try{x&&!x.done&&(l=I.return)&&l.call(I)}finally{if(c)throw c.error}}this.scheduler.clear(),this.scheduler=new uh({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var e=this,n=this.scheduler;return this._stop(),n.schedule(function(){var r=Pe({type:"xstate.stop"}),i=Wi(e,function(){var o=te(Ht([],Et(e.state.configuration),!1).sort(function(l,d){return d.order-l.order}).map(function(l){return Nr(l.onExit,e.machine.options.actions)})),a=Et(Ws(e.machine,e.state,e.state.context,r,[{type:"exit",actions:o}],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),u=a[0],s=a[1],c=new gn({value:e.state.value,context:s,_event:r,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:u.filter(function(l){return!Sl(l)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return c.changed=!0,c});e.update(i,r),e._stopChildren(),Vo.free(e.sessionId)}),this},t.prototype.batch=function(e){var n=this;if(this.status===se.NotStarted&&this.options.deferEvents)re||Ce(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
83
+ Event: `).concat(JSON.stringify(event)));else if(this.status!==se.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));if(e.length){var r=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var i,o,a=n.state,u=!1,s=[],c=function(h){var v=Pe(h);n.forward(v),a=Wi(n,function(){return n.machine.transition(a,v,void 0,r||void 0)}),s.push.apply(s,Ht([],Et(n.machine.config.predictableActionArguments?a.actions:a.actions.map(function(p){return wA(p,a)})),!1)),u=u||!!a.changed};try{for(var l=Ct(e),d=l.next();!d.done;d=l.next()){var f=d.value;c(f)}}catch(h){i={error:h}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}a.changed=u,a.actions=s,n.update(a,Pe(e[e.length-1]))})}},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype._nextState=function(e,n){var r=this;n===void 0&&(n=!!this.machine.config.predictableActionArguments&&this._exec);var i=Pe(e);if(i.name.indexOf(nh)===0&&!this.state.nextEvents.some(function(a){return a.indexOf(nh)===0}))throw i.data.data;var o=Wi(this,function(){return r.machine.transition(r.state,i,void 0,n||void 0)});return o},t.prototype.nextState=function(e){return this._nextState(e,!1)},t.prototype.forward=function(e){var n,r;try{for(var i=Ct(this.forwardTo),o=i.next();!o.done;o=i.next()){var a=o.value,u=this.children.get(a);if(!u)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));u.send(e)}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},t.prototype.defer=function(e){var n=this,r=this.clock.setTimeout(function(){"to"in e&&e.to?n.sendTo(e._event,e.to,!0):n.send(e._event)},e.delay);e.id&&(this.delayedEventsMap[e.id]=r)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,n,r){r===void 0&&(r=this.machine.options.actions),this._exec(e,n.context,n._event,r)},t.prototype.removeChild=function(e){var n;this.children.delete(e),this.forwardTo.delete(e),(n=this.state)===null||n===void 0||delete n.children[e]},t.prototype.stopChild=function(e){var n=this.children.get(e);n&&(this.removeChild(e),Rt(n.stop)&&n.stop())},t.prototype.spawn=function(e,n,r){if(this.status!==se.Running)return Rf(e,n);if(oh(e))return this.spawnPromise(Promise.resolve(e),n);if(Rt(e))return this.spawnCallback(e,n);if(yA(e))return this.spawnActor(e,n);if(Y0(e))return this.spawnObservable(e,n);if(vr(e))return this.spawnMachine(e,V(V({},r),{id:n}));if(H0(e))return this.spawnBehavior(e,n);throw new Error('Unable to spawn entity "'.concat(n,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,n){var r=this;n===void 0&&(n={});var i=new t(e,V(V({},this.options),{parent:this,id:n.id||e.id})),o=V(V({},Tl),n);o.sync&&i.onTransition(function(u){r.send(Fy,{state:u,id:i.id})});var a=i;return this.children.set(i.id,a),o.autoForward&&this.forwardTo.add(i.id),i.onDone(function(u){r.removeChild(i.id),r.send(Pe(u,{origin:i.id}))}).start(),a},t.prototype.spawnBehavior=function(e,n){var r=AA(e,{id:n,parent:this});return this.children.set(n,r),r},t.prototype.spawnPromise=function(e,n){var r,i=this,o=!1,a;e.then(function(s){o||(a=s,i.removeChild(n),i.send(Pe(Ts(n,s),{origin:n})))},function(s){if(!o){i.removeChild(n);var c=Qo(n,s);try{i.send(Pe(c,{origin:n}))}catch(l){Q0(s,l,n),i.devTools&&i.devTools.send(c,i.state),i.machine.strict&&i.stop()}}});var u=(r={id:n,send:function(){},subscribe:function(s,c,l){var d=ws(s,c,l),f=!1;return e.then(function(h){f||(d.next(h),!f&&d.complete())},function(h){f||d.error(h)}),{unsubscribe:function(){return f=!0}}},stop:function(){o=!0},toJSON:function(){return{id:n}},getSnapshot:function(){return a}},r[Or]=function(){return this},r);return this.children.set(n,u),u},t.prototype.spawnCallback=function(e,n){var r,i=this,o=!1,a=new Set,u=new Set,s,c=function(f){s=f,u.forEach(function(h){return h(f)}),!o&&i.send(Pe(f,{origin:n}))},l;try{l=e(c,function(f){a.add(f)})}catch(f){this.send(Qo(n,f))}if(oh(l))return this.spawnPromise(l,n);var d=(r={id:n,send:function(f){return a.forEach(function(h){return h(f)})},subscribe:function(f){var h=ws(f);return u.add(h.next),{unsubscribe:function(){u.delete(h.next)}}},stop:function(){o=!0,Rt(l)&&l()},toJSON:function(){return{id:n}},getSnapshot:function(){return s}},r[Or]=function(){return this},r);return this.children.set(n,d),d},t.prototype.spawnObservable=function(e,n){var r,i=this,o,a=e.subscribe(function(s){o=s,i.send(Pe(s,{origin:n}))},function(s){i.removeChild(n),i.send(Pe(Qo(n,s),{origin:n}))},function(){i.removeChild(n),i.send(Pe(Ts(n),{origin:n}))}),u=(r={id:n,send:function(){},subscribe:function(s,c,l){return e.subscribe(s,c,l)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return o},toJSON:function(){return{id:n}}},r[Or]=function(){return this},r);return this.children.set(n,u),u},t.prototype.spawnActor=function(e,n){return this.children.set(n,e),e},t.prototype.spawnActivity=function(e){var n=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!n){re||Ce(!1,"No implementation found for activity '".concat(e.type,"'"));return}var r=n(this.state.context,e);this.spawnEffect(e.id,r)},t.prototype.spawnEffect=function(e,n){var r;this.children.set(e,(r={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:n||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},r[Or]=function(){return this},r))},t.prototype.attachDev=function(){var e=_f();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var n=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(V(V({name:this.id,autoPause:!0,stateSanitizer:function(r){return{value:r.value,context:r.context,actions:r.actions}}},n),{features:V({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}xA(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[Or]=function(){return this},t.prototype.getSnapshot=function(){return this.status===se.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,n){return setTimeout(e,n)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=em,t}(),DA=function(t){return At(t)?V(V({},Tl),{name:t}):V(V(V({},Tl),{name:X0()}),t)};function ch(t,e){var n=DA(e);return hA(function(r){if(!re){var i=vr(t)||Rt(t);Ce(!!r||i,'Attempted to spawn an Actor (ID: "'.concat(vr(t)?t.id:"undefined",'") outside of a service. This will have no effect.'))}return r?r.spawn(t,n.name,n):Rf(t,n.name)})}function em(t,e){var n=new $A(t,e);return n}function OA(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function as(t){return V(V({type:ml},t),{toJSON:function(){t.onDone,t.onError;var e=Df(t,["onDone","onError"]);return V(V({},e),{type:ml,src:OA(t.src)})}})}var Ki="",Il="#",Fo="*",Ui={},Bi=function(t){return t[0]===Il},NA=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},PA=function(t,e,n){var r=n.slice(0,-1).some(function(o){return!("cond"in o)&&!("in"in o)&&(At(o.target)||vr(o.target))}),i=e===Ki?"the transient event":"event '".concat(e,"'");Ce(!r,"One or more transitions for ".concat(i," on state '").concat(t.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},MA=function(){function t(e,n,r,i){r===void 0&&(r="context"in e?e.context:void 0);var o=this,a;this.config=e,this._context=r,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(NA(),n),this.parent=i==null?void 0:i.parent,this.key=this.config.key||(i==null?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:Ly),this.id=this.config.id||Ht([this.machine.key],Et(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(a=this.config.schema)!==null&&a!==void 0?a:{},this.description=this.config.description,re||Ce(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Zo(this.config.states,function(c,l){var d,f=new t(c,{},void 0,{parent:o,key:l});return Object.assign(o.idMap,V((d={},d[f.id]=f,d),f.idMap)),f}):Ui;var u=0;function s(c){var l,d;c.order=u++;try{for(var f=Ct(Xy(c)),h=f.next();!h.done;h=f.next()){var v=h.value;s(v)}}catch(p){l={error:p}}finally{try{h&&!h.done&&(d=f.return)&&d.call(f)}finally{if(l)throw l.error}}}s(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(c){var l=c.event;return l===Ki}):Ki in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=xn(this.config.entry||this.config.onEntry).map(function(c){return wa(c)}),this.onExit=xn(this.config.exit||this.config.onExit).map(function(c){return wa(c)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=xn(this.config.invoke).map(function(c,l){var d,f;if(vr(c)){var h=is(o.id,l);return o.machine.options.services=V((d={},d[h]=c,d),o.machine.options.services),as({src:h,id:h})}else if(At(c.src)){var h=c.id||is(o.id,l);return as(V(V({},c),{id:h,src:c.src}))}else if(vr(c.src)||Rt(c.src)){var h=c.id||is(o.id,l);return o.machine.options.services=V((f={},f[h]=c.src,f),o.machine.options.services),as(V(V({id:h},c),{src:h}))}else{var v=c.src;return as(V(V({id:is(o.id,l)},c),{src:v}))}}),this.activities=xn(this.config.activities).concat(this.invoke).map(function(c){return Mf(c)}),this.transition=this.transition.bind(this),this.tags=xn(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||Zy(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,n){var r=this.options,i=r.actions,o=r.activities,a=r.guards,u=r.services,s=r.delays;return new t(this.config,{actions:V(V({},i),e.actions),activities:V(V({},o),e.activities),guards:V(V({},a),e.guards),services:V(V({},u),e.services),delays:V(V({},s),e.delays)},n??this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return Rt(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Zo(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(n,r){return n[r.eventType]=n[r.eventType]||[],n[r.eventType].push(r),n},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var n=e===Ki,r=this.transitions.filter(function(i){var o=i.eventType===e;return n?o:o||i.eventType===Fo});return this.__cache.candidates[e]=r,r},t.prototype.getDelayedTransitions=function(){var e=this,n=this.config.after;if(!n)return[];var r=function(o,a){var u=Rt(o)?"".concat(e.id,":delay[").concat(a,"]"):o,s=lA(u,e.id);return e.onEntry.push(Mu(s,{delay:o})),e.onExit.push(oA(s)),s},i=Io(n)?n.map(function(o,a){var u=r(o.delay,a);return V(V({},o),{event:u})}):te(Object.keys(n).map(function(o,a){var u=n[o],s=At(u)?{target:u}:u,c=isNaN(+o)?o:+o,l=r(c,a);return xn(s).map(function(d){return V(V({},d),{event:l,delay:c})})}));return i.map(function(o){var a=o.delay;return V(V({},e.formatTransition(o)),{delay:a})})},t.prototype.getStateNodes=function(e){var n,r=this;if(!e)return[];var i=e instanceof gn?e.value:ca(e,this.delimiter);if(At(i)){var o=this.getStateNode(i).initial;return o!==void 0?this.getStateNodes((n={},n[i]=o,n)):[this,this.states[i]]}var a=Object.keys(i),u=[this];return u.push.apply(u,Ht([],Et(te(a.map(function(s){return r.getStateNode(s).getStateNodes(i[s])}))),!1)),u},t.prototype.handles=function(e){var n=Gy(e);return this.events.includes(n)},t.prototype.resolveState=function(e){var n=e instanceof gn?e:gn.create(e),r=Array.from(ta([],this.getStateNodes(n.value)));return new gn(V(V({},n),{value:this.resolve(n.value),configuration:r,done:Is(r,this),tags:sh(r),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,n,r){var i=this.getStateNode(e),o=i.next(n,r);return!o||!o.transitions.length?this.next(n,r):o},t.prototype.transitionCompoundNode=function(e,n,r){var i=Object.keys(e),o=this.getStateNode(i[0]),a=o._transition(e[i[0]],n,r);return!a||!a.transitions.length?this.next(n,r):a},t.prototype.transitionParallelNode=function(e,n,r){var i,o,a={};try{for(var u=Ct(Object.keys(e)),s=u.next();!s.done;s=u.next()){var c=s.value,l=e[c];if(l){var d=this.getStateNode(c),f=d._transition(l,n,r);f&&(a[c]=f)}}}catch(C){i={error:C}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}var h=Object.keys(a).map(function(C){return a[C]}),v=te(h.map(function(C){return C.transitions})),p=h.some(function(C){return C.transitions.length>0});if(!p)return this.next(n,r);var S=te(Object.keys(a).map(function(C){return a[C].configuration}));return{transitions:v,exitSet:te(h.map(function(C){return C.exitSet})),configuration:S,source:n,actions:te(Object.keys(a).map(function(C){return a[C].actions}))}},t.prototype._transition=function(e,n,r){return At(e)?this.transitionLeafNode(e,n,r):Object.keys(e).length===1?this.transitionCompoundNode(e,n,r):this.transitionParallelNode(e,n,r)},t.prototype.getTransitionData=function(e,n){return this._transition(e.value,e,Pe(n))},t.prototype.next=function(e,n){var r,i,o=this,a=n.name,u=[],s=[],c;try{for(var l=Ct(this.getCandidates(a)),d=l.next();!d.done;d=l.next()){var f=d.value,h=f.cond,v=f.in,p=e.context,S=v?At(v)&&Bi(v)?e.matches(ca(this.getStateNodeById(v).path,this.delimiter)):Pf(ca(v,this.delimiter),L0(this.path.slice(0,-2))(e.value)):!0,C=!1;try{C=!h||Ky(this.machine,h,p,n,e)}catch(I){throw new Error("Unable to evaluate guard '".concat(h.name||h.type,"' in transition for event '").concat(a,"' in state node '").concat(this.id,`':
84
+ `).concat(I.message))}if(C&&S){f.target!==void 0&&(s=f.target),u.push.apply(u,Ht([],Et(f.actions),!1)),c=f;break}}}catch(I){r={error:I}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}if(c){if(!s.length)return{transitions:[c],exitSet:[],configuration:e.value?[this]:[],source:e,actions:u};var w=te(s.map(function(I){return o.getRelativeStateNodes(I,e.historyValue)})),T=!!c.internal;return{transitions:[c],exitSet:T?[]:te(s.map(function(I){return o.getPotentiallyReenteringNodes(I)})),configuration:w,source:e,actions:u}}},t.prototype.getPotentiallyReenteringNodes=function(e){if(this.order<e.order)return[this];for(var n=[],r=this,i=e;r&&r!==i;)n.push(r),r=r.parent;return r!==i?[]:(n.push(i),n)},t.prototype.getActions=function(e,n,r,i,o,a,u){var s,c,l,d,f=this,h=a?ta([],this.getStateNodes(a.value)):[],v=new Set;try{for(var p=Ct(Array.from(e).sort(function(M,$){return M.order-$.order})),S=p.next();!S.done;S=p.next()){var C=S.value;(!ea(h,C)||ea(r.exitSet,C)||C.parent&&v.has(C.parent))&&v.add(C)}}catch(M){s={error:M}}finally{try{S&&!S.done&&(c=p.return)&&c.call(p)}finally{if(s)throw s.error}}try{for(var w=Ct(h),T=w.next();!T.done;T=w.next()){var C=T.value;(!ea(e,C)||ea(r.exitSet,C.parent))&&r.exitSet.push(C)}}catch(M){l={error:M}}finally{try{T&&!T.done&&(d=w.return)&&d.call(w)}finally{if(l)throw l.error}}r.exitSet.sort(function(M,$){return $.order-M.order});var I=Array.from(v).sort(function(M,$){return M.order-$.order}),x=new Set(r.exitSet),b=te(I.map(function(M){var $=[];if(M.type!=="final")return $;var z=M.parent;if(!z.parent)return $;$.push(os(M.id,M.doneData),os(z.id,M.doneData?Hs(M.doneData,i,o):void 0));var Z=z.parent;return Z.type==="parallel"&&Ta(Z).every(function(Vt){return Is(r.configuration,Vt)})&&$.push(os(Z.id)),$})),E=I.map(function(M){var $=M.onEntry,z=M.activities.map(function(Z){return aA(Z)});return{type:"entry",actions:Nr(u?Ht(Ht([],Et($),!1),Et(z),!1):Ht(Ht([],Et(z),!1),Et($),!1),f.machine.options.actions)}}).concat({type:"state_done",actions:b.map(function(M){return tA(M)})}),P=Array.from(x).map(function(M){return{type:"exit",actions:Nr(Ht(Ht([],Et(M.onExit),!1),Et(M.activities.map(function($){return sA($)})),!1),f.machine.options.actions)}}),A=P.concat({type:"transition",actions:Nr(r.actions,this.machine.options.actions)}).concat(E);if(n){var U=Nr(te(Ht([],Et(e),!1).sort(function(M,$){return $.order-M.order}).map(function(M){return M.onExit})),this.machine.options.actions).filter(function(M){return!Sl(M)});return A.concat({type:"stop",actions:U})}return A},t.prototype.transition=function(e,n,r,i){e===void 0&&(e=this.initialState);var o=Pe(n),a;if(e instanceof gn)a=r===void 0?e:this.resolveState(gn.from(e,r));else{var u=At(e)?this.resolve(zs(this.getResolvedPath(e))):this.resolve(e),s=r??this.machine.context;a=this.resolveState(gn.from(u,s))}if(!re&&o.name===Fo)throw new Error("An event cannot have the wildcard type ('".concat(Fo,"')"));if(this.strict&&!this.events.includes(o.name)&&!z0(o.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var c=this._transition(a.value,a,o)||{transitions:[],configuration:[],exitSet:[],source:a,actions:[]},l=ta([],this.getStateNodes(a.value)),d=c.configuration.length?ta(l,c.configuration):l;return c.configuration=Ht([],Et(d),!1),this.resolveTransition(c,a,a.context,i,o)},t.prototype.resolveRaisedTransition=function(e,n,r,i){var o,a=e.actions;return e=this.transition(e,n,void 0,i),e._event=r,e.event=r.data,(o=e.actions).unshift.apply(o,Ht([],Et(a),!1)),e},t.prototype.resolveTransition=function(e,n,r,i,o){var a,u,s,c,l=this;o===void 0&&(o=no);var d=e.configuration,f=!n||e.transitions.length>0,h=f?e.configuration:n?n.configuration:[],v=Is(h,this),p=f?gA(this.machine,d):void 0,S=n?n.historyValue?n.historyValue:e.source?this.machine.historyValue(n.value):void 0:void 0,C=this.getActions(new Set(h),v,e,r,o,n,i),w=n?V({},n.activities):{};try{for(var T=Ct(C),I=T.next();!I.done;I=T.next()){var x=I.value;try{for(var b=(s=void 0,Ct(x.actions)),E=b.next();!E.done;E=b.next()){var P=E.value;P.type===yl?w[P.activity.id||P.activity.type]=P:P.type===Of&&(w[P.activity.id||P.activity.type]=!1)}}catch(Ot){s={error:Ot}}finally{try{E&&!E.done&&(c=b.return)&&c.call(b)}finally{if(s)throw s.error}}}}catch(Ot){a={error:Ot}}finally{try{I&&!I.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}var A=Et(Ws(this,n,r,o,C,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),U=A[0],M=A[1],$=Et(W0(U,Sl),2),z=$[0],Z=$[1],Vt=U.filter(function(Ot){var Zt;return Ot.type===yl&&((Zt=Ot.activity)===null||Zt===void 0?void 0:Zt.type)===ml}),bt=Vt.reduce(function(Ot,Zt){return Ot[Zt.activity.id]=pA(Zt.activity,l.machine,M,o),Ot},n?V({},n.children):{}),J=new gn({value:p||n.value,context:M,_event:o,_sessionid:n?n._sessionid:null,historyValue:p?S?K0(S,p):void 0:n?n.historyValue:void 0,history:!p||e.source?n:void 0,actions:p?Z:[],activities:p?w:n?n.activities:{},events:[],configuration:h,transitions:e.transitions,children:bt,done:v,tags:sh(h),machine:this}),Y=r!==M;J.changed=o.name===Fy||Y;var ut=J.history;ut&&delete ut.history;var $e=!v&&(this._transient||d.some(function(Ot){return Ot._transient}));if(!f&&(!$e||o.name===Ki))return J;var tt=J;if(!v)for($e&&(tt=this.resolveRaisedTransition(tt,{type:j0},o,i));z.length;){var De=z.shift();tt=this.resolveRaisedTransition(tt,De._event,o,i)}var an=tt.changed||(ut?!!tt.actions.length||Y||typeof ut.value!=typeof tt.value||!tm(tt.value,ut.value):void 0);return tt.changed=an,tt.history=ut,tt},t.prototype.getStateNode=function(e){if(Bi(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var n=this.states[e];if(!n)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return n},t.prototype.getStateNodeById=function(e){var n=Bi(e)?e.slice(Il.length):e;if(n===this.id)return this;var r=this.machine.idMap[n];if(!r)throw new Error("Child state node '#".concat(n,"' does not exist on machine '").concat(this.id,"'"));return r},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Bi(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var n=bl(e,this.delimiter).slice(),r=this;n.length;){var i=n.shift();if(!i.length)break;r=r.getStateNode(i)}return r},t.prototype.resolve=function(e){var n,r=this;if(!e)return this.initialStateValue||Ui;switch(this.type){case"parallel":return Zo(this.initialStateValue,function(o,a){return o?r.getStateNode(a).resolve(e[a]||o):Ui});case"compound":if(At(e)){var i=this.getStateNode(e);return i.type==="parallel"||i.type==="compound"?(n={},n[e]=i.initialStateValue,n):e}return Object.keys(e).length?Zo(e,function(o,a){return o?r.getStateNode(a).resolve(o):Ui}):this.initialStateValue||{};default:return e||Ui}},t.prototype.getResolvedPath=function(e){if(Bi(e)){var n=this.machine.idMap[e.slice(Il.length)];if(!n)throw new Error("Unable to find state node '".concat(e,"'"));return n.path}return bl(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var n;if(this.type==="parallel")n=ih(this.states,function(r){return r.initialStateValue||Ui},function(r){return r.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));n=Ys(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else n={};return this.__cache.initialStateValue=n,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,n){this._init();var r=this.getStateNodes(e);return this.resolveTransition({configuration:r,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,n??this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var n=this.config;At(n.target)?e=Bi(n.target)?zs(this.machine.getStateNodeById(n.target).path.slice(this.path.length-1)):n.target:e=n.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,n,r){return r===void 0&&(r=!0),r?e.type==="history"?e.resolveHistory(n):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(Ys(this))return[this];if(this.type==="compound"&&!this.initial)return re||Ce(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var n=Cs(this.initialStateValue);return te(n.map(function(r){return e.getFromRelativePath(r)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var n=Et(e),r=n[0],i=n.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(r,"' from node with no states"));var o=this.getStateNode(r);if(o.type==="history")return o.resolveHistory();if(!this.states[r])throw new Error("Child state '".concat(r,"' does not exist on '").concat(this.id,"'"));return this.states[r].getFromRelativePath(i)},t.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:ih(this.states,function(n,r){if(!e)return n.historyValue();var i=At(e)?void 0:e[r];return n.historyValue(i||n.initialStateValue)},function(n){return!n.history})}},t.prototype.resolveHistory=function(e){var n=this;if(this.type!=="history")return[this];var r=this.parent;if(!e){var i=this.target;return i?te(Cs(i).map(function(a){return r.getFromRelativePath(a)})):r.initialStateNodes}var o=G0(r.path,"states")(e).current;return At(o)?[r.getStateNode(o)]:te(Cs(o).map(function(a){return n.history==="deep"?r.getFromRelativePath(a):[r.states[a[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,n=te(Object.keys(this.states).map(function(r){return e.states[r].stateIds}));return[this.id].concat(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,n,r,i;if(this.__cache.events)return this.__cache.events;var o=this.states,a=new Set(this.ownEvents);if(o)try{for(var u=Ct(Object.keys(o)),s=u.next();!s.done;s=u.next()){var c=s.value,l=o[c];if(l.states)try{for(var d=(r=void 0,Ct(l.events)),f=d.next();!f.done;f=d.next()){var h=f.value;a.add("".concat(h))}}catch(v){r={error:v}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}}catch(v){e={error:v}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(n){return!(!n.target&&!n.actions.length&&n.internal)}).map(function(n){return n.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var n=this;if(e!==void 0)return e.map(function(r){if(!At(r))return r;var i=r[0]===n.delimiter;if(i&&!n.parent)return n.getStateNodeByPath(r.slice(1));var o=i?n.key+r:r;if(n.parent)try{var a=n.parent.getStateNodeByPath(o);return a}catch(u){throw new Error("Invalid transition definition for state node '".concat(n.id,`':
85
+ `).concat(u.message))}else return n.getStateNodeByPath(o)})},t.prototype.formatTransition=function(e){var n=this,r=Z0(e.target),i="internal"in e?e.internal:r?r.some(function(s){return At(s)&&s[0]===n.delimiter}):!0,o=this.machine.options.guards,a=this.resolveTarget(r),u=V(V({},e),{actions:Nr(xn(e.actions)),cond:Wy(e.cond,o),target:a,source:this,internal:i,eventType:e.event,toJSON:function(){return V(V({},u),{target:u.target?u.target.map(function(s){return"#".concat(s.id)}):void 0,source:"#".concat(n.id)})}});return u},t.prototype.formatTransitions=function(){var e,n,r=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var o=this.config.on,a=Fo,u=o[a],s=u===void 0?[]:u,c=Df(o,[typeof a=="symbol"?a:a+""]);i=te(Object.keys(c).map(function(w){!re&&w===Ki&&Ce(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(r.id,'".'));var T=ki(w,c[w]);return re||PA(r,w,T),T}).concat(ki(Fo,s)))}var l=this.config.always?ki("",this.config.always):[],d=this.config.onDone?ki(String(os(this.id)),this.config.onDone):[];re||Ce(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var f=te(this.invoke.map(function(w){var T=[];return w.onDone&&T.push.apply(T,Ht([],Et(ki(String(Ts(w.id)),w.onDone)),!1)),w.onError&&T.push.apply(T,Ht([],Et(ki(String(Qo(w.id)),w.onError)),!1)),T})),h=this.after,v=te(Ht(Ht(Ht(Ht([],Et(d),!1),Et(f),!1),Et(i),!1),Et(l),!1).map(function(w){return xn(w).map(function(T){return r.formatTransition(T)})}));try{for(var p=Ct(h),S=p.next();!S.done;S=p.next()){var C=S.value;v.push(C)}}catch(w){e={error:w}}finally{try{S&&!S.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}return v},t}(),lh=!1;function jf(t,e){return!re&&!("predictableActionArguments"in t)&&!lh&&(lh=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new MA(t,e)}var Xe=cA,RA=Mu,nm=rA,ss=fA,jt={},qf={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});/*! *****************************************************************************
86
86
  Copyright (c) Microsoft Corporation.
87
87
 
88
88
  Permission to use, copy, modify, and/or distribute this software for any
@@ -95,7 +95,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==se.Running)throw
95
95
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
96
96
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
97
97
  PERFORMANCE OF THIS SOFTWARE.
98
- ***************************************************************************** */t.__assign=function(){return t.__assign=Object.assign||function(a){for(var u,s=1,c=arguments.length;s<c;s++){u=arguments[s];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(a[l]=u[l])}return a},t.__assign.apply(this,arguments)};function e(o,a){var u={};for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&a.indexOf(s)<0&&(u[s]=o[s]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,s=Object.getOwnPropertySymbols(o);c<s.length;c++)a.indexOf(s[c])<0&&Object.prototype.propertyIsEnumerable.call(o,s[c])&&(u[s[c]]=o[s[c]]);return u}function n(o){var a=typeof Symbol=="function"&&Symbol.iterator,u=a&&o[a],s=0;if(u)return u.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&s>=o.length&&(o=void 0),{value:o&&o[s++],done:!o}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(o,a){var u=typeof Symbol=="function"&&o[Symbol.iterator];if(!u)return o;var s=u.call(o),c,l=[],d;try{for(;(a===void 0||a-- >0)&&!(c=s.next()).done;)l.push(c.value)}catch(f){d={error:f}}finally{try{c&&!c.done&&(u=s.return)&&u.call(s)}finally{if(d)throw d.error}}return l}function i(o,a,u){if(u||arguments.length===2)for(var s=0,c=a.length,l;s<c;s++)(l||!(s in a))&&(l||(l=Array.prototype.slice.call(a,0,s)),l[s]=a[s]);return o.concat(l||Array.prototype.slice.call(a))}t.__read=r,t.__rest=e,t.__spreadArray=i,t.__values=n})(qf);var Ru={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ActionTypes=void 0,function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"}(t.ActionTypes||(t.ActionTypes={})),t.SpecialTargets=void 0,function(e){e.Parent="#_parent",e.Internal="#_internal"}(t.SpecialTargets||(t.SpecialTargets={}))})(Ru);var de={};Object.defineProperty(de,"__esModule",{value:!0});var Ae=Ru,RA=Ae.ActionTypes.Start,_A=Ae.ActionTypes.Stop,jA=Ae.ActionTypes.Raise,qA=Ae.ActionTypes.Send,kA=Ae.ActionTypes.Cancel,UA=Ae.ActionTypes.NullEvent,BA=Ae.ActionTypes.Assign,VA=Ae.ActionTypes.After,FA=Ae.ActionTypes.DoneState,LA=Ae.ActionTypes.Log,GA=Ae.ActionTypes.Init,zA=Ae.ActionTypes.Invoke,HA=Ae.ActionTypes.ErrorExecution,WA=Ae.ActionTypes.ErrorPlatform,KA=Ae.ActionTypes.ErrorCustom,JA=Ae.ActionTypes.Update,YA=Ae.ActionTypes.Choose,XA=Ae.ActionTypes.Pure;de.after=VA;de.assign=BA;de.cancel=kA;de.choose=YA;de.doneState=FA;de.error=KA;de.errorExecution=HA;de.errorPlatform=WA;de.init=GA;de.invoke=zA;de.log=LA;de.nullEvent=UA;de.pure=XA;de.raise=jA;de.send=qA;de.start=RA;de.stop=_A;de.update=JA;var rm={},Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});var ZA=".",QA={},t$="xstate.guard",e$="";Eo.DEFAULT_GUARD_TYPE=t$;Eo.EMPTY_ACTIVITY_MAP=QA;Eo.STATE_DELIMITER=ZA;Eo.TARGETLESS_KEY=e$;var _u={};Object.defineProperty(_u,"__esModule",{value:!0});var n$=process.env.NODE_ENV==="production";_u.IS_PRODUCTION=n$;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=qf,n=Ru,r=de,i=Eo,o=_u,a;function u(y){return Object.keys(y)}function s(y,D,N){N===void 0&&(N=i.STATE_DELIMITER);var O=h(y,N),j=h(D,N);return J(j)?J(O)?j===O:!1:J(O)?O in j:Object.keys(O).every(function(q){return q in j?s(O[q],j[q]):!1})}function c(y){try{return J(y)||typeof y=="number"?"".concat(y):y.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function l(y){try{return J(y)||typeof y=="number"?"".concat(y):Y(y)?y.name:y.type}catch{throw new Error("Actions must be strings or objects with a string action.type property.")}}function d(y,D){try{return bt(y)?y:y.toString().split(D)}catch{throw new Error("'".concat(y,"' is not a valid state path."))}}function f(y){return typeof y=="object"&&"value"in y&&"context"in y&&"event"in y&&"_event"in y}function h(y,D){if(f(y))return y.value;if(bt(y))return v(y);if(typeof y!="string")return y;var N=d(y,D);return v(N)}function v(y){if(y.length===1)return y[0];for(var D={},N=D,O=0;O<y.length-1;O++)O===y.length-2?N[y[O]]=y[O+1]:(N[y[O]]={},N=N[y[O]]);return D}function p(y,D){for(var N={},O=Object.keys(y),j=0;j<O.length;j++){var q=O[j];N[q]=D(y[q],q,y,j)}return N}function S(y,D,N){var O,j,q={};try{for(var W=e.__values(Object.keys(y)),G=W.next();!G.done;G=W.next()){var Q=G.value,ct=y[Q];N(ct)&&(q[Q]=D(ct,Q,y))}}catch(le){O={error:le}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}var C=function(y){return function(D){var N,O,j=D;try{for(var q=e.__values(y),W=q.next();!W.done;W=q.next()){var G=W.value;j=j[G]}}catch(Q){N={error:Q}}finally{try{W&&!W.done&&(O=q.return)&&O.call(q)}finally{if(N)throw N.error}}return j}};function w(y,D){return function(N){var O,j,q=N;try{for(var W=e.__values(y),G=W.next();!G.done;G=W.next()){var Q=G.value;q=q[D][Q]}}catch(ct){O={error:ct}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}}function T(y){if(!y)return[[]];if(J(y))return[[y]];var D=x(Object.keys(y).map(function(N){var O=y[N];return typeof O!="string"&&(!O||!Object.keys(O).length)?[[N]]:T(y[N]).map(function(j){return[N].concat(j)})}));return D}function I(y){var D,N,O={};if(y&&y.length===1&&y[0].length===1)return y[0][0];try{for(var j=e.__values(y),q=j.next();!q.done;q=j.next())for(var W=q.value,G=O,Q=0;Q<W.length;Q++){var ct=W[Q];if(Q===W.length-2){G[ct]=W[Q+1];break}G[ct]=G[ct]||{},G=G[ct]}}catch(le){D={error:le}}finally{try{q&&!q.done&&(N=j.return)&&N.call(j)}finally{if(D)throw D.error}}return O}function x(y){var D;return(D=[]).concat.apply(D,e.__spreadArray([],e.__read(y),!1))}function b(y){return bt(y)?y:[y]}function E(y){return y===void 0?[]:b(y)}function P(y,D,N){var O,j;if(Y(y))return y(D,N.data);var q={};try{for(var W=e.__values(Object.keys(y)),G=W.next();!G.done;G=W.next()){var Q=G.value,ct=y[Q];Y(ct)?q[Q]=ct(D,N.data):q[Q]=ct}}catch(le){O={error:le}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}function A(y){return/^(done|error)\./.test(y)}function U(y){return!!(y instanceof Promise||y!==null&&(Y(y)||typeof y=="object")&&Y(y.then))}function M(y){return y!==null&&typeof y=="object"&&"transition"in y&&typeof y.transition=="function"}function $(y,D){var N,O,j=e.__read([[],[]],2),q=j[0],W=j[1];try{for(var G=e.__values(y),Q=G.next();!Q.done;Q=G.next()){var ct=Q.value;D(ct)?q.push(ct):W.push(ct)}}catch(le){N={error:le}}finally{try{Q&&!Q.done&&(O=G.return)&&O.call(G)}finally{if(N)throw N.error}}return[q,W]}function z(y,D){return p(y.states,function(N,O){if(N){var j=(J(D)?void 0:D[O])||(N?N.current:void 0);if(j)return{current:j,states:z(N,j)}}})}function Z(y,D){return{current:D,states:z(y,D)}}function Vt(y,D,N,O){o.IS_PRODUCTION||t.warn(!!y,"Attempting to update undefined context");var j=y&&N.reduce(function(q,W){var G,Q,ct=W.assignment,le={state:O,action:W,_event:D},ni={};if(Y(ct))ni=ct(q,D.data,le);else try{for(var Qn=e.__values(Object.keys(ct)),In=Qn.next();!In.done;In=Qn.next()){var jo=In.value,ri=ct[jo];ni[jo]=Y(ri)?ri(q,D.data,le):ri}}catch(pc){G={error:pc}}finally{try{In&&!In.done&&(Q=Qn.return)&&Q.call(Qn)}finally{if(G)throw G.error}}return Object.assign({},q,ni)},y);return j}t.warn=function(){},o.IS_PRODUCTION||(t.warn=function(y,D){var N=y instanceof Error?y:void 0;if(!(!N&&y)&&console!==void 0){var O=["Warning: ".concat(D)];N&&O.push(N),console.warn.apply(console,O)}});function bt(y){return Array.isArray(y)}function Y(y){return typeof y=="function"}function J(y){return typeof y=="string"}function ut(y,D){if(y)return J(y)?{type:i.DEFAULT_GUARD_TYPE,name:y,predicate:D?D[y]:void 0}:Y(y)?{type:i.DEFAULT_GUARD_TYPE,name:y.name,predicate:y}:y}function $e(y){try{return"subscribe"in y&&Y(y.subscribe)}catch{return!1}}var tt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),De=(a={},a[tt]=function(){return this},a[Symbol.observable]=function(){return this},a);function an(y){return!!y&&"__xstatenode"in y}function Ot(y){return!!y&&typeof y.send=="function"}var Zt=function(){var y=0;return function(){return y++,y.toString(16)}}();function Un(y,D){return J(y)||typeof y=="number"?e.__assign({type:y},D):y}function Bn(y,D){if(!J(y)&&"$$type"in y&&y.$$type==="scxml")return y;var N=Un(y);return e.__assign({name:N.type,data:N,$$type:"scxml",type:"external"},D)}function Tn(y,D){var N=b(D).map(function(O){return typeof O>"u"||typeof O=="string"||an(O)?{target:O,event:y}:e.__assign(e.__assign({},O),{event:y})});return N}function ei(y){if(!(y===void 0||y===i.TARGETLESS_KEY))return E(y)}function br(y,D,N){if(!o.IS_PRODUCTION){var O=y.stack?" Stacktrace was '".concat(y.stack,"'"):"";if(y===D)console.error("Missing onError handler for invocation '".concat(N,"', error was '").concat(y,"'.").concat(O));else{var j=D.stack?" Stacktrace was '".concat(D.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(N,"'. ")+"Original error: '".concat(y,"'. ").concat(O," Current error is '").concat(D,"'.").concat(j))}}}function yn(y,D,N,O,j){var q=y.options.guards,W={state:j,cond:D,_event:O};if(D.type===i.DEFAULT_GUARD_TYPE)return((q==null?void 0:q[D.name])||D.predicate)(N,O.data,W);var G=q==null?void 0:q[D.type];if(!G)throw new Error("Guard '".concat(D.type,"' is not implemented on machine '").concat(y.id,"'."));return G(N,O.data,W)}function lc(y){return typeof y=="string"?{type:y}:y}function fc(y,D,N){var O=function(){},j=typeof y=="object",q=j?y:null;return{next:((j?y.next:y)||O).bind(q),error:((j?y.error:D)||O).bind(q),complete:((j?y.complete:N)||O).bind(q)}}function dc(y,D){return"".concat(y,":invocation[").concat(D,"]")}function hc(y){return(y.type===r.raise||y.type===r.send&&y.to===n.SpecialTargets.Internal)&&typeof y.delay!="number"}t.createInvokeId=dc,t.evaluateGuard=yn,t.flatten=x,t.getActionType=l,t.getEventType=c,t.interopSymbols=De,t.isActor=Ot,t.isArray=bt,t.isBehavior=M,t.isBuiltInEvent=A,t.isFunction=Y,t.isMachine=an,t.isObservable=$e,t.isPromiseLike=U,t.isRaisableAction=hc,t.isStateLike=f,t.isString=J,t.keys=u,t.mapContext=P,t.mapFilterValues=S,t.mapValues=p,t.matchesState=s,t.nestedPath=w,t.normalizeTarget=ei,t.partition=$,t.path=C,t.pathToStateValue=v,t.pathsToStateValue=I,t.reportUnhandledExceptionOnInvocation=br,t.symbolObservable=tt,t.toArray=E,t.toArrayStrict=b,t.toEventObject=Un,t.toGuard=ut,t.toInvokeSource=lc,t.toObserver=fc,t.toSCXMLEvent=Bn,t.toStatePath=d,t.toStatePaths=T,t.toStateValue=h,t.toTransitionConfigArray=Tn,t.uniqueId=Zt,t.updateContext=Vt,t.updateHistoryStates=z,t.updateHistoryValue=Z})(rm);Object.defineProperty(jt,"__esModule",{value:!0});var Dt=qf,wn=Ru,Ee=de,gt=rm,im=_u,r$=gt.toSCXMLEvent({type:Ee.init});function El(t,e){return e&&e[t]||void 0}function ju(t,e){var n;if(gt.isString(t)||typeof t=="number"){var r=El(t,e);gt.isFunction(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(gt.isFunction(t))n={type:t.name||t.toString(),exec:t};else{var r=El(t.type,e);if(gt.isFunction(r))n=Dt.__assign(Dt.__assign({},t),{exec:r});else if(r){var i=r.type||t.type;n=Dt.__assign(Dt.__assign(Dt.__assign({},r),t),{type:i})}else n=t}return n}var xl=function(t,e){if(!t)return[];var n=gt.isArray(t)?t:[t];return n.map(function(r){return ju(r,e)})};function kf(t){var e=ju(t);return Dt.__assign(Dt.__assign({id:gt.isString(t)?t:e.id},e),{type:e.type})}function i$(t,e){return{type:Ee.raise,event:typeof t=="function"?t:gt.toEventObject(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function om(t,e,n,r){var i={_event:n},o=gt.toSCXMLEvent(gt.isFunction(t.event)?t.event(e,n.data,i):t.event),a;if(gt.isString(t.delay)){var u=r&&r[t.delay];a=gt.isFunction(u)?u(e,n.data,i):u}else a=gt.isFunction(t.delay)?t.delay(e,n.data,i):t.delay;return Dt.__assign(Dt.__assign({},t),{type:Ee.raise,_event:o,delay:a})}function Va(t,e){return{to:e?e.to:void 0,type:Ee.send,event:gt.isFunction(t)?t:gt.toEventObject(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:gt.isFunction(t)?t.name:gt.getEventType(t)}}function am(t,e,n,r){var i={_event:n},o=gt.toSCXMLEvent(gt.isFunction(t.event)?t.event(e,n.data,i):t.event),a;if(gt.isString(t.delay)){var u=r&&r[t.delay];a=gt.isFunction(u)?u(e,n.data,i):u}else a=gt.isFunction(t.delay)?t.delay(e,n.data,i):t.delay;var s=gt.isFunction(t.to)?t.to(e,n.data,i):t.to;return Dt.__assign(Dt.__assign({},t),{to:s,_event:o,event:o.data,delay:a})}function Uf(t,e){return Va(t,Dt.__assign(Dt.__assign({},e),{to:wn.SpecialTargets.Parent}))}function o$(t,e,n){return Va(e,Dt.__assign(Dt.__assign({},n),{to:t}))}function a$(){return Uf(Ee.update)}function s$(t,e){return Va(t,Dt.__assign(Dt.__assign({},e),{to:function(n,r,i){var o=i._event;return o.origin}}))}var u$=function(t,e){return{context:t,event:e}};function c$(t,e){return t===void 0&&(t=u$),{type:Ee.log,label:e,expr:t}}var sm=function(t,e,n){return Dt.__assign(Dt.__assign({},t),{value:gt.isString(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},l$=function(t){return{type:Ee.cancel,sendId:t}};function f$(t){var e=kf(t);return{type:wn.ActionTypes.Start,activity:e,exec:void 0}}function d$(t){var e=gt.isFunction(t)?t:kf(t);return{type:wn.ActionTypes.Stop,activity:e,exec:void 0}}function um(t,e,n){var r=gt.isFunction(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,o={type:wn.ActionTypes.Stop,activity:i};return o}var h$=function(t){return{type:Ee.assign,assignment:t}};function p$(t){return typeof t=="object"&&"type"in t}function v$(t,e){var n=e?"#".concat(e):"";return"".concat(wn.ActionTypes.After,"(").concat(t,")").concat(n)}function y$(t,e){var n="".concat(wn.ActionTypes.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function m$(t,e){var n="".concat(wn.ActionTypes.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function g$(t,e){var n="".concat(wn.ActionTypes.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function b$(t){return{type:wn.ActionTypes.Pure,get:t}}function S$(t,e){if(!im.IS_PRODUCTION&&(!t||typeof t=="function")){var n=t;t=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=typeof n=="function"?n.apply(void 0,Dt.__spreadArray([],Dt.__read(r),!1)):n;if(!o)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return o}}return Va(function(r,i){return i},Dt.__assign(Dt.__assign({},e),{to:t}))}function C$(t,e){return Uf(function(n,r,i){return{type:Ee.error,data:gt.isFunction(t)?t(n,r,i):t}},Dt.__assign(Dt.__assign({},e),{to:wn.SpecialTargets.Parent}))}function w$(t){return{type:wn.ActionTypes.Choose,conds:t}}var T$=function(t){var e,n,r=[];try{for(var i=Dt.__values(t),o=i.next();!o.done;o=i.next())for(var a=o.value,u=0;u<a.actions.length;){if(a.actions[u].type===Ee.assign){r.push(a.actions[u]),a.actions.splice(u,1);continue}u++}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function Al(t,e,n,r,i,o,a){a===void 0&&(a=!1);var u=a?[]:T$(i),s=u.length?gt.updateContext(n,r,u,e):n,c=a?[n]:void 0,l=[];function d(v,p){var S;switch(p.type){case Ee.raise:{var C=om(p,s,r,t.options.delays);return o&&typeof C.delay=="number"&&o(C,s,r),C}case Ee.send:var w=am(p,s,r,t.options.delays);if(!im.IS_PRODUCTION){var T=p.delay;gt.warn(!gt.isString(T)||typeof w.delay=="number","No delay reference for delay expression '".concat(T,"' was found on machine '").concat(t.id,"'"))}return o&&w.to!==wn.SpecialTargets.Internal&&(v==="entry"?l.push(w):o(w,s,r)),w;case Ee.log:{var I=sm(p,s,r);return o==null||o(I,s,r),I}case Ee.choose:{var x=p,b=(S=x.conds.find(function(Y){var J=gt.toGuard(Y.cond,t.options.guards);return!J||gt.evaluateGuard(t,J,s,r,o?void 0:e)}))===null||S===void 0?void 0:S.actions;if(!b)return[];var E=Dt.__read(Al(t,e,s,r,[{type:v,actions:xl(gt.toArray(b),t.options.actions)}],o,a),2),P=E[0],A=E[1];return s=A,c==null||c.push(s),P}case Ee.pure:{var b=p.get(s,r.data);if(!b)return[];var U=Dt.__read(Al(t,e,s,r,[{type:v,actions:xl(gt.toArray(b),t.options.actions)}],o,a),2),M=U[0],$=U[1];return s=$,c==null||c.push(s),M}case Ee.stop:{var I=um(p,s,r);return o==null||o(I,n,r),I}case Ee.assign:{s=gt.updateContext(s,r,[p],o?void 0:e),c==null||c.push(s);break}default:var z=ju(p,t.options.actions),Z=z.exec;if(o)o(z,s,r);else if(Z&&c){var Vt=c.length-1,bt=Dt.__assign(Dt.__assign({},z),{exec:function(Y){for(var J=[],ut=1;ut<arguments.length;ut++)J[ut-1]=arguments[ut];Z.apply(void 0,Dt.__spreadArray([c[Vt]],Dt.__read(J),!1))}});z=bt}return z}}function f(v){var p,S,C=[];try{for(var w=Dt.__values(v.actions),T=w.next();!T.done;T=w.next()){var I=T.value,x=d(v.type,I);x&&(C=C.concat(x))}}catch(b){p={error:b}}finally{try{T&&!T.done&&(S=w.return)&&S.call(w)}finally{if(p)throw p.error}}return l.forEach(function(b){o(b,s,r)}),l.length=0,C}var h=gt.flatten(i.map(f));return[h,s]}jt.actionTypes=Ee;jt.after=v$;jt.assign=h$;jt.cancel=l$;jt.choose=w$;jt.done=y$;jt.doneInvoke=m$;jt.error=g$;jt.escalate=C$;jt.forwardTo=S$;jt.getActionFunction=El;jt.initEvent=r$;jt.isActionObject=p$;var dn=jt.log=c$,I$=jt.pure=b$;jt.raise=i$;jt.resolveActions=Al;jt.resolveLog=sm;jt.resolveRaise=om;jt.resolveSend=am;jt.resolveStop=um;jt.respond=s$;jt.send=Va;jt.sendParent=Uf;jt.sendTo=o$;jt.sendUpdate=a$;jt.start=f$;var fh=jt.stop=d$;jt.toActionObject=ju;jt.toActionObjects=xl;jt.toActivityDefinition=kf;var $l={exports:{}},Ec={},us={exports:{}},xc={};/**
98
+ ***************************************************************************** */t.__assign=function(){return t.__assign=Object.assign||function(a){for(var u,s=1,c=arguments.length;s<c;s++){u=arguments[s];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(a[l]=u[l])}return a},t.__assign.apply(this,arguments)};function e(o,a){var u={};for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&a.indexOf(s)<0&&(u[s]=o[s]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,s=Object.getOwnPropertySymbols(o);c<s.length;c++)a.indexOf(s[c])<0&&Object.prototype.propertyIsEnumerable.call(o,s[c])&&(u[s[c]]=o[s[c]]);return u}function n(o){var a=typeof Symbol=="function"&&Symbol.iterator,u=a&&o[a],s=0;if(u)return u.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&s>=o.length&&(o=void 0),{value:o&&o[s++],done:!o}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(o,a){var u=typeof Symbol=="function"&&o[Symbol.iterator];if(!u)return o;var s=u.call(o),c,l=[],d;try{for(;(a===void 0||a-- >0)&&!(c=s.next()).done;)l.push(c.value)}catch(f){d={error:f}}finally{try{c&&!c.done&&(u=s.return)&&u.call(s)}finally{if(d)throw d.error}}return l}function i(o,a,u){if(u||arguments.length===2)for(var s=0,c=a.length,l;s<c;s++)(l||!(s in a))&&(l||(l=Array.prototype.slice.call(a,0,s)),l[s]=a[s]);return o.concat(l||Array.prototype.slice.call(a))}t.__read=r,t.__rest=e,t.__spreadArray=i,t.__values=n})(qf);var Ru={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ActionTypes=void 0,function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"}(t.ActionTypes||(t.ActionTypes={})),t.SpecialTargets=void 0,function(e){e.Parent="#_parent",e.Internal="#_internal"}(t.SpecialTargets||(t.SpecialTargets={}))})(Ru);var de={};Object.defineProperty(de,"__esModule",{value:!0});var Ae=Ru,_A=Ae.ActionTypes.Start,jA=Ae.ActionTypes.Stop,qA=Ae.ActionTypes.Raise,kA=Ae.ActionTypes.Send,UA=Ae.ActionTypes.Cancel,BA=Ae.ActionTypes.NullEvent,VA=Ae.ActionTypes.Assign,FA=Ae.ActionTypes.After,LA=Ae.ActionTypes.DoneState,GA=Ae.ActionTypes.Log,zA=Ae.ActionTypes.Init,HA=Ae.ActionTypes.Invoke,WA=Ae.ActionTypes.ErrorExecution,KA=Ae.ActionTypes.ErrorPlatform,YA=Ae.ActionTypes.ErrorCustom,JA=Ae.ActionTypes.Update,XA=Ae.ActionTypes.Choose,ZA=Ae.ActionTypes.Pure;de.after=FA;de.assign=VA;de.cancel=UA;de.choose=XA;de.doneState=LA;de.error=YA;de.errorExecution=WA;de.errorPlatform=KA;de.init=zA;de.invoke=HA;de.log=GA;de.nullEvent=BA;de.pure=ZA;de.raise=qA;de.send=kA;de.start=_A;de.stop=jA;de.update=JA;var rm={},Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});var QA=".",t$={},e$="xstate.guard",n$="";Eo.DEFAULT_GUARD_TYPE=e$;Eo.EMPTY_ACTIVITY_MAP=t$;Eo.STATE_DELIMITER=QA;Eo.TARGETLESS_KEY=n$;var _u={};Object.defineProperty(_u,"__esModule",{value:!0});var r$=process.env.NODE_ENV==="production";_u.IS_PRODUCTION=r$;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=qf,n=Ru,r=de,i=Eo,o=_u,a;function u(y){return Object.keys(y)}function s(y,D,N){N===void 0&&(N=i.STATE_DELIMITER);var O=h(y,N),j=h(D,N);return Y(j)?Y(O)?j===O:!1:Y(O)?O in j:Object.keys(O).every(function(q){return q in j?s(O[q],j[q]):!1})}function c(y){try{return Y(y)||typeof y=="number"?"".concat(y):y.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function l(y){try{return Y(y)||typeof y=="number"?"".concat(y):J(y)?y.name:y.type}catch{throw new Error("Actions must be strings or objects with a string action.type property.")}}function d(y,D){try{return bt(y)?y:y.toString().split(D)}catch{throw new Error("'".concat(y,"' is not a valid state path."))}}function f(y){return typeof y=="object"&&"value"in y&&"context"in y&&"event"in y&&"_event"in y}function h(y,D){if(f(y))return y.value;if(bt(y))return v(y);if(typeof y!="string")return y;var N=d(y,D);return v(N)}function v(y){if(y.length===1)return y[0];for(var D={},N=D,O=0;O<y.length-1;O++)O===y.length-2?N[y[O]]=y[O+1]:(N[y[O]]={},N=N[y[O]]);return D}function p(y,D){for(var N={},O=Object.keys(y),j=0;j<O.length;j++){var q=O[j];N[q]=D(y[q],q,y,j)}return N}function S(y,D,N){var O,j,q={};try{for(var W=e.__values(Object.keys(y)),G=W.next();!G.done;G=W.next()){var Q=G.value,ct=y[Q];N(ct)&&(q[Q]=D(ct,Q,y))}}catch(le){O={error:le}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}var C=function(y){return function(D){var N,O,j=D;try{for(var q=e.__values(y),W=q.next();!W.done;W=q.next()){var G=W.value;j=j[G]}}catch(Q){N={error:Q}}finally{try{W&&!W.done&&(O=q.return)&&O.call(q)}finally{if(N)throw N.error}}return j}};function w(y,D){return function(N){var O,j,q=N;try{for(var W=e.__values(y),G=W.next();!G.done;G=W.next()){var Q=G.value;q=q[D][Q]}}catch(ct){O={error:ct}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}}function T(y){if(!y)return[[]];if(Y(y))return[[y]];var D=x(Object.keys(y).map(function(N){var O=y[N];return typeof O!="string"&&(!O||!Object.keys(O).length)?[[N]]:T(y[N]).map(function(j){return[N].concat(j)})}));return D}function I(y){var D,N,O={};if(y&&y.length===1&&y[0].length===1)return y[0][0];try{for(var j=e.__values(y),q=j.next();!q.done;q=j.next())for(var W=q.value,G=O,Q=0;Q<W.length;Q++){var ct=W[Q];if(Q===W.length-2){G[ct]=W[Q+1];break}G[ct]=G[ct]||{},G=G[ct]}}catch(le){D={error:le}}finally{try{q&&!q.done&&(N=j.return)&&N.call(j)}finally{if(D)throw D.error}}return O}function x(y){var D;return(D=[]).concat.apply(D,e.__spreadArray([],e.__read(y),!1))}function b(y){return bt(y)?y:[y]}function E(y){return y===void 0?[]:b(y)}function P(y,D,N){var O,j;if(J(y))return y(D,N.data);var q={};try{for(var W=e.__values(Object.keys(y)),G=W.next();!G.done;G=W.next()){var Q=G.value,ct=y[Q];J(ct)?q[Q]=ct(D,N.data):q[Q]=ct}}catch(le){O={error:le}}finally{try{G&&!G.done&&(j=W.return)&&j.call(W)}finally{if(O)throw O.error}}return q}function A(y){return/^(done|error)\./.test(y)}function U(y){return!!(y instanceof Promise||y!==null&&(J(y)||typeof y=="object")&&J(y.then))}function M(y){return y!==null&&typeof y=="object"&&"transition"in y&&typeof y.transition=="function"}function $(y,D){var N,O,j=e.__read([[],[]],2),q=j[0],W=j[1];try{for(var G=e.__values(y),Q=G.next();!Q.done;Q=G.next()){var ct=Q.value;D(ct)?q.push(ct):W.push(ct)}}catch(le){N={error:le}}finally{try{Q&&!Q.done&&(O=G.return)&&O.call(G)}finally{if(N)throw N.error}}return[q,W]}function z(y,D){return p(y.states,function(N,O){if(N){var j=(Y(D)?void 0:D[O])||(N?N.current:void 0);if(j)return{current:j,states:z(N,j)}}})}function Z(y,D){return{current:D,states:z(y,D)}}function Vt(y,D,N,O){o.IS_PRODUCTION||t.warn(!!y,"Attempting to update undefined context");var j=y&&N.reduce(function(q,W){var G,Q,ct=W.assignment,le={state:O,action:W,_event:D},ni={};if(J(ct))ni=ct(q,D.data,le);else try{for(var Qn=e.__values(Object.keys(ct)),In=Qn.next();!In.done;In=Qn.next()){var jo=In.value,ri=ct[jo];ni[jo]=J(ri)?ri(q,D.data,le):ri}}catch(pc){G={error:pc}}finally{try{In&&!In.done&&(Q=Qn.return)&&Q.call(Qn)}finally{if(G)throw G.error}}return Object.assign({},q,ni)},y);return j}t.warn=function(){},o.IS_PRODUCTION||(t.warn=function(y,D){var N=y instanceof Error?y:void 0;if(!(!N&&y)&&console!==void 0){var O=["Warning: ".concat(D)];N&&O.push(N),console.warn.apply(console,O)}});function bt(y){return Array.isArray(y)}function J(y){return typeof y=="function"}function Y(y){return typeof y=="string"}function ut(y,D){if(y)return Y(y)?{type:i.DEFAULT_GUARD_TYPE,name:y,predicate:D?D[y]:void 0}:J(y)?{type:i.DEFAULT_GUARD_TYPE,name:y.name,predicate:y}:y}function $e(y){try{return"subscribe"in y&&J(y.subscribe)}catch{return!1}}var tt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),De=(a={},a[tt]=function(){return this},a[Symbol.observable]=function(){return this},a);function an(y){return!!y&&"__xstatenode"in y}function Ot(y){return!!y&&typeof y.send=="function"}var Zt=function(){var y=0;return function(){return y++,y.toString(16)}}();function Un(y,D){return Y(y)||typeof y=="number"?e.__assign({type:y},D):y}function Bn(y,D){if(!Y(y)&&"$$type"in y&&y.$$type==="scxml")return y;var N=Un(y);return e.__assign({name:N.type,data:N,$$type:"scxml",type:"external"},D)}function Tn(y,D){var N=b(D).map(function(O){return typeof O>"u"||typeof O=="string"||an(O)?{target:O,event:y}:e.__assign(e.__assign({},O),{event:y})});return N}function ei(y){if(!(y===void 0||y===i.TARGETLESS_KEY))return E(y)}function br(y,D,N){if(!o.IS_PRODUCTION){var O=y.stack?" Stacktrace was '".concat(y.stack,"'"):"";if(y===D)console.error("Missing onError handler for invocation '".concat(N,"', error was '").concat(y,"'.").concat(O));else{var j=D.stack?" Stacktrace was '".concat(D.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(N,"'. ")+"Original error: '".concat(y,"'. ").concat(O," Current error is '").concat(D,"'.").concat(j))}}}function yn(y,D,N,O,j){var q=y.options.guards,W={state:j,cond:D,_event:O};if(D.type===i.DEFAULT_GUARD_TYPE)return((q==null?void 0:q[D.name])||D.predicate)(N,O.data,W);var G=q==null?void 0:q[D.type];if(!G)throw new Error("Guard '".concat(D.type,"' is not implemented on machine '").concat(y.id,"'."));return G(N,O.data,W)}function lc(y){return typeof y=="string"?{type:y}:y}function fc(y,D,N){var O=function(){},j=typeof y=="object",q=j?y:null;return{next:((j?y.next:y)||O).bind(q),error:((j?y.error:D)||O).bind(q),complete:((j?y.complete:N)||O).bind(q)}}function dc(y,D){return"".concat(y,":invocation[").concat(D,"]")}function hc(y){return(y.type===r.raise||y.type===r.send&&y.to===n.SpecialTargets.Internal)&&typeof y.delay!="number"}t.createInvokeId=dc,t.evaluateGuard=yn,t.flatten=x,t.getActionType=l,t.getEventType=c,t.interopSymbols=De,t.isActor=Ot,t.isArray=bt,t.isBehavior=M,t.isBuiltInEvent=A,t.isFunction=J,t.isMachine=an,t.isObservable=$e,t.isPromiseLike=U,t.isRaisableAction=hc,t.isStateLike=f,t.isString=Y,t.keys=u,t.mapContext=P,t.mapFilterValues=S,t.mapValues=p,t.matchesState=s,t.nestedPath=w,t.normalizeTarget=ei,t.partition=$,t.path=C,t.pathToStateValue=v,t.pathsToStateValue=I,t.reportUnhandledExceptionOnInvocation=br,t.symbolObservable=tt,t.toArray=E,t.toArrayStrict=b,t.toEventObject=Un,t.toGuard=ut,t.toInvokeSource=lc,t.toObserver=fc,t.toSCXMLEvent=Bn,t.toStatePath=d,t.toStatePaths=T,t.toStateValue=h,t.toTransitionConfigArray=Tn,t.uniqueId=Zt,t.updateContext=Vt,t.updateHistoryStates=z,t.updateHistoryValue=Z})(rm);Object.defineProperty(jt,"__esModule",{value:!0});var Dt=qf,wn=Ru,Ee=de,gt=rm,im=_u,i$=gt.toSCXMLEvent({type:Ee.init});function El(t,e){return e&&e[t]||void 0}function ju(t,e){var n;if(gt.isString(t)||typeof t=="number"){var r=El(t,e);gt.isFunction(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(gt.isFunction(t))n={type:t.name||t.toString(),exec:t};else{var r=El(t.type,e);if(gt.isFunction(r))n=Dt.__assign(Dt.__assign({},t),{exec:r});else if(r){var i=r.type||t.type;n=Dt.__assign(Dt.__assign(Dt.__assign({},r),t),{type:i})}else n=t}return n}var xl=function(t,e){if(!t)return[];var n=gt.isArray(t)?t:[t];return n.map(function(r){return ju(r,e)})};function kf(t){var e=ju(t);return Dt.__assign(Dt.__assign({id:gt.isString(t)?t:e.id},e),{type:e.type})}function o$(t,e){return{type:Ee.raise,event:typeof t=="function"?t:gt.toEventObject(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function om(t,e,n,r){var i={_event:n},o=gt.toSCXMLEvent(gt.isFunction(t.event)?t.event(e,n.data,i):t.event),a;if(gt.isString(t.delay)){var u=r&&r[t.delay];a=gt.isFunction(u)?u(e,n.data,i):u}else a=gt.isFunction(t.delay)?t.delay(e,n.data,i):t.delay;return Dt.__assign(Dt.__assign({},t),{type:Ee.raise,_event:o,delay:a})}function Va(t,e){return{to:e?e.to:void 0,type:Ee.send,event:gt.isFunction(t)?t:gt.toEventObject(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:gt.isFunction(t)?t.name:gt.getEventType(t)}}function am(t,e,n,r){var i={_event:n},o=gt.toSCXMLEvent(gt.isFunction(t.event)?t.event(e,n.data,i):t.event),a;if(gt.isString(t.delay)){var u=r&&r[t.delay];a=gt.isFunction(u)?u(e,n.data,i):u}else a=gt.isFunction(t.delay)?t.delay(e,n.data,i):t.delay;var s=gt.isFunction(t.to)?t.to(e,n.data,i):t.to;return Dt.__assign(Dt.__assign({},t),{to:s,_event:o,event:o.data,delay:a})}function Uf(t,e){return Va(t,Dt.__assign(Dt.__assign({},e),{to:wn.SpecialTargets.Parent}))}function a$(t,e,n){return Va(e,Dt.__assign(Dt.__assign({},n),{to:t}))}function s$(){return Uf(Ee.update)}function u$(t,e){return Va(t,Dt.__assign(Dt.__assign({},e),{to:function(n,r,i){var o=i._event;return o.origin}}))}var c$=function(t,e){return{context:t,event:e}};function l$(t,e){return t===void 0&&(t=c$),{type:Ee.log,label:e,expr:t}}var sm=function(t,e,n){return Dt.__assign(Dt.__assign({},t),{value:gt.isString(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},f$=function(t){return{type:Ee.cancel,sendId:t}};function d$(t){var e=kf(t);return{type:wn.ActionTypes.Start,activity:e,exec:void 0}}function h$(t){var e=gt.isFunction(t)?t:kf(t);return{type:wn.ActionTypes.Stop,activity:e,exec:void 0}}function um(t,e,n){var r=gt.isFunction(t.activity)?t.activity(e,n.data):t.activity,i=typeof r=="string"?{id:r}:r,o={type:wn.ActionTypes.Stop,activity:i};return o}var p$=function(t){return{type:Ee.assign,assignment:t}};function v$(t){return typeof t=="object"&&"type"in t}function y$(t,e){var n=e?"#".concat(e):"";return"".concat(wn.ActionTypes.After,"(").concat(t,")").concat(n)}function m$(t,e){var n="".concat(wn.ActionTypes.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function g$(t,e){var n="".concat(wn.ActionTypes.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function b$(t,e){var n="".concat(wn.ActionTypes.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function S$(t){return{type:wn.ActionTypes.Pure,get:t}}function C$(t,e){if(!im.IS_PRODUCTION&&(!t||typeof t=="function")){var n=t;t=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=typeof n=="function"?n.apply(void 0,Dt.__spreadArray([],Dt.__read(r),!1)):n;if(!o)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return o}}return Va(function(r,i){return i},Dt.__assign(Dt.__assign({},e),{to:t}))}function w$(t,e){return Uf(function(n,r,i){return{type:Ee.error,data:gt.isFunction(t)?t(n,r,i):t}},Dt.__assign(Dt.__assign({},e),{to:wn.SpecialTargets.Parent}))}function T$(t){return{type:wn.ActionTypes.Choose,conds:t}}var I$=function(t){var e,n,r=[];try{for(var i=Dt.__values(t),o=i.next();!o.done;o=i.next())for(var a=o.value,u=0;u<a.actions.length;){if(a.actions[u].type===Ee.assign){r.push(a.actions[u]),a.actions.splice(u,1);continue}u++}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r};function Al(t,e,n,r,i,o,a){a===void 0&&(a=!1);var u=a?[]:I$(i),s=u.length?gt.updateContext(n,r,u,e):n,c=a?[n]:void 0,l=[];function d(v,p){var S;switch(p.type){case Ee.raise:{var C=om(p,s,r,t.options.delays);return o&&typeof C.delay=="number"&&o(C,s,r),C}case Ee.send:var w=am(p,s,r,t.options.delays);if(!im.IS_PRODUCTION){var T=p.delay;gt.warn(!gt.isString(T)||typeof w.delay=="number","No delay reference for delay expression '".concat(T,"' was found on machine '").concat(t.id,"'"))}return o&&w.to!==wn.SpecialTargets.Internal&&(v==="entry"?l.push(w):o(w,s,r)),w;case Ee.log:{var I=sm(p,s,r);return o==null||o(I,s,r),I}case Ee.choose:{var x=p,b=(S=x.conds.find(function(J){var Y=gt.toGuard(J.cond,t.options.guards);return!Y||gt.evaluateGuard(t,Y,s,r,o?void 0:e)}))===null||S===void 0?void 0:S.actions;if(!b)return[];var E=Dt.__read(Al(t,e,s,r,[{type:v,actions:xl(gt.toArray(b),t.options.actions)}],o,a),2),P=E[0],A=E[1];return s=A,c==null||c.push(s),P}case Ee.pure:{var b=p.get(s,r.data);if(!b)return[];var U=Dt.__read(Al(t,e,s,r,[{type:v,actions:xl(gt.toArray(b),t.options.actions)}],o,a),2),M=U[0],$=U[1];return s=$,c==null||c.push(s),M}case Ee.stop:{var I=um(p,s,r);return o==null||o(I,n,r),I}case Ee.assign:{s=gt.updateContext(s,r,[p],o?void 0:e),c==null||c.push(s);break}default:var z=ju(p,t.options.actions),Z=z.exec;if(o)o(z,s,r);else if(Z&&c){var Vt=c.length-1,bt=Dt.__assign(Dt.__assign({},z),{exec:function(J){for(var Y=[],ut=1;ut<arguments.length;ut++)Y[ut-1]=arguments[ut];Z.apply(void 0,Dt.__spreadArray([c[Vt]],Dt.__read(Y),!1))}});z=bt}return z}}function f(v){var p,S,C=[];try{for(var w=Dt.__values(v.actions),T=w.next();!T.done;T=w.next()){var I=T.value,x=d(v.type,I);x&&(C=C.concat(x))}}catch(b){p={error:b}}finally{try{T&&!T.done&&(S=w.return)&&S.call(w)}finally{if(p)throw p.error}}return l.forEach(function(b){o(b,s,r)}),l.length=0,C}var h=gt.flatten(i.map(f));return[h,s]}jt.actionTypes=Ee;jt.after=y$;jt.assign=p$;jt.cancel=f$;jt.choose=T$;jt.done=m$;jt.doneInvoke=g$;jt.error=b$;jt.escalate=w$;jt.forwardTo=C$;jt.getActionFunction=El;jt.initEvent=i$;jt.isActionObject=v$;var dn=jt.log=l$,E$=jt.pure=S$;jt.raise=o$;jt.resolveActions=Al;jt.resolveLog=sm;jt.resolveRaise=om;jt.resolveSend=am;jt.resolveStop=um;jt.respond=u$;jt.send=Va;jt.sendParent=Uf;jt.sendTo=a$;jt.sendUpdate=s$;jt.start=d$;var fh=jt.stop=h$;jt.toActionObject=ju;jt.toActionObjects=xl;jt.toActivityDefinition=kf;var $l={exports:{}},Ec={},us={exports:{}},xc={};/**
99
99
  * @license React
100
100
  * use-sync-external-store-shim.production.min.js
101
101
  *
@@ -103,7 +103,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==se.Running)throw
103
103
  *
104
104
  * This source code is licensed under the MIT license found in the
105
105
  * LICENSE file in the root directory of this source tree.
106
- */var dh;function E$(){if(dh)return xc;dh=1;var t=R;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,a=t.useDebugValue;function u(d,f){var h=f(),v=r({inst:{value:h,getSnapshot:f}}),p=v[0].inst,S=v[1];return o(function(){p.value=h,p.getSnapshot=f,s(p)&&S({inst:p})},[d,h,f]),i(function(){return s(p)&&S({inst:p}),d(function(){s(p)&&S({inst:p})})},[d]),a(h),h}function s(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:u;return xc.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:l,xc}var Ac={};/**
106
+ */var dh;function x$(){if(dh)return xc;dh=1;var t=R;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,a=t.useDebugValue;function u(d,f){var h=f(),v=r({inst:{value:h,getSnapshot:f}}),p=v[0].inst,S=v[1];return o(function(){p.value=h,p.getSnapshot=f,s(p)&&S({inst:p})},[d,h,f]),i(function(){return s(p)&&S({inst:p}),d(function(){s(p)&&S({inst:p})})},[d]),a(h),h}function s(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:u;return xc.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:l,xc}var Ac={};/**
107
107
  * @license React
108
108
  * use-sync-external-store-shim.development.js
109
109
  *
@@ -111,7 +111,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==se.Running)throw
111
111
  *
112
112
  * This source code is licensed under the MIT license found in the
113
113
  * LICENSE file in the root directory of this source tree.
114
- */var hh;function x$(){return hh||(hh=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=R,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(T){{for(var I=arguments.length,x=new Array(I>1?I-1:0),b=1;b<I;b++)x[b-1]=arguments[b];r("error",T,x)}}function r(T,I,x){{var b=e.ReactDebugCurrentFrame,E=b.getStackAddendum();E!==""&&(I+="%s",x=x.concat([E]));var P=x.map(function(A){return String(A)});P.unshift("Warning: "+I),Function.prototype.apply.call(console[T],console,P)}}function i(T,I){return T===I&&(T!==0||1/T===1/I)||T!==T&&I!==I}var o=typeof Object.is=="function"?Object.is:i,a=t.useState,u=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue,l=!1,d=!1;function f(T,I,x){l||t.startTransition!==void 0&&(l=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=I();if(!d){var E=I();o(b,E)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var P=a({inst:{value:b,getSnapshot:I}}),A=P[0].inst,U=P[1];return s(function(){A.value=b,A.getSnapshot=I,h(A)&&U({inst:A})},[T,b,I]),u(function(){h(A)&&U({inst:A});var M=function(){h(A)&&U({inst:A})};return T(M)},[T]),c(b),b}function h(T){var I=T.getSnapshot,x=T.value;try{var b=I();return!o(x,b)}catch{return!0}}function v(T,I,x){return I()}var p=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",S=!p,C=S?v:f,w=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:C;Ac.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ac}var ph;function cm(){return ph||(ph=1,process.env.NODE_ENV==="production"?us.exports=E$():us.exports=x$()),us.exports}/**
114
+ */var hh;function A$(){return hh||(hh=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=R,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(T){{for(var I=arguments.length,x=new Array(I>1?I-1:0),b=1;b<I;b++)x[b-1]=arguments[b];r("error",T,x)}}function r(T,I,x){{var b=e.ReactDebugCurrentFrame,E=b.getStackAddendum();E!==""&&(I+="%s",x=x.concat([E]));var P=x.map(function(A){return String(A)});P.unshift("Warning: "+I),Function.prototype.apply.call(console[T],console,P)}}function i(T,I){return T===I&&(T!==0||1/T===1/I)||T!==T&&I!==I}var o=typeof Object.is=="function"?Object.is:i,a=t.useState,u=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue,l=!1,d=!1;function f(T,I,x){l||t.startTransition!==void 0&&(l=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=I();if(!d){var E=I();o(b,E)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var P=a({inst:{value:b,getSnapshot:I}}),A=P[0].inst,U=P[1];return s(function(){A.value=b,A.getSnapshot=I,h(A)&&U({inst:A})},[T,b,I]),u(function(){h(A)&&U({inst:A});var M=function(){h(A)&&U({inst:A})};return T(M)},[T]),c(b),b}function h(T){var I=T.getSnapshot,x=T.value;try{var b=I();return!o(x,b)}catch{return!0}}function v(T,I,x){return I()}var p=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",S=!p,C=S?v:f,w=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:C;Ac.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ac}var ph;function cm(){return ph||(ph=1,process.env.NODE_ENV==="production"?us.exports=x$():us.exports=A$()),us.exports}/**
115
115
  * @license React
116
116
  * use-sync-external-store-shim/with-selector.production.min.js
117
117
  *
@@ -119,7 +119,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==se.Running)throw
119
119
  *
120
120
  * This source code is licensed under the MIT license found in the
121
121
  * LICENSE file in the root directory of this source tree.
122
- */var vh;function A$(){if(vh)return Ec;vh=1;var t=R,e=cm();function n(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,s=t.useDebugValue;return Ec.useSyncExternalStoreWithSelector=function(c,l,d,f,h){var v=o(null);if(v.current===null){var p={hasValue:!1,value:null};v.current=p}else p=v.current;v=u(function(){function C(b){if(!w){if(w=!0,T=b,b=f(b),h!==void 0&&p.hasValue){var E=p.value;if(h(E,b))return I=E}return I=b}if(E=I,r(T,b))return E;var P=f(b);return h!==void 0&&h(E,P)?E:(T=b,I=P)}var w=!1,T,I,x=d===void 0?null:d;return[function(){return C(l())},x===null?void 0:function(){return C(x())}]},[l,d,f,h]);var S=i(c,v[0],v[1]);return a(function(){p.hasValue=!0,p.value=S},[S]),s(S),S},Ec}var $c={};/**
122
+ */var vh;function $$(){if(vh)return Ec;vh=1;var t=R,e=cm();function n(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,s=t.useDebugValue;return Ec.useSyncExternalStoreWithSelector=function(c,l,d,f,h){var v=o(null);if(v.current===null){var p={hasValue:!1,value:null};v.current=p}else p=v.current;v=u(function(){function C(b){if(!w){if(w=!0,T=b,b=f(b),h!==void 0&&p.hasValue){var E=p.value;if(h(E,b))return I=E}return I=b}if(E=I,r(T,b))return E;var P=f(b);return h!==void 0&&h(E,P)?E:(T=b,I=P)}var w=!1,T,I,x=d===void 0?null:d;return[function(){return C(l())},x===null?void 0:function(){return C(x())}]},[l,d,f,h]);var S=i(c,v[0],v[1]);return a(function(){p.hasValue=!0,p.value=S},[S]),s(S),S},Ec}var $c={};/**
123
123
  * @license React
124
124
  * use-sync-external-store-shim/with-selector.development.js
125
125
  *
@@ -127,9 +127,9 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==se.Running)throw
127
127
  *
128
128
  * This source code is licensed under the MIT license found in the
129
129
  * LICENSE file in the root directory of this source tree.
130
- */var yh;function $$(){return yh||(yh=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=R,e=cm();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,s=t.useDebugValue;function c(l,d,f,h,v){var p=o(null),S;p.current===null?(S={hasValue:!1,value:null},p.current=S):S=p.current;var C=u(function(){var x=!1,b,E,P=function($){if(!x){x=!0,b=$;var z=h($);if(v!==void 0&&S.hasValue){var Z=S.value;if(v(Z,z))return E=Z,Z}return E=z,z}var Vt=b,bt=E;if(r(Vt,$))return bt;var Y=h($);return v!==void 0&&v(bt,Y)?bt:(b=$,E=Y,Y)},A=f===void 0?null:f,U=function(){return P(d())},M=A===null?void 0:function(){return P(A())};return[U,M]},[d,f,h,v]),w=C[0],T=C[1],I=i(l,w,T);return a(function(){S.hasValue=!0,S.value=I},[I]),s(I),I}$c.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),$c}process.env.NODE_ENV==="production"?$l.exports=A$():$l.exports=$$();var D$=$l.exports,O$=R.useLayoutEffect;function mh(t){var e=pp.useRef();return e.current||(e.current={v:t()}),e.current.v}var Ys=globalThis&&globalThis.__assign||function(){return Ys=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Ys.apply(this,arguments)},N$=globalThis&&globalThis.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},P$=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o};function M$(t,e){var n=mh(function(){return typeof t=="function"?t():t});if(process.env.NODE_ENV!=="production"&&typeof t!="function"){var r=P$(R.useState(n),1),i=r[0];t!==i&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var o=e.context,a=e.guards,u=e.actions,s=e.activities,c=e.services,l=e.delays;e.state;var d=N$(e,["context","guards","actions","activities","services","delays","state"]),f=mh(function(){var h={context:o,guards:a,actions:u,activities:s,services:c,delays:l},v=n.withConfig(h,function(){return Ys(Ys({},n.context),o)});return em(v,d)});return O$(function(){Object.assign(f.machine.options.actions,u),Object.assign(f.machine.options.guards,a),Object.assign(f.machine.options.activities,s),Object.assign(f.machine.options.services,c),Object.assign(f.machine.options.delays,l)},[u,a,s,c,l]),f}globalThis&&globalThis.__read;globalThis&&globalThis.__values;function R$(t,e,n){if(t.status===se.NotStarted)return!0;var r=n.changed===void 0&&(Object.keys(n.children).length>0||typeof e.changed=="boolean");return!(n.changed||r)}var _$=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o};function j$(t){return t}function q$(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=_$(e,1),i=r[0],o=i===void 0?{}:i,a=M$(t,o),u=R.useCallback(function(){return a.status===se.NotStarted?o.state?gn.create(o.state):a.machine.initialState:a.getSnapshot()},[a]),s=R.useCallback(function(d,f){return R$(a,d,f)},[a]),c=R.useCallback(function(d){var f=a.subscribe(d).unsubscribe;return f},[a]),l=D$.useSyncExternalStoreWithSelector(c,u,u,j$,s);return R.useEffect(function(){var d=o.state;return a.start(d?gn.create(d):void 0),function(){a.stop(),a.status=se.NotStarted}},[]),[l,a.send,a]}var k$=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};function qu(t){return t}function lm(t){return function(){return t}}var U$=lm(null),fm=lm(void 0),B$=fm;function V$(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function ft(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return s(u(a(o(i(r(n(e(t))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var Bf=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(i){return e.apply(void 0,k$([i],r,!1))}}},dm=function(t){return t._tag==="Some"},hm={_tag:"None"},pm=function(t){return{_tag:"Some",value:t}},F$=function(t){return t.length>0},L$=[],G$=Object.prototype.hasOwnProperty;function z$(t){return function(e,n){return t.chain(e,function(r){return t.map(n(r),function(){return r})})}}var Yn=function(t){return{equals:function(e,n){return e===n||t(e,n)}}},Yr=function(t){return Yn(function(e,n){for(var r in t)if(!t[r].equals(e[r],n[r]))return!1;return!0})},vm={equals:function(t,e){return t===e}};vm.equals;var kn=hm,Xr=pm;function ku(t){return function(e){return t(e)?Xr(e):kn}}var H$=function(t,e){return ft(t,yr(e))},W$=function(t,e){return ft(t,J$(e))},K$="Option",yr=function(t){return function(e){return Ii(e)?kn:Xr(t(e.value))}},J$=function(t){return function(e){return Ii(e)||Ii(t)?kn:Xr(e.value(t.value))}},ym=Bf(2,function(t,e){return Ii(t)?kn:e(t.value)}),Y$={URI:K$,map:H$,ap:W$,chain:ym},Zr=function(t){return function(e){return Ii(e)?kn:t(e.value)?e:kn}},Ii=function(t){return t._tag==="None"},X$=function(t,e){return function(n){return Ii(n)?t():e(n.value)}},Vf=X$,Z$=function(t){return function(e){return Ii(e)?t():e.value}},Ia=Z$,Q$=Bf(2,z$(Y$)),Je=function(t){return t==null?kn:Xr(t)},Uu=Vf(U$,qu),xo=Vf(fm,qu),tD=ym,eD=Q$,Ff={equals:function(t,e){return t===e}};Ff.equals;Ff.equals;var nD=L$,rD=F$,iD=function(t){return t.length===0},mm=rD,oD=function(t){return function(e){if(iD(e))return uD;for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}};function gm(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return pm(e[n]);return hm}}var aD=function(t,e,n){for(var r=[],i=Math.min(t.length,e.length),o=0;o<i;o++)r[o]=n(t[o],e[o]);return r};function bm(t,e){return e===void 0?function(n){return bm(n,t)}:aD(t,e,function(n,r){return[n,r]})}var Sm=Bf(2,function(t,e){return ft(t,oD(function(n,r){return e(r,n)}))}),Cm=Sm(qu),jr=function(t){return function(e){return e.map(function(n){return t(n)})}},nn=function(t){return function(e){return e.filter(t)}},sD=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);dm(i)&&n.push(i.value)}return n}},Ao=function(t){return sD(function(e,n){return t(n)})},Dc=Ao(qu),Lf=function(t){return Yn(function(e,n){return e.length===n.length&&e.every(function(r,i){return t.equals(r,n[i])})})},uD=nD;function cD(t){return function(e){return e.every(t)}}var lD=Sm,Ke={equals:function(t,e){return t===e}};Ke.equals;var wm={equals:function(t,e){return t===e}};wm.equals;function Tm(t){return function(e,n){if(n===void 0){var r=Tm(t);return function(o){return r(o,e)}}for(var i in e)if(!G$.call(n,i)||!t.equals(e[i],n[i]))return!1;return!0}}function fD(t){var e=Tm(t);return Yn(function(n,r){return e(n)(r)&&e(r)(n)})}function dD(t){return{equals(e,n){return e==null&&n==null?!0:e==null||n===null||n===void 0?!1:t.equals(e,n)}}}function Im(t){return{equals(e,n){const r=ft(Je(e),Ia(()=>[])),i=ft(Je(n),Ia(()=>[]));return Lf(t).equals(r,i)}}}const $o=Yr({localId:Ke,componentPath:Im(Ke),sharedConfigurationModelId:dD(Ke)}),hD=Yr({localId:Ke,configurationModelId:Ke}),pD=Yn((t,e)=>y0({x:t,y:e}).with({x:{type:"Choice"},y:{type:"Choice"}},n=>vD.equals(n.x,n.y)).with({x:{type:"Component"},y:{type:"Component"}},n=>yD.equals(n.x,n.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},n=>mD.equals(n.x,n.y)).with({x:{type:"Boolean"},y:{type:"Boolean"}},n=>gD.equals(n.x,n.y)).otherwise(()=>!1)),vD=Yr({type:Ke,attributeId:$o,state:Ke,choiceValueId:Ke}),yD=Yr({type:Ke,attributeId:$o,state:Ke}),mD=Yr({type:Ke,attributeId:$o,state:Ff}),gD=Yr({type:Ke,attributeId:$o,state:wm});var Em=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(Em||{}),xm=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(xm||{}),Be=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(Be||{}),Bu=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(Bu||{});function bD(t,e){return ft(t.values,Ao(n=>ft(n.decision,Je,Zr(r=>r.kind===e))))}function SD(t){return ft(t.decision,Je,Zr(e=>e.kind===Bu.Explicit),Uu)}function CD(t){return ft(t.decision,Je,Zr(e=>e.kind===Bu.Explicit),Uu)}function wD(t){return ft(t.decision,Je,Uu)}const Am=t=>t.type===Be.Boolean,$m=t=>t.type===Be.Choice,Dm=t=>t.type===Be.Numeric,Om=t=>t.type===Be.Component,TD=Im(Ke);function ID(t,e,n){var r;const i=((r=e.componentPath)==null?void 0:r.length)??0;return ft(t,nn(o=>{var a;const u=((a=o.id.componentPath)==null?void 0:a.length)??0;return n?i>u?!1:ft(o.id.componentPath??[],bm(e.componentPath??[]),cD(([s,c])=>s===c)):TD.equals(o.id.componentPath,e.componentPath)}))}function ED(t,e,n){return[]}function xD(t){return ft(t,nn(e=>{const n=ft(e.id.componentPath,Je,yr(i=>i.length===0),Ia(()=>!0)),r=ft(e.id.sharedConfigurationModelId,Je,Vf(()=>!0,()=>!1));return n&&r}))}function AD(t,e){return ft(Nm(t),jr(n=>bD(n,e)),Cm,Ao(n=>Je(n)))}function $D(t,e){return ft(Mm(t),nn(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),jr(n=>SD(n)),Ao(n=>Je(n)))}function DD(t,e){return ft(Rm(t),nn(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),jr(n=>CD(n)),Ao(n=>Je(n)))}function OD(t,e){return ft(Pm(t),nn(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),jr(n=>wD(n)),Ao(n=>Je(n)))}function Nm(t){return ft(t.attributes,nn($m))}function Pm(t){return ft(t.attributes,nn(Om))}function Mm(t){return ft(t.attributes,nn(Dm))}function Rm(t){return ft(t.attributes,nn(Am))}function ND(t,e){return ft(Fa(t,e),xo)}function PD(t,e){return ft(_m(t,e),xo)}function MD(t,e,n){return ft(_m(t,e),yr(r=>r.values),tD(V$(gm(r=>r.id===n))),xo)}function RD(t,e){return ft(Fa(t,e),Zr(Dm),xo)}function _D(t,e){return ft(Fa(t,e),Zr(Am),xo)}function jD(t,e){return ft(Fa(t,e),Zr(Om),xo)}function Fa(t,e){return ft(t.attributes,gm(n=>$o.equals(n.id,e)))}function _m(t,e){return ft(Fa(t,e),Zr($m))}const La=Object.freeze(Object.defineProperty({__proto__:null,filterAttributesOfComponent:ID,filterAttributesOfRoot:xD,filterAttributesOfShared:ED,getAttribute:ND,getBooleanAttribute:_D,getBooleanAttributes:Rm,getBooleanDecisions:DD,getChoiceAttribute:PD,getChoiceAttributes:Nm,getChoiceDecisions:AD,getChoiceValue:MD,getComponentAttribute:jD,getComponentAttributes:Pm,getComponentDecisions:OD,getNumericAttribute:RD,getNumericAttributes:Mm,getNumericDecisions:$D},Symbol.toStringTag,{value:"Module"}));Em.whyIsNotSatisfied,xm.configuration;const gh=$o.equals;hD.equals;pD.equals;function Dl(t){return Yn((e,n)=>{const r=e==null,i=n==null;return r&&i||!r&&!i&&t.equals(e,n)})}const jm=R.createContext(null),qm=R.createContext(null),qD=R.createContext(null),km=R.createContext(null),kD=()=>R.useContext(jm),Vu=()=>R.useContext(km),Um="The configuration is not initialized. Consider using the ConfigurationSuspender or unload components manually that make use of any unsafe hook while the configuration is initializing. Check the hooks documentation to see if it is safe to use while the configuration is initializing.";function UD(t){if(!t)throw new Error(Um)}function Fu(t){if(!t)throw new Error(Um)}function Lu(){const t=kD();return UD(t),R.useMemo(()=>({makeDecision:e=>t.makeDecision(e),setManyDecision:(e,n)=>t.setMany(e,n)}),[t])}var Gu=function(t){return function(e){return dm(t(e))}};const BD=Gu(t=>t.type===Be.Choice?Xr(t):kn),VD=Gu(t=>t.type===Be.Numeric?Xr(t):kn),FD=Gu(t=>t.type===Be.Boolean?Xr(t):kn),LD=Gu(t=>t.type===Be.Component?Xr(t):kn);function zu(t){return t.decision!=null&&t.decision.kind===Bu.Explicit}function Bm(t){return ft(t.values,nn(zu),jr(e=>({type:Be.Choice,attributeId:t.id,choiceValueId:e.id,state:null})))}function GD(t){return ft(t,ku(zu),yr(()=>({type:Be.Numeric,attributeId:t.id,state:null})))}function zD(t){return ft(t,ku(zu),yr(()=>({type:Be.Boolean,attributeId:t.id,state:null})))}function HD(t){return ft(t,ku(zu),yr(()=>({type:Be.Component,attributeId:t.id,state:null})))}function WD(t,e){return ft(La.filterAttributesOfComponent(e,t,!0),n=>[ft(n,nn(BD),lD(Bm)),ft(n,nn(VD),jr(GD),Dc),ft(n,nn(FD),jr(zD),Dc),ft(n,nn(LD),jr(HD),Dc)],Cm)}function KD(t){const e=Vu(),{makeDecision:n,setManyDecision:r}=Lu();Fu(e);const i=La.getChoiceAttribute(e,t),o=R.useMemo(()=>({makeDecision:(u,s)=>n({type:Be.Choice,attributeId:t,choiceValueId:u,state:s}),clearDecisions:ft(i,Je,yr(Bm),Zr(mm),yr(u=>()=>r(u,{type:"Default"})),Ia(()=>()=>Promise.resolve()))}),[t,i,n,r]),a=R.useMemo(()=>({...o,attribute:i}),[i,o]);if(i)return a}function JD(t){const e=Vu(),{makeDecision:n}=Lu();Fu(e);const r=La.getNumericAttribute(e,t),i=R.useMemo(()=>({makeDecision:a=>n({type:Be.Numeric,attributeId:t,state:a})}),[t,n]),o=R.useMemo(()=>({...i,attribute:r}),[r,i]);if(r)return o}function YD(t){const e=Vu(),{makeDecision:n}=Lu();Fu(e);const r=La.getBooleanAttribute(e,t),i=R.useMemo(()=>({makeDecision:a=>n({type:Be.Boolean,attributeId:t,state:a})}),[t,n]),o=R.useMemo(()=>({...i,attribute:r}),[r,i]);if(r)return o}function XD(t){const e=Vu(),{makeDecision:n,setManyDecision:r}=Lu();Fu(e);const i=e.attributes,o=La.getComponentAttribute(e,t),a=R.useMemo(()=>({makeDecision:s=>n({type:Be.Component,attributeId:t,state:s}),clearSubtree:ft(WD(t,i),ku(mm),yr(s=>()=>r(s,{type:"Default"})),Ia(()=>()=>Promise.resolve()))}),[t,n,i,r]),u=R.useMemo(()=>({...a,attribute:o}),[o,a]);if(o)return u}const ZD=Yn((t,e)=>fD(Ke).equals(t??{},e??{})),QD=Yr({attributeId:Yn(gh),decisions:Lf(Yn(gh))}),t1=Yn((t,e)=>Lf(QD).equals(t??[],e??[])),Oc=Yr({configurationModelSource:Yn((t,e)=>R0(t,e)),attributeRelations:t1,usageRuleParameters:ZD}),e1=vm,Nc=Dl(e1),n1=()=>jf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{desiredClient:null,desiredSessionContext:null,actualClient:null,session:null,sessionCreationError:null,sessionUpdateError:null,hasEverSuccessfullyCreatedSession:!1},initial:"ProcessChanges",on:{ChangeConfigurationClient:{actions:["saveDesiredClient"]},ChangeSessionContext:{actions:["saveDesiredSessionContext"]}},exit:[dn("Shutting down","SessionManagement:"),"disposeOldSession"],states:{ProcessChanges:{entry:[dn("Entering ProcessChanges","SessionManagement:"),Vi(2)],always:[{target:"DisposeSession",cond:"shallDisposeSession"},{target:"CreateSession",cond:"shallCreateSession"},{target:"UpdateSession",cond:"shallUpdateSession"}]},DisposeSession:{entry:[dn("Entering DisposeSession","SessionManagement:"),Vi(2)],always:{actions:["disposeOldSession"],target:"ProcessChanges"}},CreateSession:{entry:[dn("Entering CreateSession","SessionManagement:"),Vi(0)],invoke:{id:"getNewSession",src:"createSession",onDone:{actions:["setSessionCreationResult","setHasEverSuccessfullyCreatedSession"],target:"ProcessChanges"},onError:{actions:"setSessionCreationError",target:"SessionCreationFailed"}}},SessionCreationFailed:{entry:[dn("Entering SessionCreationFailed","SessionManagement:"),Vi(2)],always:{target:"ProcessChanges",cond:"shallImmediatelyProcessChangesAfterSessionCreationError"},exit:[dn("Exiting SessionCreationFailed","SessionManagement:"),"clearSessionCreationError"],on:{RetrySessionCreation:{target:"ProcessChanges",actions:dn("Retrying session creation","SessionManagement:")}}},UpdateSession:{entry:[dn("Entering UpdateSession","SessionManagement:"),Vi(1)],invoke:{id:"updateExistingSession",src:"updateSession",onDone:{target:"ProcessChanges"},onError:{actions:"setSessionUpdateError",target:"SessionUpdateFailed"}}},SessionUpdateFailed:{entry:[dn("Entering SessionUpdateFailed","SessionManagement:"),Vi(2)],always:{target:"ProcessChanges",cond:"shallImmediatelyProcessChangesAfterSessionUpdateError"},exit:[dn("Exiting SessionUpdateFailed","SessionManagement:"),"clearSessionUpdateError"],on:{RetrySessionUpdate:{target:"ProcessChanges",actions:dn("Retrying session update","SessionManagement:")}}}}},{actions:{saveDesiredClient:Xe({desiredClient:(t,e)=>e.client}),saveDesiredSessionContext:Xe({desiredSessionContext:(t,e)=>e.sessionContext}),disposeOldSession:Xe((t,e)=>(t.session&&t.session.close().then(B$).catch(n=>{}),{session:null,actualClient:null})),setSessionCreationResult:Xe((t,e)=>({session:e.data.session,actualClient:e.data.client})),setSessionCreationError:Xe((t,e)=>({sessionCreationError:e.data})),clearSessionCreationError:Xe({sessionCreationError:()=>null}),setSessionUpdateError:Xe((t,e)=>({sessionUpdateError:e.data})),clearSessionUpdateError:Xe({sessionUpdateError:()=>null}),setHasEverSuccessfullyCreatedSession:Xe({hasEverSuccessfullyCreatedSession:()=>!0})},services:{createSession:t=>t.desiredClient.createSession(t.desiredSessionContext).then(e=>({session:e,client:t.desiredClient})).catch(e=>Promise.reject({type:e.type,client:t.desiredClient,sessionContext:t.desiredSessionContext})),updateSession:t=>t.session.setSessionContext(t.desiredSessionContext).catch(e=>Promise.reject({type:e.type,sessionContext:t.desiredSessionContext}))},guards:{shallDisposeSession:t=>t.session!=null&&(t.desiredSessionContext==null||t.desiredClient==null||!Nc.equals(t.actualClient,t.desiredClient)),shallCreateSession:t=>t.session==null&&t.desiredClient!=null&&t.desiredSessionContext!=null,shallUpdateSession:t=>t.session!=null&&!Oc.equals(t.session.getSessionContext(),t.desiredSessionContext),shallImmediatelyProcessChangesAfterSessionCreationError:t=>!Nc.equals(t.desiredClient,t.sessionCreationError.client)||!Dl(Oc).equals(t.desiredSessionContext,t.sessionCreationError.sessionContext),shallImmediatelyProcessChangesAfterSessionUpdateError:t=>!Nc.equals(t.desiredClient,t.actualClient)||!Dl(Oc).equals(t.desiredSessionContext,t.sessionUpdateError.sessionContext)}});function Vi(t){const e=t===0,n=t===1;return I$((r,i)=>{const o={isInitializing:(!r.hasEverSuccessfullyCreatedSession||e)&&r.sessionCreationError==null,errorType:r.sessionCreationError&&r.sessionCreationError.type},a={isUpdating:n&&r.sessionUpdateError==null,errorType:r.sessionUpdateError&&r.sessionUpdateError.type};return nm({type:"SessionManagementStateChanged",sessionInitialization:o,sessionUpdating:a,session:r.session})})}const r1=t=>e=>(e({type:"ConfigurationChanged",session:t,configuration:t.getConfiguration()}),t.setOnConfigurationChangedHandler(n=>{e({type:"ConfigurationChanged",session:t,configuration:n})}),()=>{t.setOnConfigurationChangedHandler(null)}),i1=()=>jf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{session:null},on:{ConfigurationChanged:{actions:[nm((t,e)=>e)]}},initial:"ProcessChanges",states:{ProcessChanges:{entry:[dn("Entering ProcessChanges","ConfigurationSubscriptionManagement:")],on:{ChangeSession:{actions:["saveSession"]}},always:[{target:"Subscribe",cond:(t,e)=>t.session!=null}]},Subscribe:{entry:[dn("Entering Subscribe","ConfigurationSubscriptionManagement:")],on:{ChangeSession:{target:"ProcessChanges",cond:(t,e)=>e.session==null||t.session!==e.session,actions:["saveSession"]}},invoke:{id:"configurationSubscriptionActor",src:(t,e)=>r1(t.session)}}}},{actions:{saveSession:Xe((t,e)=>({session:e.session}))}}),o1=()=>{let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}},bh=()=>{const t=o1();return{capsule:{promise:t.promise},resolve:t.resolve,reject:t.reject}},a1=()=>jf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{sessionManagementActor:null,configurationSubscriptionManagementActor:null,sessionInitialization:null,sessionUpdating:null,session:null,configuration:null,isReadyPromise:bh()},entry:[Xe({sessionManagementActor:()=>ch(n1()),configurationSubscriptionManagementActor:()=>ch(i1())})],exit:[fh(t=>t.sessionManagementActor),fh(t=>t.configurationSubscriptionManagementActor)],on:{ChangeConfigurationClient:{actions:[ss(t=>t.sessionManagementActor)]},ChangeSessionContext:{actions:[ss(t=>t.sessionManagementActor)]},RetrySessionCreation:{actions:[ss(t=>t.sessionManagementActor)]},RetrySessionUpdate:{actions:[ss(t=>t.sessionManagementActor)]},SessionManagementStateChanged:{actions:[Xe((t,e)=>({session:e.session,sessionInitialization:e.sessionInitialization,sessionUpdating:e.sessionUpdating})),MA(t=>({type:"ChangeSession",session:t.session}),{to:t=>t.configurationSubscriptionManagementActor}),"calculateReadyState"]},ConfigurationChanged:{actions:[Xe((t,e)=>({configuration:{session:e.session,configuration:e.configuration}})),"calculateReadyState"]}},initial:"Idle",states:{Idle:{}}},{actions:{calculateReadyState:Xe((t,e)=>{var n;const r=!((n=t.sessionInitialization)!=null&&n.isInitializing)&&t.session!=null&&t.configuration!=null&&t.configuration.session===t.session;return t.isReadyPromise&&r&&(t.isReadyPromise.resolve(),t.isReadyPromise.capsule.promise=null),{isReadyPromise:(()=>r?null:t.isReadyPromise!=null?t.isReadyPromise:bh())()}})}});function s1(t){var e,n;const[r,i]=q$(a1,{logger:(...s)=>console.log("ConfigurationManagement:",...s)});R.useEffect(()=>{i({type:"ChangeConfigurationClient",client:t.configuratorClient}),t.configuratorClient||console.warn("The configurator client is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass a valid client.")},[t.configuratorClient]),R.useEffect(()=>{const s=ft(Je(t.sessionContext),eD(c=>Je(c.configurationModelSource)),Uu);i({type:"ChangeSessionContext",sessionContext:s}),s||console.warn("The session context is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass valid session context data.")},[t.sessionContext]);const o=R.useMemo(()=>{var s,c,l,d;return{isInitializing:((c=(s=r.context.isReadyPromise)==null?void 0:s.capsule)==null?void 0:c.promise)!=null,isInitializingPromise:(l=r.context.isReadyPromise)==null?void 0:l.capsule,error:((d=r.context.sessionInitialization)==null?void 0:d.errorType)&&{type:r.context.sessionInitialization.errorType,retry:()=>i({type:"RetrySessionCreation"})}}},[r.context.sessionInitialization,r.context.isReadyPromise]),a=R.useMemo(()=>{var s,c;return{isUpdating:(s=r.context.sessionUpdating)==null?void 0:s.isUpdating,error:((c=r.context.sessionUpdating)==null?void 0:c.errorType)&&{type:r.context.sessionUpdating.errorType,retry:()=>i({type:"RetrySessionUpdate"})}}},[r.context.sessionUpdating]),u=((e=r.context.configuration)==null?void 0:e.session)===r.context.session?(n=r.context.configuration)==null?void 0:n.configuration:null;return{configurationInitialization:o,configurationUpdating:a,session:r.context.session,configuration:u}}function u1(t){const{configurationInitialization:e,configurationUpdating:n,session:r,configuration:i}=s1({configuratorClient:t.configuratorClient,sessionContext:t});return X.jsx(qm.Provider,{value:e,children:X.jsx(qD.Provider,{value:n,children:X.jsx(jm.Provider,{value:r,children:X.jsx(km.Provider,{value:i,children:t.children})})})})}function c1(){return R.useContext(qm)}function l1(t){const{children:e}=t,{isInitializingPromise:n}=c1();if(n!=null&&n.promise)throw n.promise;return X.jsx(X.Fragment,{children:e})}var rn=function(){return rn=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},rn.apply(this,arguments)};function oo(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function f1(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var d1=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,h1=f1(function(t){return d1.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),Jt="-ms-",la="-moz-",qt="-webkit-",Vm="comm",Hu="rule",Gf="decl",p1="@import",Fm="@keyframes",v1="@layer",y1=Math.abs,zf=String.fromCharCode,Ol=Object.assign;function m1(t,e){return we(t,0)^45?(((e<<2^we(t,0))<<2^we(t,1))<<2^we(t,2))<<2^we(t,3):0}function Lm(t){return t.trim()}function er(t,e){return(t=e.exec(t))?t[0]:t}function vt(t,e,n){return t.replace(e,n)}function Es(t,e){return t.indexOf(e)}function we(t,e){return t.charCodeAt(e)|0}function ao(t,e,n){return t.slice(e,n)}function Ln(t){return t.length}function Gm(t){return t.length}function na(t,e){return e.push(t),t}function g1(t,e){return t.map(e).join("")}function Sh(t,e){return t.filter(function(n){return!er(n,e)})}var Wu=1,so=1,zm=0,Sn=0,he=0,Do="";function Ku(t,e,n,r,i,o,a,u){return{value:t,root:e,parent:n,type:r,props:i,children:o,line:Wu,column:so,length:a,return:"",siblings:u}}function Ir(t,e){return Ol(Ku("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},e)}function Fi(t){for(;t.root;)t=Ir(t.root,{children:[t]});na(t,t.siblings)}function b1(){return he}function S1(){return he=Sn>0?we(Do,--Sn):0,so--,he===10&&(so=1,Wu--),he}function Rn(){return he=Sn<zm?we(Do,Sn++):0,so++,he===10&&(so=1,Wu++),he}function hi(){return we(Do,Sn)}function xs(){return Sn}function Ju(t,e){return ao(Do,t,e)}function Nl(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function C1(t){return Wu=so=1,zm=Ln(Do=t),Sn=0,[]}function w1(t){return Do="",t}function Pc(t){return Lm(Ju(Sn-1,Pl(t===91?t+2:t===40?t+1:t)))}function T1(t){for(;(he=hi())&&he<33;)Rn();return Nl(t)>2||Nl(he)>3?"":" "}function I1(t,e){for(;--e&&Rn()&&!(he<48||he>102||he>57&&he<65||he>70&&he<97););return Ju(t,xs()+(e<6&&hi()==32&&Rn()==32))}function Pl(t){for(;Rn();)switch(he){case t:return Sn;case 34:case 39:t!==34&&t!==39&&Pl(he);break;case 40:t===41&&Pl(t);break;case 92:Rn();break}return Sn}function E1(t,e){for(;Rn()&&t+he!==47+10;)if(t+he===42+42&&hi()===47)break;return"/*"+Ju(e,Sn-1)+"*"+zf(t===47?t:Rn())}function x1(t){for(;!Nl(hi());)Rn();return Ju(t,Sn)}function A1(t){return w1(As("",null,null,null,[""],t=C1(t),0,[0],t))}function As(t,e,n,r,i,o,a,u,s){for(var c=0,l=0,d=a,f=0,h=0,v=0,p=1,S=1,C=1,w=0,T="",I=i,x=o,b=r,E=T;S;)switch(v=w,w=Rn()){case 40:if(v!=108&&we(E,d-1)==58){Es(E+=vt(Pc(w),"&","&\f"),"&\f")!=-1&&(C=-1);break}case 34:case 39:case 91:E+=Pc(w);break;case 9:case 10:case 13:case 32:E+=T1(v);break;case 92:E+=I1(xs()-1,7);continue;case 47:switch(hi()){case 42:case 47:na($1(E1(Rn(),xs()),e,n,s),s);break;default:E+="/"}break;case 123*p:u[c++]=Ln(E)*C;case 125*p:case 59:case 0:switch(w){case 0:case 125:S=0;case 59+l:C==-1&&(E=vt(E,/\f/g,"")),h>0&&Ln(E)-d&&na(h>32?wh(E+";",r,n,d-1,s):wh(vt(E," ","")+";",r,n,d-2,s),s);break;case 59:E+=";";default:if(na(b=Ch(E,e,n,c,l,i,u,T,I=[],x=[],d,o),o),w===123)if(l===0)As(E,e,b,b,I,o,d,u,x);else switch(f===99&&we(E,3)===110?100:f){case 100:case 108:case 109:case 115:As(t,b,b,r&&na(Ch(t,b,b,0,0,i,u,T,i,I=[],d,x),x),i,x,d,u,r?I:x);break;default:As(E,b,b,b,[""],x,0,u,x)}}c=l=h=0,p=C=1,T=E="",d=a;break;case 58:d=1+Ln(E),h=v;default:if(p<1){if(w==123)--p;else if(w==125&&p++==0&&S1()==125)continue}switch(E+=zf(w),w*p){case 38:C=l>0?1:(E+="\f",-1);break;case 44:u[c++]=(Ln(E)-1)*C,C=1;break;case 64:hi()===45&&(E+=Pc(Rn())),f=hi(),l=d=Ln(T=E+=x1(xs())),w++;break;case 45:v===45&&Ln(E)==2&&(p=0)}}return o}function Ch(t,e,n,r,i,o,a,u,s,c,l,d){for(var f=i-1,h=i===0?o:[""],v=Gm(h),p=0,S=0,C=0;p<r;++p)for(var w=0,T=ao(t,f+1,f=y1(S=a[p])),I=t;w<v;++w)(I=Lm(S>0?h[w]+" "+T:vt(T,/&\f/g,h[w])))&&(s[C++]=I);return Ku(t,e,n,i===0?Hu:u,s,c,l,d)}function $1(t,e,n,r){return Ku(t,e,n,Vm,zf(b1()),ao(t,2,-2),0,r)}function wh(t,e,n,r,i){return Ku(t,e,n,Gf,ao(t,0,r),ao(t,r+1,-1),r,i)}function Hm(t,e,n){switch(m1(t,e)){case 5103:return qt+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return qt+t+t;case 4789:return la+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return qt+t+la+t+Jt+t+t;case 5936:switch(we(t,e+11)){case 114:return qt+t+Jt+vt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return qt+t+Jt+vt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return qt+t+Jt+vt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return qt+t+Jt+t+t;case 6165:return qt+t+Jt+"flex-"+t+t;case 5187:return qt+t+vt(t,/(\w+).+(:[^]+)/,qt+"box-$1$2"+Jt+"flex-$1$2")+t;case 5443:return qt+t+Jt+"flex-item-"+vt(t,/flex-|-self/g,"")+(er(t,/flex-|baseline/)?"":Jt+"grid-row-"+vt(t,/flex-|-self/g,""))+t;case 4675:return qt+t+Jt+"flex-line-pack"+vt(t,/align-content|flex-|-self/g,"")+t;case 5548:return qt+t+Jt+vt(t,"shrink","negative")+t;case 5292:return qt+t+Jt+vt(t,"basis","preferred-size")+t;case 6060:return qt+"box-"+vt(t,"-grow","")+qt+t+Jt+vt(t,"grow","positive")+t;case 4554:return qt+vt(t,/([^-])(transform)/g,"$1"+qt+"$2")+t;case 6187:return vt(vt(vt(t,/(zoom-|grab)/,qt+"$1"),/(image-set)/,qt+"$1"),t,"")+t;case 5495:case 3959:return vt(t,/(image-set\([^]*)/,qt+"$1$`$1");case 4968:return vt(vt(t,/(.+:)(flex-)?(.*)/,qt+"box-pack:$3"+Jt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+qt+t+t;case 4200:if(!er(t,/flex-|baseline/))return Jt+"grid-column-align"+ao(t,e)+t;break;case 2592:case 3360:return Jt+vt(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(r,i){return e=i,er(r.props,/grid-\w+-end/)})?~Es(t+(n=n[e].value),"span")?t:Jt+vt(t,"-start","")+t+Jt+"grid-row-span:"+(~Es(n,"span")?er(n,/\d+/):+er(n,/\d+/)-+er(t,/\d+/))+";":Jt+vt(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(r){return er(r.props,/grid-\w+-start/)})?t:Jt+vt(vt(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return vt(t,/(.+)-inline(.+)/,qt+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ln(t)-1-e>6)switch(we(t,e+1)){case 109:if(we(t,e+4)!==45)break;case 102:return vt(t,/(.+:)(.+)-([^]+)/,"$1"+qt+"$2-$3$1"+la+(we(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~Es(t,"stretch")?Hm(vt(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return vt(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,a,u,s,c){return Jt+i+":"+o+c+(a?Jt+i+"-span:"+(u?s:+s-+o)+c:"")+t});case 4949:if(we(t,e+6)===121)return vt(t,":",":"+qt)+t;break;case 6444:switch(we(t,we(t,14)===45?18:11)){case 120:return vt(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+qt+(we(t,14)===45?"inline-":"")+"box$3$1"+qt+"$2$3$1"+Jt+"$2box$3")+t;case 100:return vt(t,":",":"+Jt)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return vt(t,"scroll-","scroll-snap-")+t}return t}function Xs(t,e){for(var n="",r=0;r<t.length;r++)n+=e(t[r],r,t,e)||"";return n}function D1(t,e,n,r){switch(t.type){case v1:if(t.children.length)break;case p1:case Gf:return t.return=t.return||t.value;case Vm:return"";case Fm:return t.return=t.value+"{"+Xs(t.children,r)+"}";case Hu:if(!Ln(t.value=t.props.join(",")))return""}return Ln(n=Xs(t.children,r))?t.return=t.value+"{"+n+"}":""}function O1(t){var e=Gm(t);return function(n,r,i,o){for(var a="",u=0;u<e;u++)a+=t[u](n,r,i,o)||"";return a}}function N1(t){return function(e){e.root||(e=e.return)&&t(e)}}function P1(t,e,n,r){if(t.length>-1&&!t.return)switch(t.type){case Gf:t.return=Hm(t.value,t.length,n);return;case Fm:return Xs([Ir(t,{value:vt(t.value,"@","@"+qt)})],r);case Hu:if(t.length)return g1(n=t.props,function(i){switch(er(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Fi(Ir(t,{props:[vt(i,/:(read-\w+)/,":"+la+"$1")]})),Fi(Ir(t,{props:[i]})),Ol(t,{props:Sh(n,r)});break;case"::placeholder":Fi(Ir(t,{props:[vt(i,/:(plac\w+)/,":"+qt+"input-$1")]})),Fi(Ir(t,{props:[vt(i,/:(plac\w+)/,":"+la+"$1")]})),Fi(Ir(t,{props:[vt(i,/:(plac\w+)/,Jt+"input-$1")]})),Fi(Ir(t,{props:[i]})),Ol(t,{props:Sh(n,r)});break}return""})}}var M1={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ei=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Hf=typeof window<"u"&&"HTMLElement"in window,R1=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""?process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY:process.env.NODE_ENV!=="production"),Th=/invalid hook call/i,cs=new Set,_1=function(t,e){if(process.env.NODE_ENV!=="production"){var n=e?' with the id of "'.concat(e,'"'):"",r="The component ".concat(t).concat(n,` has been created dynamically.
130
+ */var yh;function D$(){return yh||(yh=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=R,e=cm();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,u=t.useMemo,s=t.useDebugValue;function c(l,d,f,h,v){var p=o(null),S;p.current===null?(S={hasValue:!1,value:null},p.current=S):S=p.current;var C=u(function(){var x=!1,b,E,P=function($){if(!x){x=!0,b=$;var z=h($);if(v!==void 0&&S.hasValue){var Z=S.value;if(v(Z,z))return E=Z,Z}return E=z,z}var Vt=b,bt=E;if(r(Vt,$))return bt;var J=h($);return v!==void 0&&v(bt,J)?bt:(b=$,E=J,J)},A=f===void 0?null:f,U=function(){return P(d())},M=A===null?void 0:function(){return P(A())};return[U,M]},[d,f,h,v]),w=C[0],T=C[1],I=i(l,w,T);return a(function(){S.hasValue=!0,S.value=I},[I]),s(I),I}$c.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),$c}process.env.NODE_ENV==="production"?$l.exports=$$():$l.exports=D$();var O$=$l.exports,N$=R.useLayoutEffect;function mh(t){var e=pp.useRef();return e.current||(e.current={v:t()}),e.current.v}var Js=globalThis&&globalThis.__assign||function(){return Js=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Js.apply(this,arguments)},P$=globalThis&&globalThis.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},M$=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o};function R$(t,e){var n=mh(function(){return typeof t=="function"?t():t});if(process.env.NODE_ENV!=="production"&&typeof t!="function"){var r=M$(R.useState(n),1),i=r[0];t!==i&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var o=e.context,a=e.guards,u=e.actions,s=e.activities,c=e.services,l=e.delays;e.state;var d=P$(e,["context","guards","actions","activities","services","delays","state"]),f=mh(function(){var h={context:o,guards:a,actions:u,activities:s,services:c,delays:l},v=n.withConfig(h,function(){return Js(Js({},n.context),o)});return em(v,d)});return N$(function(){Object.assign(f.machine.options.actions,u),Object.assign(f.machine.options.guards,a),Object.assign(f.machine.options.activities,s),Object.assign(f.machine.options.services,c),Object.assign(f.machine.options.delays,l)},[u,a,s,c,l]),f}globalThis&&globalThis.__read;globalThis&&globalThis.__values;function _$(t,e,n){if(t.status===se.NotStarted)return!0;var r=n.changed===void 0&&(Object.keys(n.children).length>0||typeof e.changed=="boolean");return!(n.changed||r)}var j$=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o};function q$(t){return t}function k$(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=j$(e,1),i=r[0],o=i===void 0?{}:i,a=R$(t,o),u=R.useCallback(function(){return a.status===se.NotStarted?o.state?gn.create(o.state):a.machine.initialState:a.getSnapshot()},[a]),s=R.useCallback(function(d,f){return _$(a,d,f)},[a]),c=R.useCallback(function(d){var f=a.subscribe(d).unsubscribe;return f},[a]),l=O$.useSyncExternalStoreWithSelector(c,u,u,q$,s);return R.useEffect(function(){var d=o.state;return a.start(d?gn.create(d):void 0),function(){a.stop(),a.status=se.NotStarted}},[]),[l,a.send,a]}var U$=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};function qu(t){return t}function lm(t){return function(){return t}}var B$=lm(null),fm=lm(void 0),V$=fm;function F$(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function ft(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return s(u(a(o(i(r(n(e(t))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var Bf=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(i){return e.apply(void 0,U$([i],r,!1))}}},dm=function(t){return t._tag==="Some"},hm={_tag:"None"},pm=function(t){return{_tag:"Some",value:t}},L$=function(t){return t.length>0},G$=[],z$=Object.prototype.hasOwnProperty;function H$(t){return function(e,n){return t.chain(e,function(r){return t.map(n(r),function(){return r})})}}var Jn=function(t){return{equals:function(e,n){return e===n||t(e,n)}}},Jr=function(t){return Jn(function(e,n){for(var r in t)if(!t[r].equals(e[r],n[r]))return!1;return!0})},vm={equals:function(t,e){return t===e}};vm.equals;var kn=hm,Xr=pm;function ku(t){return function(e){return t(e)?Xr(e):kn}}var W$=function(t,e){return ft(t,yr(e))},K$=function(t,e){return ft(t,J$(e))},Y$="Option",yr=function(t){return function(e){return Ii(e)?kn:Xr(t(e.value))}},J$=function(t){return function(e){return Ii(e)||Ii(t)?kn:Xr(e.value(t.value))}},ym=Bf(2,function(t,e){return Ii(t)?kn:e(t.value)}),X$={URI:Y$,map:W$,ap:K$,chain:ym},Zr=function(t){return function(e){return Ii(e)?kn:t(e.value)?e:kn}},Ii=function(t){return t._tag==="None"},Z$=function(t,e){return function(n){return Ii(n)?t():e(n.value)}},Vf=Z$,Q$=function(t){return function(e){return Ii(e)?t():e.value}},Ia=Q$,tD=Bf(2,H$(X$)),Ye=function(t){return t==null?kn:Xr(t)},Uu=Vf(B$,qu),xo=Vf(fm,qu),eD=ym,nD=tD,Ff={equals:function(t,e){return t===e}};Ff.equals;Ff.equals;var rD=G$,iD=L$,oD=function(t){return t.length===0},mm=iD,aD=function(t){return function(e){if(oD(e))return cD;for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}};function gm(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return pm(e[n]);return hm}}var sD=function(t,e,n){for(var r=[],i=Math.min(t.length,e.length),o=0;o<i;o++)r[o]=n(t[o],e[o]);return r};function bm(t,e){return e===void 0?function(n){return bm(n,t)}:sD(t,e,function(n,r){return[n,r]})}var Sm=Bf(2,function(t,e){return ft(t,aD(function(n,r){return e(r,n)}))}),Cm=Sm(qu),jr=function(t){return function(e){return e.map(function(n){return t(n)})}},nn=function(t){return function(e){return e.filter(t)}},uD=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);dm(i)&&n.push(i.value)}return n}},Ao=function(t){return uD(function(e,n){return t(n)})},Dc=Ao(qu),Lf=function(t){return Jn(function(e,n){return e.length===n.length&&e.every(function(r,i){return t.equals(r,n[i])})})},cD=rD;function lD(t){return function(e){return e.every(t)}}var fD=Sm,Ke={equals:function(t,e){return t===e}};Ke.equals;var wm={equals:function(t,e){return t===e}};wm.equals;function Tm(t){return function(e,n){if(n===void 0){var r=Tm(t);return function(o){return r(o,e)}}for(var i in e)if(!z$.call(n,i)||!t.equals(e[i],n[i]))return!1;return!0}}function dD(t){var e=Tm(t);return Jn(function(n,r){return e(n)(r)&&e(r)(n)})}function hD(t){return{equals(e,n){return e==null&&n==null?!0:e==null||n===null||n===void 0?!1:t.equals(e,n)}}}function Im(t){return{equals(e,n){const r=ft(Ye(e),Ia(()=>[])),i=ft(Ye(n),Ia(()=>[]));return Lf(t).equals(r,i)}}}const $o=Jr({localId:Ke,componentPath:Im(Ke),sharedConfigurationModelId:hD(Ke)}),pD=Jr({localId:Ke,configurationModelId:Ke}),vD=Jn((t,e)=>m0({x:t,y:e}).with({x:{type:"Choice"},y:{type:"Choice"}},n=>yD.equals(n.x,n.y)).with({x:{type:"Component"},y:{type:"Component"}},n=>mD.equals(n.x,n.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},n=>gD.equals(n.x,n.y)).with({x:{type:"Boolean"},y:{type:"Boolean"}},n=>bD.equals(n.x,n.y)).otherwise(()=>!1)),yD=Jr({type:Ke,attributeId:$o,state:Ke,choiceValueId:Ke}),mD=Jr({type:Ke,attributeId:$o,state:Ke}),gD=Jr({type:Ke,attributeId:$o,state:Ff}),bD=Jr({type:Ke,attributeId:$o,state:wm});var Em=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(Em||{}),xm=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(xm||{}),Be=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(Be||{}),Bu=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(Bu||{});function SD(t,e){return ft(t.values,Ao(n=>ft(n.decision,Ye,Zr(r=>r.kind===e))))}function CD(t){return ft(t.decision,Ye,Zr(e=>e.kind===Bu.Explicit),Uu)}function wD(t){return ft(t.decision,Ye,Zr(e=>e.kind===Bu.Explicit),Uu)}function TD(t){return ft(t.decision,Ye,Uu)}const Am=t=>t.type===Be.Boolean,$m=t=>t.type===Be.Choice,Dm=t=>t.type===Be.Numeric,Om=t=>t.type===Be.Component,ID=Im(Ke);function ED(t,e,n){var r;const i=((r=e.componentPath)==null?void 0:r.length)??0;return ft(t,nn(o=>{var a;const u=((a=o.id.componentPath)==null?void 0:a.length)??0;return n?i>u?!1:ft(o.id.componentPath??[],bm(e.componentPath??[]),lD(([s,c])=>s===c)):ID.equals(o.id.componentPath,e.componentPath)}))}function xD(t,e,n){return[]}function AD(t){return ft(t,nn(e=>{const n=ft(e.id.componentPath,Ye,yr(i=>i.length===0),Ia(()=>!0)),r=ft(e.id.sharedConfigurationModelId,Ye,Vf(()=>!0,()=>!1));return n&&r}))}function $D(t,e){return ft(Nm(t),jr(n=>SD(n,e)),Cm,Ao(n=>Ye(n)))}function DD(t,e){return ft(Mm(t),nn(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),jr(n=>CD(n)),Ao(n=>Ye(n)))}function OD(t,e){return ft(Rm(t),nn(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),jr(n=>wD(n)),Ao(n=>Ye(n)))}function ND(t,e){return ft(Pm(t),nn(n=>{var r;return((r=n.decision)==null?void 0:r.kind)===e}),jr(n=>TD(n)),Ao(n=>Ye(n)))}function Nm(t){return ft(t.attributes,nn($m))}function Pm(t){return ft(t.attributes,nn(Om))}function Mm(t){return ft(t.attributes,nn(Dm))}function Rm(t){return ft(t.attributes,nn(Am))}function PD(t,e){return ft(Fa(t,e),xo)}function MD(t,e){return ft(_m(t,e),xo)}function RD(t,e,n){return ft(_m(t,e),yr(r=>r.values),eD(F$(gm(r=>r.id===n))),xo)}function _D(t,e){return ft(Fa(t,e),Zr(Dm),xo)}function jD(t,e){return ft(Fa(t,e),Zr(Am),xo)}function qD(t,e){return ft(Fa(t,e),Zr(Om),xo)}function Fa(t,e){return ft(t.attributes,gm(n=>$o.equals(n.id,e)))}function _m(t,e){return ft(Fa(t,e),Zr($m))}const La=Object.freeze(Object.defineProperty({__proto__:null,filterAttributesOfComponent:ED,filterAttributesOfRoot:AD,filterAttributesOfShared:xD,getAttribute:PD,getBooleanAttribute:jD,getBooleanAttributes:Rm,getBooleanDecisions:OD,getChoiceAttribute:MD,getChoiceAttributes:Nm,getChoiceDecisions:$D,getChoiceValue:RD,getComponentAttribute:qD,getComponentAttributes:Pm,getComponentDecisions:ND,getNumericAttribute:_D,getNumericAttributes:Mm,getNumericDecisions:DD},Symbol.toStringTag,{value:"Module"}));Em.whyIsNotSatisfied,xm.configuration;const gh=$o.equals;pD.equals;vD.equals;function Dl(t){return Jn((e,n)=>{const r=e==null,i=n==null;return r&&i||!r&&!i&&t.equals(e,n)})}const jm=R.createContext(null),qm=R.createContext(null),kD=R.createContext(null),km=R.createContext(null),UD=()=>R.useContext(jm),Vu=()=>R.useContext(km),Um="The configuration is not initialized. Consider using the ConfigurationSuspender or unload components manually that make use of any unsafe hook while the configuration is initializing. Check the hooks documentation to see if it is safe to use while the configuration is initializing.";function BD(t){if(!t)throw new Error(Um)}function Fu(t){if(!t)throw new Error(Um)}function Lu(){const t=UD();return BD(t),R.useMemo(()=>({makeDecision:e=>t.makeDecision(e),setManyDecision:(e,n)=>t.setMany(e,n)}),[t])}var Gu=function(t){return function(e){return dm(t(e))}};const VD=Gu(t=>t.type===Be.Choice?Xr(t):kn),FD=Gu(t=>t.type===Be.Numeric?Xr(t):kn),LD=Gu(t=>t.type===Be.Boolean?Xr(t):kn),GD=Gu(t=>t.type===Be.Component?Xr(t):kn);function zu(t){return t.decision!=null&&t.decision.kind===Bu.Explicit}function Bm(t){return ft(t.values,nn(zu),jr(e=>({type:Be.Choice,attributeId:t.id,choiceValueId:e.id,state:null})))}function zD(t){return ft(t,ku(zu),yr(()=>({type:Be.Numeric,attributeId:t.id,state:null})))}function HD(t){return ft(t,ku(zu),yr(()=>({type:Be.Boolean,attributeId:t.id,state:null})))}function WD(t){return ft(t,ku(zu),yr(()=>({type:Be.Component,attributeId:t.id,state:null})))}function KD(t,e){return ft(La.filterAttributesOfComponent(e,t,!0),n=>[ft(n,nn(VD),fD(Bm)),ft(n,nn(FD),jr(zD),Dc),ft(n,nn(LD),jr(HD),Dc),ft(n,nn(GD),jr(WD),Dc)],Cm)}function YD(t){const e=Vu(),{makeDecision:n,setManyDecision:r}=Lu();Fu(e);const i=La.getChoiceAttribute(e,t),o=R.useMemo(()=>({makeDecision:(u,s)=>n({type:Be.Choice,attributeId:t,choiceValueId:u,state:s}),clearDecisions:ft(i,Ye,yr(Bm),Zr(mm),yr(u=>()=>r(u,{type:"Default"})),Ia(()=>()=>Promise.resolve()))}),[t,i,n,r]),a=R.useMemo(()=>({...o,attribute:i}),[i,o]);if(i)return a}function JD(t){const e=Vu(),{makeDecision:n}=Lu();Fu(e);const r=La.getNumericAttribute(e,t),i=R.useMemo(()=>({makeDecision:a=>n({type:Be.Numeric,attributeId:t,state:a})}),[t,n]),o=R.useMemo(()=>({...i,attribute:r}),[r,i]);if(r)return o}function XD(t){const e=Vu(),{makeDecision:n}=Lu();Fu(e);const r=La.getBooleanAttribute(e,t),i=R.useMemo(()=>({makeDecision:a=>n({type:Be.Boolean,attributeId:t,state:a})}),[t,n]),o=R.useMemo(()=>({...i,attribute:r}),[r,i]);if(r)return o}function ZD(t){const e=Vu(),{makeDecision:n,setManyDecision:r}=Lu();Fu(e);const i=e.attributes,o=La.getComponentAttribute(e,t),a=R.useMemo(()=>({makeDecision:s=>n({type:Be.Component,attributeId:t,state:s}),clearSubtree:ft(KD(t,i),ku(mm),yr(s=>()=>r(s,{type:"Default"})),Ia(()=>()=>Promise.resolve()))}),[t,n,i,r]),u=R.useMemo(()=>({...a,attribute:o}),[o,a]);if(o)return u}const QD=Jn((t,e)=>dD(Ke).equals(t??{},e??{})),t1=Jr({attributeId:Jn(gh),decisions:Lf(Jn(gh))}),e1=Jn((t,e)=>Lf(t1).equals(t??[],e??[])),Oc=Jr({configurationModelSource:Jn((t,e)=>_0(t,e)),attributeRelations:e1,usageRuleParameters:QD}),n1=vm,Nc=Dl(n1),r1=()=>jf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{desiredClient:null,desiredSessionContext:null,actualClient:null,session:null,sessionCreationError:null,sessionUpdateError:null,hasEverSuccessfullyCreatedSession:!1},initial:"ProcessChanges",on:{ChangeConfigurationClient:{actions:["saveDesiredClient"]},ChangeSessionContext:{actions:["saveDesiredSessionContext"]}},exit:[dn("Shutting down","SessionManagement:"),"disposeOldSession"],states:{ProcessChanges:{entry:[dn("Entering ProcessChanges","SessionManagement:"),Vi(2)],always:[{target:"DisposeSession",cond:"shallDisposeSession"},{target:"CreateSession",cond:"shallCreateSession"},{target:"UpdateSession",cond:"shallUpdateSession"}]},DisposeSession:{entry:[dn("Entering DisposeSession","SessionManagement:"),Vi(2)],always:{actions:["disposeOldSession"],target:"ProcessChanges"}},CreateSession:{entry:[dn("Entering CreateSession","SessionManagement:"),Vi(0)],invoke:{id:"getNewSession",src:"createSession",onDone:{actions:["setSessionCreationResult","setHasEverSuccessfullyCreatedSession"],target:"ProcessChanges"},onError:{actions:"setSessionCreationError",target:"SessionCreationFailed"}}},SessionCreationFailed:{entry:[dn("Entering SessionCreationFailed","SessionManagement:"),Vi(2)],always:{target:"ProcessChanges",cond:"shallImmediatelyProcessChangesAfterSessionCreationError"},exit:[dn("Exiting SessionCreationFailed","SessionManagement:"),"clearSessionCreationError"],on:{RetrySessionCreation:{target:"ProcessChanges",actions:dn("Retrying session creation","SessionManagement:")}}},UpdateSession:{entry:[dn("Entering UpdateSession","SessionManagement:"),Vi(1)],invoke:{id:"updateExistingSession",src:"updateSession",onDone:{target:"ProcessChanges"},onError:{actions:"setSessionUpdateError",target:"SessionUpdateFailed"}}},SessionUpdateFailed:{entry:[dn("Entering SessionUpdateFailed","SessionManagement:"),Vi(2)],always:{target:"ProcessChanges",cond:"shallImmediatelyProcessChangesAfterSessionUpdateError"},exit:[dn("Exiting SessionUpdateFailed","SessionManagement:"),"clearSessionUpdateError"],on:{RetrySessionUpdate:{target:"ProcessChanges",actions:dn("Retrying session update","SessionManagement:")}}}}},{actions:{saveDesiredClient:Xe({desiredClient:(t,e)=>e.client}),saveDesiredSessionContext:Xe({desiredSessionContext:(t,e)=>e.sessionContext}),disposeOldSession:Xe((t,e)=>(t.session&&t.session.close().then(V$).catch(n=>{}),{session:null,actualClient:null})),setSessionCreationResult:Xe((t,e)=>({session:e.data.session,actualClient:e.data.client})),setSessionCreationError:Xe((t,e)=>({sessionCreationError:e.data})),clearSessionCreationError:Xe({sessionCreationError:()=>null}),setSessionUpdateError:Xe((t,e)=>({sessionUpdateError:e.data})),clearSessionUpdateError:Xe({sessionUpdateError:()=>null}),setHasEverSuccessfullyCreatedSession:Xe({hasEverSuccessfullyCreatedSession:()=>!0})},services:{createSession:t=>t.desiredClient.createSession(t.desiredSessionContext).then(e=>({session:e,client:t.desiredClient})).catch(e=>Promise.reject({type:e.type,client:t.desiredClient,sessionContext:t.desiredSessionContext})),updateSession:t=>t.session.setSessionContext(t.desiredSessionContext).catch(e=>Promise.reject({type:e.type,sessionContext:t.desiredSessionContext}))},guards:{shallDisposeSession:t=>t.session!=null&&(t.desiredSessionContext==null||t.desiredClient==null||!Nc.equals(t.actualClient,t.desiredClient)),shallCreateSession:t=>t.session==null&&t.desiredClient!=null&&t.desiredSessionContext!=null,shallUpdateSession:t=>t.session!=null&&!Oc.equals(t.session.getSessionContext(),t.desiredSessionContext),shallImmediatelyProcessChangesAfterSessionCreationError:t=>!Nc.equals(t.desiredClient,t.sessionCreationError.client)||!Dl(Oc).equals(t.desiredSessionContext,t.sessionCreationError.sessionContext),shallImmediatelyProcessChangesAfterSessionUpdateError:t=>!Nc.equals(t.desiredClient,t.actualClient)||!Dl(Oc).equals(t.desiredSessionContext,t.sessionUpdateError.sessionContext)}});function Vi(t){const e=t===0,n=t===1;return E$((r,i)=>{const o={isInitializing:(!r.hasEverSuccessfullyCreatedSession||e)&&r.sessionCreationError==null,errorType:r.sessionCreationError&&r.sessionCreationError.type},a={isUpdating:n&&r.sessionUpdateError==null,errorType:r.sessionUpdateError&&r.sessionUpdateError.type};return nm({type:"SessionManagementStateChanged",sessionInitialization:o,sessionUpdating:a,session:r.session})})}const i1=t=>e=>(e({type:"ConfigurationChanged",session:t,configuration:t.getConfiguration()}),t.setOnConfigurationChangedHandler(n=>{e({type:"ConfigurationChanged",session:t,configuration:n})}),()=>{t.setOnConfigurationChangedHandler(null)}),o1=()=>jf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{session:null},on:{ConfigurationChanged:{actions:[nm((t,e)=>e)]}},initial:"ProcessChanges",states:{ProcessChanges:{entry:[dn("Entering ProcessChanges","ConfigurationSubscriptionManagement:")],on:{ChangeSession:{actions:["saveSession"]}},always:[{target:"Subscribe",cond:(t,e)=>t.session!=null}]},Subscribe:{entry:[dn("Entering Subscribe","ConfigurationSubscriptionManagement:")],on:{ChangeSession:{target:"ProcessChanges",cond:(t,e)=>e.session==null||t.session!==e.session,actions:["saveSession"]}},invoke:{id:"configurationSubscriptionActor",src:(t,e)=>i1(t.session)}}}},{actions:{saveSession:Xe((t,e)=>({session:e.session}))}}),a1=()=>{let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}},bh=()=>{const t=a1();return{capsule:{promise:t.promise},resolve:t.resolve,reject:t.reject}},s1=()=>jf({predictableActionArguments:!0,preserveActionOrder:!0,schema:{context:{},events:{}},context:{sessionManagementActor:null,configurationSubscriptionManagementActor:null,sessionInitialization:null,sessionUpdating:null,session:null,configuration:null,isReadyPromise:bh()},entry:[Xe({sessionManagementActor:()=>ch(r1()),configurationSubscriptionManagementActor:()=>ch(o1())})],exit:[fh(t=>t.sessionManagementActor),fh(t=>t.configurationSubscriptionManagementActor)],on:{ChangeConfigurationClient:{actions:[ss(t=>t.sessionManagementActor)]},ChangeSessionContext:{actions:[ss(t=>t.sessionManagementActor)]},RetrySessionCreation:{actions:[ss(t=>t.sessionManagementActor)]},RetrySessionUpdate:{actions:[ss(t=>t.sessionManagementActor)]},SessionManagementStateChanged:{actions:[Xe((t,e)=>({session:e.session,sessionInitialization:e.sessionInitialization,sessionUpdating:e.sessionUpdating})),RA(t=>({type:"ChangeSession",session:t.session}),{to:t=>t.configurationSubscriptionManagementActor}),"calculateReadyState"]},ConfigurationChanged:{actions:[Xe((t,e)=>({configuration:{session:e.session,configuration:e.configuration}})),"calculateReadyState"]}},initial:"Idle",states:{Idle:{}}},{actions:{calculateReadyState:Xe((t,e)=>{var n;const r=!((n=t.sessionInitialization)!=null&&n.isInitializing)&&t.session!=null&&t.configuration!=null&&t.configuration.session===t.session;return t.isReadyPromise&&r&&(t.isReadyPromise.resolve(),t.isReadyPromise.capsule.promise=null),{isReadyPromise:(()=>r?null:t.isReadyPromise!=null?t.isReadyPromise:bh())()}})}});function u1(t){var e,n;const[r,i]=k$(s1,{logger:(...s)=>console.log("ConfigurationManagement:",...s)});R.useEffect(()=>{i({type:"ChangeConfigurationClient",client:t.configuratorClient}),t.configuratorClient||console.warn("The configurator client is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass a valid client.")},[t.configuratorClient]),R.useEffect(()=>{const s=ft(Ye(t.sessionContext),nD(c=>Ye(c.configurationModelSource)),Uu);i({type:"ChangeSessionContext",sessionContext:s}),s||console.warn("The session context is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass valid session context data.")},[t.sessionContext]);const o=R.useMemo(()=>{var s,c,l,d;return{isInitializing:((c=(s=r.context.isReadyPromise)==null?void 0:s.capsule)==null?void 0:c.promise)!=null,isInitializingPromise:(l=r.context.isReadyPromise)==null?void 0:l.capsule,error:((d=r.context.sessionInitialization)==null?void 0:d.errorType)&&{type:r.context.sessionInitialization.errorType,retry:()=>i({type:"RetrySessionCreation"})}}},[r.context.sessionInitialization,r.context.isReadyPromise]),a=R.useMemo(()=>{var s,c;return{isUpdating:(s=r.context.sessionUpdating)==null?void 0:s.isUpdating,error:((c=r.context.sessionUpdating)==null?void 0:c.errorType)&&{type:r.context.sessionUpdating.errorType,retry:()=>i({type:"RetrySessionUpdate"})}}},[r.context.sessionUpdating]),u=((e=r.context.configuration)==null?void 0:e.session)===r.context.session?(n=r.context.configuration)==null?void 0:n.configuration:null;return{configurationInitialization:o,configurationUpdating:a,session:r.context.session,configuration:u}}function c1(t){const{configurationInitialization:e,configurationUpdating:n,session:r,configuration:i}=u1({configuratorClient:t.configuratorClient,sessionContext:t});return X.jsx(qm.Provider,{value:e,children:X.jsx(kD.Provider,{value:n,children:X.jsx(jm.Provider,{value:r,children:X.jsx(km.Provider,{value:i,children:t.children})})})})}function l1(){return R.useContext(qm)}function f1(t){const{children:e}=t,{isInitializingPromise:n}=l1();if(n!=null&&n.promise)throw n.promise;return X.jsx(X.Fragment,{children:e})}var rn=function(){return rn=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},rn.apply(this,arguments)};function oo(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function d1(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var h1=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,p1=d1(function(t){return h1.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),Yt="-ms-",la="-moz-",qt="-webkit-",Vm="comm",Hu="rule",Gf="decl",v1="@import",Fm="@keyframes",y1="@layer",m1=Math.abs,zf=String.fromCharCode,Ol=Object.assign;function g1(t,e){return we(t,0)^45?(((e<<2^we(t,0))<<2^we(t,1))<<2^we(t,2))<<2^we(t,3):0}function Lm(t){return t.trim()}function er(t,e){return(t=e.exec(t))?t[0]:t}function yt(t,e,n){return t.replace(e,n)}function Es(t,e){return t.indexOf(e)}function we(t,e){return t.charCodeAt(e)|0}function ao(t,e,n){return t.slice(e,n)}function Ln(t){return t.length}function Gm(t){return t.length}function na(t,e){return e.push(t),t}function b1(t,e){return t.map(e).join("")}function Sh(t,e){return t.filter(function(n){return!er(n,e)})}var Wu=1,so=1,zm=0,Sn=0,he=0,Do="";function Ku(t,e,n,r,i,o,a,u){return{value:t,root:e,parent:n,type:r,props:i,children:o,line:Wu,column:so,length:a,return:"",siblings:u}}function Ir(t,e){return Ol(Ku("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},e)}function Fi(t){for(;t.root;)t=Ir(t.root,{children:[t]});na(t,t.siblings)}function S1(){return he}function C1(){return he=Sn>0?we(Do,--Sn):0,so--,he===10&&(so=1,Wu--),he}function Rn(){return he=Sn<zm?we(Do,Sn++):0,so++,he===10&&(so=1,Wu++),he}function hi(){return we(Do,Sn)}function xs(){return Sn}function Yu(t,e){return ao(Do,t,e)}function Nl(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function w1(t){return Wu=so=1,zm=Ln(Do=t),Sn=0,[]}function T1(t){return Do="",t}function Pc(t){return Lm(Yu(Sn-1,Pl(t===91?t+2:t===40?t+1:t)))}function I1(t){for(;(he=hi())&&he<33;)Rn();return Nl(t)>2||Nl(he)>3?"":" "}function E1(t,e){for(;--e&&Rn()&&!(he<48||he>102||he>57&&he<65||he>70&&he<97););return Yu(t,xs()+(e<6&&hi()==32&&Rn()==32))}function Pl(t){for(;Rn();)switch(he){case t:return Sn;case 34:case 39:t!==34&&t!==39&&Pl(he);break;case 40:t===41&&Pl(t);break;case 92:Rn();break}return Sn}function x1(t,e){for(;Rn()&&t+he!==47+10;)if(t+he===42+42&&hi()===47)break;return"/*"+Yu(e,Sn-1)+"*"+zf(t===47?t:Rn())}function A1(t){for(;!Nl(hi());)Rn();return Yu(t,Sn)}function $1(t){return T1(As("",null,null,null,[""],t=w1(t),0,[0],t))}function As(t,e,n,r,i,o,a,u,s){for(var c=0,l=0,d=a,f=0,h=0,v=0,p=1,S=1,C=1,w=0,T="",I=i,x=o,b=r,E=T;S;)switch(v=w,w=Rn()){case 40:if(v!=108&&we(E,d-1)==58){Es(E+=yt(Pc(w),"&","&\f"),"&\f")!=-1&&(C=-1);break}case 34:case 39:case 91:E+=Pc(w);break;case 9:case 10:case 13:case 32:E+=I1(v);break;case 92:E+=E1(xs()-1,7);continue;case 47:switch(hi()){case 42:case 47:na(D1(x1(Rn(),xs()),e,n,s),s);break;default:E+="/"}break;case 123*p:u[c++]=Ln(E)*C;case 125*p:case 59:case 0:switch(w){case 0:case 125:S=0;case 59+l:C==-1&&(E=yt(E,/\f/g,"")),h>0&&Ln(E)-d&&na(h>32?wh(E+";",r,n,d-1,s):wh(yt(E," ","")+";",r,n,d-2,s),s);break;case 59:E+=";";default:if(na(b=Ch(E,e,n,c,l,i,u,T,I=[],x=[],d,o),o),w===123)if(l===0)As(E,e,b,b,I,o,d,u,x);else switch(f===99&&we(E,3)===110?100:f){case 100:case 108:case 109:case 115:As(t,b,b,r&&na(Ch(t,b,b,0,0,i,u,T,i,I=[],d,x),x),i,x,d,u,r?I:x);break;default:As(E,b,b,b,[""],x,0,u,x)}}c=l=h=0,p=C=1,T=E="",d=a;break;case 58:d=1+Ln(E),h=v;default:if(p<1){if(w==123)--p;else if(w==125&&p++==0&&C1()==125)continue}switch(E+=zf(w),w*p){case 38:C=l>0?1:(E+="\f",-1);break;case 44:u[c++]=(Ln(E)-1)*C,C=1;break;case 64:hi()===45&&(E+=Pc(Rn())),f=hi(),l=d=Ln(T=E+=A1(xs())),w++;break;case 45:v===45&&Ln(E)==2&&(p=0)}}return o}function Ch(t,e,n,r,i,o,a,u,s,c,l,d){for(var f=i-1,h=i===0?o:[""],v=Gm(h),p=0,S=0,C=0;p<r;++p)for(var w=0,T=ao(t,f+1,f=m1(S=a[p])),I=t;w<v;++w)(I=Lm(S>0?h[w]+" "+T:yt(T,/&\f/g,h[w])))&&(s[C++]=I);return Ku(t,e,n,i===0?Hu:u,s,c,l,d)}function D1(t,e,n,r){return Ku(t,e,n,Vm,zf(S1()),ao(t,2,-2),0,r)}function wh(t,e,n,r,i){return Ku(t,e,n,Gf,ao(t,0,r),ao(t,r+1,-1),r,i)}function Hm(t,e,n){switch(g1(t,e)){case 5103:return qt+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return qt+t+t;case 4789:return la+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return qt+t+la+t+Yt+t+t;case 5936:switch(we(t,e+11)){case 114:return qt+t+Yt+yt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return qt+t+Yt+yt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return qt+t+Yt+yt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return qt+t+Yt+t+t;case 6165:return qt+t+Yt+"flex-"+t+t;case 5187:return qt+t+yt(t,/(\w+).+(:[^]+)/,qt+"box-$1$2"+Yt+"flex-$1$2")+t;case 5443:return qt+t+Yt+"flex-item-"+yt(t,/flex-|-self/g,"")+(er(t,/flex-|baseline/)?"":Yt+"grid-row-"+yt(t,/flex-|-self/g,""))+t;case 4675:return qt+t+Yt+"flex-line-pack"+yt(t,/align-content|flex-|-self/g,"")+t;case 5548:return qt+t+Yt+yt(t,"shrink","negative")+t;case 5292:return qt+t+Yt+yt(t,"basis","preferred-size")+t;case 6060:return qt+"box-"+yt(t,"-grow","")+qt+t+Yt+yt(t,"grow","positive")+t;case 4554:return qt+yt(t,/([^-])(transform)/g,"$1"+qt+"$2")+t;case 6187:return yt(yt(yt(t,/(zoom-|grab)/,qt+"$1"),/(image-set)/,qt+"$1"),t,"")+t;case 5495:case 3959:return yt(t,/(image-set\([^]*)/,qt+"$1$`$1");case 4968:return yt(yt(t,/(.+:)(flex-)?(.*)/,qt+"box-pack:$3"+Yt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+qt+t+t;case 4200:if(!er(t,/flex-|baseline/))return Yt+"grid-column-align"+ao(t,e)+t;break;case 2592:case 3360:return Yt+yt(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(r,i){return e=i,er(r.props,/grid-\w+-end/)})?~Es(t+(n=n[e].value),"span")?t:Yt+yt(t,"-start","")+t+Yt+"grid-row-span:"+(~Es(n,"span")?er(n,/\d+/):+er(n,/\d+/)-+er(t,/\d+/))+";":Yt+yt(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(r){return er(r.props,/grid-\w+-start/)})?t:Yt+yt(yt(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return yt(t,/(.+)-inline(.+)/,qt+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ln(t)-1-e>6)switch(we(t,e+1)){case 109:if(we(t,e+4)!==45)break;case 102:return yt(t,/(.+:)(.+)-([^]+)/,"$1"+qt+"$2-$3$1"+la+(we(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~Es(t,"stretch")?Hm(yt(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return yt(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,a,u,s,c){return Yt+i+":"+o+c+(a?Yt+i+"-span:"+(u?s:+s-+o)+c:"")+t});case 4949:if(we(t,e+6)===121)return yt(t,":",":"+qt)+t;break;case 6444:switch(we(t,we(t,14)===45?18:11)){case 120:return yt(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+qt+(we(t,14)===45?"inline-":"")+"box$3$1"+qt+"$2$3$1"+Yt+"$2box$3")+t;case 100:return yt(t,":",":"+Yt)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return yt(t,"scroll-","scroll-snap-")+t}return t}function Xs(t,e){for(var n="",r=0;r<t.length;r++)n+=e(t[r],r,t,e)||"";return n}function O1(t,e,n,r){switch(t.type){case y1:if(t.children.length)break;case v1:case Gf:return t.return=t.return||t.value;case Vm:return"";case Fm:return t.return=t.value+"{"+Xs(t.children,r)+"}";case Hu:if(!Ln(t.value=t.props.join(",")))return""}return Ln(n=Xs(t.children,r))?t.return=t.value+"{"+n+"}":""}function N1(t){var e=Gm(t);return function(n,r,i,o){for(var a="",u=0;u<e;u++)a+=t[u](n,r,i,o)||"";return a}}function P1(t){return function(e){e.root||(e=e.return)&&t(e)}}function M1(t,e,n,r){if(t.length>-1&&!t.return)switch(t.type){case Gf:t.return=Hm(t.value,t.length,n);return;case Fm:return Xs([Ir(t,{value:yt(t.value,"@","@"+qt)})],r);case Hu:if(t.length)return b1(n=t.props,function(i){switch(er(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Fi(Ir(t,{props:[yt(i,/:(read-\w+)/,":"+la+"$1")]})),Fi(Ir(t,{props:[i]})),Ol(t,{props:Sh(n,r)});break;case"::placeholder":Fi(Ir(t,{props:[yt(i,/:(plac\w+)/,":"+qt+"input-$1")]})),Fi(Ir(t,{props:[yt(i,/:(plac\w+)/,":"+la+"$1")]})),Fi(Ir(t,{props:[yt(i,/:(plac\w+)/,Yt+"input-$1")]})),Fi(Ir(t,{props:[i]})),Ol(t,{props:Sh(n,r)});break}return""})}}var R1={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ei=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Hf=typeof window<"u"&&"HTMLElement"in window,_1=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""?process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY:process.env.NODE_ENV!=="production"),Th=/invalid hook call/i,cs=new Set,j1=function(t,e){if(process.env.NODE_ENV!=="production"){var n=e?' with the id of "'.concat(e,'"'):"",r="The component ".concat(t).concat(n,` has been created dynamically.
131
131
  `)+`You may see this warning because you've called styled inside another component.
132
- To resolve this only create new StyledComponents outside of any render method and function component.`,i=console.error;try{var o=!0;console.error=function(a){for(var u=[],s=1;s<arguments.length;s++)u[s-1]=arguments[s];Th.test(a)?(o=!1,cs.delete(r)):i.apply(void 0,oo([a],u,!1))},R.useRef(),o&&!cs.has(r)&&(console.warn(r),cs.add(r))}catch(a){Th.test(a.message)&&cs.delete(r)}finally{console.error=i}}},Yu=Object.freeze([]),uo=Object.freeze({});function j1(t,e,n){return n===void 0&&(n=uo),t.theme!==n.theme&&t.theme||e||n.theme}var Ml=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),q1=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,k1=/(^-|-$)/g;function Ih(t){return t.replace(q1,"-").replace(k1,"")}var U1=/(a)(d)/gi,Eh=function(t){return String.fromCharCode(t+(t>25?39:97))};function Rl(t){var e,n="";for(e=Math.abs(t);e>52;e=e/52|0)n=Eh(e%52)+n;return(Eh(e%52)+n).replace(U1,"$1-$2")}var Mc,li=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},Wm=function(t){return li(5381,t)};function B1(t){return Rl(Wm(t)>>>0)}function Km(t){return process.env.NODE_ENV!=="production"&&typeof t=="string"&&t||t.displayName||t.name||"Component"}function Rc(t){return typeof t=="string"&&(process.env.NODE_ENV==="production"||t.charAt(0)===t.charAt(0).toLowerCase())}var Jm=typeof Symbol=="function"&&Symbol.for,Ym=Jm?Symbol.for("react.memo"):60115,V1=Jm?Symbol.for("react.forward_ref"):60112,F1={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},L1={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Xm={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},G1=((Mc={})[V1]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Mc[Ym]=Xm,Mc);function xh(t){return("type"in(e=t)&&e.type.$$typeof)===Ym?Xm:"$$typeof"in t?G1[t.$$typeof]:F1;var e}var z1=Object.defineProperty,H1=Object.getOwnPropertyNames,Ah=Object.getOwnPropertySymbols,W1=Object.getOwnPropertyDescriptor,K1=Object.getPrototypeOf,$h=Object.prototype;function Zm(t,e,n){if(typeof e!="string"){if($h){var r=K1(e);r&&r!==$h&&Zm(t,r,n)}var i=H1(e);Ah&&(i=i.concat(Ah(e)));for(var o=xh(t),a=xh(e),u=0;u<i.length;++u){var s=i[u];if(!(s in L1||n&&n[s]||a&&s in a||o&&s in o)){var c=W1(e,s);try{z1(t,s,c)}catch{}}}}return t}function co(t){return typeof t=="function"}function Wf(t){return typeof t=="object"&&"styledComponentId"in t}function fi(t,e){return t&&e?"".concat(t," ").concat(e):t||e||""}function Dh(t,e){if(t.length===0)return"";for(var n=t[0],r=1;r<t.length;r++)n+=e?e+t[r]:t[r];return n}function lo(t){return t!==null&&typeof t=="object"&&t.constructor.name===Object.name&&!("props"in t&&t.$$typeof)}function _l(t,e,n){if(n===void 0&&(n=!1),!n&&!lo(t)&&!Array.isArray(t))return e;if(Array.isArray(e))for(var r=0;r<e.length;r++)t[r]=_l(t[r],e[r]);else if(lo(e))for(var r in e)t[r]=_l(t[r],e[r]);return t}function Kf(t,e){Object.defineProperty(t,"toString",{value:e})}var J1=process.env.NODE_ENV!=="production"?{1:`Cannot create styled-component for component: %s.
132
+ To resolve this only create new StyledComponents outside of any render method and function component.`,i=console.error;try{var o=!0;console.error=function(a){for(var u=[],s=1;s<arguments.length;s++)u[s-1]=arguments[s];Th.test(a)?(o=!1,cs.delete(r)):i.apply(void 0,oo([a],u,!1))},R.useRef(),o&&!cs.has(r)&&(console.warn(r),cs.add(r))}catch(a){Th.test(a.message)&&cs.delete(r)}finally{console.error=i}}},Ju=Object.freeze([]),uo=Object.freeze({});function q1(t,e,n){return n===void 0&&(n=uo),t.theme!==n.theme&&t.theme||e||n.theme}var Ml=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),k1=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,U1=/(^-|-$)/g;function Ih(t){return t.replace(k1,"-").replace(U1,"")}var B1=/(a)(d)/gi,Eh=function(t){return String.fromCharCode(t+(t>25?39:97))};function Rl(t){var e,n="";for(e=Math.abs(t);e>52;e=e/52|0)n=Eh(e%52)+n;return(Eh(e%52)+n).replace(B1,"$1-$2")}var Mc,li=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},Wm=function(t){return li(5381,t)};function V1(t){return Rl(Wm(t)>>>0)}function Km(t){return process.env.NODE_ENV!=="production"&&typeof t=="string"&&t||t.displayName||t.name||"Component"}function Rc(t){return typeof t=="string"&&(process.env.NODE_ENV==="production"||t.charAt(0)===t.charAt(0).toLowerCase())}var Ym=typeof Symbol=="function"&&Symbol.for,Jm=Ym?Symbol.for("react.memo"):60115,F1=Ym?Symbol.for("react.forward_ref"):60112,L1={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},G1={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Xm={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},z1=((Mc={})[F1]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Mc[Jm]=Xm,Mc);function xh(t){return("type"in(e=t)&&e.type.$$typeof)===Jm?Xm:"$$typeof"in t?z1[t.$$typeof]:L1;var e}var H1=Object.defineProperty,W1=Object.getOwnPropertyNames,Ah=Object.getOwnPropertySymbols,K1=Object.getOwnPropertyDescriptor,Y1=Object.getPrototypeOf,$h=Object.prototype;function Zm(t,e,n){if(typeof e!="string"){if($h){var r=Y1(e);r&&r!==$h&&Zm(t,r,n)}var i=W1(e);Ah&&(i=i.concat(Ah(e)));for(var o=xh(t),a=xh(e),u=0;u<i.length;++u){var s=i[u];if(!(s in G1||n&&n[s]||a&&s in a||o&&s in o)){var c=K1(e,s);try{H1(t,s,c)}catch{}}}}return t}function co(t){return typeof t=="function"}function Wf(t){return typeof t=="object"&&"styledComponentId"in t}function fi(t,e){return t&&e?"".concat(t," ").concat(e):t||e||""}function Dh(t,e){if(t.length===0)return"";for(var n=t[0],r=1;r<t.length;r++)n+=e?e+t[r]:t[r];return n}function lo(t){return t!==null&&typeof t=="object"&&t.constructor.name===Object.name&&!("props"in t&&t.$$typeof)}function _l(t,e,n){if(n===void 0&&(n=!1),!n&&!lo(t)&&!Array.isArray(t))return e;if(Array.isArray(e))for(var r=0;r<e.length;r++)t[r]=_l(t[r],e[r]);else if(lo(e))for(var r in e)t[r]=_l(t[r],e[r]);return t}function Kf(t,e){Object.defineProperty(t,"toString",{value:e})}var J1=process.env.NODE_ENV!=="production"?{1:`Cannot create styled-component for component: %s.
133
133
 
134
134
  `,2:`Can't collect styles once you've consumed a \`ServerStyleSheet\`'s styles! \`ServerStyleSheet\` is a one off instance for each server-side render cycle.
135
135
 
@@ -170,10 +170,10 @@ as for instance in your render method then you may be running into this limitati
170
170
 
171
171
  `,17:`CSSStyleSheet could not be found on HTMLStyleElement.
172
172
  Has styled-components' style tag been unmounted or altered by another script?
173
- `,18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function Y1(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=t[0],r=[],i=1,o=t.length;i<o;i+=1)r.push(t[i]);return r.forEach(function(a){n=n.replace(/%[a-z]/,a)}),n}function Oo(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return process.env.NODE_ENV==="production"?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(e.length>0?" Args: ".concat(e.join(", ")):"")):new Error(Y1.apply(void 0,oo([J1[t]],e,!1)).trim())}var X1=function(){function t(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return t.prototype.indexOfGroup=function(e){for(var n=0,r=0;r<e;r++)n+=this.groupSizes[r];return n},t.prototype.insertRules=function(e,n){if(e>=this.groupSizes.length){for(var r=this.groupSizes,i=r.length,o=i;e>=o;)if((o<<=1)<0)throw Oo(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var a=i;a<o;a++)this.groupSizes[a]=0}for(var u=this.indexOfGroup(e+1),s=(a=0,n.length);a<s;a++)this.tag.insertRule(u,n[a])&&(this.groupSizes[e]++,u++)},t.prototype.clearGroup=function(e){if(e<this.length){var n=this.groupSizes[e],r=this.indexOfGroup(e),i=r+n;this.groupSizes[e]=0;for(var o=r;o<i;o++)this.tag.deleteRule(r)}},t.prototype.getGroup=function(e){var n="";if(e>=this.length||this.groupSizes[e]===0)return n;for(var r=this.groupSizes[e],i=this.indexOfGroup(e),o=i+r,a=i;a<o;a++)n+="".concat(this.tag.getRule(a)).concat(`/*!sc*/
174
- `);return n},t}(),$s=new Map,Zs=new Map,Ds=1,ls=function(t){if($s.has(t))return $s.get(t);for(;Zs.has(Ds);)Ds++;var e=Ds++;if(process.env.NODE_ENV!=="production"&&((0|e)<0||e>1073741824))throw Oo(16,"".concat(e));return $s.set(t,e),Zs.set(e,t),e},Z1=function(t,e){Ds=e+1,$s.set(t,e),Zs.set(e,t)},Q1="style[".concat(Ei,"][").concat("data-styled-version",'="').concat("6.1.1",'"]'),tO=new RegExp("^".concat(Ei,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),eO=function(t,e,n){for(var r,i=n.split(","),o=0,a=i.length;o<a;o++)(r=i[o])&&t.registerName(e,r)},nO=function(t,e){for(var n,r=((n=e.textContent)!==null&&n!==void 0?n:"").split(`/*!sc*/
175
- `),i=[],o=0,a=r.length;o<a;o++){var u=r[o].trim();if(u){var s=u.match(tO);if(s){var c=0|parseInt(s[1],10),l=s[2];c!==0&&(Z1(l,c),eO(t,l,s[3]),t.getTag().insertRules(c,i)),i.length=0}else i.push(u)}}};function rO(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var Qm=function(t){var e=document.head,n=t||e,r=document.createElement("style"),i=function(u){var s=Array.from(u.querySelectorAll("style[".concat(Ei,"]")));return s[s.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(Ei,"active"),r.setAttribute("data-styled-version","6.1.1");var a=rO();return a&&r.setAttribute("nonce",a),n.insertBefore(r,o),r},iO=function(){function t(e){this.element=Qm(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(n){if(n.sheet)return n.sheet;for(var r=document.styleSheets,i=0,o=r.length;i<o;i++){var a=r[i];if(a.ownerNode===n)return a}throw Oo(17)}(this.element),this.length=0}return t.prototype.insertRule=function(e,n){try{return this.sheet.insertRule(n,e),this.length++,!0}catch{return!1}},t.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},t.prototype.getRule=function(e){var n=this.sheet.cssRules[e];return n&&n.cssText?n.cssText:""},t}(),oO=function(){function t(e){this.element=Qm(e),this.nodes=this.element.childNodes,this.length=0}return t.prototype.insertRule=function(e,n){if(e<=this.length&&e>=0){var r=document.createTextNode(n);return this.element.insertBefore(r,this.nodes[e]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},t}(),aO=function(){function t(e){this.rules=[],this.length=0}return t.prototype.insertRule=function(e,n){return e<=this.length&&(this.rules.splice(e,0,n),this.length++,!0)},t.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},t.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},t}(),Oh=Hf,sO={isServer:!Hf,useCSSOMInjection:!R1},tg=function(){function t(e,n,r){e===void 0&&(e=uo),n===void 0&&(n={});var i=this;this.options=rn(rn({},sO),e),this.gs=n,this.names=new Map(r),this.server=!!e.isServer,!this.server&&Hf&&Oh&&(Oh=!1,function(o){for(var a=document.querySelectorAll(Q1),u=0,s=a.length;u<s;u++){var c=a[u];c&&c.getAttribute(Ei)!=="active"&&(nO(o,c),c.parentNode&&c.parentNode.removeChild(c))}}(this)),Kf(this,function(){return function(o){for(var a=o.getTag(),u=a.length,s="",c=function(d){var f=function(C){return Zs.get(C)}(d);if(f===void 0)return"continue";var h=o.names.get(f),v=a.getGroup(d);if(h===void 0||v.length===0)return"continue";var p="".concat(Ei,".g").concat(d,'[id="').concat(f,'"]'),S="";h!==void 0&&h.forEach(function(C){C.length>0&&(S+="".concat(C,","))}),s+="".concat(v).concat(p,'{content:"').concat(S,'"}').concat(`/*!sc*/
176
- `)},l=0;l<u;l++)c(l);return s}(i)})}return t.registerId=function(e){return ls(e)},t.prototype.reconstructWithOptions=function(e,n){return n===void 0&&(n=!0),new t(rn(rn({},this.options),e),this.gs,n&&this.names||void 0)},t.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(e=function(n){var r=n.useCSSOMInjection,i=n.target;return n.isServer?new aO(i):r?new iO(i):new oO(i)}(this.options),new X1(e)));var e},t.prototype.hasNameForId=function(e,n){return this.names.has(e)&&this.names.get(e).has(n)},t.prototype.registerName=function(e,n){if(ls(e),this.names.has(e))this.names.get(e).add(n);else{var r=new Set;r.add(n),this.names.set(e,r)}},t.prototype.insertRules=function(e,n,r){this.registerName(e,n),this.getTag().insertRules(ls(e),r)},t.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.prototype.clearRules=function(e){this.getTag().clearGroup(ls(e)),this.clearNames(e)},t.prototype.clearTag=function(){this.tag=void 0},t}(),uO=/&/g,cO=/^\s*\/\/.*$/gm;function eg(t,e){return t.map(function(n){return n.type==="rule"&&(n.value="".concat(e," ").concat(n.value),n.value=n.value.replaceAll(",",",".concat(e," ")),n.props=n.props.map(function(r){return"".concat(e," ").concat(r)})),Array.isArray(n.children)&&n.type!=="@keyframes"&&(n.children=eg(n.children,e)),n})}function lO(t){var e,n,r,i=t===void 0?uo:t,o=i.options,a=o===void 0?uo:o,u=i.plugins,s=u===void 0?Yu:u,c=function(f,h,v){return v===n||v.startsWith(n)&&v.endsWith(n)&&v.replaceAll(n,"").length>0?".".concat(e):f},l=s.slice();l.push(function(f){f.type===Hu&&f.value.includes("&")&&(f.props[0]=f.props[0].replace(uO,n).replace(r,c))}),a.prefix&&l.push(P1),l.push(D1);var d=function(f,h,v,p){h===void 0&&(h=""),v===void 0&&(v=""),p===void 0&&(p="&"),e=p,n=h,r=new RegExp("\\".concat(n,"\\b"),"g");var S=f.replace(cO,""),C=A1(v||h?"".concat(v," ").concat(h," { ").concat(S," }"):S);a.namespace&&(C=eg(C,a.namespace));var w=[];return Xs(C,O1(l.concat(N1(function(T){return w.push(T)})))),w};return d.hash=s.length?s.reduce(function(f,h){return h.name||Oo(15),li(f,h.name)},5381).toString():"",d}var fO=new tg,jl=lO(),ng=R.createContext({shouldForwardProp:void 0,styleSheet:fO,stylis:jl});ng.Consumer;R.createContext(void 0);function Nh(){return R.useContext(ng)}var Ph=function(){function t(e,n){var r=this;this.inject=function(i,o){o===void 0&&(o=jl);var a=r.name+o.hash;i.hasNameForId(r.id,a)||i.insertRules(r.id,a,o(r.rules,a,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=n,Kf(this,function(){throw Oo(12,String(r.name))})}return t.prototype.getName=function(e){return e===void 0&&(e=jl),this.name+e.hash},t}(),dO=function(t){return t>="A"&&t<="Z"};function Mh(t){for(var e="",n=0;n<t.length;n++){var r=t[n];if(n===1&&r==="-"&&t[0]==="-")return t;dO(r)?e+="-"+r.toLowerCase():e+=r}return e.startsWith("ms-")?"-"+e:e}var rg=function(t){return t==null||t===!1||t===""},ig=function(t){var e,n,r=[];for(var i in t){var o=t[i];t.hasOwnProperty(i)&&!rg(o)&&(Array.isArray(o)&&o.isCss||co(o)?r.push("".concat(Mh(i),":"),o,";"):lo(o)?r.push.apply(r,oo(oo(["".concat(i," {")],ig(o),!1),["}"],!1)):r.push("".concat(Mh(i),": ").concat((e=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||e in M1||e.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function pi(t,e,n,r){if(rg(t))return[];if(Wf(t))return[".".concat(t.styledComponentId)];if(co(t)){if(!co(o=t)||o.prototype&&o.prototype.isReactComponent||!e)return[t];var i=t(e);return process.env.NODE_ENV==="production"||typeof i!="object"||Array.isArray(i)||i instanceof Ph||lo(i)||i===null||console.error("".concat(Km(t)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),pi(i,e,n,r)}var o;return t instanceof Ph?n?(t.inject(n,r),[t.getName(r)]):[t]:lo(t)?ig(t):Array.isArray(t)?Array.prototype.concat.apply(Yu,t.map(function(a){return pi(a,e,n,r)})):[t.toString()]}function hO(t){for(var e=0;e<t.length;e+=1){var n=t[e];if(co(n)&&!Wf(n))return!1}return!0}var pO=Wm("6.1.1"),vO=function(){function t(e,n,r){this.rules=e,this.staticRulesId="",this.isStatic=process.env.NODE_ENV==="production"&&(r===void 0||r.isStatic)&&hO(e),this.componentId=n,this.baseHash=li(pO,n),this.baseStyle=r,tg.registerId(n)}return t.prototype.generateAndInjectStyles=function(e,n,r){var i=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,n,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&n.hasNameForId(this.componentId,this.staticRulesId))i=fi(i,this.staticRulesId);else{var o=Dh(pi(this.rules,e,n,r)),a=Rl(li(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,a)){var u=r(o,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,u)}i=fi(i,a),this.staticRulesId=a}else{for(var s=li(this.baseHash,r.hash),c="",l=0;l<this.rules.length;l++){var d=this.rules[l];if(typeof d=="string")c+=d,process.env.NODE_ENV!=="production"&&(s=li(s,d));else if(d){var f=Dh(pi(d,e,n,r));s=li(s,f+l),c+=f}}if(c){var h=Rl(s>>>0);n.hasNameForId(this.componentId,h)||n.insertRules(this.componentId,h,r(c,".".concat(h),void 0,this.componentId)),i=fi(i,h)}}return i},t}(),og=R.createContext(void 0);og.Consumer;var _c={},Rh=new Set;function yO(t,e,n){var r=Wf(t),i=t,o=!Rc(t),a=e.attrs,u=a===void 0?Yu:a,s=e.componentId,c=s===void 0?function(I,x){var b=typeof I!="string"?"sc":Ih(I);_c[b]=(_c[b]||0)+1;var E="".concat(b,"-").concat(B1("6.1.1"+b+_c[b]));return x?"".concat(x,"-").concat(E):E}(e.displayName,e.parentComponentId):s,l=e.displayName,d=l===void 0?function(I){return Rc(I)?"styled.".concat(I):"Styled(".concat(Km(I),")")}(t):l,f=e.displayName&&e.componentId?"".concat(Ih(e.displayName),"-").concat(e.componentId):e.componentId||c,h=r&&i.attrs?i.attrs.concat(u).filter(Boolean):u,v=e.shouldForwardProp;if(r&&i.shouldForwardProp){var p=i.shouldForwardProp;if(e.shouldForwardProp){var S=e.shouldForwardProp;v=function(I,x){return p(I,x)&&S(I,x)}}else v=p}var C=new vO(n,f,r?i.componentStyle:void 0);function w(I,x){return function(b,E,P){var A=b.attrs,U=b.componentStyle,M=b.defaultProps,$=b.foldedComponentIds,z=b.styledComponentId,Z=b.target,Vt=R.useContext(og),bt=Nh(),Y=b.shouldForwardProp||bt.shouldForwardProp;process.env.NODE_ENV!=="production"&&R.useDebugValue(z);var J=function(Ot,Zt,Un){for(var Bn,Tn=rn(rn({},Zt),{className:void 0,theme:Un}),ei=0;ei<Ot.length;ei+=1){var br=co(Bn=Ot[ei])?Bn(Tn):Bn;for(var yn in br)Tn[yn]=yn==="className"?fi(Tn[yn],br[yn]):yn==="style"?rn(rn({},Tn[yn]),br[yn]):br[yn]}return Zt.className&&(Tn.className=fi(Tn.className,Zt.className)),Tn}(A,E,j1(E,Vt,M)||uo),ut=J.as||Z,$e={};for(var tt in J)J[tt]===void 0||tt[0]==="$"||tt==="as"||tt==="theme"||(tt==="forwardedAs"?$e.as=J.forwardedAs:Y&&!Y(tt,ut)||($e[tt]=J[tt],Y||process.env.NODE_ENV!=="development"||h1(tt)||Rh.has(tt)||!Ml.has(ut)||(Rh.add(tt),console.warn('styled-components: it looks like an unknown prop "'.concat(tt,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var De=function(Ot,Zt){var Un=Nh(),Bn=Ot.generateAndInjectStyles(Zt,Un.styleSheet,Un.stylis);return process.env.NODE_ENV!=="production"&&R.useDebugValue(Bn),Bn}(U,J);process.env.NODE_ENV!=="production"&&b.warnTooManyClasses&&b.warnTooManyClasses(De);var an=fi($,z);return De&&(an+=" "+De),J.className&&(an+=" "+J.className),$e[Rc(ut)&&!Ml.has(ut)?"class":"className"]=an,$e.ref=P,R.createElement(ut,$e)}(T,I,x)}w.displayName=d;var T=R.forwardRef(w);return T.attrs=h,T.componentStyle=C,T.displayName=d,T.shouldForwardProp=v,T.foldedComponentIds=r?fi(i.foldedComponentIds,i.styledComponentId):"",T.styledComponentId=f,T.target=r?i.target:t,Object.defineProperty(T,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(I){this._foldedDefaultProps=r?function(x){for(var b=[],E=1;E<arguments.length;E++)b[E-1]=arguments[E];for(var P=0,A=b;P<A.length;P++)_l(x,A[P],!0);return x}({},i.defaultProps,I):I}}),process.env.NODE_ENV!=="production"&&(_1(d,f),T.warnTooManyClasses=function(I,x){var b={},E=!1;return function(P){if(!E&&(b[P]=!0,Object.keys(b).length>=200)){var A=x?' with the id of "'.concat(x,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(I).concat(A,`.
173
+ `,18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function X1(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=t[0],r=[],i=1,o=t.length;i<o;i+=1)r.push(t[i]);return r.forEach(function(a){n=n.replace(/%[a-z]/,a)}),n}function Oo(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return process.env.NODE_ENV==="production"?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(e.length>0?" Args: ".concat(e.join(", ")):"")):new Error(X1.apply(void 0,oo([J1[t]],e,!1)).trim())}var Z1=function(){function t(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return t.prototype.indexOfGroup=function(e){for(var n=0,r=0;r<e;r++)n+=this.groupSizes[r];return n},t.prototype.insertRules=function(e,n){if(e>=this.groupSizes.length){for(var r=this.groupSizes,i=r.length,o=i;e>=o;)if((o<<=1)<0)throw Oo(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var a=i;a<o;a++)this.groupSizes[a]=0}for(var u=this.indexOfGroup(e+1),s=(a=0,n.length);a<s;a++)this.tag.insertRule(u,n[a])&&(this.groupSizes[e]++,u++)},t.prototype.clearGroup=function(e){if(e<this.length){var n=this.groupSizes[e],r=this.indexOfGroup(e),i=r+n;this.groupSizes[e]=0;for(var o=r;o<i;o++)this.tag.deleteRule(r)}},t.prototype.getGroup=function(e){var n="";if(e>=this.length||this.groupSizes[e]===0)return n;for(var r=this.groupSizes[e],i=this.indexOfGroup(e),o=i+r,a=i;a<o;a++)n+="".concat(this.tag.getRule(a)).concat(`/*!sc*/
174
+ `);return n},t}(),$s=new Map,Zs=new Map,Ds=1,ls=function(t){if($s.has(t))return $s.get(t);for(;Zs.has(Ds);)Ds++;var e=Ds++;if(process.env.NODE_ENV!=="production"&&((0|e)<0||e>1073741824))throw Oo(16,"".concat(e));return $s.set(t,e),Zs.set(e,t),e},Q1=function(t,e){Ds=e+1,$s.set(t,e),Zs.set(e,t)},tO="style[".concat(Ei,"][").concat("data-styled-version",'="').concat("6.1.1",'"]'),eO=new RegExp("^".concat(Ei,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),nO=function(t,e,n){for(var r,i=n.split(","),o=0,a=i.length;o<a;o++)(r=i[o])&&t.registerName(e,r)},rO=function(t,e){for(var n,r=((n=e.textContent)!==null&&n!==void 0?n:"").split(`/*!sc*/
175
+ `),i=[],o=0,a=r.length;o<a;o++){var u=r[o].trim();if(u){var s=u.match(eO);if(s){var c=0|parseInt(s[1],10),l=s[2];c!==0&&(Q1(l,c),nO(t,l,s[3]),t.getTag().insertRules(c,i)),i.length=0}else i.push(u)}}};function iO(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var Qm=function(t){var e=document.head,n=t||e,r=document.createElement("style"),i=function(u){var s=Array.from(u.querySelectorAll("style[".concat(Ei,"]")));return s[s.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(Ei,"active"),r.setAttribute("data-styled-version","6.1.1");var a=iO();return a&&r.setAttribute("nonce",a),n.insertBefore(r,o),r},oO=function(){function t(e){this.element=Qm(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(n){if(n.sheet)return n.sheet;for(var r=document.styleSheets,i=0,o=r.length;i<o;i++){var a=r[i];if(a.ownerNode===n)return a}throw Oo(17)}(this.element),this.length=0}return t.prototype.insertRule=function(e,n){try{return this.sheet.insertRule(n,e),this.length++,!0}catch{return!1}},t.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},t.prototype.getRule=function(e){var n=this.sheet.cssRules[e];return n&&n.cssText?n.cssText:""},t}(),aO=function(){function t(e){this.element=Qm(e),this.nodes=this.element.childNodes,this.length=0}return t.prototype.insertRule=function(e,n){if(e<=this.length&&e>=0){var r=document.createTextNode(n);return this.element.insertBefore(r,this.nodes[e]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},t}(),sO=function(){function t(e){this.rules=[],this.length=0}return t.prototype.insertRule=function(e,n){return e<=this.length&&(this.rules.splice(e,0,n),this.length++,!0)},t.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},t.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},t}(),Oh=Hf,uO={isServer:!Hf,useCSSOMInjection:!_1},tg=function(){function t(e,n,r){e===void 0&&(e=uo),n===void 0&&(n={});var i=this;this.options=rn(rn({},uO),e),this.gs=n,this.names=new Map(r),this.server=!!e.isServer,!this.server&&Hf&&Oh&&(Oh=!1,function(o){for(var a=document.querySelectorAll(tO),u=0,s=a.length;u<s;u++){var c=a[u];c&&c.getAttribute(Ei)!=="active"&&(rO(o,c),c.parentNode&&c.parentNode.removeChild(c))}}(this)),Kf(this,function(){return function(o){for(var a=o.getTag(),u=a.length,s="",c=function(d){var f=function(C){return Zs.get(C)}(d);if(f===void 0)return"continue";var h=o.names.get(f),v=a.getGroup(d);if(h===void 0||v.length===0)return"continue";var p="".concat(Ei,".g").concat(d,'[id="').concat(f,'"]'),S="";h!==void 0&&h.forEach(function(C){C.length>0&&(S+="".concat(C,","))}),s+="".concat(v).concat(p,'{content:"').concat(S,'"}').concat(`/*!sc*/
176
+ `)},l=0;l<u;l++)c(l);return s}(i)})}return t.registerId=function(e){return ls(e)},t.prototype.reconstructWithOptions=function(e,n){return n===void 0&&(n=!0),new t(rn(rn({},this.options),e),this.gs,n&&this.names||void 0)},t.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(e=function(n){var r=n.useCSSOMInjection,i=n.target;return n.isServer?new sO(i):r?new oO(i):new aO(i)}(this.options),new Z1(e)));var e},t.prototype.hasNameForId=function(e,n){return this.names.has(e)&&this.names.get(e).has(n)},t.prototype.registerName=function(e,n){if(ls(e),this.names.has(e))this.names.get(e).add(n);else{var r=new Set;r.add(n),this.names.set(e,r)}},t.prototype.insertRules=function(e,n,r){this.registerName(e,n),this.getTag().insertRules(ls(e),r)},t.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.prototype.clearRules=function(e){this.getTag().clearGroup(ls(e)),this.clearNames(e)},t.prototype.clearTag=function(){this.tag=void 0},t}(),cO=/&/g,lO=/^\s*\/\/.*$/gm;function eg(t,e){return t.map(function(n){return n.type==="rule"&&(n.value="".concat(e," ").concat(n.value),n.value=n.value.replaceAll(",",",".concat(e," ")),n.props=n.props.map(function(r){return"".concat(e," ").concat(r)})),Array.isArray(n.children)&&n.type!=="@keyframes"&&(n.children=eg(n.children,e)),n})}function fO(t){var e,n,r,i=t===void 0?uo:t,o=i.options,a=o===void 0?uo:o,u=i.plugins,s=u===void 0?Ju:u,c=function(f,h,v){return v===n||v.startsWith(n)&&v.endsWith(n)&&v.replaceAll(n,"").length>0?".".concat(e):f},l=s.slice();l.push(function(f){f.type===Hu&&f.value.includes("&")&&(f.props[0]=f.props[0].replace(cO,n).replace(r,c))}),a.prefix&&l.push(M1),l.push(O1);var d=function(f,h,v,p){h===void 0&&(h=""),v===void 0&&(v=""),p===void 0&&(p="&"),e=p,n=h,r=new RegExp("\\".concat(n,"\\b"),"g");var S=f.replace(lO,""),C=$1(v||h?"".concat(v," ").concat(h," { ").concat(S," }"):S);a.namespace&&(C=eg(C,a.namespace));var w=[];return Xs(C,N1(l.concat(P1(function(T){return w.push(T)})))),w};return d.hash=s.length?s.reduce(function(f,h){return h.name||Oo(15),li(f,h.name)},5381).toString():"",d}var dO=new tg,jl=fO(),ng=R.createContext({shouldForwardProp:void 0,styleSheet:dO,stylis:jl});ng.Consumer;R.createContext(void 0);function Nh(){return R.useContext(ng)}var Ph=function(){function t(e,n){var r=this;this.inject=function(i,o){o===void 0&&(o=jl);var a=r.name+o.hash;i.hasNameForId(r.id,a)||i.insertRules(r.id,a,o(r.rules,a,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=n,Kf(this,function(){throw Oo(12,String(r.name))})}return t.prototype.getName=function(e){return e===void 0&&(e=jl),this.name+e.hash},t}(),hO=function(t){return t>="A"&&t<="Z"};function Mh(t){for(var e="",n=0;n<t.length;n++){var r=t[n];if(n===1&&r==="-"&&t[0]==="-")return t;hO(r)?e+="-"+r.toLowerCase():e+=r}return e.startsWith("ms-")?"-"+e:e}var rg=function(t){return t==null||t===!1||t===""},ig=function(t){var e,n,r=[];for(var i in t){var o=t[i];t.hasOwnProperty(i)&&!rg(o)&&(Array.isArray(o)&&o.isCss||co(o)?r.push("".concat(Mh(i),":"),o,";"):lo(o)?r.push.apply(r,oo(oo(["".concat(i," {")],ig(o),!1),["}"],!1)):r.push("".concat(Mh(i),": ").concat((e=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||e in R1||e.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function pi(t,e,n,r){if(rg(t))return[];if(Wf(t))return[".".concat(t.styledComponentId)];if(co(t)){if(!co(o=t)||o.prototype&&o.prototype.isReactComponent||!e)return[t];var i=t(e);return process.env.NODE_ENV==="production"||typeof i!="object"||Array.isArray(i)||i instanceof Ph||lo(i)||i===null||console.error("".concat(Km(t)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),pi(i,e,n,r)}var o;return t instanceof Ph?n?(t.inject(n,r),[t.getName(r)]):[t]:lo(t)?ig(t):Array.isArray(t)?Array.prototype.concat.apply(Ju,t.map(function(a){return pi(a,e,n,r)})):[t.toString()]}function pO(t){for(var e=0;e<t.length;e+=1){var n=t[e];if(co(n)&&!Wf(n))return!1}return!0}var vO=Wm("6.1.1"),yO=function(){function t(e,n,r){this.rules=e,this.staticRulesId="",this.isStatic=process.env.NODE_ENV==="production"&&(r===void 0||r.isStatic)&&pO(e),this.componentId=n,this.baseHash=li(vO,n),this.baseStyle=r,tg.registerId(n)}return t.prototype.generateAndInjectStyles=function(e,n,r){var i=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,n,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&n.hasNameForId(this.componentId,this.staticRulesId))i=fi(i,this.staticRulesId);else{var o=Dh(pi(this.rules,e,n,r)),a=Rl(li(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,a)){var u=r(o,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,u)}i=fi(i,a),this.staticRulesId=a}else{for(var s=li(this.baseHash,r.hash),c="",l=0;l<this.rules.length;l++){var d=this.rules[l];if(typeof d=="string")c+=d,process.env.NODE_ENV!=="production"&&(s=li(s,d));else if(d){var f=Dh(pi(d,e,n,r));s=li(s,f+l),c+=f}}if(c){var h=Rl(s>>>0);n.hasNameForId(this.componentId,h)||n.insertRules(this.componentId,h,r(c,".".concat(h),void 0,this.componentId)),i=fi(i,h)}}return i},t}(),og=R.createContext(void 0);og.Consumer;var _c={},Rh=new Set;function mO(t,e,n){var r=Wf(t),i=t,o=!Rc(t),a=e.attrs,u=a===void 0?Ju:a,s=e.componentId,c=s===void 0?function(I,x){var b=typeof I!="string"?"sc":Ih(I);_c[b]=(_c[b]||0)+1;var E="".concat(b,"-").concat(V1("6.1.1"+b+_c[b]));return x?"".concat(x,"-").concat(E):E}(e.displayName,e.parentComponentId):s,l=e.displayName,d=l===void 0?function(I){return Rc(I)?"styled.".concat(I):"Styled(".concat(Km(I),")")}(t):l,f=e.displayName&&e.componentId?"".concat(Ih(e.displayName),"-").concat(e.componentId):e.componentId||c,h=r&&i.attrs?i.attrs.concat(u).filter(Boolean):u,v=e.shouldForwardProp;if(r&&i.shouldForwardProp){var p=i.shouldForwardProp;if(e.shouldForwardProp){var S=e.shouldForwardProp;v=function(I,x){return p(I,x)&&S(I,x)}}else v=p}var C=new yO(n,f,r?i.componentStyle:void 0);function w(I,x){return function(b,E,P){var A=b.attrs,U=b.componentStyle,M=b.defaultProps,$=b.foldedComponentIds,z=b.styledComponentId,Z=b.target,Vt=R.useContext(og),bt=Nh(),J=b.shouldForwardProp||bt.shouldForwardProp;process.env.NODE_ENV!=="production"&&R.useDebugValue(z);var Y=function(Ot,Zt,Un){for(var Bn,Tn=rn(rn({},Zt),{className:void 0,theme:Un}),ei=0;ei<Ot.length;ei+=1){var br=co(Bn=Ot[ei])?Bn(Tn):Bn;for(var yn in br)Tn[yn]=yn==="className"?fi(Tn[yn],br[yn]):yn==="style"?rn(rn({},Tn[yn]),br[yn]):br[yn]}return Zt.className&&(Tn.className=fi(Tn.className,Zt.className)),Tn}(A,E,q1(E,Vt,M)||uo),ut=Y.as||Z,$e={};for(var tt in Y)Y[tt]===void 0||tt[0]==="$"||tt==="as"||tt==="theme"||(tt==="forwardedAs"?$e.as=Y.forwardedAs:J&&!J(tt,ut)||($e[tt]=Y[tt],J||process.env.NODE_ENV!=="development"||p1(tt)||Rh.has(tt)||!Ml.has(ut)||(Rh.add(tt),console.warn('styled-components: it looks like an unknown prop "'.concat(tt,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var De=function(Ot,Zt){var Un=Nh(),Bn=Ot.generateAndInjectStyles(Zt,Un.styleSheet,Un.stylis);return process.env.NODE_ENV!=="production"&&R.useDebugValue(Bn),Bn}(U,Y);process.env.NODE_ENV!=="production"&&b.warnTooManyClasses&&b.warnTooManyClasses(De);var an=fi($,z);return De&&(an+=" "+De),Y.className&&(an+=" "+Y.className),$e[Rc(ut)&&!Ml.has(ut)?"class":"className"]=an,$e.ref=P,R.createElement(ut,$e)}(T,I,x)}w.displayName=d;var T=R.forwardRef(w);return T.attrs=h,T.componentStyle=C,T.displayName=d,T.shouldForwardProp=v,T.foldedComponentIds=r?fi(i.foldedComponentIds,i.styledComponentId):"",T.styledComponentId=f,T.target=r?i.target:t,Object.defineProperty(T,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(I){this._foldedDefaultProps=r?function(x){for(var b=[],E=1;E<arguments.length;E++)b[E-1]=arguments[E];for(var P=0,A=b;P<A.length;P++)_l(x,A[P],!0);return x}({},i.defaultProps,I):I}}),process.env.NODE_ENV!=="production"&&(j1(d,f),T.warnTooManyClasses=function(I,x){var b={},E=!1;return function(P){if(!E&&(b[P]=!0,Object.keys(b).length>=200)){var A=x?' with the id of "'.concat(x,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(I).concat(A,`.
177
177
  `)+`Consider using the attrs method, together with a style object for frequently changed styles.
178
178
  Example:
179
179
  const Component = styled.div.attrs(props => ({
@@ -182,30 +182,32 @@ Example:
182
182
  },
183
183
  }))\`width: 100%;\`
184
184
 
185
- <Component />`),E=!0,b={}}}}(d,f)),Kf(T,function(){return".".concat(T.styledComponentId)}),o&&Zm(T,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),T}function _h(t,e){for(var n=[t[0]],r=0,i=e.length;r<i;r+=1)n.push(e[r],t[r+1]);return n}var jh=function(t){return Object.assign(t,{isCss:!0})};function mO(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(co(t)||lo(t)){var r=t;return jh(pi(_h(Yu,oo([r],e,!0))))}var i=t;return e.length===0&&i.length===1&&typeof i[0]=="string"?pi(i):jh(pi(_h(i,e)))}function ql(t,e,n){if(n===void 0&&(n=uo),!e)throw Oo(1,e);var r=function(i){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return t(e,n,mO.apply(void 0,oo([i],o,!1)))};return r.attrs=function(i){return ql(t,e,rn(rn({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return ql(t,e,rn(rn({},n),i))},r}var ag=function(t){return ql(yO,t)},No=ag;Ml.forEach(function(t){No[t]=ag(t)});process.env.NODE_ENV!=="production"&&typeof navigator<"u"&&navigator.product==="ReactNative"&&console.warn(`It looks like you've imported 'styled-components' on React Native.
185
+ <Component />`),E=!0,b={}}}}(d,f)),Kf(T,function(){return".".concat(T.styledComponentId)}),o&&Zm(T,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),T}function _h(t,e){for(var n=[t[0]],r=0,i=e.length;r<i;r+=1)n.push(e[r],t[r+1]);return n}var jh=function(t){return Object.assign(t,{isCss:!0})};function gO(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(co(t)||lo(t)){var r=t;return jh(pi(_h(Ju,oo([r],e,!0))))}var i=t;return e.length===0&&i.length===1&&typeof i[0]=="string"?pi(i):jh(pi(_h(i,e)))}function ql(t,e,n){if(n===void 0&&(n=uo),!e)throw Oo(1,e);var r=function(i){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return t(e,n,gO.apply(void 0,oo([i],o,!1)))};return r.attrs=function(i){return ql(t,e,rn(rn({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return ql(t,e,rn(rn({},n),i))},r}var ag=function(t){return ql(mO,t)},No=ag;Ml.forEach(function(t){No[t]=ag(t)});process.env.NODE_ENV!=="production"&&typeof navigator<"u"&&navigator.product==="ReactNative"&&console.warn(`It looks like you've imported 'styled-components' on React Native.
186
186
  Perhaps you're looking to import 'styled-components/native'?
187
187
  Read more about this at https://www.styled-components.com/docs/basics#react-native`);var fs="__sc-".concat(Ei,"__");process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&typeof window<"u"&&(window[fs]||(window[fs]=0),window[fs]===1&&console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.
188
188
 
189
- See https://s-c.sh/2BAXzed for more info.`),window[fs]+=1);const gO=R.createContext(null),jc={didCatch:!1,error:null};class Xu extends R.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=jc}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var n,r,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:o,reason:"imperative-api"}),this.setState(jc)}}componentDidCatch(e,n){var r,i;(r=(i=this.props).onError)===null||r===void 0||r.call(i,e,n)}componentDidUpdate(e,n){const{didCatch:r}=this.state,{resetKeys:i}=this.props;if(r&&n.error!==null&&bO(e.resetKeys,i)){var o,a;(o=(a=this.props).onReset)===null||o===void 0||o.call(a,{next:i,prev:e.resetKeys,reason:"keys"}),this.setState(jc)}}render(){const{children:e,fallbackRender:n,FallbackComponent:r,fallback:i}=this.props,{didCatch:o,error:a}=this.state;let u=e;if(o){const s={error:a,resetErrorBoundary:this.resetErrorBoundary};if(R.isValidElement(i))u=i;else if(typeof n=="function")u=n(s);else if(r)u=R.createElement(r,s);else throw a}return R.createElement(gO.Provider,{value:{didCatch:o,error:a,resetErrorBoundary:this.resetErrorBoundary}},u)}}function bO(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((n,r)=>!Object.is(n,e[r]))}function Li(){}function SO(){return!0}function Lo(t){return!!(t||"").match(/\d/)}function qh(t){return t==null}function kh(t){return t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function CO(t){switch(t){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function wO(t,e,n){var r=CO(n),i=t.search(/[1-9]/);return i=i===-1?t.length:i,t.substring(0,i)+t.substring(i,t.length).replace(r,"$1"+e)}function kl(t,e){e===void 0&&(e=!0);var n=t[0]==="-",r=n&&e;t=t.replace("-","");var i=t.split("."),o=i[0],a=i[1]||"";return{beforeDecimal:o,afterDecimal:a,hasNagation:n,addNegation:r}}function TO(t){if(!t)return t;var e=t[0]==="-";e&&(t=t.substring(1,t.length));var n=t.split("."),r=n[0].replace(/^0+/,"")||"0",i=n[1]||"";return(e?"-":"")+r+(i?"."+i:"")}function sg(t,e,n){for(var r="",i=n?"0":"",o=0;o<=e-1;o++)r+=t[o]||i;return r}function Uh(t,e){return Array(e+1).join(t)}function IO(t){t+="";var e=t[0]==="-"?"-":"";e&&(t=t.substring(1));var n=t.split(/[eE]/g),r=n[0],i=n[1];if(i=Number(i),!i)return e+r;r=r.replace(".","");var o=1+i,a=r.length;return o<0?r="0."+Uh("0",Math.abs(o))+r:o>=a?r=r+Uh("0",o-a):r=(r.substring(0,o)||"0")+"."+r.substring(o),e+r}function EO(t,e,n){if(["","-"].indexOf(t)!==-1)return t;var r=t.indexOf(".")!==-1&&e,i=kl(t),o=i.beforeDecimal,a=i.afterDecimal,u=i.hasNagation,s=parseFloat("0."+(a||"0")),c=a.length<=e?"0."+a:s.toFixed(e),l=c.split("."),d=o.split("").reverse().reduce(function(p,S,C){return p.length>C?(Number(p[0])+Number(S)).toString()+p.substring(1,p.length):S+p},l[0]),f=sg(l[1]||"",Math.min(e,a.length),n),h=u?"-":"",v=r?".":"";return""+h+d+v+f}function Bh(t,e){if(t.value=t.value,t!==null){if(t.createTextRange){var n=t.createTextRange();return n.move("character",e),n.select(),!0}return t.selectionStart||t.selectionStart===0?(t.focus(),t.setSelectionRange(e,e),!0):(t.focus(),!1)}}function xO(t,e){for(var n=0,r=0,i=t.length,o=e.length;t[n]===e[n]&&n<i;)n++;for(;t[i-1-r]===e[o-1-r]&&o-r>n&&i-r>n;)r++;return{start:n,end:i-r}}function qc(t,e,n){return Math.min(Math.max(t,e),n)}function Vh(t){return Math.max(t.selectionStart,t.selectionEnd)}function AO(t){return t||typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function $O(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)===-1&&(n[r]=t[r]);return n}var DO={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:Li,onChange:Li,onKeyDown:Li,onMouseUp:Li,onFocus:Li,onBlur:Li,isAllowed:SO},ug=function(t){function e(n){t.call(this,n);var r=n.defaultValue;this.validateProps();var i=this.formatValueProp(r);this.state={value:i,numAsString:this.removeFormatting(i),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.componentDidMount=function(){this.setState({mounted:!0})},e.prototype.componentDidUpdate=function(r){this.updateValueIfRequired(r)},e.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},e.prototype.updateValueIfRequired=function(r){var i=this,o=i.props,a=i.state,u=i.focusedElm,s=a.value,c=a.numAsString;if(c===void 0&&(c=""),r!==o){this.validateProps();var l=this.formatNumString(c),d=qh(o.value)?l:this.formatValueProp(),f=this.removeFormatting(d),h=parseFloat(f),v=parseFloat(c);((!isNaN(h)||!isNaN(v))&&h!==v||l!==s||u===null&&d!==s)&&this.updateValue({formattedValue:d,numAsString:f,input:u,source:"prop",event:null})}},e.prototype.getFloatString=function(r){r===void 0&&(r="");var i=this.props,o=i.decimalScale,a=this.getSeparators(),u=a.decimalSeparator,s=this.getNumberRegex(!0),c=r[0]==="-";c&&(r=r.replace("-","")),u&&o===0&&(r=r.split(u)[0]),r=(r.match(s)||[]).join("").replace(u,".");var l=r.indexOf(".");return l!==-1&&(r=r.substring(0,l)+"."+r.substring(l+1,r.length).replace(new RegExp(kh(u),"g"),"")),c&&(r="-"+r),r},e.prototype.getNumberRegex=function(r,i){var o=this.props,a=o.format,u=o.decimalScale,s=o.customNumerals,c=this.getSeparators(),l=c.decimalSeparator;return new RegExp("[0-9"+(s?s.join(""):"")+"]"+(l&&u!==0&&!i&&!a?"|"+kh(l):""),r?"g":void 0)},e.prototype.getSeparators=function(){var r=this.props,i=r.decimalSeparator,o=this.props,a=o.thousandSeparator,u=o.allowedDecimalSeparators;return a===!0&&(a=","),u||(u=[i,"."]),{decimalSeparator:i,thousandSeparator:a,allowedDecimalSeparators:u}},e.prototype.getMaskAtIndex=function(r){var i=this.props,o=i.mask;return o===void 0&&(o=" "),typeof o=="string"?o:o[r]||" "},e.prototype.getValueObject=function(r,i){var o=parseFloat(i);return{formattedValue:r,value:i,floatValue:isNaN(o)?void 0:o}},e.prototype.validateProps=function(){var r=this.props,i=r.mask,o=this.getSeparators(),a=o.decimalSeparator,u=o.thousandSeparator;if(a===u)throw new Error(`
189
+ See https://s-c.sh/2BAXzed for more info.`),window[fs]+=1);function sg(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=sg(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function bO(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=sg(t))&&(r&&(r+=" "),r+=e);return r}const SO=R.createContext(null),jc={didCatch:!1,error:null};class Xu extends R.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=jc}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var n,r,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:o,reason:"imperative-api"}),this.setState(jc)}}componentDidCatch(e,n){var r,i;(r=(i=this.props).onError)===null||r===void 0||r.call(i,e,n)}componentDidUpdate(e,n){const{didCatch:r}=this.state,{resetKeys:i}=this.props;if(r&&n.error!==null&&CO(e.resetKeys,i)){var o,a;(o=(a=this.props).onReset)===null||o===void 0||o.call(a,{next:i,prev:e.resetKeys,reason:"keys"}),this.setState(jc)}}render(){const{children:e,fallbackRender:n,FallbackComponent:r,fallback:i}=this.props,{didCatch:o,error:a}=this.state;let u=e;if(o){const s={error:a,resetErrorBoundary:this.resetErrorBoundary};if(R.isValidElement(i))u=i;else if(typeof n=="function")u=n(s);else if(r)u=R.createElement(r,s);else throw a}return R.createElement(SO.Provider,{value:{didCatch:o,error:a,resetErrorBoundary:this.resetErrorBoundary}},u)}}function CO(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((n,r)=>!Object.is(n,e[r]))}function Li(){}function wO(){return!0}function Lo(t){return!!(t||"").match(/\d/)}function qh(t){return t==null}function kh(t){return t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function TO(t){switch(t){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function IO(t,e,n){var r=TO(n),i=t.search(/[1-9]/);return i=i===-1?t.length:i,t.substring(0,i)+t.substring(i,t.length).replace(r,"$1"+e)}function kl(t,e){e===void 0&&(e=!0);var n=t[0]==="-",r=n&&e;t=t.replace("-","");var i=t.split("."),o=i[0],a=i[1]||"";return{beforeDecimal:o,afterDecimal:a,hasNagation:n,addNegation:r}}function EO(t){if(!t)return t;var e=t[0]==="-";e&&(t=t.substring(1,t.length));var n=t.split("."),r=n[0].replace(/^0+/,"")||"0",i=n[1]||"";return(e?"-":"")+r+(i?"."+i:"")}function ug(t,e,n){for(var r="",i=n?"0":"",o=0;o<=e-1;o++)r+=t[o]||i;return r}function Uh(t,e){return Array(e+1).join(t)}function xO(t){t+="";var e=t[0]==="-"?"-":"";e&&(t=t.substring(1));var n=t.split(/[eE]/g),r=n[0],i=n[1];if(i=Number(i),!i)return e+r;r=r.replace(".","");var o=1+i,a=r.length;return o<0?r="0."+Uh("0",Math.abs(o))+r:o>=a?r=r+Uh("0",o-a):r=(r.substring(0,o)||"0")+"."+r.substring(o),e+r}function AO(t,e,n){if(["","-"].indexOf(t)!==-1)return t;var r=t.indexOf(".")!==-1&&e,i=kl(t),o=i.beforeDecimal,a=i.afterDecimal,u=i.hasNagation,s=parseFloat("0."+(a||"0")),c=a.length<=e?"0."+a:s.toFixed(e),l=c.split("."),d=o.split("").reverse().reduce(function(p,S,C){return p.length>C?(Number(p[0])+Number(S)).toString()+p.substring(1,p.length):S+p},l[0]),f=ug(l[1]||"",Math.min(e,a.length),n),h=u?"-":"",v=r?".":"";return""+h+d+v+f}function Bh(t,e){if(t.value=t.value,t!==null){if(t.createTextRange){var n=t.createTextRange();return n.move("character",e),n.select(),!0}return t.selectionStart||t.selectionStart===0?(t.focus(),t.setSelectionRange(e,e),!0):(t.focus(),!1)}}function $O(t,e){for(var n=0,r=0,i=t.length,o=e.length;t[n]===e[n]&&n<i;)n++;for(;t[i-1-r]===e[o-1-r]&&o-r>n&&i-r>n;)r++;return{start:n,end:i-r}}function qc(t,e,n){return Math.min(Math.max(t,e),n)}function Vh(t){return Math.max(t.selectionStart,t.selectionEnd)}function DO(t){return t||typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function OO(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)===-1&&(n[r]=t[r]);return n}var NO={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:Li,onChange:Li,onKeyDown:Li,onMouseUp:Li,onFocus:Li,onBlur:Li,isAllowed:wO},cg=function(t){function e(n){t.call(this,n);var r=n.defaultValue;this.validateProps();var i=this.formatValueProp(r);this.state={value:i,numAsString:this.removeFormatting(i),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.componentDidMount=function(){this.setState({mounted:!0})},e.prototype.componentDidUpdate=function(r){this.updateValueIfRequired(r)},e.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},e.prototype.updateValueIfRequired=function(r){var i=this,o=i.props,a=i.state,u=i.focusedElm,s=a.value,c=a.numAsString;if(c===void 0&&(c=""),r!==o){this.validateProps();var l=this.formatNumString(c),d=qh(o.value)?l:this.formatValueProp(),f=this.removeFormatting(d),h=parseFloat(f),v=parseFloat(c);((!isNaN(h)||!isNaN(v))&&h!==v||l!==s||u===null&&d!==s)&&this.updateValue({formattedValue:d,numAsString:f,input:u,source:"prop",event:null})}},e.prototype.getFloatString=function(r){r===void 0&&(r="");var i=this.props,o=i.decimalScale,a=this.getSeparators(),u=a.decimalSeparator,s=this.getNumberRegex(!0),c=r[0]==="-";c&&(r=r.replace("-","")),u&&o===0&&(r=r.split(u)[0]),r=(r.match(s)||[]).join("").replace(u,".");var l=r.indexOf(".");return l!==-1&&(r=r.substring(0,l)+"."+r.substring(l+1,r.length).replace(new RegExp(kh(u),"g"),"")),c&&(r="-"+r),r},e.prototype.getNumberRegex=function(r,i){var o=this.props,a=o.format,u=o.decimalScale,s=o.customNumerals,c=this.getSeparators(),l=c.decimalSeparator;return new RegExp("[0-9"+(s?s.join(""):"")+"]"+(l&&u!==0&&!i&&!a?"|"+kh(l):""),r?"g":void 0)},e.prototype.getSeparators=function(){var r=this.props,i=r.decimalSeparator,o=this.props,a=o.thousandSeparator,u=o.allowedDecimalSeparators;return a===!0&&(a=","),u||(u=[i,"."]),{decimalSeparator:i,thousandSeparator:a,allowedDecimalSeparators:u}},e.prototype.getMaskAtIndex=function(r){var i=this.props,o=i.mask;return o===void 0&&(o=" "),typeof o=="string"?o:o[r]||" "},e.prototype.getValueObject=function(r,i){var o=parseFloat(i);return{formattedValue:r,value:i,floatValue:isNaN(o)?void 0:o}},e.prototype.validateProps=function(){var r=this.props,i=r.mask,o=this.getSeparators(),a=o.decimalSeparator,u=o.thousandSeparator;if(a===u)throw new Error(`
190
190
  Decimal separator can't be same as thousand separator.
191
191
  thousandSeparator: `+u+` (thousandSeparator = {true} is same as thousandSeparator = ",")
192
192
  decimalSeparator: `+a+` (default value for decimalSeparator is .)
193
193
  `);if(i){var s=i==="string"?i:i.toString();if(s.match(/\d/g))throw new Error(`
194
194
  Mask `+i+` should not contain numeric character;
195
- `)}},e.prototype.setPatchedCaretPosition=function(r,i,o){Bh(r,i),this.caretPositionTimeout=setTimeout(function(){r.value===o&&Bh(r,i)},0)},e.prototype.correctCaretPosition=function(r,i,o){var a=this.props,u=a.prefix,s=a.suffix,c=a.format;if(r==="")return 0;if(i=qc(i,0,r.length),!c){var l=r[0]==="-";return qc(i,u.length+(l?1:0),r.length-s.length)}if(typeof c=="function"||c[i]==="#"&&Lo(r[i])||c[i-1]==="#"&&Lo(r[i-1]))return i;var d=c.indexOf("#"),f=c.lastIndexOf("#");i=qc(i,d,f+1);for(var h=c.substring(i,c.length).indexOf("#"),v=i,p=i+(h===-1?0:h);v>d&&(c[v]!=="#"||!Lo(r[v]));)v-=1;var S=!Lo(r[p])||o==="left"&&i!==d||i-v<p-i;return S?Lo(r[v])?v+1:v:p},e.prototype.getCaretPosition=function(r,i,o){var a=this.props,u=a.format,s=this.state.value,c=this.getNumberRegex(!0),l=(r.match(c)||[]).join(""),d=(i.match(c)||[]).join(""),f,h;for(f=0,h=0;h<o;h++){var v=r[h]||"",p=i[f]||"";if(!(!v.match(c)&&v!==p)&&!(v==="0"&&p.match(c)&&p!=="0"&&l.length!==d.length)){for(;v!==i[f]&&f<i.length;)f++;f++}}return typeof u=="string"&&!s&&(f=i.length),f=this.correctCaretPosition(i,f),f},e.prototype.removePrefixAndSuffix=function(r){var i=this.props,o=i.format,a=i.prefix,u=i.suffix;if(!o&&r){var s=r[0]==="-";s&&(r=r.substring(1,r.length)),r=a&&r.indexOf(a)===0?r.substring(a.length,r.length):r;var c=r.lastIndexOf(u);r=u&&c!==-1&&c===r.length-u.length?r.substring(0,c):r,s&&(r="-"+r)}return r},e.prototype.removePatternFormatting=function(r){for(var i=this.props,o=i.format,a=o.split("#").filter(function(h){return h!==""}),u=0,s="",c=0,l=a.length;c<=l;c++){var d=a[c]||"",f=c===l?r.length:r.indexOf(d,u);if(f===-1){s=r;break}else s+=r.substring(u,f),u=f+d.length}return(s.match(this.getNumberRegex(!0))||[]).join("")},e.prototype.removeFormatting=function(r){var i=this.props,o=i.format,a=i.removeFormatting;return r&&(o?typeof o=="string"?r=this.removePatternFormatting(r):typeof a=="function"?r=a(r):r=(r.match(this.getNumberRegex(!0))||[]).join(""):(r=this.removePrefixAndSuffix(r),r=this.getFloatString(r)),r)},e.prototype.formatWithPattern=function(r){for(var i=this.props,o=i.format,a=0,u=o.split(""),s=0,c=o.length;s<c;s++)o[s]==="#"&&(u[s]=r[a]||this.getMaskAtIndex(a),a+=1);return u.join("")},e.prototype.formatAsNumber=function(r){var i=this.props,o=i.decimalScale,a=i.fixedDecimalScale,u=i.prefix,s=i.suffix,c=i.allowNegative,l=i.thousandsGroupStyle,d=this.getSeparators(),f=d.thousandSeparator,h=d.decimalSeparator,v=r.indexOf(".")!==-1||o&&a,p=kl(r,c),S=p.beforeDecimal,C=p.afterDecimal,w=p.addNegation;return o!==void 0&&(C=sg(C,o,a)),f&&(S=wO(S,f,l)),u&&(S=u+S),s&&(C=C+s),w&&(S="-"+S),r=S+(v&&h||"")+C,r},e.prototype.formatNumString=function(r){r===void 0&&(r="");var i=this.props,o=i.format,a=i.allowEmptyFormatting,u=i.customNumerals,s=r;if(u&&u.length===10){var c=new RegExp("["+u.join("")+"]","g");s=r.replace(c,function(l){return u.indexOf(l).toString()})}return r===""&&!a?s="":r==="-"&&!o?s="-":typeof o=="string"?s=this.formatWithPattern(s):typeof o=="function"?s=o(s):s=this.formatAsNumber(s),s},e.prototype.formatValueProp=function(r){var i=this.props,o=i.format,a=i.decimalScale,u=i.fixedDecimalScale,s=i.allowEmptyFormatting,c=this.props,l=c.value,d=c.isNumericString;l=qh(l)?r:l;var f=!l&&l!==0;if(f&&s&&(l=""),f&&!s)return"";typeof l=="number"&&(l=IO(l),d=!0),l==="Infinity"&&d&&(l=""),d&&!o&&typeof a=="number"&&(l=EO(l,a,u));var h=d?this.formatNumString(l):this.formatInput(l);return h},e.prototype.formatNegation=function(r){r===void 0&&(r="");var i=this.props,o=i.allowNegative,a=new RegExp("(-)"),u=new RegExp("(-)(.)*(-)"),s=a.test(r),c=u.test(r);return r=r.replace(/-/g,""),s&&!c&&o&&(r="-"+r),r},e.prototype.formatInput=function(r){r===void 0&&(r="");var i=this.props,o=i.format;return o||(r=this.removePrefixAndSuffix(r),r=this.formatNegation(r)),r=this.removeFormatting(r),this.formatNumString(r)},e.prototype.isCharacterAFormat=function(r,i){var o=this.props,a=o.format,u=o.prefix,s=o.suffix,c=o.decimalScale,l=o.fixedDecimalScale,d=this.getSeparators(),f=d.decimalSeparator;return!!(typeof a=="string"&&a[r]!=="#"||!a&&(r<u.length||r>=i.length-s.length||c&&l&&i[r]===f))},e.prototype.correctInputValue=function(r,i,o){var a=this,u=this.props,s=u.format,c=u.allowNegative,l=u.prefix,d=u.suffix,f=u.decimalScale,h=this.getSeparators(),v=h.allowedDecimalSeparators,p=h.decimalSeparator,S=this.state.numAsString||"",C=this.selectionBeforeInput,w=C.selectionStart,T=C.selectionEnd,I=xO(i,o),x=I.start,b=I.end;if(!s&&x===b&&v.indexOf(o[w])!==-1){var E=f===0?"":p;return o.substr(0,w)+E+o.substr(w+1,o.length)}var P=s?0:l.length,A=i.length-(s?0:d.length);if(o.length>i.length||!o.length||x===b||w===0&&T===i.length||x===0&&b===i.length||w===P&&T===A)return o;var U=i.substr(x,b-x),M=!![].concat(U).find(function(tt,De){return a.isCharacterAFormat(De+x,i)});if(M){var $=i.substr(x),z={},Z=[];[].concat($).forEach(function(tt,De){a.isCharacterAFormat(De+x,i)?z[De]=tt:De>U.length-1&&Z.push(tt)}),Object.keys(z).forEach(function(tt){Z.length>tt?Z.splice(tt,0,z[tt]):Z.push(z[tt])}),o=i.substr(0,x)+Z.join("")}if(!s){var Vt=this.removeFormatting(o),bt=kl(Vt,c),Y=bt.beforeDecimal,J=bt.afterDecimal,ut=bt.addNegation,$e=r<o.indexOf(p)+1;if(Vt.length<S.length&&$e&&Y===""&&!parseFloat(J))return ut?"-":""}return o},e.prototype.updateValue=function(r){var i=r.formattedValue,o=r.input,a=r.setCaretPosition;a===void 0&&(a=!0);var u=r.source,s=r.event,c=r.numAsString,l=r.caretPos,d=this.props,f=d.onValueChange,h=this.state,v=h.value;if(o){if(l===void 0&&a){var p=r.inputValue||o.value,S=Vh(o);o.value=i,l=this.getCaretPosition(p,i,S)}o.value=i,a&&this.setPatchedCaretPosition(o,l,i)}c===void 0&&(c=this.removeFormatting(i)),i!==v&&(this.setState({value:i,numAsString:c}),f(this.getValueObject(i,c),{event:s,source:u}))},e.prototype.onChange=function(r){var i=r.target,o=i.value,a=this,u=a.state,s=a.props,c=s.isAllowed,l=u.value||"",d=Vh(i);o=this.correctInputValue(d,l,o);var f=this.formatInput(o)||"",h=this.removeFormatting(f),v=this.getValueObject(f,h),p=c(v);p||(f=l),this.updateValue({formattedValue:f,numAsString:h,inputValue:o,input:i,event:r,source:"event"}),p&&s.onChange(r)},e.prototype.onBlur=function(r){var i=this,o=i.props,a=i.state,u=o.format,s=o.onBlur,c=o.allowLeadingZeros,l=a.numAsString,d=a.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!u){isNaN(parseFloat(l))&&(l=""),c||(l=TO(l));var f=this.formatNumString(l);if(f!==d){this.updateValue({formattedValue:f,numAsString:l,input:r.target,setCaretPosition:!1,event:r,source:"event"}),s(r);return}}s(r)},e.prototype.onKeyDown=function(r){var i=r.target,o=r.key,a=i.selectionStart,u=i.selectionEnd,s=i.value;s===void 0&&(s="");var c,l=this.props,d=l.decimalScale,f=l.fixedDecimalScale,h=l.prefix,v=l.suffix,p=l.format,S=l.onKeyDown,C=d!==void 0&&f,w=this.getNumberRegex(!1,C),T=new RegExp("-"),I=typeof p=="string";if(this.selectionBeforeInput={selectionStart:a,selectionEnd:u},o==="ArrowLeft"||o==="Backspace"?c=a-1:o==="ArrowRight"?c=a+1:o==="Delete"&&(c=a),c===void 0||a!==u){S(r);return}var x=c,b=I?p.indexOf("#"):h.length,E=I?p.lastIndexOf("#")+1:s.length-v.length;if(o==="ArrowLeft"||o==="ArrowRight"){var P=o==="ArrowLeft"?"left":"right";x=this.correctCaretPosition(s,c,P)}else if(o==="Delete"&&!w.test(s[c])&&!T.test(s[c]))for(;!w.test(s[x])&&x<E;)x++;else if(o==="Backspace"&&!w.test(s[c])){if(a<=b+1&&s[0]==="-"&&typeof p>"u"){var A=s.substring(1);this.updateValue({formattedValue:A,caretPos:x,input:i,event:r,source:"event"})}else if(!T.test(s[c])){for(;!w.test(s[x-1])&&x>b;)x--;x=this.correctCaretPosition(s,x,"left")}}(x!==c||c<b||c>E)&&(r.preventDefault(),this.setPatchedCaretPosition(i,x,s)),r.isUnitTestRun&&this.setPatchedCaretPosition(i,x,s),S(r)},e.prototype.onMouseUp=function(r){var i=r.target,o=i.selectionStart,a=i.selectionEnd,u=i.value;if(u===void 0&&(u=""),o===a){var s=this.correctCaretPosition(u,o);s!==o&&this.setPatchedCaretPosition(i,s,u)}this.props.onMouseUp(r)},e.prototype.onFocus=function(r){var i=this;r.persist(),this.focusedElm=r.target,this.focusTimeout=setTimeout(function(){var o=r.target,a=o.selectionStart,u=o.selectionEnd,s=o.value;s===void 0&&(s="");var c=i.correctCaretPosition(s,a);c!==a&&!(a===0&&u===s.length)&&i.setPatchedCaretPosition(o,c,s),i.props.onFocus(r)},0)},e.prototype.render=function(){var r=this.props,i=r.type,o=r.displayType,a=r.customInput,u=r.renderText,s=r.getInputRef,c=r.format;r.thousandSeparator,r.decimalSeparator,r.allowedDecimalSeparators,r.thousandsGroupStyle,r.decimalScale,r.fixedDecimalScale,r.prefix,r.suffix,r.removeFormatting,r.mask,r.defaultValue,r.isNumericString,r.allowNegative,r.allowEmptyFormatting,r.allowLeadingZeros,r.onValueChange,r.isAllowed,r.customNumerals,r.onChange,r.onKeyDown,r.onMouseUp,r.onFocus,r.onBlur,r.value;var l=$O(r,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"]),d=l,f=this.state,h=f.value,v=f.mounted,p=v&&AO(c)?"numeric":void 0,S=Object.assign({inputMode:p},d,{type:i,value:h,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if(o==="text")return u?u(h,d)||null:R.createElement("span",Object.assign({},d,{ref:s}),h);if(a){var C=a;return R.createElement(C,Object.assign({},S,{ref:s}))}return R.createElement("input",Object.assign({},S,{ref:s}))},e}(R.Component);ug.defaultProps=DO;function OO(t,e,n){var r=this,i=R.useRef(null),o=R.useRef(0),a=R.useRef(null),u=R.useRef([]),s=R.useRef(),c=R.useRef(),l=R.useRef(t),d=R.useRef(!0);R.useEffect(function(){l.current=t},[t]);var f=!e&&e!==0&&typeof window<"u";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var h=!!(n=n||{}).leading,v=!("trailing"in n)||!!n.trailing,p="maxWait"in n,S=p?Math.max(+n.maxWait||0,e):null;R.useEffect(function(){return d.current=!0,function(){d.current=!1}},[]);var C=R.useMemo(function(){var w=function(P){var A=u.current,U=s.current;return u.current=s.current=null,o.current=P,c.current=l.current.apply(U,A)},T=function(P,A){f&&cancelAnimationFrame(a.current),a.current=f?requestAnimationFrame(P):setTimeout(P,A)},I=function(P){if(!d.current)return!1;var A=P-i.current;return!i.current||A>=e||A<0||p&&P-o.current>=S},x=function(P){return a.current=null,v&&u.current?w(P):(u.current=s.current=null,c.current)},b=function P(){var A=Date.now();if(I(A))return x(A);if(d.current){var U=e-(A-i.current),M=p?Math.min(U,S-(A-o.current)):U;T(P,M)}},E=function(){var P=Date.now(),A=I(P);if(u.current=[].slice.call(arguments),s.current=r,i.current=P,A){if(!a.current&&d.current)return o.current=i.current,T(b,e),h?w(i.current):c.current;if(p)return T(b,e),w(i.current)}return a.current||T(b,e),c.current};return E.cancel=function(){a.current&&(f?cancelAnimationFrame(a.current):clearTimeout(a.current)),o.current=0,u.current=i.current=s.current=a.current=null},E.isPending=function(){return!!a.current},E.flush=function(){return a.current?x(Date.now()):c.current},E},[h,p,e,S,v,f]);return C}var NO=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},PO=function(t){return function(){return{concat:function(e,n){return function(r){return t.concat(e(r),n(r))}}}}},MO=function(t){var e=PO(t);return function(){return{concat:e().concat,empty:function(){return t.empty}}}};function Qr(t){return t}function Zu(t){return function(){return t}}var RO=Zu(null),cg=Zu(void 0),Pr=cg;function Wn(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function g(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return s(u(a(o(i(r(n(e(t))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var gr=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(i){return e.apply(void 0,NO([i],r,!1))}}},_O=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},jO=function(t){return t._tag==="None"},Jf=function(t){return t._tag==="Some"},Qu={_tag:"None"},tc=function(t){return{_tag:"Some",value:t}},qO=function(t){return t._tag==="Left"},ec=function(t){return{_tag:"Left",left:t}},nc=function(t){return{_tag:"Right",right:t}},kO=function(t){return[t]},UO=function(t){return t.length>0},BO=function(t){return t[0]},VO=function(t){return t.slice(1)},FO=[],LO={},GO=Object.prototype.hasOwnProperty,zO=function(t){return _O([t[0]],t.slice(1),!0)};function HO(t,e){return function(n){return function(r){return t.ap(t.map(r,function(i){return function(o){return e.ap(i,o)}}),n)}}}function WO(t){return function(e){return{concat:function(n,r){return t.ap(t.map(n,function(i){return function(o){return e.concat(i,o)}}),r)}}}}function lg(t,e,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,e===0?t.apply(null,i):lg(t,e-1,i)}}function KO(t){var e=t.length;switch(e){case 1:return function(n){var r;return r={},r[t[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[t[0]]=n,i[t[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[t[0]]=n,o[t[1]]=r,o[t[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[t[0]]=n,a[t[1]]=r,a[t[2]]=i,a[t[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return u={},u[t[0]]=n,u[t[1]]=r,u[t[2]]=i,u[t[3]]=o,u[t[4]]=a,u}}}}};default:return lg(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<e;o++)i[t[o]]=n[o];return i},e-1,[])}}function JO(t){return function(e){for(var n=Object.keys(e),r=n.length,i=KO(n),o=t.map(e[n[0]],i),a=1;a<r;a++)o=t.ap(o,e[n[a]]);return o}}function YO(t,e){return function(n){return function(r){return t.map(r,function(i){return e.map(i,n)})}}}function XO(t){var e=WO(t);return function(n){return{concat:e(n).concat,empty:t.of(n.empty)}}}function ZO(t){return function(e,n){return t.chain(e,function(r){return t.map(n(r),function(){return r})})}}function fg(t){return function(e){return function(n){return t.fromEither(jO(n)?ec(e()):nc(n.value))}}}function QO(t,e){return function(n,r){return function(i){return e.chain(i,function(o){return t.fromEither(n(o)?nc(o):ec(r(o)))})}}}var Po=function(t){return{equals:function(e,n){return e===n||t(e,n)}}},Zn=function(t){return Po(function(e,n){for(var r in t)if(!t[r].equals(e[r],n[r]))return!1;return!0})},tN={equals:function(t,e){return t===e}},eN=function(t){return function(e,n){return e===n||t.compare(e,n)>-1?e:n}};function nN(t,e){return t<e?-1:t>e?1:0}var rN={equals:tN.equals,compare:nN},iN=rN,oN=function(t){return{concat:eN(t)}},aN=oN,it=Qu,Tt=tc;function sN(t){return function(e){return t(e)?Tt(e):it}}var uN=function(t,e){return g(t,L(e))},cN=function(t,e){return g(t,fN(e))},lN="Option",Ga=function(t){return{equals:function(e,n){return e===n||(_n(e)?_n(n):_n(n)?!1:t.equals(e.value,n.value))}}},L=function(t){return function(e){return _n(e)?it:Tt(t(e.value))}},qr=Tt,fN=function(t){return function(e){return _n(e)||_n(t)?it:Tt(e.value(t.value))}},dN={URI:lN,map:uN,ap:cN,of:qr},dg=gr(2,function(t,e){return _n(t)?it:e(t.value)}),hN=gr(2,function(t,e){return _n(t)?e():t}),Fh=hN,pN=dg(Qr),Qe=function(t){return function(e){return _n(e)?it:t(e.value)?e:it}},ra=Jf,_n=function(t){return t._tag==="None"},vN=function(t,e){return function(n){return _n(n)?t():e(n.value)}},Vr=vN,hg=Vr,yN=function(t){return function(e){return _n(e)?t():e.value}},Wt=yN,Ul=pN,pt=function(t){return t==null?it:Tt(t)},Rr=Vr(RO,Qr),_e=Vr(cg,Qr),Nn=dg,mN=XO(dN),rc={equals:function(t,e){return t===e}};rc.equals;rc.equals;var gN=FO,bN=UO,SN=function(t,e){return t<0||t>=e.length},CN=function(t,e,n){if(n[t]===e)return n;var r=zO(n);return r[t]=e,r},wN=function(t){return function(e){if(e.length===1)return e;for(var n=[EN(e)],r=xN(e),i=function(s){n.every(function(c){return!t.equals(c,s)})&&n.push(s)},o=0,a=r;o<a.length;o++){var u=a[o];i(u)}return n}},TN=kO,IN=BO,EN=IN,xN=VO,Qs=function(t){return t.length===0},ic=bN,AN=function(t){return function(e){if(Qs(e))return mg;for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}},$N=SN,DN=function(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return tc(n);return Qu}};function Ge(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return tc(e[n]);return Qu}}var ON=function(t,e){return function(n){return $N(t,n)?Qu:tc(qN(t,e(n[t]),n))}};function pg(t){return function(e,n){if(n===void 0){var r=pg(t);return function(a){return r(e,a)}}for(var i=function(a){return t.equals(a,e)},o=0;o<n.length;o++)if(i(n[o]))return!0;return!1}}var Xi=function(t){var e=wN(t);return function(n){return ic(n)?e(n):n}},NN=function(t){return function(e){return Qs(e)?t:Qs(t)?e:e.concat(t)}},ht=NN;function vg(t){var e=pg(t);return function(n,r){if(r===void 0){var i=vg(t);return function(o){return i(o,n)}}return n.filter(function(o){return!e(o,r)})}}var PN=TN,MN=gr(2,function(t,e){return g(t,AN(function(n,r){return e(r,n)}))}),RN=MN(Qr),k=function(t){return function(e){return e.map(function(n){return t(n)})}},za=function(t){return function(e){return e.filter(t)}},_N=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Jf(i)&&n.push(i.value)}return n}},yg=function(t){return _N(function(e,n){return t(n)})},zn=yg(Qr),Bl=function(t,e){return jN(t,function(n,r,i){return e(r,i)})},jN=function(t,e){return function(n){for(var r=n.length,i=t,o=0;o<r;o++)i=e(o,i,n[o]);return i}},Yf=function(t){return Po(function(e,n){return e.length===n.length&&e.every(function(r,i){return t.equals(r,n[i])})})},qN=function(t,e,n){return ic(n)?CN(t,e,n):n},Lh=function(t){return t.slice()},Gh=function(t){return Qs(t)?mg:t.slice()},mg=gN,oe={equals:function(t,e){return t===e}};oe.equals;var Xf={equals:function(t,e){return t===e}};Xf.equals;var kN=function(t){return function(e){for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}};function oi(t){return Ge(t)}var Os=function(t){return function(e){return e.map(function(n){return t(n)})}},UN=gr(2,function(t,e){return g(t,kN(function(n,r){return e(r,n)}))}),BN=UN(Qr),VN=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Jf(i)&&n.push(i.value)}return n}},Cr=function(t){return VN(function(e,n){return t(n)})},FN=function(t){return function(e){return e.filter(t)}},Zf=ec,oc=nc,gg=function(t,e){return g(t,GN(e))},LN=function(t,e){return g(t,WN(e))},Qf="Either",GN=function(t){return function(e){return Fr(e)?e:oc(t(e.right))}},zN={URI:Qf,map:gg},HN=function(t){return function(e){return Fr(e)?e:Fr(t)?t:oc(e.right(t.right))}},WN=HN,KN={URI:Qf,map:gg,ap:LN},JN=function(t){return function(e){return Fr(e)?Zf(t(e.left)):e}},bg={URI:Qf,fromEither:Qr},YN=fg(bg),Fr=qO,XN=function(t,e){return function(n){return Fr(n)?t(n.left):e(n.right)}},ci=XN;bg.fromEither;var ZN=function(t){return Fr(t)?oc(t.left):Zf(t.right)};function QN(t){return Wn(oc,t.of)}function tP(t){return Wn(Zf,t.of)}function eP(t){return YO(t,zN)}function nP(t){return HO(t,KN)}function rP(t){return function(e,n){return t.chain(e,function(r){return Fr(r)?t.of(r):n(r.right)})}}function iP(t){return function(e,n){return t.map(e,JN(n))}}function oP(t){return function(e,n){return function(r){return t.map(r,ci(e,n))}}}function aP(t){return function(e){return function(n){return t.chain(n,function(r){return Fr(r)?e(r.left):t.of(r)})}}}function sP(t){return function(e){return t.map(e,ZN)}}var uP=function(t){return function(){return Promise.resolve().then(t)}};function cP(t){return function(e){return function(){return new Promise(function(n){setTimeout(function(){Promise.resolve().then(e).then(n)},t)})}}}var ac=function(t,e){return g(t,Sg(e))},td=function(t,e){return g(t,lP(e))},Sg=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},lP=function(t){return function(e){return function(){return Promise.all([Promise.resolve().then(e),Promise.resolve().then(t)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Ha=function(t){return function(){return Promise.resolve(t)}},ed=gr(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),Wa="Task",sc={URI:Wa,map:ac},nd={URI:Wa,of:Ha},fP={URI:Wa,map:ac,ap:td},rd={URI:Wa,map:ac,of:Ha,ap:td,chain:ed},dP=Qr,zh=ed,tu={URI:Wa,map:ac,of:Ha,ap:td,chain:ed,fromIO:uP,fromTask:dP},hP=globalThis&&globalThis.__awaiter||function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(l){try{c(r.next(l))}catch(d){a(d)}}function s(l){try{c(r.throw(l))}catch(d){a(d)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((r=r.apply(t,e||[])).next())})},pP=globalThis&&globalThis.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},ur=tP(nd),Mo=QN(nd),vP=Ha,yP=function(t){return Sg(YN(t))},eu=oP(sc),Hh=function(t,e){return function(){return hP(void 0,void 0,void 0,function(){var n;return pP(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t().then(nc)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,ec(e(n))];case 3:return[2]}})})}},Cg=aP(rd),Wh=sP(sc),wg=function(t,e){return g(t,ye(e))},Tg=function(t,e){return g(t,gP(e))},ye=eP(sc),mP=gr(2,iP(sc)),On=mP,gP=nP(fP),Ig=gr(2,rP(rd)),Zi=Mo,id="TaskEither",bP={URI:id,map:wg,ap:Tg,of:Zi},Eg={URI:id,map:wg,ap:Tg,chain:Ig},od={URI:id,fromEither:vP},SP=gr(2,ZO(Eg)),ad=fg(od);od.fromEither;var CP=QO(od,Eg),wP=Zi(LO),$n=Ig,TP=SP,IP=Object.getOwnPropertyNames,EP=Object.getOwnPropertySymbols,xP=Object.prototype.hasOwnProperty;function Kh(t,e){return function(n,r,i){return t(n,r,i)&&e(n,r,i)}}function ds(t){return function(e,n,r){if(!e||!n||typeof e!="object"||typeof n!="object")return t(e,n,r);var i=r.cache,o=i.get(e),a=i.get(n);if(o&&a)return o===n&&a===e;i.set(e,n),i.set(n,e);var u=t(e,n,r);return i.delete(e),i.delete(n),u}}function Jh(t){return IP(t).concat(EP(t))}var xg=Object.hasOwn||function(t,e){return xP.call(t,e)};function Ro(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var Ag="_owner",Yh=Object.getOwnPropertyDescriptor,Xh=Object.keys;function AP(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function $P(t,e){return Ro(t.getTime(),e.getTime())}function Zh(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,a,u;(a=i.next())&&!a.done;){for(var s=e.entries(),c=!1,l=0;(u=s.next())&&!u.done;){var d=a.value,f=d[0],h=d[1],v=u.value,p=v[0],S=v[1];!c&&!r[l]&&(c=n.equals(f,p,o,l,t,e,n)&&n.equals(h,S,f,p,t,e,n))&&(r[l]=!0),l++}if(!c)return!1;o++}return!0}function DP(t,e,n){var r=Xh(t),i=r.length;if(Xh(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===Ag&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!xg(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function Go(t,e,n){var r=Jh(t),i=r.length;if(Jh(e).length!==i)return!1;for(var o,a,u;i-- >0;)if(o=r[i],o===Ag&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!xg(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(a=Yh(t,o),u=Yh(e,o),(a||u)&&(!a||!u||a.configurable!==u.configurable||a.enumerable!==u.enumerable||a.writable!==u.writable)))return!1;return!0}function OP(t,e){return Ro(t.valueOf(),e.valueOf())}function NP(t,e){return t.source===e.source&&t.flags===e.flags}function Qh(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,a;(o=i.next())&&!o.done;){for(var u=e.values(),s=!1,c=0;(a=u.next())&&!a.done;)!s&&!r[c]&&(s=n.equals(o.value,a.value,o.value,a.value,t,e,n))&&(r[c]=!0),c++;if(!s)return!1}return!0}function PP(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var MP="[object Arguments]",RP="[object Boolean]",_P="[object Date]",jP="[object Map]",qP="[object Number]",kP="[object Object]",UP="[object RegExp]",BP="[object Set]",VP="[object String]",FP=Array.isArray,tp=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,ep=Object.assign,LP=Object.prototype.toString.call.bind(Object.prototype.toString);function GP(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,a=t.areRegExpsEqual,u=t.areSetsEqual,s=t.areTypedArraysEqual;return function(c,l,d){if(c===l)return!0;if(c==null||l==null||typeof c!="object"||typeof l!="object")return c!==c&&l!==l;var f=c.constructor;if(f!==l.constructor)return!1;if(f===Object)return i(c,l,d);if(FP(c))return e(c,l,d);if(tp!=null&&tp(c))return s(c,l,d);if(f===Date)return n(c,l,d);if(f===RegExp)return a(c,l,d);if(f===Map)return r(c,l,d);if(f===Set)return u(c,l,d);var h=LP(c);return h===_P?n(c,l,d):h===UP?a(c,l,d):h===jP?r(c,l,d):h===BP?u(c,l,d):h===kP?typeof c.then!="function"&&typeof l.then!="function"&&i(c,l,d):h===MP?i(c,l,d):h===RP||h===qP||h===VP?o(c,l,d):!1}}function zP(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Go:AP,areDatesEqual:$P,areMapsEqual:r?Kh(Zh,Go):Zh,areObjectsEqual:r?Go:DP,arePrimitiveWrappersEqual:OP,areRegExpsEqual:NP,areSetsEqual:r?Kh(Qh,Go):Qh,areTypedArraysEqual:r?Go:PP};if(n&&(i=ep({},i,n(i))),e){var o=ds(i.areArraysEqual),a=ds(i.areMapsEqual),u=ds(i.areObjectsEqual),s=ds(i.areSetsEqual);i=ep({},i,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:u,areSetsEqual:s})}return i}function HP(t){return function(e,n,r,i,o,a,u){return t(e,n,u)}}function WP(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(u,s){var c=r(),l=c.cache,d=l===void 0?e?new WeakMap:void 0:l,f=c.meta;return n(u,s,{cache:d,equals:i,meta:f,strict:o})};if(e)return function(u,s){return n(u,s,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var a={cache:void 0,equals:i,meta:void 0,strict:o};return function(u,s){return n(u,s,a)}}var KP=ti();ti({strict:!0});ti({circular:!0});ti({circular:!0,strict:!0});ti({createInternalComparator:function(){return Ro}});ti({strict:!0,createInternalComparator:function(){return Ro}});ti({circular:!0,createInternalComparator:function(){return Ro}});ti({circular:!0,createInternalComparator:function(){return Ro},strict:!0});function ti(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,a=o===void 0?!1:o,u=zP(t),s=GP(u),c=r?r(s):HP(s);return WP({circular:n,comparator:s,createState:i,equals:c,strict:a})}function $g(t){return function(e,n){if(n===void 0){var r=$g(t);return function(o){return r(o,e)}}for(var i in e)if(!GO.call(n,i)||!t.equals(e[i],n[i]))return!1;return!0}}function JP(t){var e=$g(t);return Po(function(n,r){return e(n)(r)&&e(r)(n)})}function YP(t){return Wn(Tt,t.of)}function XP(t){return Zu(t.of(it))}function ZP(t){var e=XP(t);return function(n,r){return t.chain(n,Vr(function(){return e()},r))}}var QP=YP(nd),tM=Ha,eM=gr(2,ZP(rd)),nM=eM,rM=MO,fa=g,iM=rM(mN({concat:aN(iN).concat,empty:0}))();function oM(t){return function(e){return e.iterNumber>=t?it:Tt(0)}}function aM(t,e){return function(n){return fa(n,e,L(function(r){return Math.min(t,r)}))}}function sM(t){return function(e){return Tt(t*Math.pow(2,e.iterNumber))}}var uM={iterNumber:0,cumulativeDelay:0,previousDelay:it};function cM(t,e){var n=t(e);return{iterNumber:e.iterNumber+1,cumulativeDelay:e.cumulativeDelay+Wt(function(){return 0})(n),previousDelay:n}}function lM(t,e){var n=cM(t,e);return fa(n.previousDelay,hg(function(){return tu.of(n)},function(r){return cP(r)(tu.of(n))}))}function Gi(t,e,n){var r=function(i){return fa(i,e,zh(function(o){return n(o)?fa(lM(t,i),zh(function(a){return fa(a.previousDelay,hg(function(){return tu.of(o)},function(){return r(a)}))})):tu.of(o)}))};return r(uM)}function fM(t){return e=>g(e,ye(n=>(t(n)(),n)))}const Ea=fM;function nu(t){return e=>g(e,Wh,Ea(t),Wh)}function dM(t){return e=>g(e,Ea(n=>()=>t(n)()),nu(n=>()=>t(n)()))}function hM(t){return e=>g(e,L(n=>(t(n)(),n)))}const pM=hM;function sd(t){return{equals(e,n){return e==null&&n==null?!0:e==null||n===null||n===void 0?!1:t.equals(e,n)}}}function uc(t){return{equals(e,n){const r=g(pt(e),Wt(()=>[])),i=g(pt(n),Wt(()=>[]));return Yf(t).equals(r,i)}}}const Ka=Zn({localId:oe,componentPath:uc(oe),sharedConfigurationModelId:sd(oe)}),vM=Zn({localId:oe,configurationModelId:oe}),yM=Po((t,e)=>H({x:t,y:e}).with({x:{type:"Choice"},y:{type:"Choice"}},n=>mM.equals(n.x,n.y)).with({x:{type:"Component"},y:{type:"Component"}},n=>gM.equals(n.x,n.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},n=>bM.equals(n.x,n.y)).with({x:{type:"Boolean"},y:{type:"Boolean"}},n=>SM.equals(n.x,n.y)).otherwise(()=>!1)),mM=Zn({type:oe,attributeId:Ka,state:oe,choiceValueId:oe}),gM=Zn({type:oe,attributeId:Ka,state:oe}),bM=Zn({type:oe,attributeId:Ka,state:rc}),SM=Zn({type:oe,attributeId:Ka,state:Xf});var Er=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(Er||{}),xr=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(xr||{}),Ns=(t=>(t.Rule="Rule",t.Cardinality="Cardinality",t.Component="Component",t))(Ns||{}),Vl=(t=>(t.all="all",t.none="none",t.specific="specific",t))(Vl||{}),Lr=(t=>(t.Channel="Channel",t.Package="Package",t))(Lr||{}),ee=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(ee||{}),Gr=(t=>(t.Included="Included",t.Excluded="Excluded",t))(Gr||{}),Ze=(t=>(t.Included="Included",t.Excluded="Excluded",t))(Ze||{}),be=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(be||{}),xa=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(xa||{}),Aa=(t=>(t.Always="Always",t.Optional="Optional",t))(Aa||{}),Oe=(t=>(t.Unknown="Unknown",t.CommunicationError="Local.LowLevelCommunicationError",t.ServiceError="ServiceError",t.ConfigurationConflict="ConfigurationConflict",t.ConfigurationUnauthenticated="ConfigurationUnauthenticated",t.ConfigurationUnauthorized="ConfigurationUnauthorized",t.ConfigurationApplicationError="ConfigurationApplicationError",t.ConfigurationTimeout="ConfigurationTimeout",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConfigurationAttributeNotFound="ConfigurationAttributeNotFound",t.ConfigurationSolutionNotAvailable="ConfigurationSolutionNotAvailable",t.ConfigurationRejectedDecisionsConflict="ConfigurationRejectedDecisionsConflict",t.ConfigurationChoiceValueNotFound="ConfigurationChoiceValueNotFound",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.ConfigurationInitializationFailure="ConfigurationInitializationFailure",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t.ConfigurationSetManyConflict="ConfigurationSetManyConflict",t))(Oe||{}),Dg=(t=>(t[t.NumericDecisionOutOfRange=0]="NumericDecisionOutOfRange",t))(Dg||{});const CM={createConfigurationRejectedDecisionsConflict(t){return{type:"ConfigurationRejectedDecisionsConflict",rejectedDecisions:t}}};class wM{mapToCreateSessionRequest(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),attributeRelations:this.mapToAttributeRelations(e.attributeRelations),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters),allowedInExplain:this.mapToAllowedInExplain(e.allowedInExplain)}}mapToConfigurationModelSource(e){return H(e).with({type:Lr.Channel},n=>({type:"Channel",deploymentName:n.deploymentName,channel:n.channel})).with({type:Lr.Package},n=>({type:"Package",configurationModelPackage:n.configurationModelPackage})).exhaustive()}mapToAttributeRelations(e){return g(e,pt,L(Wn(k(n=>this.mapToDecisionsToRespect(n)),n=>[...n])),_e)}mapToDecisionsToRespect(e){return{attributeId:e.attributeId,decisions:g([...e.decisions],Os(n=>this.mapToGlobalAttributeId(n)))}}mapToUsageRuleParameters(e){return g(pt(e),_e)}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:e.componentPath,sharedConfigurationModelId:e.sharedConfigurationModelId}}mapToAllowedInExplain(e){return H(e).with({rules:{type:Vl.none}},n=>({rules:{type:"AllowedRulesNone"}})).with({rules:{type:Vl.specific,rules:Mt.array(Mt.any)}},n=>({rules:{type:"AllowedRulesSpecific",rules:g(n.rules.rules,k(r=>this.mapToGlobalConstraintId(r)),r=>[...r])}})).otherwise(()=>({rules:{type:"AllowedRulesAll"}}))}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}}function TM(t){return e=>CP(n=>n!=null,t)(e)}function IM(){return Mo(Pr())}var pn=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(pn||{}),vi=(t=>(t.decisions="decisions",t.constraints="constraints",t.all="all",t))(vi||{}),je=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(je||{});const Le=Zn({localId:oe,componentPath:uc(oe),sharedConfigurationModel:sd(oe)}),EM=Ga(Yf(Zn({attributeId:Le,decisions:uc(Le)}))),xM=Zn({configurationModelSource:Po((t,e)=>KP(t,e)),decisionsToRespect:EM,usageRuleParameters:JP(oe)});var $a=(t=>(t.Channel="Channel",t.Package="Package",t))($a||{}),Bt=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(Bt||{}),at=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.ChoiceValue="ChoiceValue",t.Component="Component",t))(at||{}),ge=(t=>(t.Included="Included",t.Excluded="Excluded",t))(ge||{}),ce=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(ce||{}),xi=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(xi||{}),Ai=(t=>(t.Always="Always",t.Optional="Optional",t))(Ai||{});const AM={equals:(t,e)=>t.choiceValueId!==e.choiceValueId?!1:Ga(oe).equals(t.state,e.state)},$M={equals(t,e){return Ga(rc).equals(t.value,e.value)}},DM={equals(t,e){return Ga(Xf).equals(t.value,e.value)}},OM={equals(t,e){return Ga(oe).equals(t.state,e.state)}},NM={equals(t,e){return Le.equals(t.attributeId,e.attributeId)?H({x:t,y:e}).with({x:{type:"Boolean"},y:{type:"Boolean"}},(n,r)=>DM.equals(r.x,r.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},(n,r)=>$M.equals(r.x,r.y)).with({x:{type:"Component"},y:{type:"Component"}},(n,r)=>OM.equals(r.x,r.y)).with({x:{type:"ChoiceValue"},y:{type:"ChoiceValue"}},(n,r)=>AM.equals(r.x,r.y)).otherwise(()=>!1):!1}},PM=Yf(NM),MM={equals:(t,e)=>PM.equals(t.decisions,e.decisions)&&RM.equals(t.mode,e.mode)},RM={equals:(t,e)=>H({x:t,y:e}).with({x:{type:"Default"},y:{type:"Default"}},n=>!0).with({x:{type:"DropExistingDecisions"},y:{type:"DropExistingDecisions"}},n=>!0).otherwise(()=>!1)};var Fl=(t=>(t.NotAvailable="NotAvailable",t.StateNotPossible="StateNotPossible",t))(Fl||{}),ro=(t=>(t.Rule="Rule",t.Cardinality="Cardinality",t.Component="Component",t))(ro||{}),rt=(t=>(t.ServiceError="ServiceError",t.Unknown="Unknown",t.CommunicationError="CommunicationError",t.ConfigurationConflict="ConfigurationConflict",t.ConfigurationSolutionNotAvailable="ConfigurationSolutionNotAvailable",t.ConfigurationAttributeNotFound="ConfigurationAttributeNotFound",t.ConfigurationChoiceValueNotFound="ConfigurationChoiceValueNotFound",t.ConfigurationUnauthenticated="ConfigurationUnauthenticated",t.ConfigurationApplicationError="ConfigurationApplicationError",t.ConfigurationTimeout="ConfigurationTimeout",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConfigurationRejectedDecisionsConflict="ConfigurationRejectedDecisionsConflict",t.ConfigurationSetManyConflict="ConfigurationSetManyConflict",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.ConfigurationInitializationFailure="ConfigurationInitializationFailure",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t))(rt||{}),ud=(t=>(t[t.NumericDecisionOutOfRange=0]="NumericDecisionOutOfRange",t))(ud||{});const _M={createConfigurationRejectedDecisionsConflict(t){return{type:"ConfigurationRejectedDecisionsConflict",rejectedDecisions:t}}};function jM(t,e){console.log(`--------------------------------------------------------------------------------
195
+ `)}},e.prototype.setPatchedCaretPosition=function(r,i,o){Bh(r,i),this.caretPositionTimeout=setTimeout(function(){r.value===o&&Bh(r,i)},0)},e.prototype.correctCaretPosition=function(r,i,o){var a=this.props,u=a.prefix,s=a.suffix,c=a.format;if(r==="")return 0;if(i=qc(i,0,r.length),!c){var l=r[0]==="-";return qc(i,u.length+(l?1:0),r.length-s.length)}if(typeof c=="function"||c[i]==="#"&&Lo(r[i])||c[i-1]==="#"&&Lo(r[i-1]))return i;var d=c.indexOf("#"),f=c.lastIndexOf("#");i=qc(i,d,f+1);for(var h=c.substring(i,c.length).indexOf("#"),v=i,p=i+(h===-1?0:h);v>d&&(c[v]!=="#"||!Lo(r[v]));)v-=1;var S=!Lo(r[p])||o==="left"&&i!==d||i-v<p-i;return S?Lo(r[v])?v+1:v:p},e.prototype.getCaretPosition=function(r,i,o){var a=this.props,u=a.format,s=this.state.value,c=this.getNumberRegex(!0),l=(r.match(c)||[]).join(""),d=(i.match(c)||[]).join(""),f,h;for(f=0,h=0;h<o;h++){var v=r[h]||"",p=i[f]||"";if(!(!v.match(c)&&v!==p)&&!(v==="0"&&p.match(c)&&p!=="0"&&l.length!==d.length)){for(;v!==i[f]&&f<i.length;)f++;f++}}return typeof u=="string"&&!s&&(f=i.length),f=this.correctCaretPosition(i,f),f},e.prototype.removePrefixAndSuffix=function(r){var i=this.props,o=i.format,a=i.prefix,u=i.suffix;if(!o&&r){var s=r[0]==="-";s&&(r=r.substring(1,r.length)),r=a&&r.indexOf(a)===0?r.substring(a.length,r.length):r;var c=r.lastIndexOf(u);r=u&&c!==-1&&c===r.length-u.length?r.substring(0,c):r,s&&(r="-"+r)}return r},e.prototype.removePatternFormatting=function(r){for(var i=this.props,o=i.format,a=o.split("#").filter(function(h){return h!==""}),u=0,s="",c=0,l=a.length;c<=l;c++){var d=a[c]||"",f=c===l?r.length:r.indexOf(d,u);if(f===-1){s=r;break}else s+=r.substring(u,f),u=f+d.length}return(s.match(this.getNumberRegex(!0))||[]).join("")},e.prototype.removeFormatting=function(r){var i=this.props,o=i.format,a=i.removeFormatting;return r&&(o?typeof o=="string"?r=this.removePatternFormatting(r):typeof a=="function"?r=a(r):r=(r.match(this.getNumberRegex(!0))||[]).join(""):(r=this.removePrefixAndSuffix(r),r=this.getFloatString(r)),r)},e.prototype.formatWithPattern=function(r){for(var i=this.props,o=i.format,a=0,u=o.split(""),s=0,c=o.length;s<c;s++)o[s]==="#"&&(u[s]=r[a]||this.getMaskAtIndex(a),a+=1);return u.join("")},e.prototype.formatAsNumber=function(r){var i=this.props,o=i.decimalScale,a=i.fixedDecimalScale,u=i.prefix,s=i.suffix,c=i.allowNegative,l=i.thousandsGroupStyle,d=this.getSeparators(),f=d.thousandSeparator,h=d.decimalSeparator,v=r.indexOf(".")!==-1||o&&a,p=kl(r,c),S=p.beforeDecimal,C=p.afterDecimal,w=p.addNegation;return o!==void 0&&(C=ug(C,o,a)),f&&(S=IO(S,f,l)),u&&(S=u+S),s&&(C=C+s),w&&(S="-"+S),r=S+(v&&h||"")+C,r},e.prototype.formatNumString=function(r){r===void 0&&(r="");var i=this.props,o=i.format,a=i.allowEmptyFormatting,u=i.customNumerals,s=r;if(u&&u.length===10){var c=new RegExp("["+u.join("")+"]","g");s=r.replace(c,function(l){return u.indexOf(l).toString()})}return r===""&&!a?s="":r==="-"&&!o?s="-":typeof o=="string"?s=this.formatWithPattern(s):typeof o=="function"?s=o(s):s=this.formatAsNumber(s),s},e.prototype.formatValueProp=function(r){var i=this.props,o=i.format,a=i.decimalScale,u=i.fixedDecimalScale,s=i.allowEmptyFormatting,c=this.props,l=c.value,d=c.isNumericString;l=qh(l)?r:l;var f=!l&&l!==0;if(f&&s&&(l=""),f&&!s)return"";typeof l=="number"&&(l=xO(l),d=!0),l==="Infinity"&&d&&(l=""),d&&!o&&typeof a=="number"&&(l=AO(l,a,u));var h=d?this.formatNumString(l):this.formatInput(l);return h},e.prototype.formatNegation=function(r){r===void 0&&(r="");var i=this.props,o=i.allowNegative,a=new RegExp("(-)"),u=new RegExp("(-)(.)*(-)"),s=a.test(r),c=u.test(r);return r=r.replace(/-/g,""),s&&!c&&o&&(r="-"+r),r},e.prototype.formatInput=function(r){r===void 0&&(r="");var i=this.props,o=i.format;return o||(r=this.removePrefixAndSuffix(r),r=this.formatNegation(r)),r=this.removeFormatting(r),this.formatNumString(r)},e.prototype.isCharacterAFormat=function(r,i){var o=this.props,a=o.format,u=o.prefix,s=o.suffix,c=o.decimalScale,l=o.fixedDecimalScale,d=this.getSeparators(),f=d.decimalSeparator;return!!(typeof a=="string"&&a[r]!=="#"||!a&&(r<u.length||r>=i.length-s.length||c&&l&&i[r]===f))},e.prototype.correctInputValue=function(r,i,o){var a=this,u=this.props,s=u.format,c=u.allowNegative,l=u.prefix,d=u.suffix,f=u.decimalScale,h=this.getSeparators(),v=h.allowedDecimalSeparators,p=h.decimalSeparator,S=this.state.numAsString||"",C=this.selectionBeforeInput,w=C.selectionStart,T=C.selectionEnd,I=$O(i,o),x=I.start,b=I.end;if(!s&&x===b&&v.indexOf(o[w])!==-1){var E=f===0?"":p;return o.substr(0,w)+E+o.substr(w+1,o.length)}var P=s?0:l.length,A=i.length-(s?0:d.length);if(o.length>i.length||!o.length||x===b||w===0&&T===i.length||x===0&&b===i.length||w===P&&T===A)return o;var U=i.substr(x,b-x),M=!![].concat(U).find(function(tt,De){return a.isCharacterAFormat(De+x,i)});if(M){var $=i.substr(x),z={},Z=[];[].concat($).forEach(function(tt,De){a.isCharacterAFormat(De+x,i)?z[De]=tt:De>U.length-1&&Z.push(tt)}),Object.keys(z).forEach(function(tt){Z.length>tt?Z.splice(tt,0,z[tt]):Z.push(z[tt])}),o=i.substr(0,x)+Z.join("")}if(!s){var Vt=this.removeFormatting(o),bt=kl(Vt,c),J=bt.beforeDecimal,Y=bt.afterDecimal,ut=bt.addNegation,$e=r<o.indexOf(p)+1;if(Vt.length<S.length&&$e&&J===""&&!parseFloat(Y))return ut?"-":""}return o},e.prototype.updateValue=function(r){var i=r.formattedValue,o=r.input,a=r.setCaretPosition;a===void 0&&(a=!0);var u=r.source,s=r.event,c=r.numAsString,l=r.caretPos,d=this.props,f=d.onValueChange,h=this.state,v=h.value;if(o){if(l===void 0&&a){var p=r.inputValue||o.value,S=Vh(o);o.value=i,l=this.getCaretPosition(p,i,S)}o.value=i,a&&this.setPatchedCaretPosition(o,l,i)}c===void 0&&(c=this.removeFormatting(i)),i!==v&&(this.setState({value:i,numAsString:c}),f(this.getValueObject(i,c),{event:s,source:u}))},e.prototype.onChange=function(r){var i=r.target,o=i.value,a=this,u=a.state,s=a.props,c=s.isAllowed,l=u.value||"",d=Vh(i);o=this.correctInputValue(d,l,o);var f=this.formatInput(o)||"",h=this.removeFormatting(f),v=this.getValueObject(f,h),p=c(v);p||(f=l),this.updateValue({formattedValue:f,numAsString:h,inputValue:o,input:i,event:r,source:"event"}),p&&s.onChange(r)},e.prototype.onBlur=function(r){var i=this,o=i.props,a=i.state,u=o.format,s=o.onBlur,c=o.allowLeadingZeros,l=a.numAsString,d=a.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!u){isNaN(parseFloat(l))&&(l=""),c||(l=EO(l));var f=this.formatNumString(l);if(f!==d){this.updateValue({formattedValue:f,numAsString:l,input:r.target,setCaretPosition:!1,event:r,source:"event"}),s(r);return}}s(r)},e.prototype.onKeyDown=function(r){var i=r.target,o=r.key,a=i.selectionStart,u=i.selectionEnd,s=i.value;s===void 0&&(s="");var c,l=this.props,d=l.decimalScale,f=l.fixedDecimalScale,h=l.prefix,v=l.suffix,p=l.format,S=l.onKeyDown,C=d!==void 0&&f,w=this.getNumberRegex(!1,C),T=new RegExp("-"),I=typeof p=="string";if(this.selectionBeforeInput={selectionStart:a,selectionEnd:u},o==="ArrowLeft"||o==="Backspace"?c=a-1:o==="ArrowRight"?c=a+1:o==="Delete"&&(c=a),c===void 0||a!==u){S(r);return}var x=c,b=I?p.indexOf("#"):h.length,E=I?p.lastIndexOf("#")+1:s.length-v.length;if(o==="ArrowLeft"||o==="ArrowRight"){var P=o==="ArrowLeft"?"left":"right";x=this.correctCaretPosition(s,c,P)}else if(o==="Delete"&&!w.test(s[c])&&!T.test(s[c]))for(;!w.test(s[x])&&x<E;)x++;else if(o==="Backspace"&&!w.test(s[c])){if(a<=b+1&&s[0]==="-"&&typeof p>"u"){var A=s.substring(1);this.updateValue({formattedValue:A,caretPos:x,input:i,event:r,source:"event"})}else if(!T.test(s[c])){for(;!w.test(s[x-1])&&x>b;)x--;x=this.correctCaretPosition(s,x,"left")}}(x!==c||c<b||c>E)&&(r.preventDefault(),this.setPatchedCaretPosition(i,x,s)),r.isUnitTestRun&&this.setPatchedCaretPosition(i,x,s),S(r)},e.prototype.onMouseUp=function(r){var i=r.target,o=i.selectionStart,a=i.selectionEnd,u=i.value;if(u===void 0&&(u=""),o===a){var s=this.correctCaretPosition(u,o);s!==o&&this.setPatchedCaretPosition(i,s,u)}this.props.onMouseUp(r)},e.prototype.onFocus=function(r){var i=this;r.persist(),this.focusedElm=r.target,this.focusTimeout=setTimeout(function(){var o=r.target,a=o.selectionStart,u=o.selectionEnd,s=o.value;s===void 0&&(s="");var c=i.correctCaretPosition(s,a);c!==a&&!(a===0&&u===s.length)&&i.setPatchedCaretPosition(o,c,s),i.props.onFocus(r)},0)},e.prototype.render=function(){var r=this.props,i=r.type,o=r.displayType,a=r.customInput,u=r.renderText,s=r.getInputRef,c=r.format;r.thousandSeparator,r.decimalSeparator,r.allowedDecimalSeparators,r.thousandsGroupStyle,r.decimalScale,r.fixedDecimalScale,r.prefix,r.suffix,r.removeFormatting,r.mask,r.defaultValue,r.isNumericString,r.allowNegative,r.allowEmptyFormatting,r.allowLeadingZeros,r.onValueChange,r.isAllowed,r.customNumerals,r.onChange,r.onKeyDown,r.onMouseUp,r.onFocus,r.onBlur,r.value;var l=OO(r,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"]),d=l,f=this.state,h=f.value,v=f.mounted,p=v&&DO(c)?"numeric":void 0,S=Object.assign({inputMode:p},d,{type:i,value:h,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if(o==="text")return u?u(h,d)||null:R.createElement("span",Object.assign({},d,{ref:s}),h);if(a){var C=a;return R.createElement(C,Object.assign({},S,{ref:s}))}return R.createElement("input",Object.assign({},S,{ref:s}))},e}(R.Component);cg.defaultProps=NO;function PO(t,e,n){var r=this,i=R.useRef(null),o=R.useRef(0),a=R.useRef(null),u=R.useRef([]),s=R.useRef(),c=R.useRef(),l=R.useRef(t),d=R.useRef(!0);R.useEffect(function(){l.current=t},[t]);var f=!e&&e!==0&&typeof window<"u";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var h=!!(n=n||{}).leading,v=!("trailing"in n)||!!n.trailing,p="maxWait"in n,S=p?Math.max(+n.maxWait||0,e):null;R.useEffect(function(){return d.current=!0,function(){d.current=!1}},[]);var C=R.useMemo(function(){var w=function(P){var A=u.current,U=s.current;return u.current=s.current=null,o.current=P,c.current=l.current.apply(U,A)},T=function(P,A){f&&cancelAnimationFrame(a.current),a.current=f?requestAnimationFrame(P):setTimeout(P,A)},I=function(P){if(!d.current)return!1;var A=P-i.current;return!i.current||A>=e||A<0||p&&P-o.current>=S},x=function(P){return a.current=null,v&&u.current?w(P):(u.current=s.current=null,c.current)},b=function P(){var A=Date.now();if(I(A))return x(A);if(d.current){var U=e-(A-i.current),M=p?Math.min(U,S-(A-o.current)):U;T(P,M)}},E=function(){var P=Date.now(),A=I(P);if(u.current=[].slice.call(arguments),s.current=r,i.current=P,A){if(!a.current&&d.current)return o.current=i.current,T(b,e),h?w(i.current):c.current;if(p)return T(b,e),w(i.current)}return a.current||T(b,e),c.current};return E.cancel=function(){a.current&&(f?cancelAnimationFrame(a.current):clearTimeout(a.current)),o.current=0,u.current=i.current=s.current=a.current=null},E.isPending=function(){return!!a.current},E.flush=function(){return a.current?x(Date.now()):c.current},E},[h,p,e,S,v,f]);return C}var MO=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},RO=function(t){return function(){return{concat:function(e,n){return function(r){return t.concat(e(r),n(r))}}}}},_O=function(t){var e=RO(t);return function(){return{concat:e().concat,empty:function(){return t.empty}}}};function Qr(t){return t}function Zu(t){return function(){return t}}var jO=Zu(null),lg=Zu(void 0),Pr=lg;function Wn(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return function(){return e(t.apply(this,arguments))};case 3:return function(){return n(e(t.apply(this,arguments)))};case 4:return function(){return r(n(e(t.apply(this,arguments))))};case 5:return function(){return i(r(n(e(t.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(e(t.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(e(t.apply(this,arguments)))))))};case 8:return function(){return u(a(o(i(r(n(e(t.apply(this,arguments))))))))};case 9:return function(){return s(u(a(o(i(r(n(e(t.apply(this,arguments)))))))))}}}function g(t,e,n,r,i,o,a,u,s){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return n(e(t));case 4:return r(n(e(t)));case 5:return i(r(n(e(t))));case 6:return o(i(r(n(e(t)))));case 7:return a(o(i(r(n(e(t))))));case 8:return u(a(o(i(r(n(e(t)))))));case 9:return s(u(a(o(i(r(n(e(t))))))));default:{for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}}var gr=function(t,e){var n=typeof t=="number"?function(r){return r.length>=t}:t;return function(){var r=Array.from(arguments);return n(arguments)?e.apply(this,r):function(i){return e.apply(void 0,MO([i],r,!1))}}},qO=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},kO=function(t){return t._tag==="None"},Yf=function(t){return t._tag==="Some"},Qu={_tag:"None"},tc=function(t){return{_tag:"Some",value:t}},UO=function(t){return t._tag==="Left"},ec=function(t){return{_tag:"Left",left:t}},nc=function(t){return{_tag:"Right",right:t}},BO=function(t){return[t]},VO=function(t){return t.length>0},FO=function(t){return t[0]},LO=function(t){return t.slice(1)},GO=[],zO={},HO=Object.prototype.hasOwnProperty,WO=function(t){return qO([t[0]],t.slice(1),!0)};function KO(t,e){return function(n){return function(r){return t.ap(t.map(r,function(i){return function(o){return e.ap(i,o)}}),n)}}}function YO(t){return function(e){return{concat:function(n,r){return t.ap(t.map(n,function(i){return function(o){return e.concat(i,o)}}),r)}}}}function fg(t,e,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,e===0?t.apply(null,i):fg(t,e-1,i)}}function JO(t){var e=t.length;switch(e){case 1:return function(n){var r;return r={},r[t[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[t[0]]=n,i[t[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[t[0]]=n,o[t[1]]=r,o[t[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[t[0]]=n,a[t[1]]=r,a[t[2]]=i,a[t[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return u={},u[t[0]]=n,u[t[1]]=r,u[t[2]]=i,u[t[3]]=o,u[t[4]]=a,u}}}}};default:return fg(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<e;o++)i[t[o]]=n[o];return i},e-1,[])}}function XO(t){return function(e){for(var n=Object.keys(e),r=n.length,i=JO(n),o=t.map(e[n[0]],i),a=1;a<r;a++)o=t.ap(o,e[n[a]]);return o}}function ZO(t,e){return function(n){return function(r){return t.map(r,function(i){return e.map(i,n)})}}}function QO(t){var e=YO(t);return function(n){return{concat:e(n).concat,empty:t.of(n.empty)}}}function tN(t){return function(e,n){return t.chain(e,function(r){return t.map(n(r),function(){return r})})}}function dg(t){return function(e){return function(n){return t.fromEither(kO(n)?ec(e()):nc(n.value))}}}function eN(t,e){return function(n,r){return function(i){return e.chain(i,function(o){return t.fromEither(n(o)?nc(o):ec(r(o)))})}}}var Po=function(t){return{equals:function(e,n){return e===n||t(e,n)}}},Zn=function(t){return Po(function(e,n){for(var r in t)if(!t[r].equals(e[r],n[r]))return!1;return!0})},nN={equals:function(t,e){return t===e}},rN=function(t){return function(e,n){return e===n||t.compare(e,n)>-1?e:n}};function iN(t,e){return t<e?-1:t>e?1:0}var oN={equals:nN.equals,compare:iN},aN=oN,sN=function(t){return{concat:rN(t)}},uN=sN,it=Qu,Tt=tc;function cN(t){return function(e){return t(e)?Tt(e):it}}var lN=function(t,e){return g(t,L(e))},fN=function(t,e){return g(t,hN(e))},dN="Option",Ga=function(t){return{equals:function(e,n){return e===n||(_n(e)?_n(n):_n(n)?!1:t.equals(e.value,n.value))}}},L=function(t){return function(e){return _n(e)?it:Tt(t(e.value))}},qr=Tt,hN=function(t){return function(e){return _n(e)||_n(t)?it:Tt(e.value(t.value))}},pN={URI:dN,map:lN,ap:fN,of:qr},hg=gr(2,function(t,e){return _n(t)?it:e(t.value)}),vN=gr(2,function(t,e){return _n(t)?e():t}),Fh=vN,yN=hg(Qr),Qe=function(t){return function(e){return _n(e)?it:t(e.value)?e:it}},ra=Yf,_n=function(t){return t._tag==="None"},mN=function(t,e){return function(n){return _n(n)?t():e(n.value)}},Vr=mN,pg=Vr,gN=function(t){return function(e){return _n(e)?t():e.value}},Wt=gN,Ul=yN,vt=function(t){return t==null?it:Tt(t)},Rr=Vr(jO,Qr),_e=Vr(lg,Qr),Nn=hg,bN=QO(pN),rc={equals:function(t,e){return t===e}};rc.equals;rc.equals;var SN=GO,CN=VO,wN=function(t,e){return t<0||t>=e.length},TN=function(t,e,n){if(n[t]===e)return n;var r=WO(n);return r[t]=e,r},IN=function(t){return function(e){if(e.length===1)return e;for(var n=[AN(e)],r=$N(e),i=function(s){n.every(function(c){return!t.equals(c,s)})&&n.push(s)},o=0,a=r;o<a.length;o++){var u=a[o];i(u)}return n}},EN=BO,xN=FO,AN=xN,$N=LO,Qs=function(t){return t.length===0},ic=CN,DN=function(t){return function(e){if(Qs(e))return gg;for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}},ON=wN,NN=function(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return tc(n);return Qu}};function Ge(t){return function(e){for(var n=0;n<e.length;n++)if(t(e[n]))return tc(e[n]);return Qu}}var PN=function(t,e){return function(n){return ON(t,n)?Qu:tc(UN(t,e(n[t]),n))}};function vg(t){return function(e,n){if(n===void 0){var r=vg(t);return function(a){return r(e,a)}}for(var i=function(a){return t.equals(a,e)},o=0;o<n.length;o++)if(i(n[o]))return!0;return!1}}var Xi=function(t){var e=IN(t);return function(n){return ic(n)?e(n):n}},MN=function(t){return function(e){return Qs(e)?t:Qs(t)?e:e.concat(t)}},ht=MN;function yg(t){var e=vg(t);return function(n,r){if(r===void 0){var i=yg(t);return function(o){return i(o,n)}}return n.filter(function(o){return!e(o,r)})}}var RN=EN,_N=gr(2,function(t,e){return g(t,DN(function(n,r){return e(r,n)}))}),jN=_N(Qr),k=function(t){return function(e){return e.map(function(n){return t(n)})}},za=function(t){return function(e){return e.filter(t)}},qN=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Yf(i)&&n.push(i.value)}return n}},mg=function(t){return qN(function(e,n){return t(n)})},zn=mg(Qr),Bl=function(t,e){return kN(t,function(n,r,i){return e(r,i)})},kN=function(t,e){return function(n){for(var r=n.length,i=t,o=0;o<r;o++)i=e(o,i,n[o]);return i}},Jf=function(t){return Po(function(e,n){return e.length===n.length&&e.every(function(r,i){return t.equals(r,n[i])})})},UN=function(t,e,n){return ic(n)?TN(t,e,n):n},Lh=function(t){return t.slice()},Gh=function(t){return Qs(t)?gg:t.slice()},gg=SN,oe={equals:function(t,e){return t===e}};oe.equals;var Xf={equals:function(t,e){return t===e}};Xf.equals;var BN=function(t){return function(e){for(var n=[],r=0;r<e.length;r++)n.push.apply(n,t(r,e[r]));return n}};function oi(t){return Ge(t)}var Os=function(t){return function(e){return e.map(function(n){return t(n)})}},VN=gr(2,function(t,e){return g(t,BN(function(n,r){return e(r,n)}))}),FN=VN(Qr),LN=function(t){return function(e){for(var n=[],r=0;r<e.length;r++){var i=t(r,e[r]);Yf(i)&&n.push(i.value)}return n}},Cr=function(t){return LN(function(e,n){return t(n)})},GN=function(t){return function(e){return e.filter(t)}},Zf=ec,oc=nc,bg=function(t,e){return g(t,HN(e))},zN=function(t,e){return g(t,YN(e))},Qf="Either",HN=function(t){return function(e){return Fr(e)?e:oc(t(e.right))}},WN={URI:Qf,map:bg},KN=function(t){return function(e){return Fr(e)?e:Fr(t)?t:oc(e.right(t.right))}},YN=KN,JN={URI:Qf,map:bg,ap:zN},XN=function(t){return function(e){return Fr(e)?Zf(t(e.left)):e}},Sg={URI:Qf,fromEither:Qr},ZN=dg(Sg),Fr=UO,QN=function(t,e){return function(n){return Fr(n)?t(n.left):e(n.right)}},ci=QN;Sg.fromEither;var tP=function(t){return Fr(t)?oc(t.left):Zf(t.right)};function eP(t){return Wn(oc,t.of)}function nP(t){return Wn(Zf,t.of)}function rP(t){return ZO(t,WN)}function iP(t){return KO(t,JN)}function oP(t){return function(e,n){return t.chain(e,function(r){return Fr(r)?t.of(r):n(r.right)})}}function aP(t){return function(e,n){return t.map(e,XN(n))}}function sP(t){return function(e,n){return function(r){return t.map(r,ci(e,n))}}}function uP(t){return function(e){return function(n){return t.chain(n,function(r){return Fr(r)?e(r.left):t.of(r)})}}}function cP(t){return function(e){return t.map(e,tP)}}var lP=function(t){return function(){return Promise.resolve().then(t)}};function fP(t){return function(e){return function(){return new Promise(function(n){setTimeout(function(){Promise.resolve().then(e).then(n)},t)})}}}var ac=function(t,e){return g(t,Cg(e))},td=function(t,e){return g(t,dP(e))},Cg=function(t){return function(e){return function(){return Promise.resolve().then(e).then(t)}}},dP=function(t){return function(e){return function(){return Promise.all([Promise.resolve().then(e),Promise.resolve().then(t)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Ha=function(t){return function(){return Promise.resolve(t)}},ed=gr(2,function(t,e){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}),Wa="Task",sc={URI:Wa,map:ac},nd={URI:Wa,of:Ha},hP={URI:Wa,map:ac,ap:td},rd={URI:Wa,map:ac,of:Ha,ap:td,chain:ed},pP=Qr,zh=ed,tu={URI:Wa,map:ac,of:Ha,ap:td,chain:ed,fromIO:lP,fromTask:pP},vP=globalThis&&globalThis.__awaiter||function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function u(l){try{c(r.next(l))}catch(d){a(d)}}function s(l){try{c(r.throw(l))}catch(d){a(d)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((r=r.apply(t,e||[])).next())})},yP=globalThis&&globalThis.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},ur=nP(nd),Mo=eP(nd),mP=Ha,gP=function(t){return Cg(ZN(t))},eu=sP(sc),Hh=function(t,e){return function(){return vP(void 0,void 0,void 0,function(){var n;return yP(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t().then(nc)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,ec(e(n))];case 3:return[2]}})})}},wg=uP(rd),Wh=cP(sc),Tg=function(t,e){return g(t,ye(e))},Ig=function(t,e){return g(t,SP(e))},ye=rP(sc),bP=gr(2,aP(sc)),On=bP,SP=iP(hP),Eg=gr(2,oP(rd)),Zi=Mo,id="TaskEither",CP={URI:id,map:Tg,ap:Ig,of:Zi},xg={URI:id,map:Tg,ap:Ig,chain:Eg},od={URI:id,fromEither:mP},wP=gr(2,tN(xg)),ad=dg(od);od.fromEither;var TP=eN(od,xg),IP=Zi(zO),$n=Eg,EP=wP,xP=Object.getOwnPropertyNames,AP=Object.getOwnPropertySymbols,$P=Object.prototype.hasOwnProperty;function Kh(t,e){return function(n,r,i){return t(n,r,i)&&e(n,r,i)}}function ds(t){return function(e,n,r){if(!e||!n||typeof e!="object"||typeof n!="object")return t(e,n,r);var i=r.cache,o=i.get(e),a=i.get(n);if(o&&a)return o===n&&a===e;i.set(e,n),i.set(n,e);var u=t(e,n,r);return i.delete(e),i.delete(n),u}}function Yh(t){return xP(t).concat(AP(t))}var Ag=Object.hasOwn||function(t,e){return $P.call(t,e)};function Ro(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var $g="_owner",Jh=Object.getOwnPropertyDescriptor,Xh=Object.keys;function DP(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function OP(t,e){return Ro(t.getTime(),e.getTime())}function Zh(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,a,u;(a=i.next())&&!a.done;){for(var s=e.entries(),c=!1,l=0;(u=s.next())&&!u.done;){var d=a.value,f=d[0],h=d[1],v=u.value,p=v[0],S=v[1];!c&&!r[l]&&(c=n.equals(f,p,o,l,t,e,n)&&n.equals(h,S,f,p,t,e,n))&&(r[l]=!0),l++}if(!c)return!1;o++}return!0}function NP(t,e,n){var r=Xh(t),i=r.length;if(Xh(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===$g&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!Ag(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function Go(t,e,n){var r=Yh(t),i=r.length;if(Yh(e).length!==i)return!1;for(var o,a,u;i-- >0;)if(o=r[i],o===$g&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!Ag(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(a=Jh(t,o),u=Jh(e,o),(a||u)&&(!a||!u||a.configurable!==u.configurable||a.enumerable!==u.enumerable||a.writable!==u.writable)))return!1;return!0}function PP(t,e){return Ro(t.valueOf(),e.valueOf())}function MP(t,e){return t.source===e.source&&t.flags===e.flags}function Qh(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,a;(o=i.next())&&!o.done;){for(var u=e.values(),s=!1,c=0;(a=u.next())&&!a.done;)!s&&!r[c]&&(s=n.equals(o.value,a.value,o.value,a.value,t,e,n))&&(r[c]=!0),c++;if(!s)return!1}return!0}function RP(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var _P="[object Arguments]",jP="[object Boolean]",qP="[object Date]",kP="[object Map]",UP="[object Number]",BP="[object Object]",VP="[object RegExp]",FP="[object Set]",LP="[object String]",GP=Array.isArray,tp=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,ep=Object.assign,zP=Object.prototype.toString.call.bind(Object.prototype.toString);function HP(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,a=t.areRegExpsEqual,u=t.areSetsEqual,s=t.areTypedArraysEqual;return function(c,l,d){if(c===l)return!0;if(c==null||l==null||typeof c!="object"||typeof l!="object")return c!==c&&l!==l;var f=c.constructor;if(f!==l.constructor)return!1;if(f===Object)return i(c,l,d);if(GP(c))return e(c,l,d);if(tp!=null&&tp(c))return s(c,l,d);if(f===Date)return n(c,l,d);if(f===RegExp)return a(c,l,d);if(f===Map)return r(c,l,d);if(f===Set)return u(c,l,d);var h=zP(c);return h===qP?n(c,l,d):h===VP?a(c,l,d):h===kP?r(c,l,d):h===FP?u(c,l,d):h===BP?typeof c.then!="function"&&typeof l.then!="function"&&i(c,l,d):h===_P?i(c,l,d):h===jP||h===UP||h===LP?o(c,l,d):!1}}function WP(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Go:DP,areDatesEqual:OP,areMapsEqual:r?Kh(Zh,Go):Zh,areObjectsEqual:r?Go:NP,arePrimitiveWrappersEqual:PP,areRegExpsEqual:MP,areSetsEqual:r?Kh(Qh,Go):Qh,areTypedArraysEqual:r?Go:RP};if(n&&(i=ep({},i,n(i))),e){var o=ds(i.areArraysEqual),a=ds(i.areMapsEqual),u=ds(i.areObjectsEqual),s=ds(i.areSetsEqual);i=ep({},i,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:u,areSetsEqual:s})}return i}function KP(t){return function(e,n,r,i,o,a,u){return t(e,n,u)}}function YP(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(u,s){var c=r(),l=c.cache,d=l===void 0?e?new WeakMap:void 0:l,f=c.meta;return n(u,s,{cache:d,equals:i,meta:f,strict:o})};if(e)return function(u,s){return n(u,s,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var a={cache:void 0,equals:i,meta:void 0,strict:o};return function(u,s){return n(u,s,a)}}var JP=ti();ti({strict:!0});ti({circular:!0});ti({circular:!0,strict:!0});ti({createInternalComparator:function(){return Ro}});ti({strict:!0,createInternalComparator:function(){return Ro}});ti({circular:!0,createInternalComparator:function(){return Ro}});ti({circular:!0,createInternalComparator:function(){return Ro},strict:!0});function ti(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,a=o===void 0?!1:o,u=WP(t),s=HP(u),c=r?r(s):KP(s);return YP({circular:n,comparator:s,createState:i,equals:c,strict:a})}function Dg(t){return function(e,n){if(n===void 0){var r=Dg(t);return function(o){return r(o,e)}}for(var i in e)if(!HO.call(n,i)||!t.equals(e[i],n[i]))return!1;return!0}}function XP(t){var e=Dg(t);return Po(function(n,r){return e(n)(r)&&e(r)(n)})}function ZP(t){return Wn(Tt,t.of)}function QP(t){return Zu(t.of(it))}function tM(t){var e=QP(t);return function(n,r){return t.chain(n,Vr(function(){return e()},r))}}var eM=ZP(nd),nM=Ha,rM=gr(2,tM(rd)),iM=rM,oM=_O,fa=g,aM=oM(bN({concat:uN(aN).concat,empty:0}))();function sM(t){return function(e){return e.iterNumber>=t?it:Tt(0)}}function uM(t,e){return function(n){return fa(n,e,L(function(r){return Math.min(t,r)}))}}function cM(t){return function(e){return Tt(t*Math.pow(2,e.iterNumber))}}var lM={iterNumber:0,cumulativeDelay:0,previousDelay:it};function fM(t,e){var n=t(e);return{iterNumber:e.iterNumber+1,cumulativeDelay:e.cumulativeDelay+Wt(function(){return 0})(n),previousDelay:n}}function dM(t,e){var n=fM(t,e);return fa(n.previousDelay,pg(function(){return tu.of(n)},function(r){return fP(r)(tu.of(n))}))}function Gi(t,e,n){var r=function(i){return fa(i,e,zh(function(o){return n(o)?fa(dM(t,i),zh(function(a){return fa(a.previousDelay,pg(function(){return tu.of(o)},function(){return r(a)}))})):tu.of(o)}))};return r(lM)}function hM(t){return e=>g(e,ye(n=>(t(n)(),n)))}const Ea=hM;function nu(t){return e=>g(e,Wh,Ea(t),Wh)}function pM(t){return e=>g(e,Ea(n=>()=>t(n)()),nu(n=>()=>t(n)()))}function vM(t){return e=>g(e,L(n=>(t(n)(),n)))}const yM=vM;function sd(t){return{equals(e,n){return e==null&&n==null?!0:e==null||n===null||n===void 0?!1:t.equals(e,n)}}}function uc(t){return{equals(e,n){const r=g(vt(e),Wt(()=>[])),i=g(vt(n),Wt(()=>[]));return Jf(t).equals(r,i)}}}const Ka=Zn({localId:oe,componentPath:uc(oe),sharedConfigurationModelId:sd(oe)}),mM=Zn({localId:oe,configurationModelId:oe}),gM=Po((t,e)=>H({x:t,y:e}).with({x:{type:"Choice"},y:{type:"Choice"}},n=>bM.equals(n.x,n.y)).with({x:{type:"Component"},y:{type:"Component"}},n=>SM.equals(n.x,n.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},n=>CM.equals(n.x,n.y)).with({x:{type:"Boolean"},y:{type:"Boolean"}},n=>wM.equals(n.x,n.y)).otherwise(()=>!1)),bM=Zn({type:oe,attributeId:Ka,state:oe,choiceValueId:oe}),SM=Zn({type:oe,attributeId:Ka,state:oe}),CM=Zn({type:oe,attributeId:Ka,state:rc}),wM=Zn({type:oe,attributeId:Ka,state:Xf});var Er=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(Er||{}),xr=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(xr||{}),Ns=(t=>(t.Rule="Rule",t.Cardinality="Cardinality",t.Component="Component",t))(Ns||{}),Vl=(t=>(t.all="all",t.none="none",t.specific="specific",t))(Vl||{}),Lr=(t=>(t.Channel="Channel",t.Package="Package",t))(Lr||{}),ee=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(ee||{}),Gr=(t=>(t.Included="Included",t.Excluded="Excluded",t))(Gr||{}),Ze=(t=>(t.Included="Included",t.Excluded="Excluded",t))(Ze||{}),be=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(be||{}),xa=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(xa||{}),Aa=(t=>(t.Always="Always",t.Optional="Optional",t))(Aa||{}),Oe=(t=>(t.Unknown="Unknown",t.CommunicationError="Local.LowLevelCommunicationError",t.ServiceError="ServiceError",t.ConfigurationConflict="ConfigurationConflict",t.ConfigurationUnauthenticated="ConfigurationUnauthenticated",t.ConfigurationUnauthorized="ConfigurationUnauthorized",t.ConfigurationApplicationError="ConfigurationApplicationError",t.ConfigurationTimeout="ConfigurationTimeout",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConfigurationAttributeNotFound="ConfigurationAttributeNotFound",t.ConfigurationSolutionNotAvailable="ConfigurationSolutionNotAvailable",t.ConfigurationRejectedDecisionsConflict="ConfigurationRejectedDecisionsConflict",t.ConfigurationChoiceValueNotFound="ConfigurationChoiceValueNotFound",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.ConfigurationInitializationFailure="ConfigurationInitializationFailure",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t.ConfigurationSetManyConflict="ConfigurationSetManyConflict",t))(Oe||{}),Og=(t=>(t[t.NumericDecisionOutOfRange=0]="NumericDecisionOutOfRange",t))(Og||{});const TM={createConfigurationRejectedDecisionsConflict(t){return{type:"ConfigurationRejectedDecisionsConflict",rejectedDecisions:t}}};class IM{mapToCreateSessionRequest(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),attributeRelations:this.mapToAttributeRelations(e.attributeRelations),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters),allowedInExplain:this.mapToAllowedInExplain(e.allowedInExplain)}}mapToConfigurationModelSource(e){return H(e).with({type:Lr.Channel},n=>({type:"Channel",deploymentName:n.deploymentName,channel:n.channel})).with({type:Lr.Package},n=>({type:"Package",configurationModelPackage:n.configurationModelPackage})).exhaustive()}mapToAttributeRelations(e){return g(e,vt,L(Wn(k(n=>this.mapToDecisionsToRespect(n)),n=>[...n])),_e)}mapToDecisionsToRespect(e){return{attributeId:e.attributeId,decisions:g([...e.decisions],Os(n=>this.mapToGlobalAttributeId(n)))}}mapToUsageRuleParameters(e){return g(vt(e),_e)}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:e.componentPath,sharedConfigurationModelId:e.sharedConfigurationModelId}}mapToAllowedInExplain(e){return H(e).with({rules:{type:Vl.none}},n=>({rules:{type:"AllowedRulesNone"}})).with({rules:{type:Vl.specific,rules:Mt.array(Mt.any)}},n=>({rules:{type:"AllowedRulesSpecific",rules:g(n.rules.rules,k(r=>this.mapToGlobalConstraintId(r)),r=>[...r])}})).otherwise(()=>({rules:{type:"AllowedRulesAll"}}))}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}}function EM(t){return e=>TP(n=>n!=null,t)(e)}function xM(){return Mo(Pr())}var pn=(t=>(t.whyIsNotSatisfied="why-is-not-satisfied",t.whyIsStateNotPossible="why-is-state-not-possible",t))(pn||{}),vi=(t=>(t.decisions="decisions",t.constraints="constraints",t.all="all",t))(vi||{}),je=(t=>(t.choiceValue="choice-value",t.component="component",t.boolean="boolean",t.numeric="numeric",t.configuration="configuration",t.attribute="attribute",t))(je||{});const Le=Zn({localId:oe,componentPath:uc(oe),sharedConfigurationModel:sd(oe)}),AM=Ga(Jf(Zn({attributeId:Le,decisions:uc(Le)}))),$M=Zn({configurationModelSource:Po((t,e)=>JP(t,e)),decisionsToRespect:AM,usageRuleParameters:XP(oe)});var $a=(t=>(t.Channel="Channel",t.Package="Package",t))($a||{}),Bt=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.Choice="Choice",t.Component="Component",t))(Bt||{}),at=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.ChoiceValue="ChoiceValue",t.Component="Component",t))(at||{}),ge=(t=>(t.Included="Included",t.Excluded="Excluded",t))(ge||{}),ce=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(ce||{}),xi=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(xi||{}),Ai=(t=>(t.Always="Always",t.Optional="Optional",t))(Ai||{});const DM={equals:(t,e)=>t.choiceValueId!==e.choiceValueId?!1:Ga(oe).equals(t.state,e.state)},OM={equals(t,e){return Ga(rc).equals(t.value,e.value)}},NM={equals(t,e){return Ga(Xf).equals(t.value,e.value)}},PM={equals(t,e){return Ga(oe).equals(t.state,e.state)}},MM={equals(t,e){return Le.equals(t.attributeId,e.attributeId)?H({x:t,y:e}).with({x:{type:"Boolean"},y:{type:"Boolean"}},(n,r)=>NM.equals(r.x,r.y)).with({x:{type:"Numeric"},y:{type:"Numeric"}},(n,r)=>OM.equals(r.x,r.y)).with({x:{type:"Component"},y:{type:"Component"}},(n,r)=>PM.equals(r.x,r.y)).with({x:{type:"ChoiceValue"},y:{type:"ChoiceValue"}},(n,r)=>DM.equals(r.x,r.y)).otherwise(()=>!1):!1}},RM=Jf(MM),_M={equals:(t,e)=>RM.equals(t.decisions,e.decisions)&&jM.equals(t.mode,e.mode)},jM={equals:(t,e)=>H({x:t,y:e}).with({x:{type:"Default"},y:{type:"Default"}},n=>!0).with({x:{type:"DropExistingDecisions"},y:{type:"DropExistingDecisions"}},n=>!0).otherwise(()=>!1)};var Fl=(t=>(t.NotAvailable="NotAvailable",t.StateNotPossible="StateNotPossible",t))(Fl||{}),ro=(t=>(t.Rule="Rule",t.Cardinality="Cardinality",t.Component="Component",t))(ro||{}),rt=(t=>(t.ServiceError="ServiceError",t.Unknown="Unknown",t.CommunicationError="CommunicationError",t.ConfigurationConflict="ConfigurationConflict",t.ConfigurationSolutionNotAvailable="ConfigurationSolutionNotAvailable",t.ConfigurationAttributeNotFound="ConfigurationAttributeNotFound",t.ConfigurationChoiceValueNotFound="ConfigurationChoiceValueNotFound",t.ConfigurationUnauthenticated="ConfigurationUnauthenticated",t.ConfigurationApplicationError="ConfigurationApplicationError",t.ConfigurationTimeout="ConfigurationTimeout",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConfigurationRejectedDecisionsConflict="ConfigurationRejectedDecisionsConflict",t.ConfigurationSetManyConflict="ConfigurationSetManyConflict",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.ConfigurationInitializationFailure="ConfigurationInitializationFailure",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t))(rt||{}),ud=(t=>(t[t.NumericDecisionOutOfRange=0]="NumericDecisionOutOfRange",t))(ud||{});const qM={createConfigurationRejectedDecisionsConflict(t){return{type:"ConfigurationRejectedDecisionsConflict",rejectedDecisions:t}}};function kM(t,e){console.log(`--------------------------------------------------------------------------------
196
196
  -- ${e??""}
197
197
  --------------------------------------------------------------------------------
198
- ${JSON.stringify(t,null,2)}`)}var da=(t=>(t.ConfigurationEngineRestApiUnauthorized="Generic::Unauthorized",t.ClientError="Generic::LocalClientError",t.ServerError="Generic::ServerError",t.UnhandledResponseStatus="LocalUnhandledResponseStatus",t.LowLevelCommunicationError="LocalLowLevelCommunicationError",t))(da||{}),Og=(t=>(t.BooleanAttributeNotFound="BooleanAttributeNotFound",t.ChoiceAttributeNotFound="ChoiceAttributeNotFound",t.ChoiceValueNotFound="ChoiceValueNotFound",t.ConfigurationInitializationFailure="InitializationFailure",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.LegacyConfigurationModelInvalid="DeploymentStore.Core.Store.SnapshotInvalid",t.LegacySnapshotInvalid="SnapshotInvalid",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConflictWithConsequence="ConflictWithConsequence",t.DecisionInvalid="DecisionInvalid",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.NumericAttributeNotFound="NumericAttributeNotFound",t.NumericDecisionOutOfRange="NumericDecisionOutOfRange",t.SessionNotFound="SessionNotFound",t.SetDecisionConflict="SetDecisionConflict",t.Unauthorized="Unauthorized",t))(Og||{});const qM=t=>Object.values(Og).includes(t),kM=t=>qM(t)?Tt(t):it;function UM(t){return g(t,kM,L(e=>H(e).with("ConfigurationModelNotFound",()=>({type:rt.ConfigurationModelNotFound})).with("DecisionsToRespectInvalid",()=>({type:rt.DecisionsToRespectInvalid})).with(Mt.union("ChoiceAttributeNotFound","NumericAttributeNotFound","BooleanAttributeNotFound"),()=>({type:rt.ConfigurationAttributeNotFound})).with("ChoiceValueNotFound",()=>({type:rt.ConfigurationChoiceValueNotFound})).with("DecisionInvalid",()=>({type:rt.ConfigurationConflict})).with("NumericDecisionOutOfRange",()=>({type:rt.ConfigurationConflict,reason:ud.NumericDecisionOutOfRange})).with("ConflictWithConsequence",()=>({type:rt.ConfigurationConflict})).with(Mt.union("SessionNotFound","Unauthorized"),()=>({type:rt.ConfigurationUnauthenticated})).with("ConfigurationModelInvalid",()=>({type:rt.ConfigurationModelInvalid})).with("DeploymentStore.Core.Store.SnapshotInvalid",()=>({type:rt.ConfigurationModelInvalid})).with("SnapshotInvalid",()=>({type:rt.ConfigurationModelInvalid})).with("InitializationFailure",()=>({type:rt.ConfigurationInitializationFailure})).with("ConfigurationModelNotFeasible",n=>({type:rt.ConfigurationModelNotFeasible,constraintExplanations:[]})).with("SetDecisionConflict",()=>({type:rt.ConfigurationConflict})).exhaustive()))}const BM=t=>Object.values(da).includes(t),VM=t=>BM(t)?Tt(t):it;function FM(t){return g(t,VM,L(e=>H(e).with("Generic::LocalClientError",()=>({type:rt.ConfigurationApplicationError})).with("Generic::ServerError",()=>({type:rt.ServiceError})).with("LocalLowLevelCommunicationError",()=>({type:rt.CommunicationError})).with("Generic::Unauthorized",()=>({type:rt.ConfigurationUnauthenticated})).with("LocalUnhandledResponseStatus",()=>({type:rt.Unknown})).exhaustive()))}function ir(t,e){jM(t,e);const n=t.type;return g(it,Fh(()=>UM(n)),Fh(()=>FM(n)),Wt(()=>(console.error("InterpretEngineError encountered unexpected error type","ProblemDetails",t,"Context",e),{type:rt.Unknown})))}class LM{constructor(e,n,r,i){this.engineApiClient=e,this.contractToRestMapper=n,this.restToDomainMapper=r,this.options=i}create(e){const n=this.contractToRestMapper.mapToCreateSessionRequest(e);return g(this.engineApiClient.createSessionUsingJwtBearer(n,this.options.accessToken),On(r=>ir(r,"ClientSideSessionLifetimeHandler - create")),$n(r=>this.restToDomainMapper.mapToSessionId(r)),TM(()=>({type:rt.ConfigurationUnauthenticated})))}close(e){return g(this.engineApiClient.deleteSessionUsingJwtBearer(e,this.options.accessToken),On(n=>ir(n,"ClientSideSessionLifetimeHandler - close")),ye(()=>Pr()))}}function GM(t){var e=[];if(t.length===0)return"";if(typeof t[0]!="string")throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var i=t[r];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(r>0&&(i=i.replace(/^[\/]+/,"")),r<t.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/");o=o.replace(/\/(\?|&|#[^!])/g,"$1");var a=o.split("?");return o=a.shift()+(a.length>0?"?":"")+a.join("&"),o}function zM(){var t;return typeof arguments[0]=="object"?t=arguments[0]:t=[].slice.call(arguments),GM(t)}var Ng=(t=>(t[t.Ok=200]="Ok",t[t.NoContent=204]="NoContent",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.NotFound=404]="NotFound",t[t.Conflict=409]="Conflict",t))(Ng||{});function nr(t,e,n){const r=g(Array.isArray(t)?t:[t],zM);return g(Hh(()=>fetch(r,e),i=>({type:"error"})),$n(i=>g(Hh(async()=>{const o=await i.json();return{response:i,data:o}},()=>i))),Cg(i=>i.status===401?ur({type:da.ConfigurationEngineRestApiUnauthorized,status:401}):i.status===204?Mo({response:i,data:{}}):i.type==="error"?ur({type:da.LowLevelCommunicationError}):ur({type:da.UnhandledResponseStatus})),$n(i=>g(n(i),ad(()=>i.data))))}function Ll(t,e){return nr(t,e,n=>{if(n.response.status===200)return qr(n.data);if(n.response.status===409){const r=n.data;return H(r).with({type:"ConfigurationModelInvalid"},i=>qr(r)).with({type:"ConfigurationModelNotFeasible"},i=>qr(r)).otherwise(()=>it)}return it})}class HM{constructor(e){this.baseUrl=e}createSessionUsingApiKey(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-API-KEY":n},body:JSON.stringify(e)};return Ll([this.baseUrl,"v2/session"],r)}createSessionUsingJwtBearer(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify(e)};return Ll([this.baseUrl,"v2/session"],r)}setMany(e,n){const r={method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return nr([this.baseUrl,"v2/session/configuration/decision/many"],r,i=>i.response.status===200||i.response.status===409?Tt(i.data):it)}makeDecision(e,n){const r={method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return nr([this.baseUrl,"v2/session/configuration/decision"],r,i=>i.response.status===200?Tt(i.data):it)}getDecisions(e){const n={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}};return nr([this.baseUrl,"v2/session/configuration/decision"],n,r=>r.response.status===200?Tt(r.data):it)}getWhyStateNotPossible(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return nr([this.baseUrl,"v2/session/configuration/consequence/explain/why-state-not-possible"],r,i=>i.response.status===200?Tt(i.data):it)}getWhyNotSatisfied(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return nr([this.baseUrl,"v2/session/configuration/consequence/explain/why-not-satisfied"],r,i=>i.response.status===200?Tt(i.data):it)}getConsequence(e){const n={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}};return nr([this.baseUrl,"v2/session/configuration/consequence"],n,r=>r.response.status===200?Tt(r.data):it)}deleteSessionUsingJwtBearer(e,n){const r={method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`}};return nr([this.baseUrl,`v2/session/${e}`],r,i=>i.response.status===204?Tt({}):it)}}var $i=(t=>(t.Included="Included",t.Excluded="Excluded",t))($i||{}),Gl=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(Gl||{}),zl=(t=>(t.Always="Always",t.Optional="Optional",t))(zl||{}),Da=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(Da||{}),cr=(t=>(t.Included="Included",t.Excluded="Excluded",t.Undefined="Undefined",t))(cr||{}),ln=(t=>(t.Choice="Choice",t.Numeric="Numeric",t.Boolean="Boolean",t.Component="Component",t))(ln||{}),Hl=(t=>(t.NotAvailable="NotAvailable",t.StateNotPossible="StateNotPossible",t))(Hl||{}),Wl=(t=>(t.Attribute="Attribute",t.Configuration="Configuration",t))(Wl||{}),ia=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.ChoiceValue="ChoiceValue",t.Component="Component",t))(ia||{});const un=Zn({localId:oe,componentPath:uc(oe),sharedConfigurationModelId:sd(oe)});class Pg{mapToDecisions(e){return{}}mapToSessionId(e){return H(e).with({sessionId:Mt.string},n=>Mo(n.sessionId)).with({type:"ConfigurationModelNotFeasible"},n=>{const r=g(n.constraintExplanations,k(i=>this.mapToConstraintExplanation(i)));return ur({type:rt.ConfigurationModelNotFeasible,constraintExplanations:r})}).with({type:"ConfigurationModelInvalid"},()=>ur({type:rt.ConfigurationModelInvalid})).otherwise(()=>ur({type:rt.Unknown}))}mapToExplainAnswer(e,n){const r=H(n).with({question:pn.whyIsStateNotPossible,subject:je.boolean},a=>[{type:at.Boolean,attributeId:a.attributeId,value:Tt(a.state)}]).with({question:pn.whyIsStateNotPossible,subject:je.numeric},a=>[{type:at.Numeric,attributeId:a.attributeId,value:Tt(a.state)}]).with({question:pn.whyIsStateNotPossible,subject:je.component},a=>[{type:at.Component,attributeId:a.attributeId,state:Tt(a.state)}]).with({question:pn.whyIsStateNotPossible,subject:je.choiceValue},a=>[{type:at.ChoiceValue,attributeId:a.attributeId,choiceValueId:a.choiceValueId,state:Tt(a.state)}]).otherwise(()=>[]),i=g(e.decisionExplanations,k(a=>this.mapToDecisionExplanation(a,r,{type:"Default"}))),o=g(e.constraintExplanations,k(a=>this.mapToConstraintExplanation(a)));return H(n).with({answerType:vi.decisions},()=>({decisionExplanations:i})).with({answerType:vi.constraints},()=>({constraintExplanations:o})).with({answerType:vi.all},()=>({constraintExplanations:o,decisionExplanations:i})).exhaustive()}mapToConfigurationSetManyConflictFailure(e,n,r){const i=this.mapToExplicitDecisions(n);return{type:rt.ConfigurationSetManyConflict,decisionExplanations:g(e.decisionExplanations,k(o=>this.mapToDecisionExplanation(o,i,r))),constraintExplanations:g(e.constraintExplanations,k(o=>this.mapToConstraintExplanation(o)))}}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}mapToConfigurationModel(e,n){const r=this.mapToAttributes(e,n);return{isSatisfied:n.isConfigurationSatisfied??!1,attributes:r}}mapToBooleanDecision(e){return{type:at.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),value:pt(e.state)}}mapToNumericDecision(e){return{type:at.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),value:pt(e.state)}}mapToComponentDecision(e){return{type:at.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToDecisionState(e.state)}}mapToExplicitChoiceValueDecision(e){return{type:at.ChoiceValue,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToDecisionState(e.state)}}mapToGlobalAttributeId(e){return{localId:e.localId,sharedConfigurationModel:e.sharedConfigurationModelId,componentPath:e.componentPath??[]}}mapToChoiceValueDecision(e){return g(this.mapToDecisionState(e.state),L(n=>({kind:this.mapToDecisionKind(e.kind),state:n})))}mapToConstraintExplanation(e){return{causedByRules:g(e.causedByRules,k(n=>this.mapToRuleConstraint(n))),causedByCardinalities:g(e.causedByCardinalities,k(n=>this.mapToCardinalityConstraint(n)))}}mapToRuleConstraint(e){return{type:ro.Rule,ruleId:this.mapToGlobalConstraintId(e.constraintId)}}mapToCardinalityConstraint(e){return{type:ro.Cardinality,attributeId:this.mapToGlobalAttributeId(e.attributeId)}}mapToExplicitDecisions(e){const n=g(e.booleanDecisions??[],k(a=>({type:at.Boolean,attributeId:this.mapToGlobalAttributeId(a.attributeId),value:pt(a.state)}))),r=g(e.numericDecisions??[],k(a=>({type:at.Numeric,attributeId:this.mapToGlobalAttributeId(a.attributeId),value:pt(a.state)}))),i=g(e.componentDecisions??[],k(a=>({type:at.Component,attributeId:this.mapToGlobalAttributeId(a.attributeId),state:g(pt(a.state),L(u=>this.mapToDecisionState(u)),Ul)}))),o=g(e.choiceDecisions??[],k(a=>({type:at.ChoiceValue,attributeId:this.mapToGlobalAttributeId(a.attributeId),choiceValueId:a.choiceValueId,state:g(pt(a.state),L(u=>this.mapToDecisionState(u)),Ul)})));return g([],ht(n),ht(r),ht(i),ht(o))}mapToDecisionExplanation(e,n,r){const i=g(e.causedByBooleanDecisions,k(v=>this.mapToCausedByBooleanDecision(v))),o=g(e.causedByNumericDecisions,k(v=>this.mapToCausedByNumericDecision(v))),a=g(e.causedByComponentDecisions,k(v=>this.mapToCausedByComponentDecision(v))),u=g(e.causedByChoiceDecisions,k(v=>this.mapToCausedByChoiceValueDecision(v))),s=g(i,k(v=>({type:at.Boolean,attributeId:v.attributeId,value:it}))),c=g(o,k(v=>({type:at.Numeric,attributeId:v.attributeId,value:it}))),l=g(a,k(v=>({type:at.Component,attributeId:v.attributeId,state:it}))),d=g(u,k(v=>({type:at.ChoiceValue,attributeId:v.attributeId,choiceValueId:v.choiceValueId,state:it}))),f=g([],ht(s),ht(c),ht(l),ht(d)),h=vg(Po((v,p)=>{const S=Le.equals(v.attributeId,p.attributeId);return H({a:v,b:p}).with({a:{type:at.ChoiceValue},b:{type:at.ChoiceValue}},C=>S&&C.a.choiceValueId===C.b.choiceValueId).otherwise(()=>S)}))(f)(n);return{causedByBooleanDecisions:i,causedByNumericDecisions:o,causedByComponentDecisions:a,causedByChoiceDecisions:u,solution:{decisions:g([],ht(f),ht(h)),mode:r}}}mapToCausedByBooleanDecision(e){return{type:at.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state,reason:this.mapToReason(e.reason)}}mapToReason(e){return H(e).with(Hl.NotAvailable,()=>Fl.NotAvailable).with(Hl.StateNotPossible,()=>Fl.StateNotPossible).exhaustive()}mapToCausedByNumericDecision(e){return{type:at.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state,reason:this.mapToReason(e.reason)}}mapToCausedByComponentDecision(e){return{type:at.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToPossibleDecisionState(e.state),reason:this.mapToReason(e.reason)}}mapToCausedByChoiceValueDecision(e){return{type:at.ChoiceValue,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToPossibleDecisionState(e.state),reason:this.mapToReason(e.reason)}}mapToAttributes(e,n){function r(f){return g(n.canAttributeContributeToConfigurationSatisfaction,Ge(h=>un.equals(h,f)),ra)}const i=g([],ht(g(e.choiceValueDecisions,k(f=>f.attributeId))),ht(g(n.choiceConsequences,k(f=>f.attributeId))),Xi(un)),o=g(i,k(f=>{const h=g(e.choiceValueDecisions??[],FN(p=>un.equals(p.attributeId,f))),v=g(n.choiceConsequences??[],oi(p=>un.equals(p.attributeId,f)));return g(v,L(p=>this.mapToChoiceAttributes(p,h,r(f))))}),zn),a=g([],ht(g(e.numericDecisions,k(f=>f.attributeId))),ht(g(n.numericConsequences,k(f=>f.attributeId))),Xi(un)),u=g(a,k(f=>{const h=g(e.numericDecisions??[],oi(p=>un.equals(p.attributeId,f))),v=g(n.numericConsequences??[],oi(p=>un.equals(p.attributeId,f)));return g(v,L(p=>this.mapToNumericAttribute(p,h,r(f))))}),zn),s=g([],ht(g(e.booleanDecisions,k(f=>f.attributeId))),ht(g(n.booleanConsequences,k(f=>f.attributeId))),Xi(un)),c=g(s,k(f=>{const h=g(e.booleanDecisions??[],oi(p=>un.equals(p.attributeId,f))),v=g(n.booleanConsequences??[],oi(p=>un.equals(p.attributeId,f)));return g(v,L(p=>this.mapToBooleanAttribute(p,h,r(f))))}),zn),l=g([],ht(g(e.componentDecisions,k(f=>f.attributeId))),ht(g(n.componentConsequences,k(f=>f.attributeId))),Xi(un)),d=g(l,k(f=>{const h=g(e.componentDecisions??[],oi(p=>un.equals(p.attributeId,f))),v=g(n.componentConsequences??[],oi(p=>un.equals(p.attributeId,f)));return g(v,L(p=>this.mapToComponentAttribute(p,h,r(f))))}),zn);return g([],ht(o),ht(d),ht(u),ht(c))}mapToComponentAttribute(e,n,r){return{type:Bt.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,possibleDecisionStates:g(e.possibleDecisionStates,Os(i=>this.mapToPossibleDecisionState(i))),decision:g(n,Nn(i=>g(this.mapToDecisionState(i.state),L(o=>({state:o,kind:i.kind}))))),inclusion:this.mapToInclusion(e.inclusion),selection:g(e.selection,pt,L(i=>this.mapToSelection(i)),_e),canContributeToConfigurationSatisfaction:r}}mapToChoiceAttributes(e,n,r){const i=g(e.values,Os(o=>{const a=g(n,Ge(u=>u.choiceValueId==o.choiceValueId));return this.mapToChoiceValue(o,a)}));return{type:Bt.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,cardinality:this.mapToCardinality(e.cardinality),values:i,canContributeToConfigurationSatisfaction:r}}mapToBooleanAttribute(e,n,r){return{type:Bt.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,selection:this.mapToSelection(e.selection),possibleDecisionStates:e.possibleDecisionStates,decision:g(n,Nn(i=>g(i.state,pt,L(o=>({kind:this.mapToDecisionKind(i.kind),state:o}))))),canContributeToConfigurationSatisfaction:r}}mapToNumericAttribute(e,n,r){return{type:Bt.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,range:{min:e.range.min,max:e.range.max},selection:this.mapToSelection(e.selection),decimalPlaces:e.decimalPlaces,decision:g(n,Nn(i=>g(i.state,pt,L(o=>({kind:this.mapToDecisionKind(i.kind),state:o}))))),canContributeToConfigurationSatisfaction:r}}mapToChoiceValue(e,n){const r=g(e.possibleDecisionStates,Os(i=>this.mapToPossibleDecisionState(i)));return{choiceValueId:e.choiceValueId,decision:g(n,Nn(i=>this.mapToChoiceValueDecision(i))),possibleDecisionStates:r}}mapToDecisionKind(e){return H(e).with(Da.Implicit,()=>ce.Implicit).with(Da.Explicit,()=>ce.Explicit).exhaustive()}mapToDecisionState(e){return H(e).with(cr.Included,()=>Tt(ge.Included)).with(cr.Excluded,()=>Tt(ge.Excluded)).with(cr.Undefined,()=>it).exhaustive()}mapToPossibleDecisionState(e){return H(e).with($i.Included,()=>ge.Included).with($i.Excluded,()=>ge.Excluded).exhaustive()}mapToSelection(e){return H(e).with(Gl.Mandatory,()=>xi.Mandatory).with(Gl.Optional,()=>xi.Optional).exhaustive()}mapToInclusion(e){return H(e).with(zl.Always,()=>Ai.Always).with(zl.Optional,()=>Ai.Optional).exhaustive()}mapToCardinality(e){return{lowerBound:e.lowerBound,upperBound:e.upperBound}}}class WM{constructor(e,n){this.restToDomainMapper=new Pg,this.contractToRestMapper=e,this.options=n}create(e){const n=this.contractToRestMapper.mapToCreateSessionRequest(e),r=Ll(this.options.sessionCreateUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(n)});return g(r,On(i=>ir(i,"ServerSideSessionLifetimeHandler - create")),$n(i=>this.restToDomainMapper.mapToSessionId(i)))}close(e){return g(nr(this.options.sessionDeleteUrl,{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}},n=>n.response.status===Ng.NoContent?Tt({}):it),On(n=>ir(n,"ServerSideSessionLifetimeHandler - close")),ye(Pr))}}class KM{constructor(e,n,r){this.inner=e,this.contractToDomainMapper=n,this.domainToContractMapper=r,this.onConfigurationChangedHandler=it}setOnConfigurationChangedHandler(e){const n=g(e,pt,L(r=>i=>{const o=this.domainToContractMapper.mapToConfiguration(i);r(o)}));this.inner.setOnConfigurationChangedHandler(n)}getConfiguration(){const e=this.inner.getConfiguration();return this.domainToContractMapper.mapToConfiguration(e)}getSessionContext(){const e=this.inner.getSessionContext();return this.domainToContractMapper.mapToSessionContext(e)}async setSessionContext(e){const n=this.contractToDomainMapper.mapToSessionContext(e);return await g(this.inner.setSessionContext(n),ye(Pr),this.adaptToContractPromise())()}async restoreConfiguration(e){const n=this.contractToDomainMapper.mapToConfiguration(e);return await g(this.inner.restoreConfiguration(n),ye(Pr),this.adaptToContractPromise())()}async makeDecision(e){const n=this.contractToDomainMapper.mapToAttributeDecision(e);return await g(this.inner.makeDecision(n),ye(Pr),this.adaptToContractPromise())()}async setMany(e,n){const r=this.contractToDomainMapper.mapToAttributeDecisions(e),i=this.contractToDomainMapper.mapToMode(n);return await g(this.inner.setMany(r,i),ye(Pr),this.adaptToContractPromise())()}async applySolution(e){const n=this.contractToDomainMapper.mapToSolution(e);return await g(this.inner.applySolution(n),ye(Pr),this.adaptToContractPromise())()}async explain(e,n){const r=this.contractToDomainMapper.mapToExplainQuestion(e,n);return await g(this.inner.explain(r),ye(i=>this.domainToContractMapper.mapToExplainAnswer(i)),this.adaptToContractPromise())()}async close(){return await g(this.inner.close(),On(e=>this.domainToContractMapper.mapToFailureResult(e)),eu(Promise.reject,e=>Promise.resolve()))()}adaptToContractPromise(){return Wn(On(e=>this.domainToContractMapper.mapToFailureResult(e)),eu(e=>Promise.reject(e),e=>Promise.resolve(e)))}}class JM{mapToExplainQuestion(e,n){const r={answerType:H(n).with("decisions",()=>vi.decisions).with("constraints",()=>vi.constraints).with("full",()=>vi.all).exhaustive()};return H(e).with({question:Er.whyIsNotSatisfied,subject:xr.configuration},i=>({...r,question:pn.whyIsNotSatisfied,subject:je.configuration})).with({question:Er.whyIsNotSatisfied,subject:xr.attribute},i=>({...r,question:pn.whyIsNotSatisfied,subject:je.attribute,attributeId:this.mapToGlobalAttributeId(i.attributeId)})).with({question:Er.whyIsStateNotPossible,subject:xr.choiceValue},i=>({...r,question:pn.whyIsStateNotPossible,subject:je.choiceValue,attributeId:this.mapToGlobalAttributeId(i.attributeId),choiceValueId:i.choiceValueId,state:this.mapToDecisionState(i.state)})).with({question:Er.whyIsStateNotPossible,subject:xr.component},i=>({...r,question:pn.whyIsStateNotPossible,subject:je.component,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:this.mapToDecisionState(i.state)})).with({question:Er.whyIsStateNotPossible,subject:xr.numeric},i=>({...r,question:pn.whyIsStateNotPossible,subject:je.numeric,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:i.state})).with({question:Er.whyIsStateNotPossible,subject:xr.boolean},i=>({...r,question:pn.whyIsStateNotPossible,subject:je.boolean,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:i.state})).exhaustive()}mapToConfiguration(e){return{isSatisfied:e.isSatisfied,attributes:g(e.attributes,k(n=>this.mapToAttribute(n)))}}mapToAttributeDecisions(e){return g(e,k(n=>this.mapToAttributeDecision(n)))}mapToSessionContext(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),decisionsToRespect:this.mapToDecisionsToRespect(e.attributeRelations),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters)}}mapToAttributeDecision(e){return H(e).with({type:ee.Choice,choiceValueId:Mt.string},n=>({type:at.ChoiceValue,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToDecisionStateOption(n.state)})).with({type:ee.Numeric},n=>({type:at.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),value:pt(n.state)})).with({type:ee.Boolean},n=>({type:at.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),value:pt(n.state)})).with({type:ee.Component},n=>({type:at.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(pt(n.state),Nn(r=>this.mapToDecisionStateOption(r)))})).exhaustive()}mapToDecisionsToRespect(e){return g(pt(e),L(n=>g(n,k(r=>({attributeId:this.mapToGlobalAttributeId(r.attributeId),decisions:g(r.decisions,k(i=>this.mapToGlobalAttributeId(i)))})))))}mapToMode(e){return H(e).with({type:"DropExistingDecisions"},n=>({type:"DropExistingDecisions",conflictHandling:this.mapToConflictHandling(n.conflictHandling)})).otherwise(()=>({type:"Default"}))}mapToConflictHandling(e){return H(e).with({type:"Manual"},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).with({type:"Automatic"},n=>({type:"Automatic"})).exhaustive()}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:e.componentPath??[],sharedConfigurationModel:e.sharedConfigurationModelId}}mapToConfigurationModelSource(e){return H(e).with({type:Lr.Package},n=>({type:$a.Package,configurationModelPackage:n.configurationModelPackage})).with({type:Lr.Channel},n=>({type:$a.Channel,deploymentName:n.deploymentName,channel:n.channel})).exhaustive()}mapToSolution(e){return{decisions:g(e.decisions,k(n=>this.mapToAttributeDecision(n))),mode:this.mapToMode(e.mode)}}mapToAttribute(e){return H(e).with({type:ee.Boolean},n=>({type:Bt.Boolean,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,possibleDecisionStates:n.possibleDecisionStates,selection:this.mapToSelection(n.selection),decision:g(n.decision,pt,L(r=>({kind:this.mapToDecisionKind(r.kind),state:r.state}))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:ee.Numeric},n=>({type:Bt.Numeric,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,range:{min:n.range.min,max:n.range.max},decimalPlaces:n.decimalPlaces,selection:this.mapToSelection(n.selection),decision:g(n.decision,pt,L(r=>({kind:this.mapToDecisionKind(r.kind),state:r.state}))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:ee.Choice},n=>({type:Bt.Choice,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,cardinality:{lowerBound:n.cardinality.lowerBound,upperBound:n.cardinality.upperBound},values:g(n.values,k(r=>this.mapToChoiceValue(r))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:ee.Component},n=>({type:Bt.Component,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,decision:g(n.decision,pt,Nn(r=>g(this.mapToDecisionStateOption(r.state),L(i=>({kind:this.mapToDecisionKind(r.kind),state:i}))))),possibleDecisionStates:g(n.possibleDecisionStates,k(r=>this.mapToDecisionStateOption(r)),zn),selection:g(n.selection,pt,L(r=>this.mapToSelection(r)),_e),inclusion:this.mapToInclusion(n.inclusion),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).exhaustive()}mapToChoiceValue(e){return{choiceValueId:e.id,decision:this.mapToChoiceValueDecision(e),possibleDecisionStates:g(e.possibleDecisionStates,k(n=>this.mapToDecisionStateOption(n)),zn)}}mapToChoiceValueDecision(e){return g(e.decision,pt,Nn(n=>g(this.mapToDecisionStateOption(n.state),L(r=>({state:r,kind:this.mapToDecisionKind(n.kind)})))))}mapToDecisionKind(e){return H(e).with(be.Implicit,()=>ce.Implicit).with(be.Explicit,()=>ce.Explicit).exhaustive()}mapToSelection(e){return H(e).with(xa.Mandatory,()=>xi.Mandatory).with(xa.Optional,()=>xi.Optional).exhaustive()}mapToInclusion(e){return H(e).with(Aa.Always,()=>Ai.Always).with(Aa.Optional,()=>Ai.Optional).exhaustive()}mapToDecisionState(e){return H(e).with(Mt.union(Gr.Included,Ze.Included),()=>ge.Included).with(Mt.union(Gr.Excluded,Ze.Excluded),()=>ge.Excluded).exhaustive()}mapToDecisionStateOption(e){return g(pt(e),L(n=>this.mapToDecisionState(n)))}mapToUsageRuleParameters(e){return e??{}}}class Mg{mapToExplainAnswer(e){const n=H(e).with({decisionExplanations:Mt.array(Mt.any)},i=>g(i.decisionExplanations,k(o=>this.mapToDecisionExplanation(o)))).otherwise(()=>[]),r=H(e).with({constraintExplanations:Mt.array(Mt.any)},i=>g(i.constraintExplanations,k(o=>this.mapToConstraintExplanation(o)))).otherwise(()=>[]);return{decisionExplanations:n,constraintExplanations:r}}mapToConstraintExplanation(e){return{causedByCardinalities:g(e.causedByCardinalities,k(n=>this.mapToGlobalAttributeId(n.attributeId))),causedByRules:g(e.causedByRules,k(n=>this.mapToGlobalConstraintId(n.ruleId)))}}mapToDecisionExplanation(e){const n=g(e.causedByChoiceDecisions,k(a=>this.mapToCausedByChoiceAttributeDecision(a))),r=g(e.causedByComponentDecisions,k(a=>this.mapToCausedByComponentAttributeDecision(a))),i=g(e.causedByNumericDecisions,k(a=>this.mapToCausedByNumericAttributeDecision(a))),o=g(e.causedByBooleanDecisions,k(a=>this.mapToCausedByBooleanAttributeDecision(a)));return{causedByDecisions:g([],ht(n),ht(r),ht(i),ht(o)),solution:this.mapToSolution(e.solution)}}mapToSolution(e){return{decisions:g(e.decisions,k(n=>this.mapToExplicitDecision(n))),mode:this.mapToMode(e.mode)}}mapToMode(e){return H(e).with({type:"DropExistingDecisions"},n=>({type:"DropExistingDecisions",conflictHandling:this.mapToConflictHandling(n.conflictHandling)})).otherwise(()=>({type:"Default"}))}mapToConflictHandling(e){return H(e).with({type:"Manual"},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).with({type:"Automatic"},n=>({type:"Automatic"})).exhaustive()}mapToSessionContext(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),attributeRelations:this.mapToDecisionsToRespect(e.decisionsToRespect),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters)}}mapToFailureResult(e){return H(e).with({type:rt.ConfigurationConflict},n=>({type:Oe.ConfigurationConflict,reason:H(n.reason).with(ud.NumericDecisionOutOfRange,()=>Dg.NumericDecisionOutOfRange).otherwise(()=>{})})).with({type:rt.ConfigurationApplicationError},()=>({type:Oe.ConfigurationApplicationError})).with({type:rt.ConfigurationUnauthenticated},()=>({type:Oe.ConfigurationUnauthenticated})).with({type:rt.ConfigurationModelNotFound},()=>({type:Oe.ConfigurationModelNotFound})).with({type:rt.ConfigurationTimeout},()=>({type:Oe.ConfigurationTimeout})).with({type:rt.ConfigurationAttributeNotFound},()=>({type:Oe.ConfigurationAttributeNotFound})).with({type:rt.ConfigurationChoiceValueNotFound},()=>({type:Oe.ConfigurationChoiceValueNotFound})).with({type:rt.ConfigurationSolutionNotAvailable},()=>({type:Oe.ConfigurationSolutionNotAvailable})).with({type:rt.ConfigurationRejectedDecisionsConflict},n=>{const r=g(n.rejectedDecisions,k(i=>this.mapToExplicitDecision(i)));return CM.createConfigurationRejectedDecisionsConflict(r)}).with({type:rt.DecisionsToRespectInvalid},()=>({type:Oe.DecisionsToRespectInvalid})).with({type:rt.ServiceError},()=>({type:Oe.ServiceError})).with({type:rt.CommunicationError},()=>({type:Oe.CommunicationError})).with({type:rt.Unknown},()=>({type:Oe.Unknown})).with({type:rt.ConfigurationModelInvalid},()=>({type:Oe.ConfigurationModelInvalid})).with({type:rt.ConfigurationInitializationFailure},()=>({type:Oe.ConfigurationInitializationFailure})).with({type:rt.ConfigurationModelNotFeasible},n=>({type:Oe.ConfigurationModelNotFeasible,constraintExplanations:g(n.constraintExplanations,k(r=>this.mapToConstraintExplanation(r)))})).with({type:rt.ConfigurationSetManyConflict},n=>({type:Oe.ConfigurationSetManyConflict,decisionExplanations:g(n.decisionExplanations,k(r=>this.mapToDecisionExplanation(r))),constraintExplanations:g(n.constraintExplanations,k(r=>this.mapToConstraintExplanation(r)))})).exhaustive()}mapToConfiguration(e){return{isSatisfied:e.isSatisfied,attributes:g(e.attributes,k(n=>this.mapToAttribute(n)))}}mapToDecisionsToRespect(e){return g(e,L(Wn(k(n=>({attributeId:this.mapToGlobalAttributeId(n.attributeId),decisions:g(n.decisions,k(r=>this.mapToGlobalAttributeId(r)))})))),_e)}mapToGlobalAttributeId(e){return{localId:e.localId,sharedConfigurationModelId:e.sharedConfigurationModel,componentPath:[...e.componentPath??[]]}}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}mapToConfigurationModelSource(e){return H(e).with({type:$a.Package},n=>({type:Lr.Package,configurationModelPackage:n.configurationModelPackage})).with({type:$a.Channel},n=>({type:Lr.Channel,deploymentName:n.deploymentName,channel:n.channel})).exhaustive()}mapToExplicitDecision(e){return H(e).with({type:at.ChoiceValue},n=>({type:ee.Choice,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.state,L(r=>this.mapToChoiceValueDecisionState(r)),_e),choiceValueId:n.choiceValueId})).with({type:at.Component},n=>({type:ee.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.state,L(r=>this.mapToComponentDecisionState(r)),_e)})).with({type:at.Numeric},n=>({type:ee.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.value,_e)})).with({type:at.Boolean},n=>({type:ee.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.value,_e)})).exhaustive()}mapToCardinality(e){return H(e).with(ro.Cardinality,()=>Ns.Cardinality).with(ro.Component,()=>Ns.Component).with(ro.Rule,()=>Ns.Rule).exhaustive()}mapToCausedByAttributeDecision(e){return H(e).with({type:at.ChoiceValue},n=>this.mapToCausedByChoiceAttributeDecision(n)).with({type:at.Numeric},n=>this.mapToCausedByNumericAttributeDecision(n)).with({type:at.Boolean},n=>this.mapToCausedByBooleanAttributeDecision(n)).with({type:at.Component},n=>this.mapToCausedByComponentAttributeDecision(n)).exhaustive()}mapToCausedByChoiceAttributeDecision(e){return{type:ee.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToChoiceValueDecisionState(e.state)}}mapToCausedByNumericAttributeDecision(e){return{type:ee.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state}}mapToCausedByBooleanAttributeDecision(e){return{type:ee.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state}}mapToCausedByComponentAttributeDecision(e){return{type:ee.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToComponentDecisionState(e.state)}}mapToSelection(e){return H(e).with(xi.Mandatory,()=>xa.Mandatory).with(xi.Optional,()=>xa.Optional).exhaustive()}mapToAttribute(e){const n={id:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,canContributeToConfigurationSatisfaction:e.canContributeToConfigurationSatisfaction};return H(e).with({type:Bt.Boolean},r=>({...n,type:ee.Boolean,decision:g(r.decision,L(i=>({state:i.state,kind:this.mapToDecisionKind(i.kind)})),Rr),selection:this.mapToSelection(r.selection),possibleDecisionStates:r.possibleDecisionStates})).with({type:Bt.Numeric},r=>({...n,type:ee.Numeric,decision:g(r.decision,L(i=>({state:i.state,kind:this.mapToDecisionKind(i.kind)})),Rr),range:r.range,decimalPlaces:r.decimalPlaces,selection:this.mapToSelection(r.selection)})).with({type:Bt.Choice},r=>({...n,type:ee.Choice,cardinality:r.cardinality,values:g(r.values,k(i=>{const o=g(i.decision,L(a=>({state:this.mapToChoiceValueDecisionState(a.state),kind:this.mapToDecisionKind(a.kind)})),Rr);return{id:i.choiceValueId,possibleDecisionStates:g(i.possibleDecisionStates,k(a=>this.mapToChoiceValueDecisionState(a))),decision:o}}))})).with({type:Bt.Component},r=>({...n,type:ee.Component,decision:g(r.decision,L(i=>({state:this.mapToComponentDecisionState(i.state),kind:this.mapToDecisionKind(i.kind)})),Rr),possibleDecisionStates:g(r.possibleDecisionStates,k(i=>this.mapToComponentDecisionState(i))),selection:g(r.selection,pt,L(i=>this.mapToSelection(i)),_e),inclusion:this.mapToInclusion(r.inclusion)})).exhaustive()}mapToInclusion(e){return H(e).with(Ai.Always,()=>Aa.Always).with(Ai.Optional,()=>Aa.Optional).exhaustive()}mapToComponentDecisionState(e){return H(e).with(ge.Included,()=>Ze.Included).with(ge.Excluded,()=>Ze.Excluded).exhaustive()}mapToChoiceValueDecisionState(e){return H(e).with(ge.Included,()=>Gr.Included).with(ge.Excluded,()=>Gr.Excluded).exhaustive()}mapToDecisionKind(e){return H(e).with(ce.Explicit,()=>be.Explicit).with(ce.Implicit,()=>be.Implicit).exhaustive()}mapToUsageRuleParameters(e){return e}}class YM{constructor(e,n){this.contractToDomainMapper=new JM,this.domainToContractMapper=new Mg,this.sessionHandler=e,this.internalConfigurationSessionCreator=n}async createSession(e){const n=this.configurationSessionFrom(e);return await g(this.sessionHandler.recreate(n),ye(r=>{const i=this.internalConfigurationSessionCreator(this.sessionHandler,r);return new KM(i,this.contractToDomainMapper,this.domainToContractMapper)}),eu(r=>{const i=this.domainToContractMapper.mapToFailureResult(r);return Promise.reject(i)},r=>Promise.resolve(r)))()}configurationSessionFrom(e){return{context:this.contractToDomainMapper.mapToSessionContext(e),sessionId:it,configuration:{isSatisfied:!1,attributes:[]},solutions:[]}}}function Rg(t){return t.possibleDecisionStates.some(e=>e===Gr.Included)}function XM(t){return!Rg(t)}function ZM(t){return H(t).with({type:ee.Choice},e=>e.cardinality.lowerBound>0).otherwise(()=>!0)}function QM(t){return H(t).with({type:ee.Choice},e=>e.cardinality.upperBound>1).otherwise(()=>!1)}function tR(t){return g(t.values,za(Rg))}function eR(t){return g(t.values,za(XM))}function nR(t,e){return g(t.values,yg(n=>g(n.decision,pt,Qe(r=>r.kind===e))))}function _g(t){return g(t.values,za(e=>g(e.decision,pt,L(n=>n.state===Gr.Included),Wt(()=>!1))))}const rR=_g;function iR(t){return g(t.decision,pt,Qe(e=>e.kind===be.Explicit),Rr)}function oR(t){return g(t.decision,pt,Qe(e=>e.kind===be.Explicit),Rr)}function aR(t,e){return t.possibleDecisionStates.some(n=>n===e)}function sR(t){return g(t.decision,pt,Rr)}function jg(t){return qg(t,Ze.Included)}function uR(t){return!jg(t)}function qg(t,e){return t.possibleDecisionStates.some(n=>n===e)}const oa=Object.freeze(Object.defineProperty({__proto__:null,getAllowedChoiceValues:tR,getBlockedChoiceValues:eR,getBooleanDecision:oR,getChoiceDecisions:nR,getComponentDecision:sR,getIncludedChoiceValues:_g,getNumericDecision:iR,getSelectedChoiceValues:rR,isBooleanValuePossible:aR,isComponentAllowed:jg,isComponentBlocked:uR,isComponentStatePossible:qg,isMandatory:ZM,isMultiSelect:QM},Symbol.toStringTag,{value:"Module"}));Er.whyIsNotSatisfied,xr.configuration;const cR="https://spc.cloud.ceventis.de/api/engine",lR={hcaEngineBaseUrl:cR};function fR(t){return{hcaEngineBaseUrl:t.hcaEngineBaseUrl??lR.hcaEngineBaseUrl,sessionHandler:t.sessionHandler}}function zo(t){if(t==null)throw new Error("Implementation Error: Unexpected null value encountered");return t}const kg=t=>e=>n=>g(n,DN(r=>t.equals(r,e)),L(r=>g(n,ON(r,i=>e))),Ul,Wt(()=>g(n,ht(PN(e))))),hs=kg({equals:(t,e)=>Le.equals(t.attributeId,e.attributeId)}),dR=kg({equals:(t,e)=>t.choiceValueId===e.choiceValueId});class hR{constructor(e){this.restToDomainMapper=e}updateConfigurationSession(e,n){const r=this.updateConfigurationModel(e.configuration,n);return{...e,configuration:r}}updateConfigurationModel(e,n){var r,i,o,a,u,s,c,l,d;const f=g(((r=n.affectedDecisions)==null?void 0:r.choiceValueDecisions)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),h=g(((i=n.consequences)==null?void 0:i.choiceConsequences)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),v=g(((o=n.affectedDecisions)==null?void 0:o.componentDecisions)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),p=g(((a=n.consequences)==null?void 0:a.componentConsequences)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),S=g(((u=n.affectedDecisions)==null?void 0:u.numericDecisions)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),C=g(((s=n.consequences)==null?void 0:s.numericConsequences)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),w=g(((c=n.affectedDecisions)==null?void 0:c.booleanDecisions)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),T=g(((l=n.consequences)==null?void 0:l.booleanConsequences)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),I=g([],ht(g(w,k(b=>b.attributeId))),ht(g(T,k(b=>b.attributeId))),ht(g(S,k(b=>b.attributeId))),ht(g(C,k(b=>b.attributeId))),ht(g(f,k(b=>b.attributeId))),ht(g(h,k(b=>b.attributeId))),ht(g(v,k(b=>b.attributeId))),ht(g(p,k(b=>b.attributeId))),Xi(Le)),x=g(I,Bl(e.attributes,(b,E)=>{const P=e.attributes.find(A=>Le.equals(A.attributeId,E));return H(P).with({type:Bt.Choice},(A,U)=>{const M=this.mergeChoice(U,g(h,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)),g(f,za($=>Le.equals($.attributeId,E)),k($=>$.payload)));return hs(M)(b)}).with({type:Bt.Numeric},(A,U)=>{const M=this.mergeNumeric(U,g(C,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)),g(S,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)));return hs(M)(b)}).with({type:Bt.Boolean},(A,U)=>{const M=this.mergeBoolean(U,g(T,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)),g(w,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)));return hs(M)(b)}).with({type:Bt.Component},(A,U)=>{const M=this.mergeComponent(U,g(p,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)),g(v,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)));return hs(M)(b)}).exhaustive()}));return{...e,isSatisfied:g((d=n.consequences)==null?void 0:d.isConfigurationSatisfied,pt,Wt(()=>e.isSatisfied)),attributes:x}}mergeChoice(e,n,r){const i=g(n,L(s=>s.values??[]),Wt(()=>[])),o=g(r),a=g([],ht(g(i,k(s=>s.choiceValueId))),ht(g(o,k(s=>s.choiceValueId))),k(zo),Xi(oe)),u=g(a,Bl(e.values,(s,c)=>{const l=g(i,Ge(v=>v.choiceValueId===c)),d=g(o,Ge(v=>v.choiceValueId===c)),f=g(e.values.find(v=>v.choiceValueId===c),pt),h=this.mergeChoiceValue(c,f,l,d);return dR(h)(s)}));return{...e,isSatisfied:g(n,L(s=>zo(s.isSatisfied)),Wt(()=>e.isSatisfied)),values:u}}mergeChoiceValue(e,n,r,i){const o=g(i,L(u=>({state:this.toDecisionState(zo(u.state)),kind:this.toDecisionKind(zo(u.kind))})),Wt(()=>({state:g(n,Nn(u=>g(u.decision,L(s=>s.state)))),kind:g(n,Nn(u=>g(u.decision,L(s=>s.kind))),Wt(()=>ce.Explicit))}))),a=g(r,L(u=>g(Gh(u.possibleDecisionStates??[]),k(s=>this.toPossibleDecisionState(s)),zn)),Wt(()=>g(n,L(u=>u.possibleDecisionStates??[]),Wt(()=>[]))));return{choiceValueId:e,decision:g(o.state,L(u=>({state:u,kind:o.kind}))),possibleDecisionStates:a}}mergeComponent(e,n,r){const i=g(r,L(a=>{const u=this.toDecisionState(zo(a.state));return g(u,L(s=>({state:s,kind:this.toDecisionKind(a.kind)})))}),Wt(()=>g(e.decision,L(a=>({state:a.state,kind:a.kind}))))),o=g(n,L(a=>g(Gh(a.possibleDecisionStates??[]),k(u=>this.toPossibleDecisionState(u)),zn)),Wt(()=>e.possibleDecisionStates));return{...e,isSatisfied:g(n,L(a=>a.isSatisfied),Wt(()=>e.isSatisfied)),possibleDecisionStates:o,decision:i}}mergeNumeric(e,n,r){return{...e,isSatisfied:g(n,Nn(i=>pt(i.isSatisfied)),Wt(()=>e.isSatisfied)),decision:g(r,Vr(()=>e.decision,i=>g(i.state,pt,L(o=>({kind:this.toDecisionKind(i.kind),state:o})))))}}mergeBoolean(e,n,r){return{...e,isSatisfied:g(n,Nn(i=>pt(i.isSatisfied)),Wt(()=>e.isSatisfied)),decision:g(r,Vr(()=>e.decision,i=>g(i.state,pt,L(o=>({kind:this.toDecisionKind(i.kind),state:o}))))),possibleDecisionStates:g(n,L(i=>i.possibleDecisionStates),Wt(()=>e.possibleDecisionStates))}}toPossibleDecisionState(e){return H(e).with($i.Included,()=>Tt(ge.Included)).with($i.Excluded,()=>Tt(ge.Excluded)).otherwise(()=>it)}toDecisionState(e){return H(e).with(cr.Included,()=>Tt(ge.Included)).with(cr.Excluded,()=>Tt(ge.Excluded)).otherwise(()=>it)}toDecisionKind(e){return H(e).with(Da.Implicit,()=>ce.Implicit).with(Da.Explicit,()=>ce.Explicit).exhaustive()}}class pR{mapSessionToExplicitDecisions(e){return this.mapToExplicitDecisionsInner(e.configuration.attributes)}mapToExplicitDecision(e){return H(e).with({type:at.ChoiceValue},n=>({type:ln.Choice,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToDecisionState(n.state)})).with({type:at.Component},n=>({type:ln.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:this.mapToDecisionState(n.state)})).with({type:at.Numeric},n=>({type:ln.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.value,_e)})).with({type:at.Boolean},n=>({type:ln.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.value,_e)})).exhaustive()}mapToExplicitDecisions(e,n){const r=this.mapToMode(n),i=g([...e],Cr(s=>s.type!==at.Boolean?it:Tt({type:ln.Boolean,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:g(s.value,_e)}))),o=g([...e],Cr(s=>s.type!==at.Numeric?it:Tt({type:ln.Numeric,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:g(s.value,_e)}))),a=g([...e],Cr(s=>s.type!==at.ChoiceValue?it:Tt({type:ln.Choice,attributeId:this.mapToGlobalAttributeId(s.attributeId),choiceValueId:s.choiceValueId,state:this.mapToDecisionState(s.state)}))),u=g([...e],Cr(s=>s.type!==at.Component?it:Tt({type:ln.Component,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:this.mapToDecisionState(s.state)})));return{mode:r,choiceDecisions:a,numericDecisions:o,booleanDecisions:i,componentDecisions:u}}mapToExplicitDecisionsInner(e){const n=g([...e],Cr(a=>a.type!==Bt.Boolean?it:g(a.decision,Qe(u=>u.kind===ce.Explicit),L(()=>this.mapToExplicitBooleanDecision(a))))),r=g([...e],Cr(a=>a.type!==Bt.Numeric?it:g(a.decision,Qe(u=>u.kind===ce.Explicit),L(()=>this.mapToExplicitNumericDecision(a))))),i=g([...e],Cr(a=>a.type!==Bt.Component?it:g(a.decision,Qe(u=>u.kind===ce.Explicit),L(()=>this.mapToExplicitComponentDecision(a))))),o=g([...e],Cr(a=>a.type!==Bt.Choice?it:g(this.mapToExplicitChoiceDecisions(a),sN(u=>g(u,ic)))),BN);return{booleanDecisions:n,numericDecisions:r,choiceDecisions:o,componentDecisions:i}}mapToMode(e){return H(e).with({type:"Default"},n=>({type:"Default"})).with({type:"DropExistingDecisions"},n=>this.mapToDropExistingDecisionsMode(n)).exhaustive()}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:g(e.componentPath,pt,L(Lh),Rr),sharedConfigurationModelId:e.sharedConfigurationModel}}mapToDropExistingDecisionsMode(e){return{type:"DropExistingDecisions",conflictResolution:H(e.conflictHandling).with({type:"Manual",includeConstraintsInConflictExplanation:Mt.boolean},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).otherwise(()=>({type:"Automatic"}))}}mapToExplicitBooleanDecision(e){return{type:ln.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:g(e.decision,L(n=>n.state),_e)}}mapToExplicitNumericDecision(e){return{type:ln.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:g(e.decision,L(n=>n.state),_e)}}mapToExplicitComponentDecision(e){return{type:ln.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToDecisionState(g(e.decision,L(n=>n.state)))}}mapToExplicitChoiceDecisions(e){function n(r){return g(r.decision,L(i=>i.kind===ce.Explicit),Wt(()=>!1))}return g(e.values,za(n),k(r=>({type:ln.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:r.choiceValueId,state:this.mapToDecisionState(g(r.decision,L(i=>i.state)))})),Lh)}mapToDecisionState(e){return g(e,L(n=>H(n).with(ge.Included,()=>cr.Included).with(ge.Excluded,()=>cr.Excluded).exhaustive()),Wt(()=>cr.Undefined))}mapToPossibleDecisionState(e){return H(e).with(ge.Included,()=>$i.Included).with(ge.Excluded,()=>$i.Excluded).exhaustive()}mapToWhyNotSatisfiedRequest(e){return H(e).with({subject:je.attribute},n=>({type:Wl.Attribute,attributeId:this.mapToGlobalAttributeId(n.attributeId)})).with({subject:je.configuration},()=>({type:Wl.Configuration})).exhaustive()}mapToWhyStateNotPossibleRequest(e){return H(e).with({subject:je.boolean},n=>({type:ia.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:n.state})).with({subject:je.numeric},n=>({type:ia.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:n.state})).with({subject:je.component},n=>({type:ia.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:this.mapToPossibleDecisionState(n.state)})).with({subject:je.choiceValue},n=>({type:ia.ChoiceValue,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToPossibleDecisionState(n.state)})).exhaustive()}}class vR{constructor(){this.configurationSession={hasExplicitDecisions(e){return g(e.configuration.attributes,Ge(n=>H(n).with({type:Bt.Boolean},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),ra)).with({type:Bt.Numeric},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),ra)).with({type:Bt.Choice},r=>g(r.values,Ge(i=>g(i.decision,L(o=>o.kind===ce.Explicit),Wt(()=>!1))),ra)).with({type:Bt.Component},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),ra)).exhaustive()),Vr(()=>!1,()=>!0))},getExplicitDecisions(e){return g(e.configuration.attributes,k(n=>H(n).with({type:Bt.Boolean},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),L(i=>({type:at.Boolean,attributeId:r.attributeId,value:pt(i.state)})),L(i=>[i]))).with({type:Bt.Numeric},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),L(i=>({type:at.Numeric,attributeId:r.attributeId,value:pt(i.state)})),L(i=>[i]))).with({type:Bt.Choice},r=>g(r.values,k(i=>g(i.decision,Qe(o=>o.kind===ce.Explicit),L(o=>({type:at.ChoiceValue,attributeId:r.attributeId,choiceValueId:i.choiceValueId,state:pt(o.state)})))),zn,qr)).with({type:Bt.Component},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),L(i=>({type:at.Component,attributeId:r.attributeId,state:pt(i.state)})),L(i=>[i]))).exhaustive()),zn,RN)}}}}class yR{constructor(e,n,r,i,o,a){this.engineApiClient=n,this.domainToRestMapper=i,this.restToDomainMapper=r,this.domainToContractMapper=o,this.domainUpdater=a,this.sessionHandler=e,this.interpreter=new vR}close(e){return this.sessionHandler.close(e)}recreate(e){return this.initializeInner(e,!1)}reinitialize(e){return this.initializeInner(e,!0)}makeDecision(e,n){const r=this.domainToRestMapper.mapToExplicitDecision(e);return this.withSession(n,(i,o)=>g(this.engineApiClient.makeDecision(i,r),On(ir),ye(a=>this.domainUpdater.updateConfigurationSession(o,a))))}explain(e,n){return this.withSession(n,r=>{const i=H(e).with({question:pn.whyIsNotSatisfied},o=>this.explainWhyNotSatisfied(o,r)).with({question:pn.whyIsStateNotPossible},o=>this.explainWhyStateNotPossible(o,r)).exhaustive();return g(i,On(ir),ye(o=>this.restToDomainMapper.mapToExplainAnswer(o,e)))})}setMany(e,n,r){return this.withSession(r,(i,o)=>{const a=this.setManyInner(e,n,i);return g(a,$n(u=>{var s,c,l,d;const f=g([],ht(g(((s=u.rejectedDecisions)==null?void 0:s.booleanDecisions)??[],k(h=>this.restToDomainMapper.mapToBooleanDecision(h)))),ht(g(((c=u.rejectedDecisions)==null?void 0:c.numericDecisions)??[],k(h=>this.restToDomainMapper.mapToNumericDecision(h)))),ht(g(((l=u.rejectedDecisions)==null?void 0:l.componentDecisions)??[],k(h=>this.restToDomainMapper.mapToComponentDecision(h)))),ht(g(((d=u.rejectedDecisions)==null?void 0:d.choiceValueDecisions)??[],k(h=>this.restToDomainMapper.mapToExplicitChoiceValueDecision(h)))));return g(f,ic)?ur(_M.createConfigurationRejectedDecisionsConflict(f)):Zi(this.domainUpdater.updateConfigurationSession(o,u))}))})}replaceDecisions(e,n){const r=this.interpreter.configurationSession.getExplicitDecisions(n),i=this.setManyInner(r,{type:"DropExistingDecisions",conflictHandling:{type:"Automatic"}},e);return g(i,ye(o=>({})))}setManyInner(e,n,r){const i=this.domainToRestMapper.mapToExplicitDecisions(e,n),o=this.engineApiClient.setMany(r,i);return g(o,On(ir),$n(a=>{const u={rejectedDecisions:{booleanDecisions:Mt.array(Mt.any)}},s={decisionExplanations:Mt.array(Mt.any)};return H(a).with(u,c=>Mo(c)).with(s,c=>ur(this.restToDomainMapper.mapToConfigurationSetManyConflictFailure(c,i,n))).otherwise(()=>ur({type:rt.Unknown}))}))}explainWhyStateNotPossible(e,n){const r=this.domainToRestMapper.mapToWhyStateNotPossibleRequest(e);return this.engineApiClient.getWhyStateNotPossible(n,r)}explainWhyNotSatisfied(e,n){const r=this.domainToRestMapper.mapToWhyNotSatisfiedRequest(e);return this.engineApiClient.getWhyNotSatisfied(n,r)}withSession(e,n){return g(Zi(e),$n(r=>g(r.sessionId,Vr(()=>this.initializeInner(r,!1),()=>Zi(r)))),$n(r=>g(r.sessionId,ad(()=>({type:rt.ConfigurationUnauthenticated})),$n(i=>n(i,r)))))}initializeInner(e,n){return g(wP,()=>g(e.sessionId,tM,nM(r=>n?QP(r):g(this.sessionHandler.close(r),eu(()=>it,()=>it)))),r=>{const i=this.domainToContractMapper.mapToSessionContext(e.context);return g(r,yP(()=>({type:rt.ConfigurationUnauthenticated})),Cg(()=>this.sessionHandler.create(i)))},r=>g(r,TP(i=>g(qr(e),Qe(this.interpreter.configurationSession.hasExplicitDecisions),L(o=>this.replaceDecisions(i,o)),Wt(()=>Zi({}))))),r=>g(r,$n(i=>{const o=this.determineConsequences(i),a=this.determineDecisions(i),u=JO(bP)({consequences:o,decisions:a});return g(u,ye(({decisions:s,consequences:c})=>this.restToDomainMapper.mapToConfigurationModel(s,c)),ye(s=>({sessionId:qr(i),configuration:s,context:e.context,solutions:[]})))})))}determineDecisions(e){return g(this.engineApiClient.getDecisions(e),On(ir))}determineConsequences(e){return g(this.engineApiClient.getConsequence(e),On(ir))}}class mR{constructor(e,n){this.onConfigurationChangedHandler=it,this.sessionHandler=e,this.configurationSession=n}setOnConfigurationChangedHandler(e){this.onConfigurationChangedHandler=e}getSessionContext(){return this.configurationSession.context}getConfiguration(){return this.configurationSession.configuration}explain(e){return g(this.sessionHandler.explain(e,this.configurationSession),this.updateAvailableSolutionsIfRight(n=>this.deriveSolutionsFromExplainAnswer(n)),this.invalidateAvailableSolutionsIfLeft())}setSessionContext(e){return g(this.sessionHandler.recreate({...this.configurationSession,context:e}),this.updateSession())}invalidateSessionId(){this.configurationSession={...this.configurationSession,sessionId:it}}restoreConfiguration(e){return g(this.sessionHandler.reinitialize({...this.configurationSession,configuration:e}),this.updateSession())}makeDecision(e){return g(this.sessionHandler.makeDecision(e,this.configurationSession),this.updateSession())}close(){return g(this.configurationSession.sessionId,L(e=>this.sessionHandler.close(e)),L(Wn(ye(e=>{this.configurationSession={...this.configurationSession,sessionId:it}}))),Wt(Zu(IM())))}applySolution(e){return g(this.configurationSession.solutions,Ge(n=>MM.equals(n,e)),ad(()=>({type:rt.ConfigurationSolutionNotAvailable})),ye(n=>n.decisions),$n(n=>this.setMany(n,e.mode)))}setMany(e,n){return g(this.sessionHandler.setMany(e,n,this.configurationSession),this.updateSession(),nu(r=>()=>{const i=H(r).with({decisionExplanations:Mt.array(Mt.any)},o=>Tt(o.decisionExplanations)).otherwise(()=>it);this.configurationSession={...this.configurationSession,solutions:g(i,L(Wn(k(o=>o.solution))),Wt(()=>[]))}}))}deriveSolutionsFromExplainAnswer(e){const n=H(e).with({decisionExplanations:Mt.array(Mt.any)},r=>r.decisionExplanations).otherwise(()=>[]);return g(n,k(r=>r.solution))}invalidateAvailableSolutions(){return dM(()=>()=>{this.configurationSession={...this.configurationSession,solutions:[]}})}invalidateAvailableSolutionsIfLeft(){return nu(()=>()=>{this.configurationSession={...this.configurationSession,solutions:[]}})}updateAvailableSolutionsIfRight(e){return Ea(n=>()=>{this.configurationSession={...this.configurationSession,solutions:e(n)}})}updateSession(){return Wn(Ea(e=>()=>{this.configurationSession=e,g(this.onConfigurationChangedHandler,pM(n=>()=>n(this.configurationSession.configuration)))}),ye(e=>e.configuration),this.invalidateAvailableSolutions())}}class gR{constructor(e){this.inner=e;const n=3,r=2e3,i=200;this.policy=aM(r,iM.concat(sM(i),oM(n)))}getSessionContext(){return this.inner.getSessionContext()}close(){return this.inner.close()}setSessionContext(e){const n=()=>this.inner.setSessionContext(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}makeDecision(e){const n=()=>this.inner.makeDecision(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}restoreConfiguration(e){const n=()=>this.inner.restoreConfiguration(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}explain(e){const n=()=>this.inner.explain(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}applySolution(e){const n=()=>this.inner.applySolution(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}setMany(e,n){const r=()=>this.inner.setMany(e,n);return Gi(this.policy,r,i=>g(i,ci(o=>this.determineAndPrepareRetry(o),()=>!1)))}setOnConfigurationChangedHandler(e){this.inner.setOnConfigurationChangedHandler(e)}invalidateSessionId(){this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}determineAndPrepareRetry(e){return H(e).with({type:rt.ConfigurationUnauthenticated},()=>(this.invalidateSessionId(),!0)).with({type:rt.ConfigurationTimeout},()=>!0).otherwise(()=>!1)}}class bR{constructor(){this.queue=[],this.operating=it}push(e){const n=new SR(e);return this.queue.push(n),this.operating=g(this.operating,Wt(()=>this.start()),qr),n.promise}async start(){for(;this.queue.length;){const e=[...this.queue];this.queue=[];const n=g(e,k(r=>r.argument),Bl(it,(r,i)=>this.reduce(r,i)),L(Wn(r=>this.execute(r),r=>r.then(i=>{g(e,k(o=>{o.resolve(i)}))}).catch(i=>{g(e,k(o=>{o.reject(i)}))}))),_e);n&&await n}this.operating=it}async flush(){return this.operating||Promise.resolve()}size(){return this.queue.length}}class SR{constructor(e){this.resolve=()=>{},this.reject=()=>{},this.argument=e,this.promise=new Promise((n,r)=>{this.resolve=n,this.reject=r})}}class CR extends bR{constructor(e){super(),this.inner=e}reduce(e,n){return Tt(n)}async execute(e){return await this.inner.setSessionContext(e)()}}class wR{constructor(e){this.inner=e,this.setContextReducingTaskExecutor=new CR(e)}getSessionContext(){return this.inner.getSessionContext()}setSessionContext(e){const n=this.inner.getSessionContext();if(xM.equals(n,e))return Mo(this.getConfiguration());const r=this.setContextReducingTaskExecutor.push(e);return()=>r}applySolution(e){return this.inner.applySolution(e)}close(){return this.inner.close()}makeDecision(e){return this.inner.makeDecision(e)}restoreConfiguration(e){return this.inner.restoreConfiguration(e)}setMany(e,n){return this.inner.setMany(e,n)}explain(e){return this.inner.explain(e)}invalidateSessionId(){return this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}setOnConfigurationChangedHandler(e){return this.inner.setOnConfigurationChangedHandler(e)}}class TR{constructor(e,n=!1){this.stringify=n,this.inner=e,this.durationNumberFormat=new Intl.NumberFormat("en-EN",{maximumFractionDigits:3})}withLogging(e,n,r){const i=performance.now(),o=()=>{const a=performance.now()-i;return this.durationNumberFormat.format(a)};return console.debug(`Operation ${e} started with`,this.renderAsRequired(n)),g(r(),nu(a=>()=>{console.debug(`Operation ${e} completed after ${o()}ms with failure`,this.renderAsRequired(a))}),Ea(a=>()=>{console.debug(`Operation ${e} completed after ${o()}ms with success`,this.renderAsRequired(a))}))}renderAsRequired(e){return this.stringify?JSON.stringify(e,null,2):e}explain(e){return this.withLogging("explain",[e],()=>this.inner.explain(e))}getSessionContext(){return this.inner.getSessionContext()}setSessionContext(e){return this.withLogging("setSessionContext",[e],()=>this.inner.setSessionContext(e))}applySolution(e){return this.withLogging("applySolution",[e],()=>this.inner.applySolution(e))}close(){return this.inner.close()}makeDecision(e){return this.withLogging("makeDecision",[e],()=>this.inner.makeDecision(e))}restoreConfiguration(e){return this.withLogging("restoreConfiguration",[e],()=>this.inner.restoreConfiguration(e))}setMany(e,n){return this.withLogging("setMany",[e,n],()=>this.inner.setMany(e,n))}invalidateSessionId(){return this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}setOnConfigurationChangedHandler(e){return this.inner.setOnConfigurationChangedHandler(e)}}function IR(t){t=fR(t);const e=new HM(t.hcaEngineBaseUrl),n=new Pg,r=new pR,i=new Mg,o=new wM,a=new hR(n),u=H(t.sessionHandler).with({create:Mt.any,close:Mt.any},l=>l).with({accessToken:Mt.string},l=>new LM(e,o,n,l)).with({sessionCreateUrl:Mt.string,sessionDeleteUrl:Mt.string},l=>new WM(o,l)).exhaustive(),s=new yR(u,e,n,r,i,a),c=(l,d)=>g(new mR(l,d),f=>new gR(f),f=>new wR(f),f=>new TR(f,!1));return new YM(s,c)}Ka.equals;vM.equals;yM.equals;function ER(t){var e=[];if(t.length===0)return"";if(typeof t[0]!="string")throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var i=t[r];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(r>0&&(i=i.replace(/^[\/]+/,"")),r<t.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/");o=o.replace(/\/(\?|&|#[^!])/g,"$1");var a=o.split("?");return o=a.shift()+(a.length>0?"?":"")+a.join("&"),o}function xR(){var t;return typeof arguments[0]=="object"?t=arguments[0]:t=[].slice.call(arguments),ER(t)}function _o(){return yt.RenderTarget.current()!==yt.RenderTarget.preview}const AR=No.div`
199
- > * {
200
- width: 100% !important;
201
- height: 100% !important;
198
+ ${JSON.stringify(t,null,2)}`)}var da=(t=>(t.ConfigurationEngineRestApiUnauthorized="Generic::Unauthorized",t.ClientError="Generic::LocalClientError",t.ServerError="Generic::ServerError",t.UnhandledResponseStatus="LocalUnhandledResponseStatus",t.LowLevelCommunicationError="LocalLowLevelCommunicationError",t))(da||{}),Ng=(t=>(t.BooleanAttributeNotFound="BooleanAttributeNotFound",t.ChoiceAttributeNotFound="ChoiceAttributeNotFound",t.ChoiceValueNotFound="ChoiceValueNotFound",t.ConfigurationInitializationFailure="InitializationFailure",t.ConfigurationModelInvalid="ConfigurationModelInvalid",t.LegacyConfigurationModelInvalid="DeploymentStore.Core.Store.SnapshotInvalid",t.LegacySnapshotInvalid="SnapshotInvalid",t.ConfigurationModelNotFeasible="ConfigurationModelNotFeasible",t.ConfigurationModelNotFound="ConfigurationModelNotFound",t.ConflictWithConsequence="ConflictWithConsequence",t.DecisionInvalid="DecisionInvalid",t.DecisionsToRespectInvalid="DecisionsToRespectInvalid",t.NumericAttributeNotFound="NumericAttributeNotFound",t.NumericDecisionOutOfRange="NumericDecisionOutOfRange",t.SessionNotFound="SessionNotFound",t.SetDecisionConflict="SetDecisionConflict",t.Unauthorized="Unauthorized",t))(Ng||{});const UM=t=>Object.values(Ng).includes(t),BM=t=>UM(t)?Tt(t):it;function VM(t){return g(t,BM,L(e=>H(e).with("ConfigurationModelNotFound",()=>({type:rt.ConfigurationModelNotFound})).with("DecisionsToRespectInvalid",()=>({type:rt.DecisionsToRespectInvalid})).with(Mt.union("ChoiceAttributeNotFound","NumericAttributeNotFound","BooleanAttributeNotFound"),()=>({type:rt.ConfigurationAttributeNotFound})).with("ChoiceValueNotFound",()=>({type:rt.ConfigurationChoiceValueNotFound})).with("DecisionInvalid",()=>({type:rt.ConfigurationConflict})).with("NumericDecisionOutOfRange",()=>({type:rt.ConfigurationConflict,reason:ud.NumericDecisionOutOfRange})).with("ConflictWithConsequence",()=>({type:rt.ConfigurationConflict})).with(Mt.union("SessionNotFound","Unauthorized"),()=>({type:rt.ConfigurationUnauthenticated})).with("ConfigurationModelInvalid",()=>({type:rt.ConfigurationModelInvalid})).with("DeploymentStore.Core.Store.SnapshotInvalid",()=>({type:rt.ConfigurationModelInvalid})).with("SnapshotInvalid",()=>({type:rt.ConfigurationModelInvalid})).with("InitializationFailure",()=>({type:rt.ConfigurationInitializationFailure})).with("ConfigurationModelNotFeasible",n=>({type:rt.ConfigurationModelNotFeasible,constraintExplanations:[]})).with("SetDecisionConflict",()=>({type:rt.ConfigurationConflict})).exhaustive()))}const FM=t=>Object.values(da).includes(t),LM=t=>FM(t)?Tt(t):it;function GM(t){return g(t,LM,L(e=>H(e).with("Generic::LocalClientError",()=>({type:rt.ConfigurationApplicationError})).with("Generic::ServerError",()=>({type:rt.ServiceError})).with("LocalLowLevelCommunicationError",()=>({type:rt.CommunicationError})).with("Generic::Unauthorized",()=>({type:rt.ConfigurationUnauthenticated})).with("LocalUnhandledResponseStatus",()=>({type:rt.Unknown})).exhaustive()))}function ir(t,e){kM(t,e);const n=t.type;return g(it,Fh(()=>VM(n)),Fh(()=>GM(n)),Wt(()=>(console.error("InterpretEngineError encountered unexpected error type","ProblemDetails",t,"Context",e),{type:rt.Unknown})))}class zM{constructor(e,n,r,i){this.engineApiClient=e,this.contractToRestMapper=n,this.restToDomainMapper=r,this.options=i}create(e){const n=this.contractToRestMapper.mapToCreateSessionRequest(e);return g(this.engineApiClient.createSessionUsingJwtBearer(n,this.options.accessToken),On(r=>ir(r,"ClientSideSessionLifetimeHandler - create")),$n(r=>this.restToDomainMapper.mapToSessionId(r)),EM(()=>({type:rt.ConfigurationUnauthenticated})))}close(e){return g(this.engineApiClient.deleteSessionUsingJwtBearer(e,this.options.accessToken),On(n=>ir(n,"ClientSideSessionLifetimeHandler - close")),ye(()=>Pr()))}}function HM(t){var e=[];if(t.length===0)return"";if(typeof t[0]!="string")throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var i=t[r];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(r>0&&(i=i.replace(/^[\/]+/,"")),r<t.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/");o=o.replace(/\/(\?|&|#[^!])/g,"$1");var a=o.split("?");return o=a.shift()+(a.length>0?"?":"")+a.join("&"),o}function WM(){var t;return typeof arguments[0]=="object"?t=arguments[0]:t=[].slice.call(arguments),HM(t)}var Pg=(t=>(t[t.Ok=200]="Ok",t[t.NoContent=204]="NoContent",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.NotFound=404]="NotFound",t[t.Conflict=409]="Conflict",t))(Pg||{});function nr(t,e,n){const r=g(Array.isArray(t)?t:[t],WM);return g(Hh(()=>fetch(r,e),i=>({type:"error"})),$n(i=>g(Hh(async()=>{const o=await i.json();return{response:i,data:o}},()=>i))),wg(i=>i.status===401?ur({type:da.ConfigurationEngineRestApiUnauthorized,status:401}):i.status===204?Mo({response:i,data:{}}):i.type==="error"?ur({type:da.LowLevelCommunicationError}):ur({type:da.UnhandledResponseStatus})),$n(i=>g(n(i),ad(()=>i.data))))}function Ll(t,e){return nr(t,e,n=>{if(n.response.status===200)return qr(n.data);if(n.response.status===409){const r=n.data;return H(r).with({type:"ConfigurationModelInvalid"},i=>qr(r)).with({type:"ConfigurationModelNotFeasible"},i=>qr(r)).otherwise(()=>it)}return it})}class KM{constructor(e){this.baseUrl=e}createSessionUsingApiKey(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-API-KEY":n},body:JSON.stringify(e)};return Ll([this.baseUrl,"v2/session"],r)}createSessionUsingJwtBearer(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify(e)};return Ll([this.baseUrl,"v2/session"],r)}setMany(e,n){const r={method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return nr([this.baseUrl,"v2/session/configuration/decision/many"],r,i=>i.response.status===200||i.response.status===409?Tt(i.data):it)}makeDecision(e,n){const r={method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return nr([this.baseUrl,"v2/session/configuration/decision"],r,i=>i.response.status===200?Tt(i.data):it)}getDecisions(e){const n={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}};return nr([this.baseUrl,"v2/session/configuration/decision"],n,r=>r.response.status===200?Tt(r.data):it)}getWhyStateNotPossible(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return nr([this.baseUrl,"v2/session/configuration/consequence/explain/why-state-not-possible"],r,i=>i.response.status===200?Tt(i.data):it)}getWhyNotSatisfied(e,n){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e},body:JSON.stringify(n)};return nr([this.baseUrl,"v2/session/configuration/consequence/explain/why-not-satisfied"],r,i=>i.response.status===200?Tt(i.data):it)}getConsequence(e){const n={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}};return nr([this.baseUrl,"v2/session/configuration/consequence"],n,r=>r.response.status===200?Tt(r.data):it)}deleteSessionUsingJwtBearer(e,n){const r={method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`}};return nr([this.baseUrl,`v2/session/${e}`],r,i=>i.response.status===204?Tt({}):it)}}var $i=(t=>(t.Included="Included",t.Excluded="Excluded",t))($i||{}),Gl=(t=>(t.Mandatory="Mandatory",t.Optional="Optional",t))(Gl||{}),zl=(t=>(t.Always="Always",t.Optional="Optional",t))(zl||{}),Da=(t=>(t.Implicit="Implicit",t.Explicit="Explicit",t))(Da||{}),cr=(t=>(t.Included="Included",t.Excluded="Excluded",t.Undefined="Undefined",t))(cr||{}),ln=(t=>(t.Choice="Choice",t.Numeric="Numeric",t.Boolean="Boolean",t.Component="Component",t))(ln||{}),Hl=(t=>(t.NotAvailable="NotAvailable",t.StateNotPossible="StateNotPossible",t))(Hl||{}),Wl=(t=>(t.Attribute="Attribute",t.Configuration="Configuration",t))(Wl||{}),ia=(t=>(t.Boolean="Boolean",t.Numeric="Numeric",t.ChoiceValue="ChoiceValue",t.Component="Component",t))(ia||{});const un=Zn({localId:oe,componentPath:uc(oe),sharedConfigurationModelId:sd(oe)});class Mg{mapToDecisions(e){return{}}mapToSessionId(e){return H(e).with({sessionId:Mt.string},n=>Mo(n.sessionId)).with({type:"ConfigurationModelNotFeasible"},n=>{const r=g(n.constraintExplanations,k(i=>this.mapToConstraintExplanation(i)));return ur({type:rt.ConfigurationModelNotFeasible,constraintExplanations:r})}).with({type:"ConfigurationModelInvalid"},()=>ur({type:rt.ConfigurationModelInvalid})).otherwise(()=>ur({type:rt.Unknown}))}mapToExplainAnswer(e,n){const r=H(n).with({question:pn.whyIsStateNotPossible,subject:je.boolean},a=>[{type:at.Boolean,attributeId:a.attributeId,value:Tt(a.state)}]).with({question:pn.whyIsStateNotPossible,subject:je.numeric},a=>[{type:at.Numeric,attributeId:a.attributeId,value:Tt(a.state)}]).with({question:pn.whyIsStateNotPossible,subject:je.component},a=>[{type:at.Component,attributeId:a.attributeId,state:Tt(a.state)}]).with({question:pn.whyIsStateNotPossible,subject:je.choiceValue},a=>[{type:at.ChoiceValue,attributeId:a.attributeId,choiceValueId:a.choiceValueId,state:Tt(a.state)}]).otherwise(()=>[]),i=g(e.decisionExplanations,k(a=>this.mapToDecisionExplanation(a,r,{type:"Default"}))),o=g(e.constraintExplanations,k(a=>this.mapToConstraintExplanation(a)));return H(n).with({answerType:vi.decisions},()=>({decisionExplanations:i})).with({answerType:vi.constraints},()=>({constraintExplanations:o})).with({answerType:vi.all},()=>({constraintExplanations:o,decisionExplanations:i})).exhaustive()}mapToConfigurationSetManyConflictFailure(e,n,r){const i=this.mapToExplicitDecisions(n);return{type:rt.ConfigurationSetManyConflict,decisionExplanations:g(e.decisionExplanations,k(o=>this.mapToDecisionExplanation(o,i,r))),constraintExplanations:g(e.constraintExplanations,k(o=>this.mapToConstraintExplanation(o)))}}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}mapToConfigurationModel(e,n){const r=this.mapToAttributes(e,n);return{isSatisfied:n.isConfigurationSatisfied??!1,attributes:r}}mapToBooleanDecision(e){return{type:at.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),value:vt(e.state)}}mapToNumericDecision(e){return{type:at.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),value:vt(e.state)}}mapToComponentDecision(e){return{type:at.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToDecisionState(e.state)}}mapToExplicitChoiceValueDecision(e){return{type:at.ChoiceValue,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToDecisionState(e.state)}}mapToGlobalAttributeId(e){return{localId:e.localId,sharedConfigurationModel:e.sharedConfigurationModelId,componentPath:e.componentPath??[]}}mapToChoiceValueDecision(e){return g(this.mapToDecisionState(e.state),L(n=>({kind:this.mapToDecisionKind(e.kind),state:n})))}mapToConstraintExplanation(e){return{causedByRules:g(e.causedByRules,k(n=>this.mapToRuleConstraint(n))),causedByCardinalities:g(e.causedByCardinalities,k(n=>this.mapToCardinalityConstraint(n)))}}mapToRuleConstraint(e){return{type:ro.Rule,ruleId:this.mapToGlobalConstraintId(e.constraintId)}}mapToCardinalityConstraint(e){return{type:ro.Cardinality,attributeId:this.mapToGlobalAttributeId(e.attributeId)}}mapToExplicitDecisions(e){const n=g(e.booleanDecisions??[],k(a=>({type:at.Boolean,attributeId:this.mapToGlobalAttributeId(a.attributeId),value:vt(a.state)}))),r=g(e.numericDecisions??[],k(a=>({type:at.Numeric,attributeId:this.mapToGlobalAttributeId(a.attributeId),value:vt(a.state)}))),i=g(e.componentDecisions??[],k(a=>({type:at.Component,attributeId:this.mapToGlobalAttributeId(a.attributeId),state:g(vt(a.state),L(u=>this.mapToDecisionState(u)),Ul)}))),o=g(e.choiceDecisions??[],k(a=>({type:at.ChoiceValue,attributeId:this.mapToGlobalAttributeId(a.attributeId),choiceValueId:a.choiceValueId,state:g(vt(a.state),L(u=>this.mapToDecisionState(u)),Ul)})));return g([],ht(n),ht(r),ht(i),ht(o))}mapToDecisionExplanation(e,n,r){const i=g(e.causedByBooleanDecisions,k(v=>this.mapToCausedByBooleanDecision(v))),o=g(e.causedByNumericDecisions,k(v=>this.mapToCausedByNumericDecision(v))),a=g(e.causedByComponentDecisions,k(v=>this.mapToCausedByComponentDecision(v))),u=g(e.causedByChoiceDecisions,k(v=>this.mapToCausedByChoiceValueDecision(v))),s=g(i,k(v=>({type:at.Boolean,attributeId:v.attributeId,value:it}))),c=g(o,k(v=>({type:at.Numeric,attributeId:v.attributeId,value:it}))),l=g(a,k(v=>({type:at.Component,attributeId:v.attributeId,state:it}))),d=g(u,k(v=>({type:at.ChoiceValue,attributeId:v.attributeId,choiceValueId:v.choiceValueId,state:it}))),f=g([],ht(s),ht(c),ht(l),ht(d)),h=yg(Po((v,p)=>{const S=Le.equals(v.attributeId,p.attributeId);return H({a:v,b:p}).with({a:{type:at.ChoiceValue},b:{type:at.ChoiceValue}},C=>S&&C.a.choiceValueId===C.b.choiceValueId).otherwise(()=>S)}))(f)(n);return{causedByBooleanDecisions:i,causedByNumericDecisions:o,causedByComponentDecisions:a,causedByChoiceDecisions:u,solution:{decisions:g([],ht(f),ht(h)),mode:r}}}mapToCausedByBooleanDecision(e){return{type:at.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state,reason:this.mapToReason(e.reason)}}mapToReason(e){return H(e).with(Hl.NotAvailable,()=>Fl.NotAvailable).with(Hl.StateNotPossible,()=>Fl.StateNotPossible).exhaustive()}mapToCausedByNumericDecision(e){return{type:at.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state,reason:this.mapToReason(e.reason)}}mapToCausedByComponentDecision(e){return{type:at.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToPossibleDecisionState(e.state),reason:this.mapToReason(e.reason)}}mapToCausedByChoiceValueDecision(e){return{type:at.ChoiceValue,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToPossibleDecisionState(e.state),reason:this.mapToReason(e.reason)}}mapToAttributes(e,n){function r(f){return g(n.canAttributeContributeToConfigurationSatisfaction,Ge(h=>un.equals(h,f)),ra)}const i=g([],ht(g(e.choiceValueDecisions,k(f=>f.attributeId))),ht(g(n.choiceConsequences,k(f=>f.attributeId))),Xi(un)),o=g(i,k(f=>{const h=g(e.choiceValueDecisions??[],GN(p=>un.equals(p.attributeId,f))),v=g(n.choiceConsequences??[],oi(p=>un.equals(p.attributeId,f)));return g(v,L(p=>this.mapToChoiceAttributes(p,h,r(f))))}),zn),a=g([],ht(g(e.numericDecisions,k(f=>f.attributeId))),ht(g(n.numericConsequences,k(f=>f.attributeId))),Xi(un)),u=g(a,k(f=>{const h=g(e.numericDecisions??[],oi(p=>un.equals(p.attributeId,f))),v=g(n.numericConsequences??[],oi(p=>un.equals(p.attributeId,f)));return g(v,L(p=>this.mapToNumericAttribute(p,h,r(f))))}),zn),s=g([],ht(g(e.booleanDecisions,k(f=>f.attributeId))),ht(g(n.booleanConsequences,k(f=>f.attributeId))),Xi(un)),c=g(s,k(f=>{const h=g(e.booleanDecisions??[],oi(p=>un.equals(p.attributeId,f))),v=g(n.booleanConsequences??[],oi(p=>un.equals(p.attributeId,f)));return g(v,L(p=>this.mapToBooleanAttribute(p,h,r(f))))}),zn),l=g([],ht(g(e.componentDecisions,k(f=>f.attributeId))),ht(g(n.componentConsequences,k(f=>f.attributeId))),Xi(un)),d=g(l,k(f=>{const h=g(e.componentDecisions??[],oi(p=>un.equals(p.attributeId,f))),v=g(n.componentConsequences??[],oi(p=>un.equals(p.attributeId,f)));return g(v,L(p=>this.mapToComponentAttribute(p,h,r(f))))}),zn);return g([],ht(o),ht(d),ht(u),ht(c))}mapToComponentAttribute(e,n,r){return{type:Bt.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,possibleDecisionStates:g(e.possibleDecisionStates,Os(i=>this.mapToPossibleDecisionState(i))),decision:g(n,Nn(i=>g(this.mapToDecisionState(i.state),L(o=>({state:o,kind:i.kind}))))),inclusion:this.mapToInclusion(e.inclusion),selection:g(e.selection,vt,L(i=>this.mapToSelection(i)),_e),canContributeToConfigurationSatisfaction:r}}mapToChoiceAttributes(e,n,r){const i=g(e.values,Os(o=>{const a=g(n,Ge(u=>u.choiceValueId==o.choiceValueId));return this.mapToChoiceValue(o,a)}));return{type:Bt.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,cardinality:this.mapToCardinality(e.cardinality),values:i,canContributeToConfigurationSatisfaction:r}}mapToBooleanAttribute(e,n,r){return{type:Bt.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,selection:this.mapToSelection(e.selection),possibleDecisionStates:e.possibleDecisionStates,decision:g(n,Nn(i=>g(i.state,vt,L(o=>({kind:this.mapToDecisionKind(i.kind),state:o}))))),canContributeToConfigurationSatisfaction:r}}mapToNumericAttribute(e,n,r){return{type:Bt.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,range:{min:e.range.min,max:e.range.max},selection:this.mapToSelection(e.selection),decimalPlaces:e.decimalPlaces,decision:g(n,Nn(i=>g(i.state,vt,L(o=>({kind:this.mapToDecisionKind(i.kind),state:o}))))),canContributeToConfigurationSatisfaction:r}}mapToChoiceValue(e,n){const r=g(e.possibleDecisionStates,Os(i=>this.mapToPossibleDecisionState(i)));return{choiceValueId:e.choiceValueId,decision:g(n,Nn(i=>this.mapToChoiceValueDecision(i))),possibleDecisionStates:r}}mapToDecisionKind(e){return H(e).with(Da.Implicit,()=>ce.Implicit).with(Da.Explicit,()=>ce.Explicit).exhaustive()}mapToDecisionState(e){return H(e).with(cr.Included,()=>Tt(ge.Included)).with(cr.Excluded,()=>Tt(ge.Excluded)).with(cr.Undefined,()=>it).exhaustive()}mapToPossibleDecisionState(e){return H(e).with($i.Included,()=>ge.Included).with($i.Excluded,()=>ge.Excluded).exhaustive()}mapToSelection(e){return H(e).with(Gl.Mandatory,()=>xi.Mandatory).with(Gl.Optional,()=>xi.Optional).exhaustive()}mapToInclusion(e){return H(e).with(zl.Always,()=>Ai.Always).with(zl.Optional,()=>Ai.Optional).exhaustive()}mapToCardinality(e){return{lowerBound:e.lowerBound,upperBound:e.upperBound}}}class YM{constructor(e,n){this.restToDomainMapper=new Mg,this.contractToRestMapper=e,this.options=n}create(e){const n=this.contractToRestMapper.mapToCreateSessionRequest(e),r=Ll(this.options.sessionCreateUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(n)});return g(r,On(i=>ir(i,"ServerSideSessionLifetimeHandler - create")),$n(i=>this.restToDomainMapper.mapToSessionId(i)))}close(e){return g(nr(this.options.sessionDeleteUrl,{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8","X-SESSION-ID":e}},n=>n.response.status===Pg.NoContent?Tt({}):it),On(n=>ir(n,"ServerSideSessionLifetimeHandler - close")),ye(Pr))}}class JM{constructor(e,n,r){this.inner=e,this.contractToDomainMapper=n,this.domainToContractMapper=r,this.onConfigurationChangedHandler=it}setOnConfigurationChangedHandler(e){const n=g(e,vt,L(r=>i=>{const o=this.domainToContractMapper.mapToConfiguration(i);r(o)}));this.inner.setOnConfigurationChangedHandler(n)}getConfiguration(){const e=this.inner.getConfiguration();return this.domainToContractMapper.mapToConfiguration(e)}getSessionContext(){const e=this.inner.getSessionContext();return this.domainToContractMapper.mapToSessionContext(e)}async setSessionContext(e){const n=this.contractToDomainMapper.mapToSessionContext(e);return await g(this.inner.setSessionContext(n),ye(Pr),this.adaptToContractPromise())()}async restoreConfiguration(e){const n=this.contractToDomainMapper.mapToConfiguration(e);return await g(this.inner.restoreConfiguration(n),ye(Pr),this.adaptToContractPromise())()}async makeDecision(e){const n=this.contractToDomainMapper.mapToAttributeDecision(e);return await g(this.inner.makeDecision(n),ye(Pr),this.adaptToContractPromise())()}async setMany(e,n){const r=this.contractToDomainMapper.mapToAttributeDecisions(e),i=this.contractToDomainMapper.mapToMode(n);return await g(this.inner.setMany(r,i),ye(Pr),this.adaptToContractPromise())()}async applySolution(e){const n=this.contractToDomainMapper.mapToSolution(e);return await g(this.inner.applySolution(n),ye(Pr),this.adaptToContractPromise())()}async explain(e,n){const r=this.contractToDomainMapper.mapToExplainQuestion(e,n);return await g(this.inner.explain(r),ye(i=>this.domainToContractMapper.mapToExplainAnswer(i)),this.adaptToContractPromise())()}async close(){return await g(this.inner.close(),On(e=>this.domainToContractMapper.mapToFailureResult(e)),eu(Promise.reject,e=>Promise.resolve()))()}adaptToContractPromise(){return Wn(On(e=>this.domainToContractMapper.mapToFailureResult(e)),eu(e=>Promise.reject(e),e=>Promise.resolve(e)))}}class XM{mapToExplainQuestion(e,n){const r={answerType:H(n).with("decisions",()=>vi.decisions).with("constraints",()=>vi.constraints).with("full",()=>vi.all).exhaustive()};return H(e).with({question:Er.whyIsNotSatisfied,subject:xr.configuration},i=>({...r,question:pn.whyIsNotSatisfied,subject:je.configuration})).with({question:Er.whyIsNotSatisfied,subject:xr.attribute},i=>({...r,question:pn.whyIsNotSatisfied,subject:je.attribute,attributeId:this.mapToGlobalAttributeId(i.attributeId)})).with({question:Er.whyIsStateNotPossible,subject:xr.choiceValue},i=>({...r,question:pn.whyIsStateNotPossible,subject:je.choiceValue,attributeId:this.mapToGlobalAttributeId(i.attributeId),choiceValueId:i.choiceValueId,state:this.mapToDecisionState(i.state)})).with({question:Er.whyIsStateNotPossible,subject:xr.component},i=>({...r,question:pn.whyIsStateNotPossible,subject:je.component,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:this.mapToDecisionState(i.state)})).with({question:Er.whyIsStateNotPossible,subject:xr.numeric},i=>({...r,question:pn.whyIsStateNotPossible,subject:je.numeric,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:i.state})).with({question:Er.whyIsStateNotPossible,subject:xr.boolean},i=>({...r,question:pn.whyIsStateNotPossible,subject:je.boolean,attributeId:this.mapToGlobalAttributeId(i.attributeId),state:i.state})).exhaustive()}mapToConfiguration(e){return{isSatisfied:e.isSatisfied,attributes:g(e.attributes,k(n=>this.mapToAttribute(n)))}}mapToAttributeDecisions(e){return g(e,k(n=>this.mapToAttributeDecision(n)))}mapToSessionContext(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),decisionsToRespect:this.mapToDecisionsToRespect(e.attributeRelations),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters)}}mapToAttributeDecision(e){return H(e).with({type:ee.Choice,choiceValueId:Mt.string},n=>({type:at.ChoiceValue,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToDecisionStateOption(n.state)})).with({type:ee.Numeric},n=>({type:at.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),value:vt(n.state)})).with({type:ee.Boolean},n=>({type:at.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),value:vt(n.state)})).with({type:ee.Component},n=>({type:at.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(vt(n.state),Nn(r=>this.mapToDecisionStateOption(r)))})).exhaustive()}mapToDecisionsToRespect(e){return g(vt(e),L(n=>g(n,k(r=>({attributeId:this.mapToGlobalAttributeId(r.attributeId),decisions:g(r.decisions,k(i=>this.mapToGlobalAttributeId(i)))})))))}mapToMode(e){return H(e).with({type:"DropExistingDecisions"},n=>({type:"DropExistingDecisions",conflictHandling:this.mapToConflictHandling(n.conflictHandling)})).otherwise(()=>({type:"Default"}))}mapToConflictHandling(e){return H(e).with({type:"Manual"},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).with({type:"Automatic"},n=>({type:"Automatic"})).exhaustive()}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:e.componentPath??[],sharedConfigurationModel:e.sharedConfigurationModelId}}mapToConfigurationModelSource(e){return H(e).with({type:Lr.Package},n=>({type:$a.Package,configurationModelPackage:n.configurationModelPackage})).with({type:Lr.Channel},n=>({type:$a.Channel,deploymentName:n.deploymentName,channel:n.channel})).exhaustive()}mapToSolution(e){return{decisions:g(e.decisions,k(n=>this.mapToAttributeDecision(n))),mode:this.mapToMode(e.mode)}}mapToAttribute(e){return H(e).with({type:ee.Boolean},n=>({type:Bt.Boolean,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,possibleDecisionStates:n.possibleDecisionStates,selection:this.mapToSelection(n.selection),decision:g(n.decision,vt,L(r=>({kind:this.mapToDecisionKind(r.kind),state:r.state}))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:ee.Numeric},n=>({type:Bt.Numeric,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,range:{min:n.range.min,max:n.range.max},decimalPlaces:n.decimalPlaces,selection:this.mapToSelection(n.selection),decision:g(n.decision,vt,L(r=>({kind:this.mapToDecisionKind(r.kind),state:r.state}))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:ee.Choice},n=>({type:Bt.Choice,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,cardinality:{lowerBound:n.cardinality.lowerBound,upperBound:n.cardinality.upperBound},values:g(n.values,k(r=>this.mapToChoiceValue(r))),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).with({type:ee.Component},n=>({type:Bt.Component,attributeId:this.mapToGlobalAttributeId(n.id),isSatisfied:n.isSatisfied,decision:g(n.decision,vt,Nn(r=>g(this.mapToDecisionStateOption(r.state),L(i=>({kind:this.mapToDecisionKind(r.kind),state:i}))))),possibleDecisionStates:g(n.possibleDecisionStates,k(r=>this.mapToDecisionStateOption(r)),zn),selection:g(n.selection,vt,L(r=>this.mapToSelection(r)),_e),inclusion:this.mapToInclusion(n.inclusion),canContributeToConfigurationSatisfaction:n.canContributeToConfigurationSatisfaction})).exhaustive()}mapToChoiceValue(e){return{choiceValueId:e.id,decision:this.mapToChoiceValueDecision(e),possibleDecisionStates:g(e.possibleDecisionStates,k(n=>this.mapToDecisionStateOption(n)),zn)}}mapToChoiceValueDecision(e){return g(e.decision,vt,Nn(n=>g(this.mapToDecisionStateOption(n.state),L(r=>({state:r,kind:this.mapToDecisionKind(n.kind)})))))}mapToDecisionKind(e){return H(e).with(be.Implicit,()=>ce.Implicit).with(be.Explicit,()=>ce.Explicit).exhaustive()}mapToSelection(e){return H(e).with(xa.Mandatory,()=>xi.Mandatory).with(xa.Optional,()=>xi.Optional).exhaustive()}mapToInclusion(e){return H(e).with(Aa.Always,()=>Ai.Always).with(Aa.Optional,()=>Ai.Optional).exhaustive()}mapToDecisionState(e){return H(e).with(Mt.union(Gr.Included,Ze.Included),()=>ge.Included).with(Mt.union(Gr.Excluded,Ze.Excluded),()=>ge.Excluded).exhaustive()}mapToDecisionStateOption(e){return g(vt(e),L(n=>this.mapToDecisionState(n)))}mapToUsageRuleParameters(e){return e??{}}}class Rg{mapToExplainAnswer(e){const n=H(e).with({decisionExplanations:Mt.array(Mt.any)},i=>g(i.decisionExplanations,k(o=>this.mapToDecisionExplanation(o)))).otherwise(()=>[]),r=H(e).with({constraintExplanations:Mt.array(Mt.any)},i=>g(i.constraintExplanations,k(o=>this.mapToConstraintExplanation(o)))).otherwise(()=>[]);return{decisionExplanations:n,constraintExplanations:r}}mapToConstraintExplanation(e){return{causedByCardinalities:g(e.causedByCardinalities,k(n=>this.mapToGlobalAttributeId(n.attributeId))),causedByRules:g(e.causedByRules,k(n=>this.mapToGlobalConstraintId(n.ruleId)))}}mapToDecisionExplanation(e){const n=g(e.causedByChoiceDecisions,k(a=>this.mapToCausedByChoiceAttributeDecision(a))),r=g(e.causedByComponentDecisions,k(a=>this.mapToCausedByComponentAttributeDecision(a))),i=g(e.causedByNumericDecisions,k(a=>this.mapToCausedByNumericAttributeDecision(a))),o=g(e.causedByBooleanDecisions,k(a=>this.mapToCausedByBooleanAttributeDecision(a)));return{causedByDecisions:g([],ht(n),ht(r),ht(i),ht(o)),solution:this.mapToSolution(e.solution)}}mapToSolution(e){return{decisions:g(e.decisions,k(n=>this.mapToExplicitDecision(n))),mode:this.mapToMode(e.mode)}}mapToMode(e){return H(e).with({type:"DropExistingDecisions"},n=>({type:"DropExistingDecisions",conflictHandling:this.mapToConflictHandling(n.conflictHandling)})).otherwise(()=>({type:"Default"}))}mapToConflictHandling(e){return H(e).with({type:"Manual"},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).with({type:"Automatic"},n=>({type:"Automatic"})).exhaustive()}mapToSessionContext(e){return{configurationModelSource:this.mapToConfigurationModelSource(e.configurationModelSource),attributeRelations:this.mapToDecisionsToRespect(e.decisionsToRespect),usageRuleParameters:this.mapToUsageRuleParameters(e.usageRuleParameters)}}mapToFailureResult(e){return H(e).with({type:rt.ConfigurationConflict},n=>({type:Oe.ConfigurationConflict,reason:H(n.reason).with(ud.NumericDecisionOutOfRange,()=>Og.NumericDecisionOutOfRange).otherwise(()=>{})})).with({type:rt.ConfigurationApplicationError},()=>({type:Oe.ConfigurationApplicationError})).with({type:rt.ConfigurationUnauthenticated},()=>({type:Oe.ConfigurationUnauthenticated})).with({type:rt.ConfigurationModelNotFound},()=>({type:Oe.ConfigurationModelNotFound})).with({type:rt.ConfigurationTimeout},()=>({type:Oe.ConfigurationTimeout})).with({type:rt.ConfigurationAttributeNotFound},()=>({type:Oe.ConfigurationAttributeNotFound})).with({type:rt.ConfigurationChoiceValueNotFound},()=>({type:Oe.ConfigurationChoiceValueNotFound})).with({type:rt.ConfigurationSolutionNotAvailable},()=>({type:Oe.ConfigurationSolutionNotAvailable})).with({type:rt.ConfigurationRejectedDecisionsConflict},n=>{const r=g(n.rejectedDecisions,k(i=>this.mapToExplicitDecision(i)));return TM.createConfigurationRejectedDecisionsConflict(r)}).with({type:rt.DecisionsToRespectInvalid},()=>({type:Oe.DecisionsToRespectInvalid})).with({type:rt.ServiceError},()=>({type:Oe.ServiceError})).with({type:rt.CommunicationError},()=>({type:Oe.CommunicationError})).with({type:rt.Unknown},()=>({type:Oe.Unknown})).with({type:rt.ConfigurationModelInvalid},()=>({type:Oe.ConfigurationModelInvalid})).with({type:rt.ConfigurationInitializationFailure},()=>({type:Oe.ConfigurationInitializationFailure})).with({type:rt.ConfigurationModelNotFeasible},n=>({type:Oe.ConfigurationModelNotFeasible,constraintExplanations:g(n.constraintExplanations,k(r=>this.mapToConstraintExplanation(r)))})).with({type:rt.ConfigurationSetManyConflict},n=>({type:Oe.ConfigurationSetManyConflict,decisionExplanations:g(n.decisionExplanations,k(r=>this.mapToDecisionExplanation(r))),constraintExplanations:g(n.constraintExplanations,k(r=>this.mapToConstraintExplanation(r)))})).exhaustive()}mapToConfiguration(e){return{isSatisfied:e.isSatisfied,attributes:g(e.attributes,k(n=>this.mapToAttribute(n)))}}mapToDecisionsToRespect(e){return g(e,L(Wn(k(n=>({attributeId:this.mapToGlobalAttributeId(n.attributeId),decisions:g(n.decisions,k(r=>this.mapToGlobalAttributeId(r)))})))),_e)}mapToGlobalAttributeId(e){return{localId:e.localId,sharedConfigurationModelId:e.sharedConfigurationModel,componentPath:[...e.componentPath??[]]}}mapToGlobalConstraintId(e){return{localId:e.localId,configurationModelId:e.configurationModelId}}mapToConfigurationModelSource(e){return H(e).with({type:$a.Package},n=>({type:Lr.Package,configurationModelPackage:n.configurationModelPackage})).with({type:$a.Channel},n=>({type:Lr.Channel,deploymentName:n.deploymentName,channel:n.channel})).exhaustive()}mapToExplicitDecision(e){return H(e).with({type:at.ChoiceValue},n=>({type:ee.Choice,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.state,L(r=>this.mapToChoiceValueDecisionState(r)),_e),choiceValueId:n.choiceValueId})).with({type:at.Component},n=>({type:ee.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.state,L(r=>this.mapToComponentDecisionState(r)),_e)})).with({type:at.Numeric},n=>({type:ee.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.value,_e)})).with({type:at.Boolean},n=>({type:ee.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.value,_e)})).exhaustive()}mapToCardinality(e){return H(e).with(ro.Cardinality,()=>Ns.Cardinality).with(ro.Component,()=>Ns.Component).with(ro.Rule,()=>Ns.Rule).exhaustive()}mapToCausedByAttributeDecision(e){return H(e).with({type:at.ChoiceValue},n=>this.mapToCausedByChoiceAttributeDecision(n)).with({type:at.Numeric},n=>this.mapToCausedByNumericAttributeDecision(n)).with({type:at.Boolean},n=>this.mapToCausedByBooleanAttributeDecision(n)).with({type:at.Component},n=>this.mapToCausedByComponentAttributeDecision(n)).exhaustive()}mapToCausedByChoiceAttributeDecision(e){return{type:ee.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:e.choiceValueId,state:this.mapToChoiceValueDecisionState(e.state)}}mapToCausedByNumericAttributeDecision(e){return{type:ee.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state}}mapToCausedByBooleanAttributeDecision(e){return{type:ee.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:e.state}}mapToCausedByComponentAttributeDecision(e){return{type:ee.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToComponentDecisionState(e.state)}}mapToSelection(e){return H(e).with(xi.Mandatory,()=>xa.Mandatory).with(xi.Optional,()=>xa.Optional).exhaustive()}mapToAttribute(e){const n={id:this.mapToGlobalAttributeId(e.attributeId),isSatisfied:e.isSatisfied,canContributeToConfigurationSatisfaction:e.canContributeToConfigurationSatisfaction};return H(e).with({type:Bt.Boolean},r=>({...n,type:ee.Boolean,decision:g(r.decision,L(i=>({state:i.state,kind:this.mapToDecisionKind(i.kind)})),Rr),selection:this.mapToSelection(r.selection),possibleDecisionStates:r.possibleDecisionStates})).with({type:Bt.Numeric},r=>({...n,type:ee.Numeric,decision:g(r.decision,L(i=>({state:i.state,kind:this.mapToDecisionKind(i.kind)})),Rr),range:r.range,decimalPlaces:r.decimalPlaces,selection:this.mapToSelection(r.selection)})).with({type:Bt.Choice},r=>({...n,type:ee.Choice,cardinality:r.cardinality,values:g(r.values,k(i=>{const o=g(i.decision,L(a=>({state:this.mapToChoiceValueDecisionState(a.state),kind:this.mapToDecisionKind(a.kind)})),Rr);return{id:i.choiceValueId,possibleDecisionStates:g(i.possibleDecisionStates,k(a=>this.mapToChoiceValueDecisionState(a))),decision:o}}))})).with({type:Bt.Component},r=>({...n,type:ee.Component,decision:g(r.decision,L(i=>({state:this.mapToComponentDecisionState(i.state),kind:this.mapToDecisionKind(i.kind)})),Rr),possibleDecisionStates:g(r.possibleDecisionStates,k(i=>this.mapToComponentDecisionState(i))),selection:g(r.selection,vt,L(i=>this.mapToSelection(i)),_e),inclusion:this.mapToInclusion(r.inclusion)})).exhaustive()}mapToInclusion(e){return H(e).with(Ai.Always,()=>Aa.Always).with(Ai.Optional,()=>Aa.Optional).exhaustive()}mapToComponentDecisionState(e){return H(e).with(ge.Included,()=>Ze.Included).with(ge.Excluded,()=>Ze.Excluded).exhaustive()}mapToChoiceValueDecisionState(e){return H(e).with(ge.Included,()=>Gr.Included).with(ge.Excluded,()=>Gr.Excluded).exhaustive()}mapToDecisionKind(e){return H(e).with(ce.Explicit,()=>be.Explicit).with(ce.Implicit,()=>be.Implicit).exhaustive()}mapToUsageRuleParameters(e){return e}}class ZM{constructor(e,n){this.contractToDomainMapper=new XM,this.domainToContractMapper=new Rg,this.sessionHandler=e,this.internalConfigurationSessionCreator=n}async createSession(e){const n=this.configurationSessionFrom(e);return await g(this.sessionHandler.recreate(n),ye(r=>{const i=this.internalConfigurationSessionCreator(this.sessionHandler,r);return new JM(i,this.contractToDomainMapper,this.domainToContractMapper)}),eu(r=>{const i=this.domainToContractMapper.mapToFailureResult(r);return Promise.reject(i)},r=>Promise.resolve(r)))()}configurationSessionFrom(e){return{context:this.contractToDomainMapper.mapToSessionContext(e),sessionId:it,configuration:{isSatisfied:!1,attributes:[]},solutions:[]}}}function _g(t){return t.possibleDecisionStates.some(e=>e===Gr.Included)}function QM(t){return!_g(t)}function tR(t){return H(t).with({type:ee.Choice},e=>e.cardinality.lowerBound>0).otherwise(()=>!0)}function eR(t){return H(t).with({type:ee.Choice},e=>e.cardinality.upperBound>1).otherwise(()=>!1)}function nR(t){return g(t.values,za(_g))}function rR(t){return g(t.values,za(QM))}function iR(t,e){return g(t.values,mg(n=>g(n.decision,vt,Qe(r=>r.kind===e))))}function jg(t){return g(t.values,za(e=>g(e.decision,vt,L(n=>n.state===Gr.Included),Wt(()=>!1))))}const oR=jg;function aR(t){return g(t.decision,vt,Qe(e=>e.kind===be.Explicit),Rr)}function sR(t){return g(t.decision,vt,Qe(e=>e.kind===be.Explicit),Rr)}function uR(t,e){return t.possibleDecisionStates.some(n=>n===e)}function cR(t){return g(t.decision,vt,Rr)}function qg(t){return kg(t,Ze.Included)}function lR(t){return!qg(t)}function kg(t,e){return t.possibleDecisionStates.some(n=>n===e)}const oa=Object.freeze(Object.defineProperty({__proto__:null,getAllowedChoiceValues:nR,getBlockedChoiceValues:rR,getBooleanDecision:sR,getChoiceDecisions:iR,getComponentDecision:cR,getIncludedChoiceValues:jg,getNumericDecision:aR,getSelectedChoiceValues:oR,isBooleanValuePossible:uR,isComponentAllowed:qg,isComponentBlocked:lR,isComponentStatePossible:kg,isMandatory:tR,isMultiSelect:eR},Symbol.toStringTag,{value:"Module"}));Er.whyIsNotSatisfied,xr.configuration;const fR="https://spc.cloud.ceventis.de/api/engine",dR={hcaEngineBaseUrl:fR};function hR(t){return{hcaEngineBaseUrl:t.hcaEngineBaseUrl??dR.hcaEngineBaseUrl,sessionHandler:t.sessionHandler}}function zo(t){if(t==null)throw new Error("Implementation Error: Unexpected null value encountered");return t}const Ug=t=>e=>n=>g(n,NN(r=>t.equals(r,e)),L(r=>g(n,PN(r,i=>e))),Ul,Wt(()=>g(n,ht(RN(e))))),hs=Ug({equals:(t,e)=>Le.equals(t.attributeId,e.attributeId)}),pR=Ug({equals:(t,e)=>t.choiceValueId===e.choiceValueId});class vR{constructor(e){this.restToDomainMapper=e}updateConfigurationSession(e,n){const r=this.updateConfigurationModel(e.configuration,n);return{...e,configuration:r}}updateConfigurationModel(e,n){var r,i,o,a,u,s,c,l,d;const f=g(((r=n.affectedDecisions)==null?void 0:r.choiceValueDecisions)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),h=g(((i=n.consequences)==null?void 0:i.choiceConsequences)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),v=g(((o=n.affectedDecisions)==null?void 0:o.componentDecisions)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),p=g(((a=n.consequences)==null?void 0:a.componentConsequences)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),S=g(((u=n.affectedDecisions)==null?void 0:u.numericDecisions)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),C=g(((s=n.consequences)==null?void 0:s.numericConsequences)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),w=g(((c=n.affectedDecisions)==null?void 0:c.booleanDecisions)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),T=g(((l=n.consequences)==null?void 0:l.booleanConsequences)??[],k(b=>({attributeId:this.restToDomainMapper.mapToGlobalAttributeId(b.attributeId),payload:b}))),I=g([],ht(g(w,k(b=>b.attributeId))),ht(g(T,k(b=>b.attributeId))),ht(g(S,k(b=>b.attributeId))),ht(g(C,k(b=>b.attributeId))),ht(g(f,k(b=>b.attributeId))),ht(g(h,k(b=>b.attributeId))),ht(g(v,k(b=>b.attributeId))),ht(g(p,k(b=>b.attributeId))),Xi(Le)),x=g(I,Bl(e.attributes,(b,E)=>{const P=e.attributes.find(A=>Le.equals(A.attributeId,E));return H(P).with({type:Bt.Choice},(A,U)=>{const M=this.mergeChoice(U,g(h,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)),g(f,za($=>Le.equals($.attributeId,E)),k($=>$.payload)));return hs(M)(b)}).with({type:Bt.Numeric},(A,U)=>{const M=this.mergeNumeric(U,g(C,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)),g(S,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)));return hs(M)(b)}).with({type:Bt.Boolean},(A,U)=>{const M=this.mergeBoolean(U,g(T,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)),g(w,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)));return hs(M)(b)}).with({type:Bt.Component},(A,U)=>{const M=this.mergeComponent(U,g(p,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)),g(v,Ge($=>Le.equals($.attributeId,E)),L($=>$.payload)));return hs(M)(b)}).exhaustive()}));return{...e,isSatisfied:g((d=n.consequences)==null?void 0:d.isConfigurationSatisfied,vt,Wt(()=>e.isSatisfied)),attributes:x}}mergeChoice(e,n,r){const i=g(n,L(s=>s.values??[]),Wt(()=>[])),o=g(r),a=g([],ht(g(i,k(s=>s.choiceValueId))),ht(g(o,k(s=>s.choiceValueId))),k(zo),Xi(oe)),u=g(a,Bl(e.values,(s,c)=>{const l=g(i,Ge(v=>v.choiceValueId===c)),d=g(o,Ge(v=>v.choiceValueId===c)),f=g(e.values.find(v=>v.choiceValueId===c),vt),h=this.mergeChoiceValue(c,f,l,d);return pR(h)(s)}));return{...e,isSatisfied:g(n,L(s=>zo(s.isSatisfied)),Wt(()=>e.isSatisfied)),values:u}}mergeChoiceValue(e,n,r,i){const o=g(i,L(u=>({state:this.toDecisionState(zo(u.state)),kind:this.toDecisionKind(zo(u.kind))})),Wt(()=>({state:g(n,Nn(u=>g(u.decision,L(s=>s.state)))),kind:g(n,Nn(u=>g(u.decision,L(s=>s.kind))),Wt(()=>ce.Explicit))}))),a=g(r,L(u=>g(Gh(u.possibleDecisionStates??[]),k(s=>this.toPossibleDecisionState(s)),zn)),Wt(()=>g(n,L(u=>u.possibleDecisionStates??[]),Wt(()=>[]))));return{choiceValueId:e,decision:g(o.state,L(u=>({state:u,kind:o.kind}))),possibleDecisionStates:a}}mergeComponent(e,n,r){const i=g(r,L(a=>{const u=this.toDecisionState(zo(a.state));return g(u,L(s=>({state:s,kind:this.toDecisionKind(a.kind)})))}),Wt(()=>g(e.decision,L(a=>({state:a.state,kind:a.kind}))))),o=g(n,L(a=>g(Gh(a.possibleDecisionStates??[]),k(u=>this.toPossibleDecisionState(u)),zn)),Wt(()=>e.possibleDecisionStates));return{...e,isSatisfied:g(n,L(a=>a.isSatisfied),Wt(()=>e.isSatisfied)),possibleDecisionStates:o,decision:i}}mergeNumeric(e,n,r){return{...e,isSatisfied:g(n,Nn(i=>vt(i.isSatisfied)),Wt(()=>e.isSatisfied)),decision:g(r,Vr(()=>e.decision,i=>g(i.state,vt,L(o=>({kind:this.toDecisionKind(i.kind),state:o})))))}}mergeBoolean(e,n,r){return{...e,isSatisfied:g(n,Nn(i=>vt(i.isSatisfied)),Wt(()=>e.isSatisfied)),decision:g(r,Vr(()=>e.decision,i=>g(i.state,vt,L(o=>({kind:this.toDecisionKind(i.kind),state:o}))))),possibleDecisionStates:g(n,L(i=>i.possibleDecisionStates),Wt(()=>e.possibleDecisionStates))}}toPossibleDecisionState(e){return H(e).with($i.Included,()=>Tt(ge.Included)).with($i.Excluded,()=>Tt(ge.Excluded)).otherwise(()=>it)}toDecisionState(e){return H(e).with(cr.Included,()=>Tt(ge.Included)).with(cr.Excluded,()=>Tt(ge.Excluded)).otherwise(()=>it)}toDecisionKind(e){return H(e).with(Da.Implicit,()=>ce.Implicit).with(Da.Explicit,()=>ce.Explicit).exhaustive()}}class yR{mapSessionToExplicitDecisions(e){return this.mapToExplicitDecisionsInner(e.configuration.attributes)}mapToExplicitDecision(e){return H(e).with({type:at.ChoiceValue},n=>({type:ln.Choice,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToDecisionState(n.state)})).with({type:at.Component},n=>({type:ln.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:this.mapToDecisionState(n.state)})).with({type:at.Numeric},n=>({type:ln.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.value,_e)})).with({type:at.Boolean},n=>({type:ln.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:g(n.value,_e)})).exhaustive()}mapToExplicitDecisions(e,n){const r=this.mapToMode(n),i=g([...e],Cr(s=>s.type!==at.Boolean?it:Tt({type:ln.Boolean,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:g(s.value,_e)}))),o=g([...e],Cr(s=>s.type!==at.Numeric?it:Tt({type:ln.Numeric,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:g(s.value,_e)}))),a=g([...e],Cr(s=>s.type!==at.ChoiceValue?it:Tt({type:ln.Choice,attributeId:this.mapToGlobalAttributeId(s.attributeId),choiceValueId:s.choiceValueId,state:this.mapToDecisionState(s.state)}))),u=g([...e],Cr(s=>s.type!==at.Component?it:Tt({type:ln.Component,attributeId:this.mapToGlobalAttributeId(s.attributeId),state:this.mapToDecisionState(s.state)})));return{mode:r,choiceDecisions:a,numericDecisions:o,booleanDecisions:i,componentDecisions:u}}mapToExplicitDecisionsInner(e){const n=g([...e],Cr(a=>a.type!==Bt.Boolean?it:g(a.decision,Qe(u=>u.kind===ce.Explicit),L(()=>this.mapToExplicitBooleanDecision(a))))),r=g([...e],Cr(a=>a.type!==Bt.Numeric?it:g(a.decision,Qe(u=>u.kind===ce.Explicit),L(()=>this.mapToExplicitNumericDecision(a))))),i=g([...e],Cr(a=>a.type!==Bt.Component?it:g(a.decision,Qe(u=>u.kind===ce.Explicit),L(()=>this.mapToExplicitComponentDecision(a))))),o=g([...e],Cr(a=>a.type!==Bt.Choice?it:g(this.mapToExplicitChoiceDecisions(a),cN(u=>g(u,ic)))),FN);return{booleanDecisions:n,numericDecisions:r,choiceDecisions:o,componentDecisions:i}}mapToMode(e){return H(e).with({type:"Default"},n=>({type:"Default"})).with({type:"DropExistingDecisions"},n=>this.mapToDropExistingDecisionsMode(n)).exhaustive()}mapToGlobalAttributeId(e){return{localId:e.localId,componentPath:g(e.componentPath,vt,L(Lh),Rr),sharedConfigurationModelId:e.sharedConfigurationModel}}mapToDropExistingDecisionsMode(e){return{type:"DropExistingDecisions",conflictResolution:H(e.conflictHandling).with({type:"Manual",includeConstraintsInConflictExplanation:Mt.boolean},n=>({type:"Manual",includeConstraintsInConflictExplanation:n.includeConstraintsInConflictExplanation})).otherwise(()=>({type:"Automatic"}))}}mapToExplicitBooleanDecision(e){return{type:ln.Boolean,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:g(e.decision,L(n=>n.state),_e)}}mapToExplicitNumericDecision(e){return{type:ln.Numeric,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:g(e.decision,L(n=>n.state),_e)}}mapToExplicitComponentDecision(e){return{type:ln.Component,attributeId:this.mapToGlobalAttributeId(e.attributeId),state:this.mapToDecisionState(g(e.decision,L(n=>n.state)))}}mapToExplicitChoiceDecisions(e){function n(r){return g(r.decision,L(i=>i.kind===ce.Explicit),Wt(()=>!1))}return g(e.values,za(n),k(r=>({type:ln.Choice,attributeId:this.mapToGlobalAttributeId(e.attributeId),choiceValueId:r.choiceValueId,state:this.mapToDecisionState(g(r.decision,L(i=>i.state)))})),Lh)}mapToDecisionState(e){return g(e,L(n=>H(n).with(ge.Included,()=>cr.Included).with(ge.Excluded,()=>cr.Excluded).exhaustive()),Wt(()=>cr.Undefined))}mapToPossibleDecisionState(e){return H(e).with(ge.Included,()=>$i.Included).with(ge.Excluded,()=>$i.Excluded).exhaustive()}mapToWhyNotSatisfiedRequest(e){return H(e).with({subject:je.attribute},n=>({type:Wl.Attribute,attributeId:this.mapToGlobalAttributeId(n.attributeId)})).with({subject:je.configuration},()=>({type:Wl.Configuration})).exhaustive()}mapToWhyStateNotPossibleRequest(e){return H(e).with({subject:je.boolean},n=>({type:ia.Boolean,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:n.state})).with({subject:je.numeric},n=>({type:ia.Numeric,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:n.state})).with({subject:je.component},n=>({type:ia.Component,attributeId:this.mapToGlobalAttributeId(n.attributeId),state:this.mapToPossibleDecisionState(n.state)})).with({subject:je.choiceValue},n=>({type:ia.ChoiceValue,attributeId:this.mapToGlobalAttributeId(n.attributeId),choiceValueId:n.choiceValueId,state:this.mapToPossibleDecisionState(n.state)})).exhaustive()}}class mR{constructor(){this.configurationSession={hasExplicitDecisions(e){return g(e.configuration.attributes,Ge(n=>H(n).with({type:Bt.Boolean},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),ra)).with({type:Bt.Numeric},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),ra)).with({type:Bt.Choice},r=>g(r.values,Ge(i=>g(i.decision,L(o=>o.kind===ce.Explicit),Wt(()=>!1))),ra)).with({type:Bt.Component},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),ra)).exhaustive()),Vr(()=>!1,()=>!0))},getExplicitDecisions(e){return g(e.configuration.attributes,k(n=>H(n).with({type:Bt.Boolean},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),L(i=>({type:at.Boolean,attributeId:r.attributeId,value:vt(i.state)})),L(i=>[i]))).with({type:Bt.Numeric},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),L(i=>({type:at.Numeric,attributeId:r.attributeId,value:vt(i.state)})),L(i=>[i]))).with({type:Bt.Choice},r=>g(r.values,k(i=>g(i.decision,Qe(o=>o.kind===ce.Explicit),L(o=>({type:at.ChoiceValue,attributeId:r.attributeId,choiceValueId:i.choiceValueId,state:vt(o.state)})))),zn,qr)).with({type:Bt.Component},r=>g(r.decision,Qe(i=>i.kind===ce.Explicit),L(i=>({type:at.Component,attributeId:r.attributeId,state:vt(i.state)})),L(i=>[i]))).exhaustive()),zn,jN)}}}}class gR{constructor(e,n,r,i,o,a){this.engineApiClient=n,this.domainToRestMapper=i,this.restToDomainMapper=r,this.domainToContractMapper=o,this.domainUpdater=a,this.sessionHandler=e,this.interpreter=new mR}close(e){return this.sessionHandler.close(e)}recreate(e){return this.initializeInner(e,!1)}reinitialize(e){return this.initializeInner(e,!0)}makeDecision(e,n){const r=this.domainToRestMapper.mapToExplicitDecision(e);return this.withSession(n,(i,o)=>g(this.engineApiClient.makeDecision(i,r),On(ir),ye(a=>this.domainUpdater.updateConfigurationSession(o,a))))}explain(e,n){return this.withSession(n,r=>{const i=H(e).with({question:pn.whyIsNotSatisfied},o=>this.explainWhyNotSatisfied(o,r)).with({question:pn.whyIsStateNotPossible},o=>this.explainWhyStateNotPossible(o,r)).exhaustive();return g(i,On(ir),ye(o=>this.restToDomainMapper.mapToExplainAnswer(o,e)))})}setMany(e,n,r){return this.withSession(r,(i,o)=>{const a=this.setManyInner(e,n,i);return g(a,$n(u=>{var s,c,l,d;const f=g([],ht(g(((s=u.rejectedDecisions)==null?void 0:s.booleanDecisions)??[],k(h=>this.restToDomainMapper.mapToBooleanDecision(h)))),ht(g(((c=u.rejectedDecisions)==null?void 0:c.numericDecisions)??[],k(h=>this.restToDomainMapper.mapToNumericDecision(h)))),ht(g(((l=u.rejectedDecisions)==null?void 0:l.componentDecisions)??[],k(h=>this.restToDomainMapper.mapToComponentDecision(h)))),ht(g(((d=u.rejectedDecisions)==null?void 0:d.choiceValueDecisions)??[],k(h=>this.restToDomainMapper.mapToExplicitChoiceValueDecision(h)))));return g(f,ic)?ur(qM.createConfigurationRejectedDecisionsConflict(f)):Zi(this.domainUpdater.updateConfigurationSession(o,u))}))})}replaceDecisions(e,n){const r=this.interpreter.configurationSession.getExplicitDecisions(n),i=this.setManyInner(r,{type:"DropExistingDecisions",conflictHandling:{type:"Automatic"}},e);return g(i,ye(o=>({})))}setManyInner(e,n,r){const i=this.domainToRestMapper.mapToExplicitDecisions(e,n),o=this.engineApiClient.setMany(r,i);return g(o,On(ir),$n(a=>{const u={rejectedDecisions:{booleanDecisions:Mt.array(Mt.any)}},s={decisionExplanations:Mt.array(Mt.any)};return H(a).with(u,c=>Mo(c)).with(s,c=>ur(this.restToDomainMapper.mapToConfigurationSetManyConflictFailure(c,i,n))).otherwise(()=>ur({type:rt.Unknown}))}))}explainWhyStateNotPossible(e,n){const r=this.domainToRestMapper.mapToWhyStateNotPossibleRequest(e);return this.engineApiClient.getWhyStateNotPossible(n,r)}explainWhyNotSatisfied(e,n){const r=this.domainToRestMapper.mapToWhyNotSatisfiedRequest(e);return this.engineApiClient.getWhyNotSatisfied(n,r)}withSession(e,n){return g(Zi(e),$n(r=>g(r.sessionId,Vr(()=>this.initializeInner(r,!1),()=>Zi(r)))),$n(r=>g(r.sessionId,ad(()=>({type:rt.ConfigurationUnauthenticated})),$n(i=>n(i,r)))))}initializeInner(e,n){return g(IP,()=>g(e.sessionId,nM,iM(r=>n?eM(r):g(this.sessionHandler.close(r),eu(()=>it,()=>it)))),r=>{const i=this.domainToContractMapper.mapToSessionContext(e.context);return g(r,gP(()=>({type:rt.ConfigurationUnauthenticated})),wg(()=>this.sessionHandler.create(i)))},r=>g(r,EP(i=>g(qr(e),Qe(this.interpreter.configurationSession.hasExplicitDecisions),L(o=>this.replaceDecisions(i,o)),Wt(()=>Zi({}))))),r=>g(r,$n(i=>{const o=this.determineConsequences(i),a=this.determineDecisions(i),u=XO(CP)({consequences:o,decisions:a});return g(u,ye(({decisions:s,consequences:c})=>this.restToDomainMapper.mapToConfigurationModel(s,c)),ye(s=>({sessionId:qr(i),configuration:s,context:e.context,solutions:[]})))})))}determineDecisions(e){return g(this.engineApiClient.getDecisions(e),On(ir))}determineConsequences(e){return g(this.engineApiClient.getConsequence(e),On(ir))}}class bR{constructor(e,n){this.onConfigurationChangedHandler=it,this.sessionHandler=e,this.configurationSession=n}setOnConfigurationChangedHandler(e){this.onConfigurationChangedHandler=e}getSessionContext(){return this.configurationSession.context}getConfiguration(){return this.configurationSession.configuration}explain(e){return g(this.sessionHandler.explain(e,this.configurationSession),this.updateAvailableSolutionsIfRight(n=>this.deriveSolutionsFromExplainAnswer(n)),this.invalidateAvailableSolutionsIfLeft())}setSessionContext(e){return g(this.sessionHandler.recreate({...this.configurationSession,context:e}),this.updateSession())}invalidateSessionId(){this.configurationSession={...this.configurationSession,sessionId:it}}restoreConfiguration(e){return g(this.sessionHandler.reinitialize({...this.configurationSession,configuration:e}),this.updateSession())}makeDecision(e){return g(this.sessionHandler.makeDecision(e,this.configurationSession),this.updateSession())}close(){return g(this.configurationSession.sessionId,L(e=>this.sessionHandler.close(e)),L(Wn(ye(e=>{this.configurationSession={...this.configurationSession,sessionId:it}}))),Wt(Zu(xM())))}applySolution(e){return g(this.configurationSession.solutions,Ge(n=>_M.equals(n,e)),ad(()=>({type:rt.ConfigurationSolutionNotAvailable})),ye(n=>n.decisions),$n(n=>this.setMany(n,e.mode)))}setMany(e,n){return g(this.sessionHandler.setMany(e,n,this.configurationSession),this.updateSession(),nu(r=>()=>{const i=H(r).with({decisionExplanations:Mt.array(Mt.any)},o=>Tt(o.decisionExplanations)).otherwise(()=>it);this.configurationSession={...this.configurationSession,solutions:g(i,L(Wn(k(o=>o.solution))),Wt(()=>[]))}}))}deriveSolutionsFromExplainAnswer(e){const n=H(e).with({decisionExplanations:Mt.array(Mt.any)},r=>r.decisionExplanations).otherwise(()=>[]);return g(n,k(r=>r.solution))}invalidateAvailableSolutions(){return pM(()=>()=>{this.configurationSession={...this.configurationSession,solutions:[]}})}invalidateAvailableSolutionsIfLeft(){return nu(()=>()=>{this.configurationSession={...this.configurationSession,solutions:[]}})}updateAvailableSolutionsIfRight(e){return Ea(n=>()=>{this.configurationSession={...this.configurationSession,solutions:e(n)}})}updateSession(){return Wn(Ea(e=>()=>{this.configurationSession=e,g(this.onConfigurationChangedHandler,yM(n=>()=>n(this.configurationSession.configuration)))}),ye(e=>e.configuration),this.invalidateAvailableSolutions())}}class SR{constructor(e){this.inner=e;const n=3,r=2e3,i=200;this.policy=uM(r,aM.concat(cM(i),sM(n)))}getSessionContext(){return this.inner.getSessionContext()}close(){return this.inner.close()}setSessionContext(e){const n=()=>this.inner.setSessionContext(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}makeDecision(e){const n=()=>this.inner.makeDecision(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}restoreConfiguration(e){const n=()=>this.inner.restoreConfiguration(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}explain(e){const n=()=>this.inner.explain(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}applySolution(e){const n=()=>this.inner.applySolution(e);return Gi(this.policy,n,r=>g(r,ci(i=>this.determineAndPrepareRetry(i),()=>!1)))}setMany(e,n){const r=()=>this.inner.setMany(e,n);return Gi(this.policy,r,i=>g(i,ci(o=>this.determineAndPrepareRetry(o),()=>!1)))}setOnConfigurationChangedHandler(e){this.inner.setOnConfigurationChangedHandler(e)}invalidateSessionId(){this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}determineAndPrepareRetry(e){return H(e).with({type:rt.ConfigurationUnauthenticated},()=>(this.invalidateSessionId(),!0)).with({type:rt.ConfigurationTimeout},()=>!0).otherwise(()=>!1)}}class CR{constructor(){this.queue=[],this.operating=it}push(e){const n=new wR(e);return this.queue.push(n),this.operating=g(this.operating,Wt(()=>this.start()),qr),n.promise}async start(){for(;this.queue.length;){const e=[...this.queue];this.queue=[];const n=g(e,k(r=>r.argument),Bl(it,(r,i)=>this.reduce(r,i)),L(Wn(r=>this.execute(r),r=>r.then(i=>{g(e,k(o=>{o.resolve(i)}))}).catch(i=>{g(e,k(o=>{o.reject(i)}))}))),_e);n&&await n}this.operating=it}async flush(){return this.operating||Promise.resolve()}size(){return this.queue.length}}class wR{constructor(e){this.resolve=()=>{},this.reject=()=>{},this.argument=e,this.promise=new Promise((n,r)=>{this.resolve=n,this.reject=r})}}class TR extends CR{constructor(e){super(),this.inner=e}reduce(e,n){return Tt(n)}async execute(e){return await this.inner.setSessionContext(e)()}}class IR{constructor(e){this.inner=e,this.setContextReducingTaskExecutor=new TR(e)}getSessionContext(){return this.inner.getSessionContext()}setSessionContext(e){const n=this.inner.getSessionContext();if($M.equals(n,e))return Mo(this.getConfiguration());const r=this.setContextReducingTaskExecutor.push(e);return()=>r}applySolution(e){return this.inner.applySolution(e)}close(){return this.inner.close()}makeDecision(e){return this.inner.makeDecision(e)}restoreConfiguration(e){return this.inner.restoreConfiguration(e)}setMany(e,n){return this.inner.setMany(e,n)}explain(e){return this.inner.explain(e)}invalidateSessionId(){return this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}setOnConfigurationChangedHandler(e){return this.inner.setOnConfigurationChangedHandler(e)}}class ER{constructor(e,n=!1){this.stringify=n,this.inner=e,this.durationNumberFormat=new Intl.NumberFormat("en-EN",{maximumFractionDigits:3})}withLogging(e,n,r){const i=performance.now(),o=()=>{const a=performance.now()-i;return this.durationNumberFormat.format(a)};return console.debug(`Operation ${e} started with`,this.renderAsRequired(n)),g(r(),nu(a=>()=>{console.debug(`Operation ${e} completed after ${o()}ms with failure`,this.renderAsRequired(a))}),Ea(a=>()=>{console.debug(`Operation ${e} completed after ${o()}ms with success`,this.renderAsRequired(a))}))}renderAsRequired(e){return this.stringify?JSON.stringify(e,null,2):e}explain(e){return this.withLogging("explain",[e],()=>this.inner.explain(e))}getSessionContext(){return this.inner.getSessionContext()}setSessionContext(e){return this.withLogging("setSessionContext",[e],()=>this.inner.setSessionContext(e))}applySolution(e){return this.withLogging("applySolution",[e],()=>this.inner.applySolution(e))}close(){return this.inner.close()}makeDecision(e){return this.withLogging("makeDecision",[e],()=>this.inner.makeDecision(e))}restoreConfiguration(e){return this.withLogging("restoreConfiguration",[e],()=>this.inner.restoreConfiguration(e))}setMany(e,n){return this.withLogging("setMany",[e,n],()=>this.inner.setMany(e,n))}invalidateSessionId(){return this.inner.invalidateSessionId()}getConfiguration(){return this.inner.getConfiguration()}setOnConfigurationChangedHandler(e){return this.inner.setOnConfigurationChangedHandler(e)}}function xR(t){t=hR(t);const e=new KM(t.hcaEngineBaseUrl),n=new Mg,r=new yR,i=new Rg,o=new IM,a=new vR(n),u=H(t.sessionHandler).with({create:Mt.any,close:Mt.any},l=>l).with({accessToken:Mt.string},l=>new zM(e,o,n,l)).with({sessionCreateUrl:Mt.string,sessionDeleteUrl:Mt.string},l=>new YM(o,l)).exhaustive(),s=new gR(u,e,n,r,i,a),c=(l,d)=>g(new bR(l,d),f=>new SR(f),f=>new IR(f),f=>new ER(f,!1));return new ZM(s,c)}Ka.equals;mM.equals;gM.equals;function AR(t){var e=[];if(t.length===0)return"";if(typeof t[0]!="string")throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var i=t[r];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(r>0&&(i=i.replace(/^[\/]+/,"")),r<t.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/");o=o.replace(/\/(\?|&|#[^!])/g,"$1");var a=o.split("?");return o=a.shift()+(a.length>0?"?":"")+a.join("&"),o}function $R(){var t;return typeof arguments[0]=="object"?t=arguments[0]:t=[].slice.call(arguments),AR(t)}function _o(){return pt.RenderTarget.current()!==pt.RenderTarget.preview}const DR=No.div`
199
+ &.override-children-size {
200
+ > * {
201
+ width: 100% !important;
202
+ height: 100% !important;
203
+ }
202
204
  }
203
- `;function Ug(t){const{hcaBaseUrl:e,sessionCreation:n,accessToken:r,sessionCreateUrl:i,sessionDeleteUrl:o,deploymentName:a,channel:u,children:s,style:c}=t,l=X.jsx(AR,{style:c,children:s});if(_o())return l;const d=R.useMemo(()=>IR({hcaEngineBaseUrl:xR(e,"api","engine"),sessionHandler:H(n).with("client-side",()=>({accessToken:r})).with("server-side",()=>({sessionCreateUrl:i,sessionDeleteUrl:o})).exhaustive()}),[e,n,r,i,o]);return X.jsx(u1,{configuratorClient:d,configurationModelSource:{type:Lr.Channel,channel:u,deploymentName:a},children:X.jsx(R.Suspense,{children:X.jsx(l1,{children:l})})})}yt.addPropertyControls(Ug,{children:{title:"Children",type:yt.ControlType.ComponentInstance},channel:{type:yt.ControlType.String,title:"Channel",defaultValue:"release"},deploymentName:{type:yt.ControlType.String,title:"Deployment Name"},hcaBaseUrl:{title:"HCA Base URL",type:yt.ControlType.String,defaultValue:"https://spc.cloud.ceventis.de/hca"},sessionCreation:{title:"Session Creation",type:yt.ControlType.Enum,displaySegmentedControl:!0,segmentedControlDirection:"horizontal",defaultValue:"client-side",options:["client-side","server-side"]},accessToken:{title:"HCA Access Token",type:yt.ControlType.String,obscured:!0,hidden:t=>t.sessionCreation!=="client-side"},sessionCreateUrl:{title:"Create Session URl",type:yt.ControlType.String,hidden:t=>t.sessionCreation!=="server-side"},sessionDeleteUrl:{title:"Close Session URl",type:yt.ControlType.String,hidden:t=>t.sessionCreation!=="server-side"}});const $R={attributeId:{title:"Attribute Id",type:yt.ControlType.String,defaultValue:"Engine"},componentPath:{title:"Component Path",type:yt.ControlType.String},sharedConfigurationModel:{title:"Shared Configuration Model",type:yt.ControlType.String}},Bg={padding:{type:yt.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}},DR=t=>({paddingTop:t.isMixedPadding?t.paddingTop:t.padding,paddingRight:t.isMixedPadding?t.paddingRight:t.padding,paddingBottom:t.isMixedPadding?t.paddingBottom:t.padding,paddingLeft:t.isMixedPadding?t.paddingLeft:t.padding}),OR={radius:{title:"Radius",type:yt.ControlType.Number,defaultValue:6},...Bg,border:{title:"Border",type:yt.ControlType.Object,controls:{color:{type:yt.ControlType.Color,title:"Color"},width:{type:yt.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}}}},NR=t=>{var e,n,r,i,o,a,u,s,c,l,d,f,h;return{borderRadius:t.radius,borderColor:(e=t.border)==null?void 0:e.color,borderTopWidth:(n=t.border)!=null&&n.isMixedWidth?(r=t.border)==null?void 0:r.widthTop:(i=t.border)==null?void 0:i.width,borderRightWidth:(o=t.border)!=null&&o.isMixedWidth?(a=t.border)==null?void 0:a.widthRight:(u=t.border)==null?void 0:u.width,borderBottomWidth:(s=t.border)!=null&&s.isMixedWidth?(c=t.border)==null?void 0:c.widthBottom:(l=t.border)==null?void 0:l.width,borderLeftWidth:(d=t.border)!=null&&d.isMixedWidth?(f=t.border)==null?void 0:f.widthLeft:(h=t.border)==null?void 0:h.width}},PR={fill:{title:"Fill",type:yt.ControlType.Color,defaultValue:"#EBEBEB"},...Bg,...OR},MR=t=>({...DR(t),...NR(t),backgroundColor:t.fill}),RR={color:{title:"Color",type:yt.ControlType.Color,defaultValue:"black"},fontSize:{title:"Font size",type:yt.ControlType.Number,defaultValue:16}},_R=t=>({color:t.color,fontSize:t.fontSize}),np={type:yt.ControlType.Object,optional:!0,controls:{fill:{title:"Fill",type:yt.ControlType.Color,optional:!0},color:{title:"Color",type:yt.ControlType.Color,optional:!0},borderColor:{title:"Border Color",type:yt.ControlType.Color,optional:!0}}},Vg={...$R,...RR,...PR,implicitLabelPrefix:{title:"Implicit Label Prefix",type:yt.ControlType.String,defaultValue:"Implicit: "},unsatisfiedColors:{...np,title:"Unsatisfied Colors"},implicitSelectedColors:{...np,title:"Implicit Selected Colors"}},Kl=(t,e,n)=>{var r,i,o,a,u,s;const c=MR(t),l=_R(t);return{...c,...l,backgroundColor:H({isSatisfied:e,isImplicitSelected:n,unsatisfiedFill:(r=t.unsatisfiedColors)==null?void 0:r.fill,implicitSelectedFill:(i=t.implicitSelectedColors)==null?void 0:i.fill}).with({isSatisfied:!1,unsatisfiedFill:Mt.string.minLength(1)},d=>d.unsatisfiedFill).with({isImplicitSelected:!0,implicitSelectedFill:Mt.string.minLength(1)},d=>d.implicitSelectedFill).otherwise(()=>c.backgroundColor),borderColor:H({isSatisfied:e,isImplicitSelected:n,unsatisfiedBorderColor:(o=t.unsatisfiedColors)==null?void 0:o.borderColor,implicitSelectedBorderColor:(a=t.implicitSelectedColors)==null?void 0:a.borderColor}).with({isSatisfied:!1,unsatisfiedBorderColor:Mt.string.minLength(1)},d=>d.unsatisfiedBorderColor).with({isImplicitSelected:!0,implicitSelectedBorderColor:Mt.string.minLength(1)},d=>d.implicitSelectedBorderColor).otherwise(()=>c.borderColor),color:H({isSatisfied:e,isImplicitSelected:n,unsatisfiedColor:(u=t.unsatisfiedColors)==null?void 0:u.color,implicitSelectedColor:(s=t.implicitSelectedColors)==null?void 0:s.color}).with({isSatisfied:!1,unsatisfiedColor:Mt.string.minLength(1)},d=>d.unsatisfiedColor).with({isImplicitSelected:!0,implicitSelectedColor:Mt.string.minLength(1)},d=>d.implicitSelectedColor).otherwise(()=>l.color),...t.style}},cd={...Vg,resetLabel:{title:"Reset Label",type:yt.ControlType.String,defaultValue:"Reset"}},fo=(t,e,n)=>Kl(t,e,n);function cc(t){var e;return{localId:t.attributeId,componentPath:t.componentPath===""?[]:((e=t.componentPath)==null?void 0:e.split(" -> "))??[],sharedConfigurationModelId:t.sharedConfigurationModel===""?null:t.sharedConfigurationModel}}const rp=No.select`
205
+ `;function Bg(t){const{hcaBaseUrl:e,sessionCreation:n,accessToken:r,sessionCreateUrl:i,sessionDeleteUrl:o,deploymentName:a,channel:u,children:s,style:c}=t,l=X.jsx(DR,{style:c,className:bO(t.overrideChildrenSize&&"override-children-size"),children:s});if(_o())return l;const d=R.useMemo(()=>xR({hcaEngineBaseUrl:$R(e,"api","engine"),sessionHandler:H(n).with("client-side",()=>({accessToken:r})).with("server-side",()=>({sessionCreateUrl:i,sessionDeleteUrl:o})).exhaustive()}),[e,n,r,i,o]);return X.jsx(c1,{configuratorClient:d,configurationModelSource:{type:Lr.Channel,channel:u,deploymentName:a},children:X.jsx(R.Suspense,{children:X.jsx(f1,{children:l})})})}pt.addPropertyControls(Bg,{children:{title:"Children",type:pt.ControlType.ComponentInstance},channel:{type:pt.ControlType.String,title:"Channel",defaultValue:"release"},deploymentName:{type:pt.ControlType.String,title:"Deployment Name"},hcaBaseUrl:{title:"HCA Base URL",type:pt.ControlType.String,defaultValue:"https://spc.cloud.ceventis.de/hca"},sessionCreation:{title:"Session Creation",type:pt.ControlType.Enum,displaySegmentedControl:!0,segmentedControlDirection:"horizontal",defaultValue:"client-side",options:["client-side","server-side"]},accessToken:{title:"HCA Access Token",type:pt.ControlType.String,obscured:!0,hidden:t=>t.sessionCreation!=="client-side"},sessionCreateUrl:{title:"Create Session URl",type:pt.ControlType.String,hidden:t=>t.sessionCreation!=="server-side"},sessionDeleteUrl:{title:"Close Session URl",type:pt.ControlType.String,hidden:t=>t.sessionCreation!=="server-side"},overrideChildrenSize:{type:pt.ControlType.Boolean,title:"Override Children Size",defaultValue:!0}});const OR={attributeId:{title:"Attribute Id",type:pt.ControlType.String},componentPath:{title:"Component Path",type:pt.ControlType.String},sharedConfigurationModel:{title:"Shared Configuration Model",type:pt.ControlType.String}},Vg={padding:{type:pt.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}},NR=t=>({paddingTop:t.isMixedPadding?t.paddingTop:t.padding,paddingRight:t.isMixedPadding?t.paddingRight:t.padding,paddingBottom:t.isMixedPadding?t.paddingBottom:t.padding,paddingLeft:t.isMixedPadding?t.paddingLeft:t.padding}),PR={radius:{title:"Radius",type:pt.ControlType.Number,defaultValue:6},...Vg,border:{title:"Border",type:pt.ControlType.Object,controls:{color:{type:pt.ControlType.Color,title:"Color"},width:{type:pt.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}}}},MR=t=>{var e,n,r,i,o,a,u,s,c,l,d,f,h;return{borderRadius:t.radius,borderColor:(e=t.border)==null?void 0:e.color,borderTopWidth:(n=t.border)!=null&&n.isMixedWidth?(r=t.border)==null?void 0:r.widthTop:(i=t.border)==null?void 0:i.width,borderRightWidth:(o=t.border)!=null&&o.isMixedWidth?(a=t.border)==null?void 0:a.widthRight:(u=t.border)==null?void 0:u.width,borderBottomWidth:(s=t.border)!=null&&s.isMixedWidth?(c=t.border)==null?void 0:c.widthBottom:(l=t.border)==null?void 0:l.width,borderLeftWidth:(d=t.border)!=null&&d.isMixedWidth?(f=t.border)==null?void 0:f.widthLeft:(h=t.border)==null?void 0:h.width}},RR={fill:{title:"Fill",type:pt.ControlType.Color,defaultValue:"#EBEBEB"},...Vg,...PR},_R=t=>({...NR(t),...MR(t),backgroundColor:t.fill}),jR={color:{title:"Color",type:pt.ControlType.Color,defaultValue:"black"},fontSize:{title:"Font size",type:pt.ControlType.Number,defaultValue:16}},qR=t=>({color:t.color,fontSize:t.fontSize}),np={type:pt.ControlType.Object,optional:!0,controls:{fill:{title:"Fill",type:pt.ControlType.Color,optional:!0},color:{title:"Color",type:pt.ControlType.Color,optional:!0},borderColor:{title:"Border Color",type:pt.ControlType.Color,optional:!0}}},Fg={...OR,...jR,...RR,implicitLabelPrefix:{title:"Implicit Label Prefix",type:pt.ControlType.String,defaultValue:"Implicit: "},unsatisfiedColors:{...np,title:"Unsatisfied Colors"},implicitSelectedColors:{...np,title:"Implicit Selected Colors"}},Kl=(t,e,n)=>{var r,i,o,a,u,s;const c=_R(t),l=qR(t);return{...c,...l,backgroundColor:H({isSatisfied:e,isImplicitSelected:n,unsatisfiedFill:(r=t.unsatisfiedColors)==null?void 0:r.fill,implicitSelectedFill:(i=t.implicitSelectedColors)==null?void 0:i.fill}).with({isSatisfied:!1,unsatisfiedFill:Mt.string.minLength(1)},d=>d.unsatisfiedFill).with({isImplicitSelected:!0,implicitSelectedFill:Mt.string.minLength(1)},d=>d.implicitSelectedFill).otherwise(()=>c.backgroundColor),borderColor:H({isSatisfied:e,isImplicitSelected:n,unsatisfiedBorderColor:(o=t.unsatisfiedColors)==null?void 0:o.borderColor,implicitSelectedBorderColor:(a=t.implicitSelectedColors)==null?void 0:a.borderColor}).with({isSatisfied:!1,unsatisfiedBorderColor:Mt.string.minLength(1)},d=>d.unsatisfiedBorderColor).with({isImplicitSelected:!0,implicitSelectedBorderColor:Mt.string.minLength(1)},d=>d.implicitSelectedBorderColor).otherwise(()=>c.borderColor),color:H({isSatisfied:e,isImplicitSelected:n,unsatisfiedColor:(u=t.unsatisfiedColors)==null?void 0:u.color,implicitSelectedColor:(s=t.implicitSelectedColors)==null?void 0:s.color}).with({isSatisfied:!1,unsatisfiedColor:Mt.string.minLength(1)},d=>d.unsatisfiedColor).with({isImplicitSelected:!0,implicitSelectedColor:Mt.string.minLength(1)},d=>d.implicitSelectedColor).otherwise(()=>l.color),...t.style}},cd={...Fg,resetLabel:{title:"Reset Label",type:pt.ControlType.String,defaultValue:"Reset"}},fo=(t,e,n)=>Kl(t,e,n);function cc(t){var e;return{localId:t.attributeId,componentPath:t.componentPath===""?[]:((e=t.componentPath)==null?void 0:e.split(" -> "))??[],sharedConfigurationModelId:t.sharedConfigurationModel===""?null:t.sharedConfigurationModel}}const rp=No.select`
204
206
  color: inherit;
205
- `,ip="<reset>",op="<nothing>";function Fg(t){return X.jsx(Xu,{fallbackRender:()=>X.jsx("span",{children:"Component crashed"}),children:X.jsx(jR,{...t})})}function jR(t){if(_o()){const S=fo(t,!0,!1);return X.jsx(rp,{style:S})}const e=cc(t),n=KD(e);if(!n)return X.jsx("span",{children:"Choice Attribute not found"});const{attribute:r,makeDecision:i}=n,o=oa.getAllowedChoiceValues(r),a=oa.getBlockedChoiceValues(r),u=oa.isMultiSelect(r),s=oa.getSelectedChoiceValues(r),c=s.map(S=>S.id),l=c[0]??op,d=s.some(S=>{var C;return((C=S.decision)==null?void 0:C.kind)===be.Explicit}),f=c.length>=1,h=s.some(S=>{var C;return((C=S.decision)==null?void 0:C.kind)===be.Implicit}),v=async S=>{if(S===ip)c.length===1&&await i(l,void 0);else if(o.some(C=>C.id===S)){const C=c.some(w=>w===S)?void 0:Gr.Included;await i(S,C)}else alert("Explain is not supported yet.")},p=fo(t,r.isSatisfied,h);return X.jsxs(rp,{value:u?c:l,multiple:u,onChange:S=>v(S.currentTarget.value),style:p,children:[!f&&X.jsx("option",{value:op}),d&&X.jsx("option",{value:ip,children:t.resetLabel}),o.map(S=>{var C;return X.jsxs("option",{value:S.id,children:[((C=S.decision)==null?void 0:C.kind)===be.Implicit?t.implicitLabelPrefix:"",S.id]},S.id)}),a.length>0&&X.jsx("optgroup",{label:"Blocked",children:a.map(S=>X.jsx("option",{value:S.id,children:S.id},S.id))})]})}const qR={...cd};yt.addPropertyControls(Fg,qR);const ap=No.select`
207
+ `,ip="<reset>",op="<nothing>";function Lg(t){return X.jsx(Xu,{fallbackRender:()=>X.jsx("span",{children:"Component crashed"}),children:X.jsx(kR,{...t})})}function kR(t){if(_o()){const S=fo(t,!0,!1);return X.jsx(rp,{style:S})}const e=cc(t),n=YD(e);if(!n)return X.jsx("span",{children:"Choice Attribute not found"});const{attribute:r,makeDecision:i}=n,o=oa.getAllowedChoiceValues(r),a=oa.getBlockedChoiceValues(r),u=oa.isMultiSelect(r),s=oa.getSelectedChoiceValues(r),c=s.map(S=>S.id),l=c[0]??op,d=s.some(S=>{var C;return((C=S.decision)==null?void 0:C.kind)===be.Explicit}),f=c.length>=1,h=s.some(S=>{var C;return((C=S.decision)==null?void 0:C.kind)===be.Implicit}),v=async S=>{if(S===ip)c.length===1&&await i(l,void 0);else if(o.some(C=>C.id===S)){const C=c.some(w=>w===S)?void 0:Gr.Included;await i(S,C)}else alert("Explain is not supported yet.")},p=fo(t,r.isSatisfied,h);return X.jsxs(rp,{value:u?c:l,multiple:u,onChange:S=>v(S.currentTarget.value),style:p,children:[!f&&X.jsx("option",{value:op}),d&&X.jsx("option",{value:ip,children:t.resetLabel}),o.map(S=>{var C;return X.jsxs("option",{value:S.id,children:[((C=S.decision)==null?void 0:C.kind)===be.Implicit?t.implicitLabelPrefix:"",S.id]},S.id)}),a.length>0&&X.jsx("optgroup",{label:"Blocked",children:a.map(S=>X.jsx("option",{value:S.id,children:S.id},S.id))})]})}const UR={...cd};pt.addPropertyControls(Lg,UR);const ap=No.select`
206
208
  color: inherit;
207
- `,sp="<reset>",kc="<nothing>",Uc="yes",up="no";function Lg(t){return X.jsx(Xu,{fallbackRender:()=>X.jsx("span",{children:"Component crashed"}),children:X.jsx(kR,{...t})})}function kR(t){var e,n,r;if(_o()){const C=fo(t,!0,!1);return X.jsx(ap,{style:C})}const i=cc(t),o=YD(i);if(!o)return X.jsx("span",{children:"Boolean Attribute not found"});const{attribute:a,makeDecision:u}=o,s=async C=>{const w=oa.getBooleanDecision(a)!=null;C===sp&&w?await u(void 0):await u(C===Uc)},c=H((e=a.decision)==null?void 0:e.state).with(!0,()=>Uc).with(!1,()=>up).otherwise(()=>kc),l=((n=a.decision)==null?void 0:n.kind)===be.Explicit,d=((r=a.decision)==null?void 0:r.kind)===be.Implicit,f=fo(t,a.isSatisfied,d),h=a.possibleDecisionStates.some(C=>C),v=a.possibleDecisionStates.some(C=>!C),p=X.jsxs("option",{value:Uc,children:[cp(a,!0,t.implicitLabelPrefix),t.trueLabel]}),S=X.jsxs("option",{value:up,children:[cp(a,!1,t.implicitLabelPrefix),t.falseLabel]});return X.jsxs(ap,{value:c,onChange:C=>s(C.currentTarget.value),style:f,children:[c===kc&&X.jsx("option",{value:kc}),l&&X.jsx("option",{value:sp,children:t.resetLabel}),h&&p,v&&S,!h||!v&&X.jsxs("optgroup",{label:"Blocked",children:[!h&&p,!v&&S]})]})}const cp=(t,e,n)=>{var r,i;return((r=t.decision)==null?void 0:r.kind)===be.Implicit&&((i=t.decision)==null?void 0:i.state)===e?n:""},UR={...cd,trueLabel:{title:"True Label",type:yt.ControlType.String,defaultValue:"Yes"},falseLabel:{title:"False Label",type:yt.ControlType.String,defaultValue:"No"}};yt.addPropertyControls(Lg,UR);const lp=No.select`
209
+ `,sp="<reset>",kc="<nothing>",Uc="yes",up="no";function Gg(t){return X.jsx(Xu,{fallbackRender:()=>X.jsx("span",{children:"Component crashed"}),children:X.jsx(BR,{...t})})}function BR(t){var e,n,r;if(_o()){const C=fo(t,!0,!1);return X.jsx(ap,{style:C})}const i=cc(t),o=XD(i);if(!o)return X.jsx("span",{children:"Boolean Attribute not found"});const{attribute:a,makeDecision:u}=o,s=async C=>{const w=oa.getBooleanDecision(a)!=null;C===sp&&w?await u(void 0):await u(C===Uc)},c=H((e=a.decision)==null?void 0:e.state).with(!0,()=>Uc).with(!1,()=>up).otherwise(()=>kc),l=((n=a.decision)==null?void 0:n.kind)===be.Explicit,d=((r=a.decision)==null?void 0:r.kind)===be.Implicit,f=fo(t,a.isSatisfied,d),h=a.possibleDecisionStates.some(C=>C),v=a.possibleDecisionStates.some(C=>!C),p=X.jsxs("option",{value:Uc,children:[cp(a,!0,t.implicitLabelPrefix),t.trueLabel]}),S=X.jsxs("option",{value:up,children:[cp(a,!1,t.implicitLabelPrefix),t.falseLabel]});return X.jsxs(ap,{value:c,onChange:C=>s(C.currentTarget.value),style:f,children:[c===kc&&X.jsx("option",{value:kc}),l&&X.jsx("option",{value:sp,children:t.resetLabel}),h&&p,v&&S,!h||!v&&X.jsxs("optgroup",{label:"Blocked",children:[!h&&p,!v&&S]})]})}const cp=(t,e,n)=>{var r,i;return((r=t.decision)==null?void 0:r.kind)===be.Implicit&&((i=t.decision)==null?void 0:i.state)===e?n:""},VR={...cd,trueLabel:{title:"True Label",type:pt.ControlType.String,defaultValue:"Yes"},falseLabel:{title:"False Label",type:pt.ControlType.String,defaultValue:"No"}};pt.addPropertyControls(Gg,VR);const lp=No.select`
208
210
  color: inherit;
209
- `,fp="<reset>",Bc="<nothing>",Vc="included",Fc="excluded";function Gg(t){return X.jsx(Xu,{fallbackRender:()=>X.jsx("span",{children:"Component crashed"}),children:X.jsx(BR,{...t})})}function BR(t){var e,n,r;if(_o()){const C=fo(t,!0,!1);return X.jsx(lp,{style:C})}const i=cc(t),o=XD(i);if(!o)return X.jsx("span",{children:"Component Attribute not found"});const{attribute:a,makeDecision:u}=o,s=async C=>{var w;const T=((w=a.decision)==null?void 0:w.kind)===be.Explicit;C===fp&&T?await u(void 0):C===Vc?await u(Ze.Included):C===Fc&&await u(Ze.Excluded)},c=H((e=a.decision)==null?void 0:e.state).with(Ze.Included,()=>Vc).with(Ze.Excluded,()=>Fc).otherwise(()=>Bc),l=((n=a.decision)==null?void 0:n.kind)===be.Explicit,d=((r=a.decision)==null?void 0:r.kind)===be.Implicit,f=fo(t,a.isSatisfied,d),h=a.possibleDecisionStates.some(C=>C===Ze.Included),v=a.possibleDecisionStates.some(C=>C===Ze.Excluded),p=X.jsxs("option",{value:Vc,children:[dp(a,Ze.Included,t.implicitLabelPrefix),t.includedLabel]}),S=X.jsxs("option",{value:Fc,children:[dp(a,Ze.Excluded,t.implicitLabelPrefix),t.excludedLabel]});return X.jsxs(lp,{value:c,onChange:C=>s(C.currentTarget.value),style:f,children:[c===Bc&&X.jsx("option",{value:Bc}),l&&X.jsx("option",{value:fp,children:t.resetLabel}),h&&p,v&&S,!h||!v&&X.jsxs("optgroup",{label:"Blocked",children:[!h&&p,!v&&S]})]})}const dp=(t,e,n)=>{var r,i;return((r=t.decision)==null?void 0:r.kind)===be.Implicit&&((i=t.decision)==null?void 0:i.state)===e?n:""},VR={...cd,includedLabel:{title:"Included Label",type:yt.ControlType.String,defaultValue:"Included"},excludedLabel:{title:"Excluded Label",type:yt.ControlType.String,defaultValue:"Excluded"}};yt.addPropertyControls(Gg,VR);function zg(t,e,n,r,i=1e3){const[o]=Wg.useForceUpdate(),a=OO(f=>{e(f),o()},i),u=R.useRef(n),s=R.useRef(t),c=a.isPending(),l=R.useRef(c);R.useEffect(()=>{t!==s.current&&(s.current=t,c&&(a.cancel(),o()),t!==n&&r(t)),n!==u.current&&(u.current=n,n!==t?(a(n),o()):c&&(a.cancel(),o())),c!==l.current&&(l.current=c,!c&&t!==n&&r(t))},[t,n,a,c]);const d=R.useCallback(()=>{a.isPending()&&a.flush()},[a]);return R.useEffect(()=>()=>d(),[d]),{flush:d}}const hp=No(ug)`
211
+ `,fp="<reset>",Bc="<nothing>",Vc="included",Fc="excluded";function zg(t){return X.jsx(Xu,{fallbackRender:()=>X.jsx("span",{children:"Component crashed"}),children:X.jsx(FR,{...t})})}function FR(t){var e,n,r;if(_o()){const C=fo(t,!0,!1);return X.jsx(lp,{style:C})}const i=cc(t),o=ZD(i);if(!o)return X.jsx("span",{children:"Component Attribute not found"});const{attribute:a,makeDecision:u}=o,s=async C=>{var w;const T=((w=a.decision)==null?void 0:w.kind)===be.Explicit;C===fp&&T?await u(void 0):C===Vc?await u(Ze.Included):C===Fc&&await u(Ze.Excluded)},c=H((e=a.decision)==null?void 0:e.state).with(Ze.Included,()=>Vc).with(Ze.Excluded,()=>Fc).otherwise(()=>Bc),l=((n=a.decision)==null?void 0:n.kind)===be.Explicit,d=((r=a.decision)==null?void 0:r.kind)===be.Implicit,f=fo(t,a.isSatisfied,d),h=a.possibleDecisionStates.some(C=>C===Ze.Included),v=a.possibleDecisionStates.some(C=>C===Ze.Excluded),p=X.jsxs("option",{value:Vc,children:[dp(a,Ze.Included,t.implicitLabelPrefix),t.includedLabel]}),S=X.jsxs("option",{value:Fc,children:[dp(a,Ze.Excluded,t.implicitLabelPrefix),t.excludedLabel]});return X.jsxs(lp,{value:c,onChange:C=>s(C.currentTarget.value),style:f,children:[c===Bc&&X.jsx("option",{value:Bc}),l&&X.jsx("option",{value:fp,children:t.resetLabel}),h&&p,v&&S,!h||!v&&X.jsxs("optgroup",{label:"Blocked",children:[!h&&p,!v&&S]})]})}const dp=(t,e,n)=>{var r,i;return((r=t.decision)==null?void 0:r.kind)===be.Implicit&&((i=t.decision)==null?void 0:i.state)===e?n:""},LR={...cd,includedLabel:{title:"Included Label",type:pt.ControlType.String,defaultValue:"Included"},excludedLabel:{title:"Excluded Label",type:pt.ControlType.String,defaultValue:"Excluded"}};pt.addPropertyControls(zg,LR);function Hg(t,e,n,r,i=1e3){const[o]=Kg.useForceUpdate(),a=PO(f=>{e(f),o()},i),u=R.useRef(n),s=R.useRef(t),c=a.isPending(),l=R.useRef(c);R.useEffect(()=>{t!==s.current&&(s.current=t,c&&(a.cancel(),o()),t!==n&&r(t)),n!==u.current&&(u.current=n,n!==t?(a(n),o()):c&&(a.cancel(),o())),c!==l.current&&(l.current=c,!c&&t!==n&&r(t))},[t,n,a,c]);const d=R.useCallback(()=>{a.isPending()&&a.flush()},[a]);return R.useEffect(()=>()=>d(),[d]),{flush:d}}const hp=No(cg)`
210
212
  color: inherit;
211
- `;function Hg(t){return X.jsx(Xu,{fallbackRender:()=>X.jsx("span",{children:"Component crashed"}),children:X.jsx(FR,{...t})})}function FR(t){var e,n;if(_o()){const h=Kl(t,!0,!1);return X.jsx(hp,{style:h})}const r=cc(t),i=JD(r);if(!i)return X.jsx("span",{children:"Numeric Attribute not found"});const{attribute:o,makeDecision:a}=i,u=((e=o.decision)==null?void 0:e.kind)===be.Implicit,s=Kl(t,o.isSatisfied,u),c=(n=o.decision)==null?void 0:n.state,[l,d]=R.useState(c),f=zg(c,a,l,h=>d(h),t.wait);return X.jsx(hp,{thousandsGroupStyle:"thousand",decimalSeparator:t.decimalSeparator,thousandSeparator:t.thousandSeparator,allowNegative:!0,fixedDecimalScale:!0,decimalScale:o.decimalPlaces,allowEmptyFormatting:!1,displayType:"input",placeholder:t.placeholder,prefix:LR(o,t.implicitLabelPrefix),onBlur:()=>{f.flush()},onKeyPress:h=>{h.key==="Enter"&&f.flush()},onValueChange:h=>d(h.floatValue),value:l??"",style:s})}const LR=(t,e)=>{var n;return((n=t.decision)==null?void 0:n.kind)===be.Implicit?e:""},GR={...Vg,wait:{title:"Debounce Delay",type:yt.ControlType.Number,defaultValue:2e3,min:0,unit:"ms"},decimalSeparator:{title:"Decimal Separator",type:yt.ControlType.String,defaultValue:",",maxLength:1},thousandSeparator:{title:"Thousand Separator",type:yt.ControlType.String,defaultValue:".",maxLength:1},placeholder:{title:"Placeholder",type:yt.ControlType.String,defaultValue:""}};yt.addPropertyControls(Hg,GR);const zR=Object.freeze(Object.defineProperty({__proto__:null,BooleanSelect:Lg,ChoiceSelect:Fg,ComponentSelect:Gg,Configuration:Ug,NumericInput:Hg,useDebounceValue:zg,useRenderPlaceholder:_o},Symbol.toStringTag,{value:"Module"}));exports.Configurator=lT;exports.ConfiguratorFramer=zR;exports.ConfiguratorReact=r0;
213
+ `;function Wg(t){return X.jsx(Xu,{fallbackRender:()=>X.jsx("span",{children:"Component crashed"}),children:X.jsx(GR,{...t})})}function GR(t){var e,n;if(_o()){const h=Kl(t,!0,!1);return X.jsx(hp,{style:h})}const r=cc(t),i=JD(r);if(!i)return X.jsx("span",{children:"Numeric Attribute not found"});const{attribute:o,makeDecision:a}=i,u=((e=o.decision)==null?void 0:e.kind)===be.Implicit,s=Kl(t,o.isSatisfied,u),c=(n=o.decision)==null?void 0:n.state,[l,d]=R.useState(c),f=Hg(c,a,l,h=>d(h),t.wait);return X.jsx(hp,{thousandsGroupStyle:"thousand",decimalSeparator:t.decimalSeparator,thousandSeparator:t.thousandSeparator,allowNegative:!0,fixedDecimalScale:!0,decimalScale:o.decimalPlaces,allowEmptyFormatting:!1,displayType:"input",placeholder:t.placeholder,prefix:zR(o,t.implicitLabelPrefix),onBlur:()=>{f.flush()},onKeyPress:h=>{h.key==="Enter"&&f.flush()},onValueChange:h=>d(h.floatValue),value:l??"",style:s})}const zR=(t,e)=>{var n;return((n=t.decision)==null?void 0:n.kind)===be.Implicit?e:""},HR={...Fg,wait:{title:"Debounce Delay",type:pt.ControlType.Number,defaultValue:2e3,min:0,unit:"ms"},decimalSeparator:{title:"Decimal Separator",type:pt.ControlType.String,defaultValue:",",maxLength:1},thousandSeparator:{title:"Thousand Separator",type:pt.ControlType.String,defaultValue:".",maxLength:1},placeholder:{title:"Placeholder",type:pt.ControlType.String,defaultValue:""}};pt.addPropertyControls(Wg,HR);const WR=Object.freeze(Object.defineProperty({__proto__:null,BooleanSelect:Gg,ChoiceSelect:Lg,ComponentSelect:zg,Configuration:Bg,NumericInput:Wg,useDebounceValue:Hg,useRenderPlaceholder:_o},Symbol.toStringTag,{value:"Module"}));exports.Configurator=fT;exports.ConfiguratorFramer=WR;exports.ConfiguratorReact=i0;