wcs-core 4.0.2 → 4.1.0

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 (142) hide show
  1. package/README.md +4 -2
  2. package/dist/cjs/grid-pagination-4b55c908.js.map +1 -1
  3. package/dist/cjs/isEqual-9ea7ee49.js +2047 -0
  4. package/dist/cjs/isEqual-9ea7ee49.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/wcs-button.cjs.entry.js +4 -0
  7. package/dist/cjs/wcs-button.cjs.entry.js.map +1 -1
  8. package/dist/cjs/wcs-com-nav.cjs.entry.js +22 -2
  9. package/dist/cjs/wcs-com-nav.cjs.entry.js.map +1 -1
  10. package/dist/cjs/wcs-counter.cjs.entry.js +61 -34
  11. package/dist/cjs/wcs-counter.cjs.entry.js.map +1 -1
  12. package/dist/cjs/wcs-error_2.cjs.entry.js +1 -1
  13. package/dist/cjs/wcs-error_2.cjs.entry.js.map +1 -1
  14. package/dist/cjs/wcs-grid-column.cjs.entry.js.map +1 -1
  15. package/dist/cjs/wcs-grid-custom-cell.cjs.entry.js.map +1 -1
  16. package/dist/cjs/wcs-grid.cjs.entry.js +1104 -12
  17. package/dist/cjs/wcs-grid.cjs.entry.js.map +1 -1
  18. package/dist/cjs/wcs-native-select.cjs.entry.js +1 -1
  19. package/dist/cjs/wcs-native-select.cjs.entry.js.map +1 -1
  20. package/dist/cjs/wcs-select_2.cjs.entry.js +2 -2
  21. package/dist/cjs/wcs-select_2.cjs.entry.js.map +1 -1
  22. package/dist/cjs/wcs-skeleton-circle.cjs.entry.js +23 -0
  23. package/dist/cjs/wcs-skeleton-circle.cjs.entry.js.map +1 -0
  24. package/dist/cjs/wcs-skeleton-rectangle.cjs.entry.js +25 -0
  25. package/dist/cjs/wcs-skeleton-rectangle.cjs.entry.js.map +1 -0
  26. package/dist/cjs/wcs-skeleton-text.cjs.entry.js +23 -0
  27. package/dist/cjs/wcs-skeleton-text.cjs.entry.js.map +1 -0
  28. package/dist/cjs/wcs.cjs.js +1 -1
  29. package/dist/collection/collection-manifest.json +3 -0
  30. package/dist/collection/components/button/button.js +12 -0
  31. package/dist/collection/components/button/button.js.map +1 -1
  32. package/dist/collection/components/com-nav/com-nav.css +15 -0
  33. package/dist/collection/components/com-nav/com-nav.js +27 -1
  34. package/dist/collection/components/com-nav/com-nav.js.map +1 -1
  35. package/dist/collection/components/counter/counter.js +64 -40
  36. package/dist/collection/components/counter/counter.js.map +1 -1
  37. package/dist/collection/components/form-field/form-field.js +1 -1
  38. package/dist/collection/components/form-field/form-field.js.map +1 -1
  39. package/dist/collection/components/grid/grid.js +30 -20
  40. package/dist/collection/components/grid/grid.js.map +1 -1
  41. package/dist/collection/components/grid-column/grid-column.js +16 -11
  42. package/dist/collection/components/grid-column/grid-column.js.map +1 -1
  43. package/dist/collection/components/grid-custom-cell/grid-custom-cell.js +3 -0
  44. package/dist/collection/components/grid-custom-cell/grid-custom-cell.js.map +1 -1
  45. package/dist/collection/components/grid-pagination/grid-pagination.js +9 -6
  46. package/dist/collection/components/grid-pagination/grid-pagination.js.map +1 -1
  47. package/dist/collection/components/native-select/native-select.css +5 -3
  48. package/dist/collection/components/select/select.js +3 -3
  49. package/dist/collection/components/select/select.js.map +1 -1
  50. package/dist/collection/components/skeleton/skeleton-interface.js +2 -0
  51. package/dist/collection/components/skeleton/skeleton-interface.js.map +1 -0
  52. package/dist/collection/components/skeleton-circle/skeleton-circle.css +47 -0
  53. package/dist/collection/components/skeleton-circle/skeleton-circle.js +71 -0
  54. package/dist/collection/components/skeleton-circle/skeleton-circle.js.map +1 -0
  55. package/dist/collection/components/skeleton-rectangle/skeleton-rectangle.css +53 -0
  56. package/dist/collection/components/skeleton-rectangle/skeleton-rectangle.js +121 -0
  57. package/dist/collection/components/skeleton-rectangle/skeleton-rectangle.js.map +1 -0
  58. package/dist/collection/components/skeleton-text/skeleton-text.css +62 -0
  59. package/dist/collection/components/skeleton-text/skeleton-text.js +71 -0
  60. package/dist/collection/components/skeleton-text/skeleton-text.js.map +1 -0
  61. package/dist/collection/shared-types.js.map +1 -1
  62. package/dist/esm/grid-pagination-41354861.js.map +1 -1
  63. package/dist/esm/isEqual-20881bca.js +2020 -0
  64. package/dist/esm/isEqual-20881bca.js.map +1 -0
  65. package/dist/esm/loader.js +1 -1
  66. package/dist/esm/wcs-button.entry.js +4 -0
  67. package/dist/esm/wcs-button.entry.js.map +1 -1
  68. package/dist/esm/wcs-com-nav.entry.js +22 -2
  69. package/dist/esm/wcs-com-nav.entry.js.map +1 -1
  70. package/dist/esm/wcs-counter.entry.js +61 -34
  71. package/dist/esm/wcs-counter.entry.js.map +1 -1
  72. package/dist/esm/wcs-error_2.entry.js +1 -1
  73. package/dist/esm/wcs-error_2.entry.js.map +1 -1
  74. package/dist/esm/wcs-grid-column.entry.js.map +1 -1
  75. package/dist/esm/wcs-grid-custom-cell.entry.js.map +1 -1
  76. package/dist/esm/wcs-grid.entry.js +1104 -12
  77. package/dist/esm/wcs-grid.entry.js.map +1 -1
  78. package/dist/esm/wcs-native-select.entry.js +1 -1
  79. package/dist/esm/wcs-native-select.entry.js.map +1 -1
  80. package/dist/esm/wcs-select_2.entry.js +2 -2
  81. package/dist/esm/wcs-select_2.entry.js.map +1 -1
  82. package/dist/esm/wcs-skeleton-circle.entry.js +19 -0
  83. package/dist/esm/wcs-skeleton-circle.entry.js.map +1 -0
  84. package/dist/esm/wcs-skeleton-rectangle.entry.js +21 -0
  85. package/dist/esm/wcs-skeleton-rectangle.entry.js.map +1 -0
  86. package/dist/esm/wcs-skeleton-text.entry.js +19 -0
  87. package/dist/esm/wcs-skeleton-text.entry.js.map +1 -0
  88. package/dist/esm/wcs.js +1 -1
  89. package/dist/types/components/button/button.d.ts +12 -0
  90. package/dist/types/components/com-nav/com-nav.d.ts +11 -0
  91. package/dist/types/components/counter/counter.d.ts +8 -10
  92. package/dist/types/components/grid/grid.d.ts +22 -5
  93. package/dist/types/components/grid-column/grid-column.d.ts +37 -1
  94. package/dist/types/components/grid-custom-cell/grid-custom-cell.d.ts +3 -0
  95. package/dist/types/components/grid-pagination/grid-pagination.d.ts +26 -0
  96. package/dist/types/components/skeleton/skeleton-interface.d.ts +1 -0
  97. package/dist/types/components/skeleton-circle/skeleton-circle.d.ts +16 -0
  98. package/dist/types/components/skeleton-rectangle/skeleton-rectangle.d.ts +27 -0
  99. package/dist/types/components/skeleton-text/skeleton-text.d.ts +16 -0
  100. package/dist/types/components.d.ts +350 -16
  101. package/dist/types/shared-types.d.ts +22 -0
  102. package/dist/wcs/p-15058c29.entry.js +2 -0
  103. package/dist/wcs/p-15058c29.entry.js.map +1 -0
  104. package/dist/wcs/p-22480bd8.entry.js +2 -0
  105. package/dist/wcs/p-22480bd8.entry.js.map +1 -0
  106. package/dist/wcs/p-292ca644.entry.js +2 -0
  107. package/dist/wcs/p-292ca644.entry.js.map +1 -0
  108. package/dist/wcs/p-30d8f9c3.entry.js.map +1 -1
  109. package/dist/wcs/{p-26e7de5c.entry.js → p-405140f9.entry.js} +3 -3
  110. package/dist/wcs/{p-26e7de5c.entry.js.map → p-405140f9.entry.js.map} +1 -1
  111. package/dist/wcs/p-475ac7c5.js.map +1 -1
  112. package/dist/wcs/{p-4b2d8a6d.entry.js → p-57560d7d.entry.js} +2 -2
  113. package/dist/wcs/{p-4b2d8a6d.entry.js.map → p-57560d7d.entry.js.map} +1 -1
  114. package/dist/wcs/p-627bbb6a.entry.js.map +1 -1
  115. package/dist/wcs/p-6b66ce85.entry.js +2 -0
  116. package/dist/wcs/p-6b66ce85.entry.js.map +1 -0
  117. package/dist/wcs/p-8181f8cd.js +2 -0
  118. package/dist/wcs/p-8181f8cd.js.map +1 -0
  119. package/dist/wcs/p-84afb8af.entry.js +2 -0
  120. package/dist/wcs/p-84afb8af.entry.js.map +1 -0
  121. package/dist/wcs/p-b229a91c.entry.js.map +1 -1
  122. package/dist/wcs/p-cfcacc44.entry.js +2 -0
  123. package/dist/wcs/p-cfcacc44.entry.js.map +1 -0
  124. package/dist/wcs/p-dfddec76.entry.js +2 -0
  125. package/dist/wcs/p-dfddec76.entry.js.map +1 -0
  126. package/dist/wcs/wcs.esm.js +1 -1
  127. package/dist/wcs/wcs.esm.js.map +1 -1
  128. package/package.json +5 -9
  129. package/dist/cjs/lodash-776d6f03.js +0 -17211
  130. package/dist/cjs/lodash-776d6f03.js.map +0 -1
  131. package/dist/esm/lodash-d6d9d079.js +0 -17209
  132. package/dist/esm/lodash-d6d9d079.js.map +0 -1
  133. package/dist/wcs/p-5a7999bb.entry.js +0 -2
  134. package/dist/wcs/p-5a7999bb.entry.js.map +0 -1
  135. package/dist/wcs/p-a24fa4f4.entry.js +0 -2
  136. package/dist/wcs/p-a24fa4f4.entry.js.map +0 -1
  137. package/dist/wcs/p-adef7aaf.js +0 -2
  138. package/dist/wcs/p-adef7aaf.js.map +0 -1
  139. package/dist/wcs/p-bcb8b731.entry.js +0 -2
  140. package/dist/wcs/p-bcb8b731.entry.js.map +0 -1
  141. package/dist/wcs/p-f386bb8b.entry.js +0 -2
  142. package/dist/wcs/p-f386bb8b.entry.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{h as t,r,c as e,H as i,g as n}from"./p-a2df3a49.js";import{l as s}from"./p-adef7aaf.js";import{S as a}from"./p-d6c3e615.js";import{m as o,l as c,a as f,n as u,i as l,o as d,p as h,q as p,s as v,t as m,e as y,b as g,u as w,v as b}from"./p-12ac2547.js";import{c as x}from"./p-314d3097.js";import{M as O}from"./p-04ad2b73.js";
1
+ import{h as t,r,c as e,H as i,g as n}from"./p-a2df3a49.js";import{S as s}from"./p-d6c3e615.js";import{m as a,l as o,a as c,n as f,i as u,o as l,p as d,q as h,s as p,t as v,e as m,b as y,u as g,v as w}from"./p-12ac2547.js";import{w as b}from"./p-8181f8cd.js";import{c as x}from"./p-314d3097.js";import{M as O}from"./p-04ad2b73.js";
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,5 +12,5 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var S=function(){S=Object.assign||function t(r){for(var e,i=1,n=arguments.length;i<n;i++){e=arguments[i];for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s))r[s]=e[s]}return r};return S.apply(this,arguments)};function k(t,r){var e={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&r.indexOf(i)<0)e[i]=t[i];if(t!=null&&typeof Object.getOwnPropertySymbols==="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++){if(r.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n]))e[i[n]]=t[i[n]]}return e}function j(t){var r=typeof Symbol==="function"&&Symbol.iterator,e=r&&t[r],i=0;if(e)return e.call(t);if(t&&typeof t.length==="number")return{next:function(){if(t&&i>=t.length)t=void 0;return{value:t&&t[i++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(t,r){var e=typeof Symbol==="function"&&t[Symbol.iterator];if(!e)return t;var i=e.call(t),n,s=[],a;try{while((r===void 0||r-- >0)&&!(n=i.next()).done)s.push(n.value)}catch(t){a={error:t}}finally{try{if(n&&!n.done&&(e=i["return"]))e.call(i)}finally{if(a)throw a.error}}return s}function E(t,r,e){if(e||arguments.length===2)for(var i=0,n=r.length,s;i<n;i++){if(s||!(i in r)){if(!s)s=Array.prototype.slice.call(r,0,i);s[i]=r[i]}}return t.concat(s||Array.prototype.slice.call(r))}var C;(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"})(C||(C={}));var _;(function(t){t["Parent"]="#_parent";t["Internal"]="#_internal"})(_||(_={}));var T=C.Start;var L=C.Stop;var N=C.Raise;var A=C.Send;var I=C.Cancel;var M=C.NullEvent;var D=C.Assign;var P=C.Log;var V=C.Init;var B=C.Invoke;var $=C.ErrorPlatform;var F=C.ErrorCustom;var J=C.Update;var U=C.Choose;var W=C.Pure;var K=".";var R={};var q="xstate.guard";var H="";var G;function Q(t,r,e){if(e===void 0){e=K}var i=tt(t,e);var n=tt(r,e);if(bt(n)){if(bt(i)){return n===i}return false}if(bt(i)){return i in n}return Object.keys(i).every((function(t){if(!(t in n)){return false}return Q(i[t],n[t])}))}function X(t){try{return bt(t)||typeof t==="number"?"".concat(t):t.type}catch(t){throw new Error("Events must be strings or objects with a string event.type property.")}}function Y(t,r){try{if(gt(t)){return t}return t.toString().split(r)}catch(r){throw new Error("'".concat(t,"' is not a valid state path."))}}function Z(t){return typeof t==="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function tt(t,r){if(Z(t)){return t.value}if(gt(t)){return rt(t)}if(typeof t!=="string"){return t}var e=Y(t,r);return rt(e)}function rt(t){if(t.length===1){return t[0]}var r={};var e=r;for(var i=0;i<t.length-1;i++){if(i===t.length-2){e[t[i]]=t[i+1]}else{e[t[i]]={};e=e[t[i]]}}return r}function et(t,r){var e={};var i=Object.keys(t);for(var n=0;n<i.length;n++){var s=i[n];e[s]=r(t[s],s,t,n)}return e}function it(t,r,e){var i,n;var s={};try{for(var a=j(Object.keys(t)),o=a.next();!o.done;o=a.next()){var c=o.value;var f=t[c];if(!e(f)){continue}s[c]=r(f,c,t)}}catch(t){i={error:t}}finally{try{if(o&&!o.done&&(n=a.return))n.call(a)}finally{if(i)throw i.error}}return s}var nt=function(t){return function(r){var e,i;var n=r;try{for(var s=j(t),a=s.next();!a.done;a=s.next()){var o=a.value;n=n[o]}}catch(t){e={error:t}}finally{try{if(a&&!a.done&&(i=s.return))i.call(s)}finally{if(e)throw e.error}}return n}};function st(t,r){return function(e){var i,n;var s=e;try{for(var a=j(t),o=a.next();!o.done;o=a.next()){var c=o.value;s=s[r][c]}}catch(t){i={error:t}}finally{try{if(o&&!o.done&&(n=a.return))n.call(a)}finally{if(i)throw i.error}}return s}}function at(t){if(!t){return[[]]}if(bt(t)){return[[t]]}var r=ot(Object.keys(t).map((function(r){var e=t[r];if(typeof e!=="string"&&(!e||!Object.keys(e).length)){return[[r]]}return at(t[r]).map((function(t){return[r].concat(t)}))})));return r}function ot(t){var r;return(r=[]).concat.apply(r,E([],z(t),false))}function ct(t){if(gt(t)){return t}return[t]}function ft(t){if(t===undefined){return[]}return ct(t)}function ut(t,r,e){var i,n;if(wt(t)){return t(r,e.data)}var s={};try{for(var a=j(Object.keys(t)),o=a.next();!o.done;o=a.next()){var c=o.value;var f=t[c];if(wt(f)){s[c]=f(r,e.data)}else{s[c]=f}}}catch(t){i={error:t}}finally{try{if(o&&!o.done&&(n=a.return))n.call(a)}finally{if(i)throw i.error}}return s}function lt(t){return/^(done|error)\./.test(t)}function dt(t){if(t instanceof Promise){return true}if(t!==null&&(wt(t)||typeof t==="object")&&wt(t.then)){return true}return false}function ht(t){return t!==null&&typeof t==="object"&&"transition"in t&&typeof t.transition==="function"}function pt(t,r){var e,i;var n=z([[],[]],2),s=n[0],a=n[1];try{for(var o=j(t),c=o.next();!c.done;c=o.next()){var f=c.value;if(r(f)){s.push(f)}else{a.push(f)}}}catch(t){e={error:t}}finally{try{if(c&&!c.done&&(i=o.return))i.call(o)}finally{if(e)throw e.error}}return[s,a]}function vt(t,r){return et(t.states,(function(t,e){if(!t){return undefined}var i=(bt(r)?undefined:r[e])||(t?t.current:undefined);if(!i){return undefined}return{current:i,states:vt(t,i)}}))}function mt(t,r){return{current:r,states:vt(t,r)}}function yt(t,r,e,i){var n=t?e.reduce((function(t,e){var n,s;var a=e.assignment;var o={state:i,action:e,_event:r};var c={};if(wt(a)){c=a(t,r.data,o)}else{try{for(var f=j(Object.keys(a)),u=f.next();!u.done;u=f.next()){var l=u.value;var d=a[l];c[l]=wt(d)?d(t,r.data,o):d}}catch(t){n={error:t}}finally{try{if(u&&!u.done&&(s=f.return))s.call(f)}finally{if(n)throw n.error}}}return Object.assign({},t,c)}),t):t;return n}function gt(t){return Array.isArray(t)}function wt(t){return typeof t==="function"}function bt(t){return typeof t==="string"}function xt(t,r){if(!t){return undefined}if(bt(t)){return{type:q,name:t,predicate:r?r[t]:undefined}}if(wt(t)){return{type:q,name:t.name,predicate:t}}return t}function Ot(t){try{return"subscribe"in t&&wt(t.subscribe)}catch(t){return false}}var St=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}();G={},G[St]=function(){return this},G[Symbol.observable]=function(){return this},G;function kt(t){return!!t&&"__xstatenode"in t}function jt(t){return!!t&&typeof t.send==="function"}function zt(t,r){if(bt(t)||typeof t==="number"){return S({type:t},r)}return t}function Et(t,r){if(!bt(t)&&"$$type"in t&&t.$$type==="scxml"){return t}var e=zt(t);return S({name:e.type,data:e,$$type:"scxml",type:"external"},r)}function Ct(t,r){var e=ct(r).map((function(r){if(typeof r==="undefined"||typeof r==="string"||kt(r)){return{target:r,event:t}}return S(S({},r),{event:t})}));return e}function _t(t){if(t===undefined||t===H){return undefined}return ft(t)}function Tt(t,r,e,i,n){var s=t.options.guards;var a={state:n,cond:r,_event:i};if(r.type===q){return((s===null||s===void 0?void 0:s[r.name])||r.predicate)(e,i.data,a)}var o=s===null||s===void 0?void 0:s[r.type];if(!o){throw new Error("Guard '".concat(r.type,"' is not implemented on machine '").concat(t.id,"'."))}return o(e,i.data,a)}function Lt(t){if(typeof t==="string"){return{type:t}}return t}function Nt(t,r,e){var i=function(){};var n=typeof t==="object";var s=n?t:null;return{next:((n?t.next:t)||i).bind(s),error:((n?t.error:r)||i).bind(s),complete:((n?t.complete:e)||i).bind(s)}}function At(t,r){return"".concat(t,":invocation[").concat(r,"]")}function It(t){return(t.type===N||t.type===A&&t.to===_.Internal)&&typeof t.delay!=="number"}var Mt=Et({type:V});function Dt(t,r){return r?r[t]||undefined:undefined}function Pt(t,r){var e;if(bt(t)||typeof t==="number"){var i=Dt(t,r);if(wt(i)){e={type:t,exec:i}}else if(i){e=i}else{e={type:t,exec:undefined}}}else if(wt(t)){e={type:t.name||t.toString(),exec:t}}else{var i=Dt(t.type,r);if(wt(i)){e=S(S({},t),{exec:i})}else if(i){var n=i.type||t.type;e=S(S(S({},i),t),{type:n})}else{e=t}}return e}var Vt=function(t,r){if(!t){return[]}var e=gt(t)?t:[t];return e.map((function(t){return Pt(t,r)}))};function Bt(t){var r=Pt(t);return S(S({id:bt(t)?t:r.id},r),{type:r.type})}function $t(t,r){return{type:N,event:typeof t==="function"?t:zt(t),delay:r?r.delay:undefined,id:r===null||r===void 0?void 0:r.id}}function Ft(t,r,e,i){var n={_event:e};var s=Et(wt(t.event)?t.event(r,e.data,n):t.event);var a;if(bt(t.delay)){var o=i&&i[t.delay];a=wt(o)?o(r,e.data,n):o}else{a=wt(t.delay)?t.delay(r,e.data,n):t.delay}return S(S({},t),{type:N,_event:s,delay:a})}function Jt(t,r){return{to:r?r.to:undefined,type:A,event:wt(t)?t:zt(t),delay:r?r.delay:undefined,id:r&&r.id!==undefined?r.id:wt(t)?t.name:X(t)}}function Ut(t,r,e,i){var n={_event:e};var s=Et(wt(t.event)?t.event(r,e.data,n):t.event);var a;if(bt(t.delay)){var o=i&&i[t.delay];a=wt(o)?o(r,e.data,n):o}else{a=wt(t.delay)?t.delay(r,e.data,n):t.delay}var c=wt(t.to)?t.to(r,e.data,n):t.to;return S(S({},t),{to:c,_event:s,event:s.data,delay:a})}var Wt=function(t,r,e){return S(S({},t),{value:bt(t.expr)?t.expr:t.expr(r,e.data,{_event:e})})};var Kt=function(t){return{type:I,sendId:t}};function Rt(t){var r=Bt(t);return{type:C.Start,activity:r,exec:undefined}}function qt(t){var r=wt(t)?t:Bt(t);return{type:C.Stop,activity:r,exec:undefined}}function Ht(t,r,e){var i=wt(t.activity)?t.activity(r,e.data):t.activity;var n=typeof i==="string"?{id:i}:i;var s={type:C.Stop,activity:n};return s}function Gt(t,r){var e=r?"#".concat(r):"";return"".concat(C.After,"(").concat(t,")").concat(e)}function Qt(t,r){var e="".concat(C.DoneState,".").concat(t);var i={type:e,data:r};i.toString=function(){return e};return i}function Xt(t,r){var e="".concat(C.DoneInvoke,".").concat(t);var i={type:e,data:r};i.toString=function(){return e};return i}function Yt(t,r){var e="".concat(C.ErrorPlatform,".").concat(t);var i={type:e,data:r};i.toString=function(){return e};return i}var Zt=function(t){var r,e;var i=[];try{for(var n=j(t),s=n.next();!s.done;s=n.next()){var a=s.value;var o=0;while(o<a.actions.length){if(a.actions[o].type===D){i.push(a.actions[o]);a.actions.splice(o,1);continue}o++}}}catch(t){r={error:t}}finally{try{if(s&&!s.done&&(e=n.return))e.call(n)}finally{if(r)throw r.error}}return i};function tr(t,r,e,i,n,s,a){if(a===void 0){a=false}var o=a?[]:Zt(n);var c=o.length?yt(e,i,o,r):e;var f=a?[e]:undefined;var u=[];function l(n,o){var l;switch(o.type){case N:{var d=Ft(o,c,i,t.options.delays);if(s&&typeof d.delay==="number"){s(d,c,i)}return d}case A:var h=Ut(o,c,i,t.options.delays);if(s&&h.to!==_.Internal){if(n==="entry"){u.push(h)}else{s(h,c,i)}}return h;case P:{var p=Wt(o,c,i);s===null||s===void 0?void 0:s(p,c,i);return p}case U:{var v=o;var m=(l=v.conds.find((function(e){var n=xt(e.cond,t.options.guards);return!n||Tt(t,n,c,i,!s?r:undefined)})))===null||l===void 0?void 0:l.actions;if(!m){return[]}var y=z(tr(t,r,c,i,[{type:n,actions:Vt(ft(m),t.options.actions)}],s,a),2),g=y[0],w=y[1];c=w;f===null||f===void 0?void 0:f.push(c);return g}case W:{var m=o.get(c,i.data);if(!m){return[]}var b=z(tr(t,r,c,i,[{type:n,actions:Vt(ft(m),t.options.actions)}],s,a),2),x=b[0],O=b[1];c=O;f===null||f===void 0?void 0:f.push(c);return x}case L:{var p=Ht(o,c,i);s===null||s===void 0?void 0:s(p,e,i);return p}case D:{c=yt(c,i,[o],!s?r:undefined);f===null||f===void 0?void 0:f.push(c);break}default:var k=Pt(o,t.options.actions);var j=k.exec;if(s){s(k,c,i)}else if(j&&f){var C=f.length-1;var T=S(S({},k),{exec:function(t){var r=[];for(var e=1;e<arguments.length;e++){r[e-1]=arguments[e]}j.apply(void 0,E([f[C]],z(r),false))}});k=T}return k}}function d(t){var r,e;var n=[];try{for(var a=j(t.actions),o=a.next();!o.done;o=a.next()){var f=o.value;var d=l(t.type,f);if(d){n=n.concat(d)}}}catch(t){r={error:t}}finally{try{if(o&&!o.done&&(e=a.return))e.call(a)}finally{if(r)throw r.error}}u.forEach((function(t){s(t,c,i)}));u.length=0;return n}var h=ot(n.map(d));return[h,c]}var rr=function(t,r){var e=r(t);return e};function er(t){var r;return r={id:t,send:function(){return void 0},subscribe:function(){return{unsubscribe:function(){return void 0}}},getSnapshot:function(){return undefined},toJSON:function(){return{id:t}}},r[St]=function(){return this},r}function ir(t,r,e,i){var n;var s=Lt(t.src);var a=(n=r===null||r===void 0?void 0:r.options.services)===null||n===void 0?void 0:n[s.type];var o=t.data?ut(t.data,e,i):undefined;var c=a?nr(a,t.id,o):er(t.id);c.meta=t;return c}function nr(t,r,e){var i=er(r);i.deferred=true;if(kt(t)){var n=i.state=rr(undefined,(function(){return(e?t.withContext(e):t).initialState}));i.getSnapshot=function(){return n}}return i}function sr(t){try{return typeof t.send==="function"}catch(t){return false}}function ar(t){return sr(t)&&"id"in t}function or(t){var r;return S((r={subscribe:function(){return{unsubscribe:function(){return void 0}}},id:"anonymous",getSnapshot:function(){return undefined}},r[St]=function(){return this},r),t)}var cr=function(t){return t.type==="atomic"||t.type==="final"};function fr(t){return Object.keys(t.states).map((function(r){return t.states[r]}))}function ur(t){return fr(t).filter((function(t){return t.type!=="history"}))}function lr(t){var r=[t];if(cr(t)){return r}return r.concat(ot(ur(t).map(lr)))}function dr(t,r){var e,i,n,s,a,o,c,f;var u=new Set(t);var l=pr(u);var d=new Set(r);try{for(var h=j(d),p=h.next();!p.done;p=h.next()){var v=p.value;var m=v.parent;while(m&&!d.has(m)){d.add(m);m=m.parent}}}catch(t){e={error:t}}finally{try{if(p&&!p.done&&(i=h.return))i.call(h)}finally{if(e)throw e.error}}var y=pr(d);try{for(var g=j(d),w=g.next();!w.done;w=g.next()){var v=w.value;if(v.type==="compound"&&(!y.get(v)||!y.get(v).length)){if(l.get(v)){l.get(v).forEach((function(t){return d.add(t)}))}else{v.initialStateNodes.forEach((function(t){return d.add(t)}))}}else{if(v.type==="parallel"){try{for(var b=(a=void 0,j(ur(v))),x=b.next();!x.done;x=b.next()){var O=x.value;if(!d.has(O)){d.add(O);if(l.get(O)){l.get(O).forEach((function(t){return d.add(t)}))}else{O.initialStateNodes.forEach((function(t){return d.add(t)}))}}}}catch(t){a={error:t}}finally{try{if(x&&!x.done&&(o=b.return))o.call(b)}finally{if(a)throw a.error}}}}}}catch(t){n={error:t}}finally{try{if(w&&!w.done&&(s=g.return))s.call(g)}finally{if(n)throw n.error}}try{for(var S=j(d),k=S.next();!k.done;k=S.next()){var v=k.value;var m=v.parent;while(m&&!d.has(m)){d.add(m);m=m.parent}}}catch(t){c={error:t}}finally{try{if(k&&!k.done&&(f=S.return))f.call(S)}finally{if(c)throw c.error}}return d}function hr(t,r){var e=r.get(t);if(!e){return{}}if(t.type==="compound"){var i=e[0];if(i){if(cr(i)){return i.key}}else{return{}}}var n={};e.forEach((function(t){n[t.key]=hr(t,r)}));return n}function pr(t){var r,e;var i=new Map;try{for(var n=j(t),s=n.next();!s.done;s=n.next()){var a=s.value;if(!i.has(a)){i.set(a,[])}if(a.parent){if(!i.has(a.parent)){i.set(a.parent,[])}i.get(a.parent).push(a)}}}catch(t){r={error:t}}finally{try{if(s&&!s.done&&(e=n.return))e.call(n)}finally{if(r)throw r.error}}return i}function vr(t,r){var e=dr([t],r);return hr(t,pr(e))}function mr(t,r){if(Array.isArray(t)){return t.some((function(t){return t===r}))}if(t instanceof Set){return t.has(r)}return false}function yr(t){return E([],z(new Set(ot(E([],z(t.map((function(t){return t.ownEvents}))),false)))),false)}function gr(t,r){if(r.type==="compound"){return ur(r).some((function(r){return r.type==="final"&&mr(t,r)}))}if(r.type==="parallel"){return ur(r).every((function(r){return gr(t,r)}))}return false}function wr(t){if(t===void 0){t=[]}return t.reduce((function(t,r){if(r.meta!==undefined){t[r.id]=r.meta}return t}),{})}function br(t){return new Set(ot(t.map((function(t){return t.tags}))))}function xr(t,r){if(t===r){return true}if(t===undefined||r===undefined){return false}if(bt(t)||bt(r)){return t===r}var e=Object.keys(t);var i=Object.keys(r);return e.length===i.length&&e.every((function(e){return xr(t[e],r[e])}))}function Or(t){if(typeof t!=="object"||t===null){return false}return"value"in t&&"_event"in t}function Sr(t,r){var e=t.exec;var i=S(S({},t),{exec:e!==undefined?function(){return e(r.context,r.event,{action:t,state:r,_event:r._event})}:undefined});return i}var kr=function(){function t(t){var r=this;var e;this.actions=[];this.activities=R;this.meta={};this.events=[];this.value=t.value;this.context=t.context;this._event=t._event;this._sessionid=t._sessionid;this.event=this._event.data;this.historyValue=t.historyValue;this.history=t.history;this.actions=t.actions||[];this.activities=t.activities||R;this.meta=wr(t.configuration);this.events=t.events||[];this.matches=this.matches.bind(this);this.toStrings=this.toStrings.bind(this);this.configuration=t.configuration;this.transitions=t.transitions;this.children=t.children;this.done=!!t.done;this.tags=(e=Array.isArray(t.tags)?new Set(t.tags):t.tags)!==null&&e!==void 0?e:new Set;this.machine=t.machine;Object.defineProperty(this,"nextEvents",{get:function(){return yr(r.configuration)}})}t.from=function(r,e){if(r instanceof t){if(r.context!==e){return new t({value:r.value,context:e,_event:r._event,_sessionid:null,historyValue:r.historyValue,history:r.history,actions:[],activities:r.activities,meta:{},events:[],configuration:[],transitions:[],children:{}})}return r}var i=Mt;return new t({value:r,context:e,_event:i,_sessionid:null,historyValue:undefined,history:undefined,actions:[],activities:undefined,meta:undefined,events:[],configuration:[],transitions:[],children:{}})};t.create=function(r){return new t(r)};t.inert=function(r,e){if(r instanceof t){if(!r.actions.length){return r}var i=Mt;return new t({value:r.value,context:e,_event:i,_sessionid:null,historyValue:r.historyValue,history:r.history,activities:r.activities,configuration:r.configuration,transitions:[],children:{}})}return t.from(r,e)};t.prototype.toStrings=function(t,r){var e=this;if(t===void 0){t=this.value}if(r===void 0){r="."}if(bt(t)){return[t]}var i=Object.keys(t);return i.concat.apply(i,E([],z(i.map((function(i){return e.toStrings(t[i],r).map((function(t){return i+r+t}))}))),false))};t.prototype.toJSON=function(){var t=this;var r=t.tags;var e=k(t,["configuration","transitions","tags","machine"]);return S(S({},e),{tags:Array.from(r)})};t.prototype.matches=function(t){return Q(t,this.value)};t.prototype.hasTag=function(t){return this.tags.has(t)};t.prototype.can=function(t){var r;var e=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,t);return!!(e===null||e===void 0?void 0:e.transitions.length)&&e.transitions.some((function(t){return t.target!==undefined||t.actions.length}))};return t}();var jr={deferEvents:false};var zr=function(){function t(t){this.processingEvent=false;this.queue=[];this.initialized=false;this.options=S(S({},jr),t)}t.prototype.initialize=function(t){this.initialized=true;if(t){if(!this.options.deferEvents){this.schedule(t);return}this.process(t)}this.flushEvents()};t.prototype.schedule=function(t){if(!this.initialized||this.processingEvent){this.queue.push(t);return}if(this.queue.length!==0){throw new Error("Event queue should be empty when it is not processing events")}this.process(t);this.flushEvents()};t.prototype.clear=function(){this.queue=[]};t.prototype.flushEvents=function(){var t=this.queue.shift();while(t){this.process(t);t=this.queue.shift()}};t.prototype.process=function(t){this.processingEvent=true;try{t()}catch(t){this.clear();throw t}finally{this.processingEvent=false}};return t}();var Er=new Map;var Cr=0;var _r={bookId:function(){return"x:".concat(Cr++)},register:function(t,r){Er.set(t,r);return t},get:function(t){return Er.get(t)},free:function(t){Er.delete(t)}};function Tr(){if(typeof globalThis!=="undefined"){return globalThis}if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}}function Lr(){var t=Tr();if(t&&"__xstate__"in t){return t.__xstate__}return undefined}function Nr(t){if(!Tr()){return}var r=Lr();if(r){r.register(t)}}function Ar(t,r){if(r===void 0){r={}}var e=t.initialState;var i=new Set;var n=[];var s=false;var a=function(){if(s){return}s=true;while(n.length>0){var r=n.shift();e=t.transition(e,r,c);i.forEach((function(t){return t.next(e)}))}s=false};var o=or({id:r.id,send:function(t){n.push(t);a()},getSnapshot:function(){return e},subscribe:function(t,r,n){var s=Nt(t,r,n);i.add(s);s.next(e);return{unsubscribe:function(){i.delete(s)}}}});var c={parent:r.parent,self:o,id:r.id||"anonymous",observers:i};e=t.start?t.start(c):e;return o}var Ir={sync:false,autoForward:false};var Mr;(function(t){t[t["NotStarted"]=0]="NotStarted";t[t["Running"]=1]="Running";t[t["Stopped"]=2]="Stopped"})(Mr||(Mr={}));var Dr=function(){function t(r,e){if(e===void 0){e=t.defaultOptions}var i=this;this.machine=r;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=false;this.status=Mr.NotStarted;this.children=new Map;this.forwardTo=new Set;this._outgoingQueue=[];this.init=this.start;this.send=function(t,r){if(gt(t)){i.batch(t);return i.state}var e=Et(zt(t,r));if(i.status===Mr.Stopped){return i.state}if(i.status!==Mr.Running&&!i.options.deferEvents){throw new Error('Event "'.concat(e.name,'" was sent to uninitialized service "').concat(i.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: ').concat(JSON.stringify(e.data)))}i.scheduler.schedule((function(){i.forward(e);var t=i._nextState(e);i.update(t,e)}));return i._state};this.sendTo=function(t,r,e){var n=i.parent&&(r===_.Parent||i.parent.id===r);var s=n?i.parent:bt(r)?r===_.Internal?i:i.children.get(r)||_r.get(r):jt(r)?r:undefined;if(!s){if(!n){throw new Error("Unable to send event to child '".concat(r,"' from service '").concat(i.id,"'."))}return}if("machine"in s){if(i.status!==Mr.Stopped||i.parent!==s||i.state.done){var a=S(S({},t),{name:t.name===F?"".concat(Yt(i.id)):t.name,origin:i.sessionId});if(!e&&i.machine.config.predictableActionArguments){i._outgoingQueue.push([s,a])}else{s.send(a)}}}else{if(!e&&i.machine.config.predictableActionArguments){i._outgoingQueue.push([s,t.data])}else{s.send(t.data)}}};this._exec=function(t,r,e,n){if(n===void 0){n=i.machine.options.actions}var s=t.exec||Dt(t.type,n);var a=wt(s)?s:s?s.exec:t.exec;if(a){try{return a(r,e.data,!i.machine.config.predictableActionArguments?{action:t,state:i.state,_event:e}:{action:t,_event:e})}catch(t){if(i.parent){i.parent.send({type:"xstate.error",data:t})}throw t}}switch(t.type){case N:{var o=t;i.defer(o);break}case A:var c=t;if(typeof c.delay==="number"){i.defer(c);return}else{if(c.to){i.sendTo(c._event,c.to,e===Mt)}else{i.send(c._event)}}break;case I:i.cancel(t.sendId);break;case T:{if(i.status!==Mr.Running){return}var f=t.activity;if(!i.machine.config.predictableActionArguments&&!i.state.activities[f.id||f.type]){break}if(f.type===C.Invoke){var u=Lt(f.src);var l=i.machine.options.services?i.machine.options.services[u.type]:undefined;var d=f.id,h=f.data;var p="autoForward"in f?f.autoForward:!!f.forward;if(!l){return}var v=h?ut(h,r,e):undefined;if(typeof l==="string"){return}var m=wt(l)?l(r,e.data,{data:v,src:u,meta:f.meta}):l;if(!m){return}var y=void 0;if(kt(m)){m=v?m.withContext(v):m;y={autoForward:p}}i.spawn(m,d,y)}else{i.spawnActivity(f)}break}case L:{i.stopChild(t.activity.id);break}case P:var g=t,w=g.label,b=g.value;if(w){i.logger(w,b)}else{i.logger(b)}break}};var n=S(S({},t.defaultOptions),e);var s=n.clock,a=n.logger,o=n.parent,c=n.id;var f=c!==undefined?c:r.id;this.id=f;this.logger=a;this.clock=s;this.parent=o;this.options=n;this.scheduler=new zr({deferEvents:this.options.deferEvents});this.sessionId=_r.bookId()}Object.defineProperty(t.prototype,"initialState",{get:function(){var t=this;if(this._initialState){return this._initialState}return rr(this,(function(){t._initialState=t.machine.initialState;return t._initialState}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:false,configurable:true});t.prototype.execute=function(t,r){var e,i;try{for(var n=j(t.actions),s=n.next();!s.done;s=n.next()){var a=s.value;this.exec(a,t,r)}}catch(t){e={error:t}}finally{try{if(s&&!s.done&&(i=n.return))i.call(n)}finally{if(e)throw e.error}}};t.prototype.update=function(t,r){var e,i,n,s,a,o,c,f;var u=this;t._sessionid=this.sessionId;this._state=t;if((!this.machine.config.predictableActionArguments||r===Mt)&&this.options.execute){this.execute(this.state)}else{var l=void 0;while(l=this._outgoingQueue.shift()){l[0].send(l[1])}}this.children.forEach((function(t){u.state.children[t.id]=t}));if(this.devTools){this.devTools.send(r.data,t)}if(t.event){try{for(var d=j(this.eventListeners),h=d.next();!h.done;h=d.next()){var p=h.value;p(t.event)}}catch(t){e={error:t}}finally{try{if(h&&!h.done&&(i=d.return))i.call(d)}finally{if(e)throw e.error}}}try{for(var v=j(this.listeners),m=v.next();!m.done;m=v.next()){var p=m.value;p(t,t.event)}}catch(t){n={error:t}}finally{try{if(m&&!m.done&&(s=v.return))s.call(v)}finally{if(n)throw n.error}}try{for(var y=j(this.contextListeners),g=y.next();!g.done;g=y.next()){var w=g.value;w(this.state.context,this.state.history?this.state.history.context:undefined)}}catch(t){a={error:t}}finally{try{if(g&&!g.done&&(o=y.return))o.call(y)}finally{if(a)throw a.error}}if(this.state.done){var b=t.configuration.find((function(t){return t.type==="final"&&t.parent===u.machine}));var x=b&&b.doneData?ut(b.doneData,t.context,r):undefined;this._doneEvent=Xt(this.id,x);try{for(var O=j(this.doneListeners),S=O.next();!S.done;S=O.next()){var p=S.value;p(this._doneEvent)}}catch(t){c={error:t}}finally{try{if(S&&!S.done&&(f=O.return))f.call(O)}finally{if(c)throw c.error}}this._stop();this._stopChildren();_r.free(this.sessionId)}};t.prototype.onTransition=function(t){this.listeners.add(t);if(this.status===Mr.Running){t(this.state,this.state.event)}return this};t.prototype.subscribe=function(t,r,e){var i=this;var n=Nt(t,r,e);this.listeners.add(n.next);if(this.status!==Mr.NotStarted){n.next(this.state)}var s=function(){i.doneListeners.delete(s);i.stopListeners.delete(s);n.complete()};if(this.status===Mr.Stopped){n.complete()}else{this.onDone(s);this.onStop(s)}return{unsubscribe:function(){i.listeners.delete(n.next);i.doneListeners.delete(s);i.stopListeners.delete(s)}}};t.prototype.onEvent=function(t){this.eventListeners.add(t);return this};t.prototype.onSend=function(t){this.sendListeners.add(t);return this};t.prototype.onChange=function(t){this.contextListeners.add(t);return this};t.prototype.onStop=function(t){this.stopListeners.add(t);return this};t.prototype.onDone=function(t){if(this.status===Mr.Stopped&&this._doneEvent){t(this._doneEvent)}else{this.doneListeners.add(t)}return this};t.prototype.off=function(t){this.listeners.delete(t);this.eventListeners.delete(t);this.sendListeners.delete(t);this.stopListeners.delete(t);this.doneListeners.delete(t);this.contextListeners.delete(t);return this};t.prototype.start=function(t){var r=this;if(this.status===Mr.Running){return this}this.machine._init();_r.register(this.sessionId,this);this.initialized=true;this.status=Mr.Running;var e=t===undefined?this.initialState:rr(this,(function(){return Or(t)?r.machine.resolveState(t):r.machine.resolveState(kr.from(t,r.machine.context))}));if(this.options.devTools){this.attachDev()}this.scheduler.initialize((function(){r.update(e,Mt)}));return this};t.prototype._stopChildren=function(){this.children.forEach((function(t){if(wt(t.stop)){t.stop()}}));this.children.clear()};t.prototype._stop=function(){var t,r,e,i,n,s,a,o,c,f;try{for(var u=j(this.listeners),l=u.next();!l.done;l=u.next()){var d=l.value;this.listeners.delete(d)}}catch(r){t={error:r}}finally{try{if(l&&!l.done&&(r=u.return))r.call(u)}finally{if(t)throw t.error}}try{for(var h=j(this.stopListeners),p=h.next();!p.done;p=h.next()){var d=p.value;d();this.stopListeners.delete(d)}}catch(t){e={error:t}}finally{try{if(p&&!p.done&&(i=h.return))i.call(h)}finally{if(e)throw e.error}}try{for(var v=j(this.contextListeners),m=v.next();!m.done;m=v.next()){var d=m.value;this.contextListeners.delete(d)}}catch(t){n={error:t}}finally{try{if(m&&!m.done&&(s=v.return))s.call(v)}finally{if(n)throw n.error}}try{for(var y=j(this.doneListeners),g=y.next();!g.done;g=y.next()){var d=g.value;this.doneListeners.delete(d)}}catch(t){a={error:t}}finally{try{if(g&&!g.done&&(o=y.return))o.call(y)}finally{if(a)throw a.error}}if(!this.initialized){return this}this.initialized=false;this.status=Mr.Stopped;this._initialState=undefined;try{for(var w=j(Object.keys(this.delayedEventsMap)),b=w.next();!b.done;b=w.next()){var x=b.value;this.clock.clearTimeout(this.delayedEventsMap[x])}}catch(t){c={error:t}}finally{try{if(b&&!b.done&&(f=w.return))f.call(w)}finally{if(c)throw c.error}}this.scheduler.clear();this.scheduler=new zr({deferEvents:this.options.deferEvents})};t.prototype.stop=function(){var t=this;var r=this.scheduler;this._stop();r.schedule((function(){var r=Et({type:"xstate.stop"});var e=rr(t,(function(){var e=ot(E([],z(t.state.configuration),false).sort((function(t,r){return r.order-t.order})).map((function(r){return Vt(r.onExit,t.machine.options.actions)})));var i=z(tr(t.machine,t.state,t.state.context,r,[{type:"exit",actions:e}],t.machine.config.predictableActionArguments?t._exec:undefined,t.machine.config.predictableActionArguments||t.machine.config.preserveActionOrder),2),n=i[0],s=i[1];var a=new kr({value:t.state.value,context:s,_event:r,_sessionid:t.sessionId,historyValue:undefined,history:t.state,actions:n.filter((function(t){return!It(t)})),activities:{},events:[],configuration:[],transitions:[],children:{},done:t.state.done,tags:t.state.tags,machine:t.machine});a.changed=true;return a}));t.update(e,r);t._stopChildren();_r.free(t.sessionId)}));return this};t.prototype.batch=function(t){var r=this;if(this.status===Mr.NotStarted&&this.options.deferEvents);else if(this.status!==Mr.Running){throw new Error("".concat(t.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(!t.length){return}var e=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule((function(){var i,n;var s=r.state;var a=false;var o=[];var c=function(t){var i=Et(t);r.forward(i);s=rr(r,(function(){return r.machine.transition(s,i,undefined,e||undefined)}));o.push.apply(o,E([],z(r.machine.config.predictableActionArguments?s.actions:s.actions.map((function(t){return Sr(t,s)}))),false));a=a||!!s.changed};try{for(var f=j(t),u=f.next();!u.done;u=f.next()){var l=u.value;c(l)}}catch(t){i={error:t}}finally{try{if(u&&!u.done&&(n=f.return))n.call(f)}finally{if(i)throw i.error}}s.changed=a;s.actions=o;r.update(s,Et(t[t.length-1]))}))};t.prototype.sender=function(t){return this.send.bind(this,t)};t.prototype._nextState=function(t,r){var e=this;if(r===void 0){r=!!this.machine.config.predictableActionArguments&&this._exec}var i=Et(t);if(i.name.indexOf($)===0&&!this.state.nextEvents.some((function(t){return t.indexOf($)===0}))){throw i.data.data}var n=rr(this,(function(){return e.machine.transition(e.state,i,undefined,r||undefined)}));return n};t.prototype.nextState=function(t){return this._nextState(t,false)};t.prototype.forward=function(t){var r,e;try{for(var i=j(this.forwardTo),n=i.next();!n.done;n=i.next()){var s=n.value;var a=this.children.get(s);if(!a){throw new Error("Unable to forward event '".concat(t,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(s,"'."))}a.send(t)}}catch(t){r={error:t}}finally{try{if(n&&!n.done&&(e=i.return))e.call(i)}finally{if(r)throw r.error}}};t.prototype.defer=function(t){var r=this;var e=this.clock.setTimeout((function(){if("to"in t&&t.to){r.sendTo(t._event,t.to,true)}else{r.send(t._event)}}),t.delay);if(t.id){this.delayedEventsMap[t.id]=e}};t.prototype.cancel=function(t){this.clock.clearTimeout(this.delayedEventsMap[t]);delete this.delayedEventsMap[t]};t.prototype.exec=function(t,r,e){if(e===void 0){e=this.machine.options.actions}this._exec(t,r.context,r._event,e)};t.prototype.removeChild=function(t){var r;this.children.delete(t);this.forwardTo.delete(t);(r=this.state)===null||r===void 0?true:delete r.children[t]};t.prototype.stopChild=function(t){var r=this.children.get(t);if(!r){return}this.removeChild(t);if(wt(r.stop)){r.stop()}};t.prototype.spawn=function(t,r,e){if(this.status!==Mr.Running){return nr(t,r)}if(dt(t)){return this.spawnPromise(Promise.resolve(t),r)}else if(wt(t)){return this.spawnCallback(t,r)}else if(ar(t)){return this.spawnActor(t,r)}else if(Ot(t)){return this.spawnObservable(t,r)}else if(kt(t)){return this.spawnMachine(t,S(S({},e),{id:r}))}else if(ht(t)){return this.spawnBehavior(t,r)}else{throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof t,'".'))}};t.prototype.spawnMachine=function(r,e){var i=this;if(e===void 0){e={}}var n=new t(r,S(S({},this.options),{parent:this,id:e.id||r.id}));var s=S(S({},Ir),e);if(s.sync){n.onTransition((function(t){i.send(J,{state:t,id:n.id})}))}var a=n;this.children.set(n.id,a);if(s.autoForward){this.forwardTo.add(n.id)}n.onDone((function(t){i.removeChild(n.id);i.send(Et(t,{origin:n.id}))})).start();return a};t.prototype.spawnBehavior=function(t,r){var e=Ar(t,{id:r,parent:this});this.children.set(r,e);return e};t.prototype.spawnPromise=function(t,r){var e;var i=this;var n=false;var s;t.then((function(t){if(!n){s=t;i.removeChild(r);i.send(Et(Xt(r,t),{origin:r}))}}),(function(t){if(!n){i.removeChild(r);var e=Yt(r,t);try{i.send(Et(e,{origin:r}))}catch(t){if(i.devTools){i.devTools.send(e,i.state)}if(i.machine.strict){i.stop()}}}}));var a=(e={id:r,send:function(){return void 0},subscribe:function(r,e,i){var n=Nt(r,e,i);var s=false;t.then((function(t){if(s){return}n.next(t);if(s){return}n.complete()}),(function(t){if(s){return}n.error(t)}));return{unsubscribe:function(){return s=true}}},stop:function(){n=true},toJSON:function(){return{id:r}},getSnapshot:function(){return s}},e[St]=function(){return this},e);this.children.set(r,a);return a};t.prototype.spawnCallback=function(t,r){var e;var i=this;var n=false;var s=new Set;var a=new Set;var o;var c=function(t){o=t;a.forEach((function(r){return r(t)}));if(n){return}i.send(Et(t,{origin:r}))};var f;try{f=t(c,(function(t){s.add(t)}))}catch(t){this.send(Yt(r,t))}if(dt(f)){return this.spawnPromise(f,r)}var u=(e={id:r,send:function(t){return s.forEach((function(r){return r(t)}))},subscribe:function(t){var r=Nt(t);a.add(r.next);return{unsubscribe:function(){a.delete(r.next)}}},stop:function(){n=true;if(wt(f)){f()}},toJSON:function(){return{id:r}},getSnapshot:function(){return o}},e[St]=function(){return this},e);this.children.set(r,u);return u};t.prototype.spawnObservable=function(t,r){var e;var i=this;var n;var s=t.subscribe((function(t){n=t;i.send(Et(t,{origin:r}))}),(function(t){i.removeChild(r);i.send(Et(Yt(r,t),{origin:r}))}),(function(){i.removeChild(r);i.send(Et(Xt(r),{origin:r}))}));var a=(e={id:r,send:function(){return void 0},subscribe:function(r,e,i){return t.subscribe(r,e,i)},stop:function(){return s.unsubscribe()},getSnapshot:function(){return n},toJSON:function(){return{id:r}}},e[St]=function(){return this},e);this.children.set(r,a);return a};t.prototype.spawnActor=function(t,r){this.children.set(r,t);return t};t.prototype.spawnActivity=function(t){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[t.type]:undefined;if(!r){return}var e=r(this.state.context,t);this.spawnEffect(t.id,e)};t.prototype.spawnEffect=function(t,r){var e;this.children.set(t,(e={id:t,send:function(){return void 0},subscribe:function(){return{unsubscribe:function(){return void 0}}},stop:r||undefined,getSnapshot:function(){return undefined},toJSON:function(){return{id:t}}},e[St]=function(){return this},e))};t.prototype.attachDev=function(){var t=Tr();if(this.options.devTools&&t){if(t.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools==="object"?this.options.devTools:undefined;this.devTools=t.__REDUX_DEVTOOLS_EXTENSION__.connect(S(S({name:this.id,autoPause:true,stateSanitizer:function(t){return{value:t.value,context:t.context,actions:t.actions}}},r),{features:S({jump:false,skip:false},r?r.features:undefined)}),this.machine);this.devTools.init(this.state)}Nr(this)}};t.prototype.toJSON=function(){return{id:this.id}};t.prototype[St]=function(){return this};t.prototype.getSnapshot=function(){if(this.status===Mr.NotStarted){return this.initialState}return this._state};t.defaultOptions={execute:true,deferEvents:true,clock:{setTimeout:function(t,r){return setTimeout(t,r)},clearTimeout:function(t){return clearTimeout(t)}},logger:console.log.bind(console),devTools:false};t.interpret=Pr;return t}();function Pr(t,r){var e=new Dr(t,r);return e}function Vr(t){if(typeof t==="string"){var r={type:t};r.toString=function(){return t};return r}return t}function Br(t){return S(S({type:B},t),{toJSON:function(){var r=k(t,["onDone","onError"]);return S(S({},r),{type:B,src:Vr(t.src)})}})}var $r="";var Fr="#";var Jr="*";var Ur={};var Wr=function(t){return t[0]===Fr};var Kr=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}};var Rr=function(){function t(r,e,i,n){if(i===void 0){i="context"in r?r.context:undefined}var s=this;var a;this.config=r;this._context=i;this.order=-1;this.__xstatenode=true;this.__cache={events:undefined,relativeValue:new Map,initialStateValue:undefined,initialState:undefined,on:undefined,transitions:undefined,candidates:{},delayedTransitions:undefined};this.idMap={};this.tags=[];this.options=Object.assign(Kr(),e);this.parent=n===null||n===void 0?void 0:n.parent;this.key=this.config.key||(n===null||n===void 0?void 0:n.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:K);this.id=this.config.id||E([this.machine.key],z(this.path),false).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;this.initial=this.config.initial;this.states=this.config.states?et(this.config.states,(function(r,e){var i;var n=new t(r,{},undefined,{parent:s,key:e});Object.assign(s.idMap,S((i={},i[n.id]=n,i),n.idMap));return n})):Ur;var o=0;function c(t){var r,e;t.order=o++;try{for(var i=j(fr(t)),n=i.next();!n.done;n=i.next()){var s=n.value;c(s)}}catch(t){r={error:t}}finally{try{if(n&&!n.done&&(e=i.return))e.call(i)}finally{if(r)throw r.error}}}c(this);this.history=this.config.history===true?"shallow":this.config.history||false;this._transient=!!this.config.always||(!this.config.on?false:Array.isArray(this.config.on)?this.config.on.some((function(t){var r=t.event;return r===$r})):$r in this.config.on);this.strict=!!this.config.strict;this.onEntry=ft(this.config.entry||this.config.onEntry).map((function(t){return Pt(t)}));this.onExit=ft(this.config.exit||this.config.onExit).map((function(t){return Pt(t)}));this.meta=this.config.meta;this.doneData=this.type==="final"?this.config.data:undefined;this.invoke=ft(this.config.invoke).map((function(t,r){var e,i;if(kt(t)){var n=At(s.id,r);s.machine.options.services=S((e={},e[n]=t,e),s.machine.options.services);return Br({src:n,id:n})}else if(bt(t.src)){var n=t.id||At(s.id,r);return Br(S(S({},t),{id:n,src:t.src}))}else if(kt(t.src)||wt(t.src)){var n=t.id||At(s.id,r);s.machine.options.services=S((i={},i[n]=t.src,i),s.machine.options.services);return Br(S(S({id:n},t),{src:n}))}else{var a=t.src;return Br(S(S({id:At(s.id,r)},t),{src:a}))}}));this.activities=ft(this.config.activities).concat(this.invoke).map((function(t){return Bt(t)}));this.transition=this.transition.bind(this);this.tags=ft(this.config.tags)}t.prototype._init=function(){if(this.__cache.transitions){return}lr(this).forEach((function(t){return t.on}))};t.prototype.withConfig=function(r,e){var i=this.options,n=i.actions,s=i.activities,a=i.guards,o=i.services,c=i.delays;return new t(this.config,{actions:S(S({},n),r.actions),activities:S(S({},s),r.activities),guards:S(S({},a),r.guards),services:S(S({},o),r.services),delays:S(S({},c),r.delays)},e!==null&&e!==void 0?e:this.context)};t.prototype.withContext=function(r){return new t(this.config,this.options,r)};Object.defineProperty(t.prototype,"context",{get:function(){return wt(this._context)?this._context():this._context},enumerable:false,configurable:true});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:et(this.states,(function(t){return t.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:false,configurable:true});t.prototype.toJSON=function(){return this.definition};Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on){return this.__cache.on}var t=this.transitions;return this.__cache.on=t.reduce((function(t,r){t[r.eventType]=t[r.eventType]||[];t[r.eventType].push(r);return t}),{})},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:false,configurable:true});t.prototype.getCandidates=function(t){if(this.__cache.candidates[t]){return this.__cache.candidates[t]}var r=t===$r;var e=this.transitions.filter((function(e){var i=e.eventType===t;return r?i:i||e.eventType===Jr}));this.__cache.candidates[t]=e;return e};t.prototype.getDelayedTransitions=function(){var t=this;var r=this.config.after;if(!r){return[]}var e=function(r,e){var i=wt(r)?"".concat(t.id,":delay[").concat(e,"]"):r;var n=Gt(i,t.id);t.onEntry.push(Jt(n,{delay:r}));t.onExit.push(Kt(n));return n};var i=gt(r)?r.map((function(t,r){var i=e(t.delay,r);return S(S({},t),{event:i})})):ot(Object.keys(r).map((function(t,i){var n=r[t];var s=bt(n)?{target:n}:n;var a=!isNaN(+t)?+t:t;var o=e(a,i);return ft(s).map((function(t){return S(S({},t),{event:o,delay:a})}))})));return i.map((function(r){var e=r.delay;return S(S({},t.formatTransition(r)),{delay:e})}))};t.prototype.getStateNodes=function(t){var r;var e=this;if(!t){return[]}var i=t instanceof kr?t.value:tt(t,this.delimiter);if(bt(i)){var n=this.getStateNode(i).initial;return n!==undefined?this.getStateNodes((r={},r[i]=n,r)):[this,this.states[i]]}var s=Object.keys(i);var a=[this];a.push.apply(a,E([],z(ot(s.map((function(t){return e.getStateNode(t).getStateNodes(i[t])})))),false));return a};t.prototype.handles=function(t){var r=X(t);return this.events.includes(r)};t.prototype.resolveState=function(t){var r=t instanceof kr?t:kr.create(t);var e=Array.from(dr([],this.getStateNodes(r.value)));return new kr(S(S({},r),{value:this.resolve(r.value),configuration:e,done:gr(e,this),tags:br(e),machine:this.machine}))};t.prototype.transitionLeafNode=function(t,r,e){var i=this.getStateNode(t);var n=i.next(r,e);if(!n||!n.transitions.length){return this.next(r,e)}return n};t.prototype.transitionCompoundNode=function(t,r,e){var i=Object.keys(t);var n=this.getStateNode(i[0]);var s=n._transition(t[i[0]],r,e);if(!s||!s.transitions.length){return this.next(r,e)}return s};t.prototype.transitionParallelNode=function(t,r,e){var i,n;var s={};try{for(var a=j(Object.keys(t)),o=a.next();!o.done;o=a.next()){var c=o.value;var f=t[c];if(!f){continue}var u=this.getStateNode(c);var l=u._transition(f,r,e);if(l){s[c]=l}}}catch(t){i={error:t}}finally{try{if(o&&!o.done&&(n=a.return))n.call(a)}finally{if(i)throw i.error}}var d=Object.keys(s).map((function(t){return s[t]}));var h=ot(d.map((function(t){return t.transitions})));var p=d.some((function(t){return t.transitions.length>0}));if(!p){return this.next(r,e)}var v=ot(Object.keys(s).map((function(t){return s[t].configuration})));return{transitions:h,exitSet:ot(d.map((function(t){return t.exitSet}))),configuration:v,source:r,actions:ot(Object.keys(s).map((function(t){return s[t].actions})))}};t.prototype._transition=function(t,r,e){if(bt(t)){return this.transitionLeafNode(t,r,e)}if(Object.keys(t).length===1){return this.transitionCompoundNode(t,r,e)}return this.transitionParallelNode(t,r,e)};t.prototype.getTransitionData=function(t,r){return this._transition(t.value,t,Et(r))};t.prototype.next=function(t,r){var e,i;var n=this;var s=r.name;var a=[];var o=[];var c;try{for(var f=j(this.getCandidates(s)),u=f.next();!u.done;u=f.next()){var l=u.value;var d=l.cond,h=l.in;var p=t.context;var v=h?bt(h)&&Wr(h)?t.matches(tt(this.getStateNodeById(h).path,this.delimiter)):Q(tt(h,this.delimiter),nt(this.path.slice(0,-2))(t.value)):true;var m=false;try{m=!d||Tt(this.machine,d,p,r,t)}catch(t){throw new Error("Unable to evaluate guard '".concat(d.name||d.type,"' in transition for event '").concat(s,"' in state node '").concat(this.id,"':\n").concat(t.message))}if(m&&v){if(l.target!==undefined){o=l.target}a.push.apply(a,E([],z(l.actions),false));c=l;break}}}catch(t){e={error:t}}finally{try{if(u&&!u.done&&(i=f.return))i.call(f)}finally{if(e)throw e.error}}if(!c){return undefined}if(!o.length){return{transitions:[c],exitSet:[],configuration:t.value?[this]:[],source:t,actions:a}}var y=ot(o.map((function(r){return n.getRelativeStateNodes(r,t.historyValue)})));var g=!!c.internal;return{transitions:[c],exitSet:g?[]:ot(o.map((function(t){return n.getPotentiallyReenteringNodes(t)}))),configuration:y,source:t,actions:a}};t.prototype.getPotentiallyReenteringNodes=function(t){if(this.order<t.order){return[this]}var r=[];var e=this;var i=t;while(e&&e!==i){r.push(e);e=e.parent}if(e!==i){return[]}r.push(i);return r};t.prototype.getActions=function(t,r,e,i,n,s,a){var o,c,f,u;var l=this;var d=s?dr([],this.getStateNodes(s.value)):[];var h=new Set;try{for(var p=j(Array.from(t).sort((function(t,r){return t.order-r.order}))),v=p.next();!v.done;v=p.next()){var m=v.value;if(!mr(d,m)||mr(e.exitSet,m)||m.parent&&h.has(m.parent)){h.add(m)}}}catch(t){o={error:t}}finally{try{if(v&&!v.done&&(c=p.return))c.call(p)}finally{if(o)throw o.error}}try{for(var y=j(d),g=y.next();!g.done;g=y.next()){var m=g.value;if(!mr(t,m)||mr(e.exitSet,m.parent)){e.exitSet.push(m)}}}catch(t){f={error:t}}finally{try{if(g&&!g.done&&(u=y.return))u.call(y)}finally{if(f)throw f.error}}e.exitSet.sort((function(t,r){return r.order-t.order}));var w=Array.from(h).sort((function(t,r){return t.order-r.order}));var b=new Set(e.exitSet);var x=ot(w.map((function(t){var r=[];if(t.type!=="final"){return r}var s=t.parent;if(!s.parent){return r}r.push(Qt(t.id,t.doneData),Qt(s.id,t.doneData?ut(t.doneData,i,n):undefined));var a=s.parent;if(a.type==="parallel"){if(ur(a).every((function(t){return gr(e.configuration,t)}))){r.push(Qt(a.id))}}return r})));var O=w.map((function(t){var r=t.onEntry;var e=t.activities.map((function(t){return Rt(t)}));return{type:"entry",actions:Vt(a?E(E([],z(r),false),z(e),false):E(E([],z(e),false),z(r),false),l.machine.options.actions)}})).concat({type:"state_done",actions:x.map((function(t){return $t(t)}))});var S=Array.from(b).map((function(t){return{type:"exit",actions:Vt(E(E([],z(t.onExit),false),z(t.activities.map((function(t){return qt(t)}))),false),l.machine.options.actions)}}));var k=S.concat({type:"transition",actions:Vt(e.actions,this.machine.options.actions)}).concat(O);if(r){var C=Vt(ot(E([],z(t),false).sort((function(t,r){return r.order-t.order})).map((function(t){return t.onExit}))),this.machine.options.actions).filter((function(t){return!It(t)}));return k.concat({type:"stop",actions:C})}return k};t.prototype.transition=function(t,r,e,i){if(t===void 0){t=this.initialState}var n=Et(r);var s;if(t instanceof kr){s=e===undefined?t:this.resolveState(kr.from(t,e))}else{var a=bt(t)?this.resolve(rt(this.getResolvedPath(t))):this.resolve(t);var o=e!==null&&e!==void 0?e:this.machine.context;s=this.resolveState(kr.from(a,o))}if(this.strict){if(!this.events.includes(n.name)&&!lt(n.name)){throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(n.name,"'"))}}var c=this._transition(s.value,s,n)||{transitions:[],configuration:[],exitSet:[],source:s,actions:[]};var f=dr([],this.getStateNodes(s.value));var u=c.configuration.length?dr(f,c.configuration):f;c.configuration=E([],z(u),false);return this.resolveTransition(c,s,s.context,i,n)};t.prototype.resolveRaisedTransition=function(t,r,e,i){var n;var s=t.actions;t=this.transition(t,r,undefined,i);t._event=e;t.event=e.data;(n=t.actions).unshift.apply(n,E([],z(s),false));return t};t.prototype.resolveTransition=function(t,r,e,i,n){var s,a,o,c;var f=this;if(n===void 0){n=Mt}var u=t.configuration;var l=!r||t.transitions.length>0;var d=l?t.configuration:r?r.configuration:[];var h=gr(d,this);var p=l?vr(this.machine,u):undefined;var v=r?r.historyValue?r.historyValue:t.source?this.machine.historyValue(r.value):undefined:undefined;var m=this.getActions(new Set(d),h,t,e,n,r,i);var y=r?S({},r.activities):{};try{for(var g=j(m),w=g.next();!w.done;w=g.next()){var b=w.value;try{for(var x=(o=void 0,j(b.actions)),O=x.next();!O.done;O=x.next()){var k=O.value;if(k.type===T){y[k.activity.id||k.activity.type]=k}else if(k.type===L){y[k.activity.id||k.activity.type]=false}}}catch(t){o={error:t}}finally{try{if(O&&!O.done&&(c=x.return))c.call(x)}finally{if(o)throw o.error}}}}catch(t){s={error:t}}finally{try{if(w&&!w.done&&(a=g.return))a.call(g)}finally{if(s)throw s.error}}var E=z(tr(this,r,e,n,m,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),C=E[0],_=E[1];var N=z(pt(C,It),2),A=N[0],I=N[1];var D=C.filter((function(t){var r;return t.type===T&&((r=t.activity)===null||r===void 0?void 0:r.type)===B}));var P=D.reduce((function(t,r){t[r.activity.id]=ir(r.activity,f.machine,_,n);return t}),r?S({},r.children):{});var V=new kr({value:p||r.value,context:_,_event:n,_sessionid:r?r._sessionid:null,historyValue:p?v?mt(v,p):undefined:r?r.historyValue:undefined,history:!p||t.source?r:undefined,actions:p?I:[],activities:p?y:r?r.activities:{},events:[],configuration:d,transitions:t.transitions,children:P,done:h,tags:br(d),machine:this});var $=e!==_;V.changed=n.name===J||$;var F=V.history;if(F){delete F.history}var U=!h&&(this._transient||u.some((function(t){return t._transient})));if(!l&&(!U||n.name===$r)){return V}var W=V;if(!h){if(U){W=this.resolveRaisedTransition(W,{type:M},n,i)}while(A.length){var K=A.shift();W=this.resolveRaisedTransition(W,K._event,n,i)}}var R=W.changed||(F?!!W.actions.length||$||typeof F.value!==typeof W.value||!xr(W.value,F.value):undefined);W.changed=R;W.history=F;return W};t.prototype.getStateNode=function(t){if(Wr(t)){return this.machine.getStateNodeById(t)}if(!this.states){throw new Error("Unable to retrieve child state '".concat(t,"' from '").concat(this.id,"'; no child states exist."))}var r=this.states[t];if(!r){throw new Error("Child state '".concat(t,"' does not exist on '").concat(this.id,"'"))}return r};t.prototype.getStateNodeById=function(t){var r=Wr(t)?t.slice(Fr.length):t;if(r===this.id){return this}var e=this.machine.idMap[r];if(!e){throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"))}return e};t.prototype.getStateNodeByPath=function(t){if(typeof t==="string"&&Wr(t)){try{return this.getStateNodeById(t.slice(1))}catch(t){}}var r=Y(t,this.delimiter).slice();var e=this;while(r.length){var i=r.shift();if(!i.length){break}e=e.getStateNode(i)}return e};t.prototype.resolve=function(t){var r;var e=this;if(!t){return this.initialStateValue||Ur}switch(this.type){case"parallel":return et(this.initialStateValue,(function(r,i){return r?e.getStateNode(i).resolve(t[i]||r):Ur}));case"compound":if(bt(t)){var i=this.getStateNode(t);if(i.type==="parallel"||i.type==="compound"){return r={},r[t]=i.initialStateValue,r}return t}if(!Object.keys(t).length){return this.initialStateValue||{}}return et(t,(function(t,r){return t?e.getStateNode(r).resolve(t):Ur}));default:return t||Ur}};t.prototype.getResolvedPath=function(t){if(Wr(t)){var r=this.machine.idMap[t.slice(Fr.length)];if(!r){throw new Error("Unable to find state node '".concat(t,"'"))}return r.path}return Y(t,this.delimiter)};Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var t;if(this.__cache.initialStateValue){return this.__cache.initialStateValue}var r;if(this.type==="parallel"){r=it(this.states,(function(t){return t.initialStateValue||Ur}),(function(t){return!(t.type==="history")}))}else if(this.initial!==undefined){if(!this.states[this.initial]){throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"))}r=cr(this.states[this.initial])?this.initial:(t={},t[this.initial]=this.states[this.initial].initialStateValue,t)}else{r={}}this.__cache.initialStateValue=r;return this.__cache.initialStateValue},enumerable:false,configurable:true});t.prototype.getInitialState=function(t,r){this._init();var e=this.getStateNodes(t);return this.resolveTransition({configuration:e,exitSet:[],transitions:[],source:undefined,actions:[]},undefined,r!==null&&r!==void 0?r:this.machine.context,undefined)};Object.defineProperty(t.prototype,"initialState",{get:function(){var t=this.initialStateValue;if(!t){throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."))}return this.getInitialState(t)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"target",{get:function(){var t;if(this.type==="history"){var r=this.config;if(bt(r.target)){t=Wr(r.target)?rt(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target}else{t=r.target}}return t},enumerable:false,configurable:true});t.prototype.getRelativeStateNodes=function(t,r,e){if(e===void 0){e=true}return e?t.type==="history"?t.resolveHistory(r):t.initialStateNodes:[t]};Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var t=this;if(cr(this)){return[this]}if(this.type==="compound"&&!this.initial){return[this]}var r=at(this.initialStateValue);return ot(r.map((function(r){return t.getFromRelativePath(r)})))},enumerable:false,configurable:true});t.prototype.getFromRelativePath=function(t){if(!t.length){return[this]}var r=z(t),e=r[0],i=r.slice(1);if(!this.states){throw new Error("Cannot retrieve subPath '".concat(e,"' from node with no states"))}var n=this.getStateNode(e);if(n.type==="history"){return n.resolveHistory()}if(!this.states[e]){throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"))}return this.states[e].getFromRelativePath(i)};t.prototype.historyValue=function(t){if(!Object.keys(this.states).length){return undefined}return{current:t||this.initialStateValue,states:it(this.states,(function(r,e){if(!t){return r.historyValue()}var i=bt(t)?undefined:t[e];return r.historyValue(i||r.initialStateValue)}),(function(t){return!t.history}))}};t.prototype.resolveHistory=function(t){var r=this;if(this.type!=="history"){return[this]}var e=this.parent;if(!t){var i=this.target;return i?ot(at(i).map((function(t){return e.getFromRelativePath(t)}))):e.initialStateNodes}var n=st(e.path,"states")(t).current;if(bt(n)){return[e.getStateNode(n)]}return ot(at(n).map((function(t){return r.history==="deep"?e.getFromRelativePath(t):[e.states[t[0]]]})))};Object.defineProperty(t.prototype,"stateIds",{get:function(){var t=this;var r=ot(Object.keys(this.states).map((function(r){return t.states[r].stateIds})));return[this.id].concat(r)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"events",{get:function(){var t,r,e,i;if(this.__cache.events){return this.__cache.events}var n=this.states;var s=new Set(this.ownEvents);if(n){try{for(var a=j(Object.keys(n)),o=a.next();!o.done;o=a.next()){var c=o.value;var f=n[c];if(f.states){try{for(var u=(e=void 0,j(f.events)),l=u.next();!l.done;l=u.next()){var d=l.value;s.add("".concat(d))}}catch(t){e={error:t}}finally{try{if(l&&!l.done&&(i=u.return))i.call(u)}finally{if(e)throw e.error}}}}}catch(r){t={error:r}}finally{try{if(o&&!o.done&&(r=a.return))r.call(a)}finally{if(t)throw t.error}}}return this.__cache.events=Array.from(s)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"ownEvents",{get:function(){var t=new Set(this.transitions.filter((function(t){return!(!t.target&&!t.actions.length&&t.internal)})).map((function(t){return t.eventType})));return Array.from(t)},enumerable:false,configurable:true});t.prototype.resolveTarget=function(t){var r=this;if(t===undefined){return undefined}return t.map((function(t){if(!bt(t)){return t}var e=t[0]===r.delimiter;if(e&&!r.parent){return r.getStateNodeByPath(t.slice(1))}var i=e?r.key+t:t;if(r.parent){try{var n=r.parent.getStateNodeByPath(i);return n}catch(t){throw new Error("Invalid transition definition for state node '".concat(r.id,"':\n").concat(t.message))}}else{return r.getStateNodeByPath(i)}}))};t.prototype.formatTransition=function(t){var r=this;var e=_t(t.target);var i="internal"in t?t.internal:e?e.some((function(t){return bt(t)&&t[0]===r.delimiter})):true;var n=this.machine.options.guards;var s=this.resolveTarget(e);var a=S(S({},t),{actions:Vt(ft(t.actions)),cond:xt(t.cond,n),target:s,source:this,internal:i,eventType:t.event,toJSON:function(){return S(S({},a),{target:a.target?a.target.map((function(t){return"#".concat(t.id)})):undefined,source:"#".concat(r.id)})}});return a};t.prototype.formatTransitions=function(){var t,r;var e=this;var i;if(!this.config.on){i=[]}else if(Array.isArray(this.config.on)){i=this.config.on}else{var n=this.config.on,s=Jr,a=n[s],o=a===void 0?[]:a,c=k(n,[typeof s==="symbol"?s:s+""]);i=ot(Object.keys(c).map((function(t){var r=Ct(t,c[t]);return r})).concat(Ct(Jr,o)))}var f=this.config.always?Ct("",this.config.always):[];var u=this.config.onDone?Ct(String(Qt(this.id)),this.config.onDone):[];var l=ot(this.invoke.map((function(t){var r=[];if(t.onDone){r.push.apply(r,E([],z(Ct(String(Xt(t.id)),t.onDone)),false))}if(t.onError){r.push.apply(r,E([],z(Ct(String(Yt(t.id)),t.onError)),false))}return r})));var d=this.after;var h=ot(E(E(E(E([],z(u),false),z(l),false),z(i),false),z(f),false).map((function(t){return ft(t).map((function(t){return e.formatTransition(t)}))})));try{for(var p=j(d),v=p.next();!v.done;v=p.next()){var m=v.value;h.push(m)}}catch(r){t={error:r}}finally{try{if(v&&!v.done&&(r=p.return))r.call(p)}finally{if(t)throw t.error}}return h};return t}();function qr(t,r,e){if(e===void 0){e=t.context}return new Rr(t,r,e)}const Hr=["m","l"];function Gr(t){return Hr.includes(t)}const Qr=({disabled:r,option:e,onRemove:i})=>{const n={};if(e.chipColor){n["color"]=e.chipColor}if(e.chipBackgroundColor){n["background-color"]=e.chipBackgroundColor}return t("label",{class:"wcs-select-chip",style:n,onClick:t=>t.stopImmediatePropagation()},t("div",null,e.displayText),r?null:t("div",{onClick:()=>i(e)},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"12",viewBox:"0 0 20 12",class:"chip"},t("path",{d:"M2,0 6,4 10,0 12,2 8,6 12,10 10,12 6,8 2,12 0,10 4,6 0,2 2,0",fill:e.chipColor,transform:"translate(8 0)"}))))};const Xr='@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-ripple-surface{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-ripple-surface::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}:host{--wcs-select-ligther-percentage:40;--wcs-select-border-radius:var(--wcs-border-radius);--wcs-select-background-color:var(--wcs-light);--wcs-select-placeholder-color:var(--wcs-text-medium);--wcs-select-value-color:var(--wcs-primary);--wcs-select-border-color:transparent;--wcs-select-overlay-max-height:360px;--wcs-select-option-height:var(--wcs-size-m);--wcs-select-border-width:1px;display:block;position:relative;outline:none;user-select:none;box-sizing:border-box}:host svg{flex-shrink:0}:host .arrow{fill:var(--wcs-select-value-color)}:host .chip{fill:var(--wcs-contrast);opacity:calc((100 - var(--wcs-select-ligther-percentage)) / 100)}:host .chip:hover{opacity:100}:host(.expanded){--wcs-select-border-color:var(--wcs-text-light)}:host(.expanded) .wcs-select-options{display:block}:host(:not(.expanded):focus) .wcs-select-control{border:var(--wcs-primary) solid 1px}:host(:not(.expanded):focus-visible) .wcs-select-control{outline:2px dashed var(--wcs-primary);outline-offset:4px;border-radius:var(--wcs-select-border-radius)}:host([disabled]){cursor:not-allowed}:host([disabled]) .wcs-select-control,:host([disabled]) label{cursor:default;pointer-events:none}:host([disabled]) label{color:var(--wcs-text-disabled)}:host([disabled]) .arrow{fill:var(--wcs-text-medium)}label{padding-left:calc(var(--wcs-padding) - var(--wcs-select-border-width));padding-right:calc(var(--wcs-padding) - var(--wcs-select-border-width));font-weight:500;cursor:pointer;color:var(--wcs-select-color);transition:color 125ms ease-in;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host([size=m]){min-height:var(--wcs-size-m);--wcs-select-font-size:1rem}:host([size=m]) .wcs-select-control{min-height:var(--wcs-size-m)}:host([size=l]){min-height:var(--wcs-size-l);--wcs-select-font-size:1.0625rem}:host([size=l]) .wcs-select-control{min-height:var(--wcs-size-l)}:host([chips]) .wcs-select-control{flex-wrap:wrap}.wcs-select-control{box-sizing:border-box;--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity;overflow:hidden;display:flex;align-items:center;padding-right:var(--wcs-text-padding);background-color:var(--wcs-select-background-color);border-radius:var(--wcs-select-border-radius);border:var(--wcs-select-border-color) solid var(--wcs-select-border-width);font-size:var(--wcs-select-font-size, 1rem);line-height:1.5;cursor:pointer}.wcs-select-control::before,.wcs-select-control::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.wcs-select-control::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.wcs-select-control::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.wcs-select-control.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.wcs-select-control.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.wcs-select-control.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.wcs-select-control.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.wcs-select-control.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.wcs-select-control::before,.wcs-select-control::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.wcs-select-control.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.wcs-select-control::before,.wcs-select-control::after{background-color:#999;background-color:var(--mdc-ripple-color, #999)}.wcs-select-control:hover::before,.wcs-select-control.mdc-ripple-surface--hover::before{opacity:0.1;opacity:var(--mdc-ripple-hover-opacity, 0.1)}.wcs-select-control.mdc-ripple-upgraded--background-focused::before,.wcs-select-control:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.wcs-select-control:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.wcs-select-control:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.3;opacity:var(--mdc-ripple-press-opacity, 0.3)}.wcs-select-control.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.3)}.wcs-select-placeholder{color:var(--wcs-select-placeholder-color);font-style:italic;font-weight:400}.wcs-select-value{color:var(--wcs-select-value-color);font-weight:var(--wcs-font-weight-form-value)}.wcs-select-value-container{margin-top:4px;margin-bottom:4px;margin-left:calc(var(--wcs-margin) / 2);max-width:calc(100% - (24px + var(--wcs-base-margin)));display:flex;flex-direction:row;gap:4px;align-items:center;flex-wrap:wrap}.wcs-select-chip{line-height:1.375;color:var(--wcs-contrast);background-color:var(--wcs-base);border-radius:0.75rem;display:flex;align-items:center;padding:calc((var(--wcs-padding) - 8px) / 2) var(--wcs-padding);overflow:initial}.wcs-select-options{display:none;position:absolute;z-index:999999999;border:solid var(--wcs-select-border-width) var(--wcs-select-border-color);border-radius:var(--wcs-select-border-radius);max-height:var(--wcs-select-overlay-max-height);overflow-y:auto;width:calc(100% - 2 * var(--wcs-select-border-width));background-color:var(--wcs-white);color:var(--wcs-text-medium)}';const Yr={key:"select",initial:"closed",states:{closed:{entry:["close"],on:{CLICK:"opened",OPEN:"opened",OPTION_SELECTED:{actions:["selectOption"]}}},opened:{entry:["open"],on:{CLICK:"closed",CLOSE:"closed",OPTION_SELECTED:{actions:["selectOption"]}}}}};const Zr=class{constructor(t){r(this,t);this.wcsChange=e(this,"wcsChange",7);this.wcsFocus=e(this,"wcsFocus",7);this.wcsBlur=e(this,"wcsBlur",7);this.selectId=`wcs-select-${te++}`;this.optionsId=o("OPTIONS");this.expanded=false;this.size="m";this.hasLoaded=false;this.displayText=undefined;this.focused=undefined;this.value=undefined;this.placeholder=undefined;this.disabled=false;this.multiple=false;this.chips=false;this.name=undefined;this.compareWith=(t,r)=>s.isEqual(t,r);this.overlayDirection="bottom"}async open(){this.stateService.send("OPEN")}async close(){this.stateService.send("CLOSE")}onValueChangeHandler(t){this.updateSelectedValue(t);this.emitChange(this.value)}updateSelectedValue(t){if(!t){this.reset()}if(this.multiple){if(!Array.isArray(t)){t=[t]}this.values=[];this.options.forEach((r=>{const e=t?t.findIndex((t=>this.compareWith(r.value,t)))!==-1:false;if(e){this.values.push({value:r.value,displayText:r.innerText,chipColor:r.chipColor,chipBackgroundColor:r.chipBackgroundColor})}r.selected=e}));this.displayText=this.values.length!==0?this.values.map((t=>t.displayText)).join(", "):undefined}else{this.options.forEach((r=>{const e=this.compareWith(r.value,t);if(e){this.displayText=r.innerText}r.selected=e}))}}reset(){this.values=[];this.displayText=undefined;this.options.forEach((t=>{t.selected=false}))}componentDidLoad(){this.optionsEl=this.el.shadowRoot.querySelector(".wcs-select-options");this.controlEl=this.el.shadowRoot.querySelector(".wcs-select-control");const t=qr(Yr,this.initMachineOptions());this.stateService=Pr(t);if(this.multiple){this.values=[]}this.addRippleEffect();this.stateService.start();if(this.optionsEl.querySelector("slot")===null){this.replaceOptions_firefoxBefore63();this.listenDomUpdate_firefoxBefore63()}if(this.value!==undefined){this.updateSelectedValue(this.value)}this.popper=this.createPopperInstance();this.labelElement=c(this.el);if(this.labelElement){this.labelElement.id=this.selectId+"-lbl"}this.hasLoaded=true}createPopperInstance(){return x(this.controlEl,this.optionsEl,{placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,4]}}]})}emitChange(t){this.wcsChange.emit({value:t})}replaceOptions_firefoxBefore63(){Array.from(this.el.querySelectorAll("wcs-select-option")).forEach((t=>{if(t.parentNode===this.el){this.el.removeChild(t);this.optionsEl.appendChild(t)}}))}listenDomUpdate_firefoxBefore63(){const t=new MutationObserver((t=>{for(const r of t){if(r.type==="childList"){this.replaceOptions_firefoxBefore63()}}}));t.observe(this.el,{childList:true})}componentWillLoad(){if(!Gr(this.size)){console.error(`Invalid size value for wcs-select : "${this.size}". Must be one of "${Hr.join(", ")}"`);this.size="m"}}componentWillUpdate(){if(this.multiple){this.options.forEach((t=>t.multiple=true))}}get options(){var t;const r=(t=this.el)===null||t===void 0?void 0:t.querySelectorAll("wcs-select-option");if(r&&r.length!==0){return r}return[]}get notDisabledOptions(){var t;const r=(t=this.el)===null||t===void 0?void 0:t.querySelectorAll("wcs-select-option:not([disabled])");if(r&&r.length!==0){return r}return[]}initMachineOptions(){return{actions:{open:()=>{var t;if(!this.disabled){this.expanded=true;this.focused=false;if(this.notDisabledOptions.length>0){this.lastFocusedOptionElement=(t=this.lastSelectedOptionElement)!==null&&t!==void 0?t:this.notDisabledOptions[0];requestAnimationFrame((()=>{var t;(t=this.lastFocusedOptionElement)===null||t===void 0?void 0:t.focus()}))}}},close:(t,r)=>{var e,i;if(r.type==="CLOSE"){if((e=r.value)===null||e===void 0?void 0:e.shouldBlur){(i=this.el.closest("wcs-select"))===null||i===void 0?void 0:i.focus();this.focused=false}else{this.el.focus();this.focused=true}}this.expanded=false},selectOption:(t,r)=>{if(r.type==="OPTION_SELECTED"){this.handleClickEvent(r.value)}}},guards:{enabled:()=>!this.disabled}}}handleClickEvent(t){if(this.multiple){this.handleClickOnMultiple(t)}else{this.handleNormalClick(t)}}handleClickOnMultiple(t){const r=this.values.findIndex((r=>r.value===t.value));if(r===-1){const{value:r,displayText:e,chipColor:i,chipBackgroundColor:n}=t;this.values.push({value:r,displayText:e,chipColor:i,chipBackgroundColor:n});t.source.selected=true;this.lastSelectedOptionElement=t.source}else{t.source.selected=false;this.values.splice(r,1);if(this.lastSelectedOptionElement===t.source)this.lastSelectedOptionElement=null}this.updateValueWithValues()}updateValueWithValues(){this.value=this.values.map((t=>t.value));this.displayText=this.values.length!==0?this.values.map((t=>t.displayText)).join(", "):undefined}handleNormalClick(t){this.options.forEach((t=>{if(t.selected)t.selected=false}));t.source.selected=true;this.value=t.value;this.displayText=t.displayText;this.lastSelectedOptionElement=t.source;this.stateService.send("CLOSE")}disconnectedCallback(){var t;(t=this.stateService)===null||t===void 0?void 0:t.stop()}addRippleEffect(){const t=new O(this.controlEl);t.unbounded=false}get hasValue(){return this.displayText!==undefined}onMouseDown(t){const r=b(t.target)&&(t.offsetX>t.target.clientWidth||t.offsetY>t.target.clientHeight||t.offsetY<0);const e=t.composedPath().filter((t=>{const r=t;return r.nodeName==="svg"&&r.classList.contains("chip")})).length>0;if(!r&&!e){this.stateService.send("CLICK")}}onWindowClickEvent(t){const r=t.composedPath().filter((t=>t.nodeName==="WCS-SELECT"))[0];const e=r===this.el;if(this.expanded&&!e){this.stateService.send("CLOSE")}}onKeyDown(t){if(this.stateService.getSnapshot().matches("closed")){if(f(t)||t.altKey&&u(t)||l(t)){t.preventDefault();t.stopPropagation();this.stateService.send("OPEN");return}if(this.multiple){if(u(t)){this.stateService.send("OPEN")}}else{if(u(t)||d(t)){t.preventDefault();this.selectClosestOption("next")}if(h(t)||p(t)){t.preventDefault();this.selectClosestOption("previous")}else if(v(t)){t.preventDefault();this.selectLastOption()}else if(m(t)||y(t)){t.preventDefault();this.selectFirstOption()}}}else if(this.stateService.getSnapshot().matches("opened")){if(g(t)||t.altKey&&h(t)){this.stateService.send({type:"CLOSE",value:{shouldBlur:false}})}else if(w(t)||t.shiftKey&&w(t)){this.stateService.send({type:"CLOSE",value:{shouldBlur:true}})}else if(u(t)){t.preventDefault();this.focusClosestOption("next")}else if(h(t)){t.preventDefault();this.focusClosestOption("previous")}else if(m(t)||y(t)){t.preventDefault();this.focusFirstOption()}else if(v(t)){t.preventDefault();this.focusLastOption()}}}getClosestActiveOptionIndexForState(t,r){let e=Array.from(this.notDisabledOptions).indexOf(r==="focused"?this.lastFocusedOptionElement:this.lastSelectedOptionElement);if(t==="next"&&e<this.notDisabledOptions.length-1){e++}else if(t==="previous"&&e>0){e--}else{return"nothing"}return e}selectOption(t){this.lastSelectedOptionElement=this.notDisabledOptions[t];this.lastSelectedOptionElement.selected=true;this.sendOptionSelectedToStateMachine({source:this.lastSelectedOptionElement,value:this.value,displayText:this.lastSelectedOptionElement.innerText})}selectClosestOption(t){const r=this.getClosestActiveOptionIndexForState(t,"selected");if(r==="nothing")return;this.selectOption(r)}selectFirstOption(){if(this.notDisabledOptions.length<1){return}this.selectOption(0)}selectLastOption(){if(this.notDisabledOptions.length<1){return}this.selectOption(this.notDisabledOptions.length-1)}focusOption(t){var r;this.lastFocusedOptionElement=this.notDisabledOptions[t];(r=this.lastFocusedOptionElement)===null||r===void 0?void 0:r.focus();this.el.setAttribute("aria-activedescendant",this.lastFocusedOptionElement.id)}focusClosestOption(t){const r=this.getClosestActiveOptionIndexForState(t,"focused");if(r==="nothing")return;this.focusOption(r)}focusFirstOption(){this.focusOption(0)}focusLastOption(){this.focusOption(this.notDisabledOptions.length-1)}selectedOptionChanged(t){this.sendOptionSelectedToStateMachine(t.detail)}sendOptionSelectedToStateMachine(t){this.stateService.send({type:"OPTION_SELECTED",value:t})}onSlotchange(){this.updateSelectedValue(this.value)}removeChip(t){this.options.forEach((r=>{if(r.value===t.value){this.sendOptionSelectedToStateMachine(Object.assign(Object.assign({},t),{source:r}))}}))}componentDidRender(){var t;(t=this.popper)===null||t===void 0?void 0:t.update()}render(){const r=`${this.labelElement?this.labelElement.innerText:""} ${this.hasValue?this.displayText:""}`.trimEnd();return t(i,Object.assign({class:this.expanded?"expanded ":"",overlayDirection:this.overlayDirection},this.focusedAttributes(),{role:"combobox","aria-haspopup":"listbox","aria-disabled":this.disabled?"true":null,"aria-expanded":this.expanded?"true":"false","aria-controls":this.optionsId,"aria-owns":this.optionsId,"aria-multiselectable":this.multiple?"true":"false","aria-label":r}),t("div",{class:"wcs-select-control"},t("div",{class:"wcs-select-value-container"},this.hasValue?this.chips?this.values.map((r=>t(Qr,{disabled:this.disabled,option:r,onRemove:this.removeChip.bind(this)}))):t("label",{class:"wcs-select-value"},this.displayText):t("label",{class:"wcs-select-placeholder"},this.placeholder)),t(a,{up:this.expanded})),t("div",{class:"wcs-select-options",id:this.optionsId,role:"listbox"},t("slot",{name:"wcs-select-option",onSlotchange:this.onSlotchange.bind(this)})))}focusedAttributes(){return!this.disabled?{tabIndex:0}:{}}get el(){return n(this)}static get watchers(){return{value:["onValueChangeHandler"]}}};let te=0;Zr.style=Xr;const re='@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-ripple-surface{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-ripple-surface::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}wcs-select-option{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity;overflow:hidden;display:flex;padding:0 var(--wcs-padding);height:var(--wcs-select-option-height);line-height:42px;cursor:pointer;user-select:none;font-weight:500;font-size:1rem;color:var(--wcs-black)}wcs-select-option::before,wcs-select-option::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}wcs-select-option::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}wcs-select-option::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}wcs-select-option.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}wcs-select-option.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}wcs-select-option.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}wcs-select-option.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}wcs-select-option.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}wcs-select-option::before,wcs-select-option::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}wcs-select-option.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}wcs-select-option::before,wcs-select-option::after{background-color:#999;background-color:var(--mdc-ripple-color, #999)}wcs-select-option:hover::before,wcs-select-option.mdc-ripple-surface--hover::before{opacity:0.1;opacity:var(--mdc-ripple-hover-opacity, 0.1)}wcs-select-option.mdc-ripple-upgraded--background-focused::before,wcs-select-option:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}wcs-select-option:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}wcs-select-option:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.3;opacity:var(--mdc-ripple-press-opacity, 0.3)}wcs-select-option.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.3)}wcs-select-option:hover{color:var(--wcs-primary);background-color:var(--wcs-light)}wcs-select-option:focus{outline:none}wcs-select-option[disabled]{cursor:not-allowed;pointer-events:none;color:var(--wcs-text-disabled)}wcs-select-option[selected]{color:var(--wcs-primary);background-color:var(--wcs-light)}wcs-select-option[multiple] wcs-checkbox{pointer-events:none;margin-right:10px}wcs-select-option[multiple]:hover wcs-checkbox{--wcs-checkbox-border-color:var(--wcs-primary)}';const ee=class{constructor(t){r(this,t);this.wcsSelectOptionClick=e(this,"wcsSelectOptionClick",7);this.selectOptionId=o(this.el.tagName);this.disabled=false;this.selected=false;this.value=undefined;this.chipColor=undefined;this.chipBackgroundColor=undefined;this.multiple=false}componentWillLoad(){if(this.value===undefined){this.value=this.el.innerText||""}}componentDidLoad(){this.mdcRipple=new O(this.el)}chooseOption(t){if(!this.disabled){t.stopPropagation();const r=this.el.innerText;this.wcsSelectOptionClick.emit({source:this.el,value:this.value,displayText:r})}}onMouseDown(t){this.chooseOption(t)}handleKeydown(t){if(f(t)||l(t)){this.chooseOption(t);t.preventDefault();t.stopPropagation()}}render(){return t(i,{id:this.selectOptionId,"aria-selected":this.selected?"true":"false",slot:"wcs-select-option",role:"option",tabindex:"-1"},this.multiple&&t("wcs-checkbox",{tabindex:"-1",checked:this.selected}),t("slot",null))}get el(){return n(this)}};ee.style=re;export{Zr as wcs_select,ee as wcs_select_option};
16
- //# sourceMappingURL=p-26e7de5c.entry.js.map
15
+ ***************************************************************************** */var S=function(){S=Object.assign||function t(r){for(var e,i=1,n=arguments.length;i<n;i++){e=arguments[i];for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s))r[s]=e[s]}return r};return S.apply(this,arguments)};function k(t,r){var e={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&r.indexOf(i)<0)e[i]=t[i];if(t!=null&&typeof Object.getOwnPropertySymbols==="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++){if(r.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n]))e[i[n]]=t[i[n]]}return e}function j(t){var r=typeof Symbol==="function"&&Symbol.iterator,e=r&&t[r],i=0;if(e)return e.call(t);if(t&&typeof t.length==="number")return{next:function(){if(t&&i>=t.length)t=void 0;return{value:t&&t[i++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(t,r){var e=typeof Symbol==="function"&&t[Symbol.iterator];if(!e)return t;var i=e.call(t),n,s=[],a;try{while((r===void 0||r-- >0)&&!(n=i.next()).done)s.push(n.value)}catch(t){a={error:t}}finally{try{if(n&&!n.done&&(e=i["return"]))e.call(i)}finally{if(a)throw a.error}}return s}function E(t,r,e){if(e||arguments.length===2)for(var i=0,n=r.length,s;i<n;i++){if(s||!(i in r)){if(!s)s=Array.prototype.slice.call(r,0,i);s[i]=r[i]}}return t.concat(s||Array.prototype.slice.call(r))}var C;(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"})(C||(C={}));var _;(function(t){t["Parent"]="#_parent";t["Internal"]="#_internal"})(_||(_={}));var T=C.Start;var L=C.Stop;var N=C.Raise;var A=C.Send;var I=C.Cancel;var M=C.NullEvent;var D=C.Assign;var P=C.Log;var V=C.Init;var B=C.Invoke;var $=C.ErrorPlatform;var F=C.ErrorCustom;var J=C.Update;var U=C.Choose;var W=C.Pure;var K=".";var R={};var q="xstate.guard";var H="";var G;function Q(t,r,e){if(e===void 0){e=K}var i=tt(t,e);var n=tt(r,e);if(bt(n)){if(bt(i)){return n===i}return false}if(bt(i)){return i in n}return Object.keys(i).every((function(t){if(!(t in n)){return false}return Q(i[t],n[t])}))}function X(t){try{return bt(t)||typeof t==="number"?"".concat(t):t.type}catch(t){throw new Error("Events must be strings or objects with a string event.type property.")}}function Y(t,r){try{if(gt(t)){return t}return t.toString().split(r)}catch(r){throw new Error("'".concat(t,"' is not a valid state path."))}}function Z(t){return typeof t==="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function tt(t,r){if(Z(t)){return t.value}if(gt(t)){return rt(t)}if(typeof t!=="string"){return t}var e=Y(t,r);return rt(e)}function rt(t){if(t.length===1){return t[0]}var r={};var e=r;for(var i=0;i<t.length-1;i++){if(i===t.length-2){e[t[i]]=t[i+1]}else{e[t[i]]={};e=e[t[i]]}}return r}function et(t,r){var e={};var i=Object.keys(t);for(var n=0;n<i.length;n++){var s=i[n];e[s]=r(t[s],s,t,n)}return e}function it(t,r,e){var i,n;var s={};try{for(var a=j(Object.keys(t)),o=a.next();!o.done;o=a.next()){var c=o.value;var f=t[c];if(!e(f)){continue}s[c]=r(f,c,t)}}catch(t){i={error:t}}finally{try{if(o&&!o.done&&(n=a.return))n.call(a)}finally{if(i)throw i.error}}return s}var nt=function(t){return function(r){var e,i;var n=r;try{for(var s=j(t),a=s.next();!a.done;a=s.next()){var o=a.value;n=n[o]}}catch(t){e={error:t}}finally{try{if(a&&!a.done&&(i=s.return))i.call(s)}finally{if(e)throw e.error}}return n}};function st(t,r){return function(e){var i,n;var s=e;try{for(var a=j(t),o=a.next();!o.done;o=a.next()){var c=o.value;s=s[r][c]}}catch(t){i={error:t}}finally{try{if(o&&!o.done&&(n=a.return))n.call(a)}finally{if(i)throw i.error}}return s}}function at(t){if(!t){return[[]]}if(bt(t)){return[[t]]}var r=ot(Object.keys(t).map((function(r){var e=t[r];if(typeof e!=="string"&&(!e||!Object.keys(e).length)){return[[r]]}return at(t[r]).map((function(t){return[r].concat(t)}))})));return r}function ot(t){var r;return(r=[]).concat.apply(r,E([],z(t),false))}function ct(t){if(gt(t)){return t}return[t]}function ft(t){if(t===undefined){return[]}return ct(t)}function ut(t,r,e){var i,n;if(wt(t)){return t(r,e.data)}var s={};try{for(var a=j(Object.keys(t)),o=a.next();!o.done;o=a.next()){var c=o.value;var f=t[c];if(wt(f)){s[c]=f(r,e.data)}else{s[c]=f}}}catch(t){i={error:t}}finally{try{if(o&&!o.done&&(n=a.return))n.call(a)}finally{if(i)throw i.error}}return s}function lt(t){return/^(done|error)\./.test(t)}function dt(t){if(t instanceof Promise){return true}if(t!==null&&(wt(t)||typeof t==="object")&&wt(t.then)){return true}return false}function ht(t){return t!==null&&typeof t==="object"&&"transition"in t&&typeof t.transition==="function"}function pt(t,r){var e,i;var n=z([[],[]],2),s=n[0],a=n[1];try{for(var o=j(t),c=o.next();!c.done;c=o.next()){var f=c.value;if(r(f)){s.push(f)}else{a.push(f)}}}catch(t){e={error:t}}finally{try{if(c&&!c.done&&(i=o.return))i.call(o)}finally{if(e)throw e.error}}return[s,a]}function vt(t,r){return et(t.states,(function(t,e){if(!t){return undefined}var i=(bt(r)?undefined:r[e])||(t?t.current:undefined);if(!i){return undefined}return{current:i,states:vt(t,i)}}))}function mt(t,r){return{current:r,states:vt(t,r)}}function yt(t,r,e,i){var n=t?e.reduce((function(t,e){var n,s;var a=e.assignment;var o={state:i,action:e,_event:r};var c={};if(wt(a)){c=a(t,r.data,o)}else{try{for(var f=j(Object.keys(a)),u=f.next();!u.done;u=f.next()){var l=u.value;var d=a[l];c[l]=wt(d)?d(t,r.data,o):d}}catch(t){n={error:t}}finally{try{if(u&&!u.done&&(s=f.return))s.call(f)}finally{if(n)throw n.error}}}return Object.assign({},t,c)}),t):t;return n}function gt(t){return Array.isArray(t)}function wt(t){return typeof t==="function"}function bt(t){return typeof t==="string"}function xt(t,r){if(!t){return undefined}if(bt(t)){return{type:q,name:t,predicate:r?r[t]:undefined}}if(wt(t)){return{type:q,name:t.name,predicate:t}}return t}function Ot(t){try{return"subscribe"in t&&wt(t.subscribe)}catch(t){return false}}var St=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}();G={},G[St]=function(){return this},G[Symbol.observable]=function(){return this},G;function kt(t){return!!t&&"__xstatenode"in t}function jt(t){return!!t&&typeof t.send==="function"}function zt(t,r){if(bt(t)||typeof t==="number"){return S({type:t},r)}return t}function Et(t,r){if(!bt(t)&&"$$type"in t&&t.$$type==="scxml"){return t}var e=zt(t);return S({name:e.type,data:e,$$type:"scxml",type:"external"},r)}function Ct(t,r){var e=ct(r).map((function(r){if(typeof r==="undefined"||typeof r==="string"||kt(r)){return{target:r,event:t}}return S(S({},r),{event:t})}));return e}function _t(t){if(t===undefined||t===H){return undefined}return ft(t)}function Tt(t,r,e,i,n){var s=t.options.guards;var a={state:n,cond:r,_event:i};if(r.type===q){return((s===null||s===void 0?void 0:s[r.name])||r.predicate)(e,i.data,a)}var o=s===null||s===void 0?void 0:s[r.type];if(!o){throw new Error("Guard '".concat(r.type,"' is not implemented on machine '").concat(t.id,"'."))}return o(e,i.data,a)}function Lt(t){if(typeof t==="string"){return{type:t}}return t}function Nt(t,r,e){var i=function(){};var n=typeof t==="object";var s=n?t:null;return{next:((n?t.next:t)||i).bind(s),error:((n?t.error:r)||i).bind(s),complete:((n?t.complete:e)||i).bind(s)}}function At(t,r){return"".concat(t,":invocation[").concat(r,"]")}function It(t){return(t.type===N||t.type===A&&t.to===_.Internal)&&typeof t.delay!=="number"}var Mt=Et({type:V});function Dt(t,r){return r?r[t]||undefined:undefined}function Pt(t,r){var e;if(bt(t)||typeof t==="number"){var i=Dt(t,r);if(wt(i)){e={type:t,exec:i}}else if(i){e=i}else{e={type:t,exec:undefined}}}else if(wt(t)){e={type:t.name||t.toString(),exec:t}}else{var i=Dt(t.type,r);if(wt(i)){e=S(S({},t),{exec:i})}else if(i){var n=i.type||t.type;e=S(S(S({},i),t),{type:n})}else{e=t}}return e}var Vt=function(t,r){if(!t){return[]}var e=gt(t)?t:[t];return e.map((function(t){return Pt(t,r)}))};function Bt(t){var r=Pt(t);return S(S({id:bt(t)?t:r.id},r),{type:r.type})}function $t(t,r){return{type:N,event:typeof t==="function"?t:zt(t),delay:r?r.delay:undefined,id:r===null||r===void 0?void 0:r.id}}function Ft(t,r,e,i){var n={_event:e};var s=Et(wt(t.event)?t.event(r,e.data,n):t.event);var a;if(bt(t.delay)){var o=i&&i[t.delay];a=wt(o)?o(r,e.data,n):o}else{a=wt(t.delay)?t.delay(r,e.data,n):t.delay}return S(S({},t),{type:N,_event:s,delay:a})}function Jt(t,r){return{to:r?r.to:undefined,type:A,event:wt(t)?t:zt(t),delay:r?r.delay:undefined,id:r&&r.id!==undefined?r.id:wt(t)?t.name:X(t)}}function Ut(t,r,e,i){var n={_event:e};var s=Et(wt(t.event)?t.event(r,e.data,n):t.event);var a;if(bt(t.delay)){var o=i&&i[t.delay];a=wt(o)?o(r,e.data,n):o}else{a=wt(t.delay)?t.delay(r,e.data,n):t.delay}var c=wt(t.to)?t.to(r,e.data,n):t.to;return S(S({},t),{to:c,_event:s,event:s.data,delay:a})}var Wt=function(t,r,e){return S(S({},t),{value:bt(t.expr)?t.expr:t.expr(r,e.data,{_event:e})})};var Kt=function(t){return{type:I,sendId:t}};function Rt(t){var r=Bt(t);return{type:C.Start,activity:r,exec:undefined}}function qt(t){var r=wt(t)?t:Bt(t);return{type:C.Stop,activity:r,exec:undefined}}function Ht(t,r,e){var i=wt(t.activity)?t.activity(r,e.data):t.activity;var n=typeof i==="string"?{id:i}:i;var s={type:C.Stop,activity:n};return s}function Gt(t,r){var e=r?"#".concat(r):"";return"".concat(C.After,"(").concat(t,")").concat(e)}function Qt(t,r){var e="".concat(C.DoneState,".").concat(t);var i={type:e,data:r};i.toString=function(){return e};return i}function Xt(t,r){var e="".concat(C.DoneInvoke,".").concat(t);var i={type:e,data:r};i.toString=function(){return e};return i}function Yt(t,r){var e="".concat(C.ErrorPlatform,".").concat(t);var i={type:e,data:r};i.toString=function(){return e};return i}var Zt=function(t){var r,e;var i=[];try{for(var n=j(t),s=n.next();!s.done;s=n.next()){var a=s.value;var o=0;while(o<a.actions.length){if(a.actions[o].type===D){i.push(a.actions[o]);a.actions.splice(o,1);continue}o++}}}catch(t){r={error:t}}finally{try{if(s&&!s.done&&(e=n.return))e.call(n)}finally{if(r)throw r.error}}return i};function tr(t,r,e,i,n,s,a){if(a===void 0){a=false}var o=a?[]:Zt(n);var c=o.length?yt(e,i,o,r):e;var f=a?[e]:undefined;var u=[];function l(n,o){var l;switch(o.type){case N:{var d=Ft(o,c,i,t.options.delays);if(s&&typeof d.delay==="number"){s(d,c,i)}return d}case A:var h=Ut(o,c,i,t.options.delays);if(s&&h.to!==_.Internal){if(n==="entry"){u.push(h)}else{s(h,c,i)}}return h;case P:{var p=Wt(o,c,i);s===null||s===void 0?void 0:s(p,c,i);return p}case U:{var v=o;var m=(l=v.conds.find((function(e){var n=xt(e.cond,t.options.guards);return!n||Tt(t,n,c,i,!s?r:undefined)})))===null||l===void 0?void 0:l.actions;if(!m){return[]}var y=z(tr(t,r,c,i,[{type:n,actions:Vt(ft(m),t.options.actions)}],s,a),2),g=y[0],w=y[1];c=w;f===null||f===void 0?void 0:f.push(c);return g}case W:{var m=o.get(c,i.data);if(!m){return[]}var b=z(tr(t,r,c,i,[{type:n,actions:Vt(ft(m),t.options.actions)}],s,a),2),x=b[0],O=b[1];c=O;f===null||f===void 0?void 0:f.push(c);return x}case L:{var p=Ht(o,c,i);s===null||s===void 0?void 0:s(p,e,i);return p}case D:{c=yt(c,i,[o],!s?r:undefined);f===null||f===void 0?void 0:f.push(c);break}default:var k=Pt(o,t.options.actions);var j=k.exec;if(s){s(k,c,i)}else if(j&&f){var C=f.length-1;var T=S(S({},k),{exec:function(t){var r=[];for(var e=1;e<arguments.length;e++){r[e-1]=arguments[e]}j.apply(void 0,E([f[C]],z(r),false))}});k=T}return k}}function d(t){var r,e;var n=[];try{for(var a=j(t.actions),o=a.next();!o.done;o=a.next()){var f=o.value;var d=l(t.type,f);if(d){n=n.concat(d)}}}catch(t){r={error:t}}finally{try{if(o&&!o.done&&(e=a.return))e.call(a)}finally{if(r)throw r.error}}u.forEach((function(t){s(t,c,i)}));u.length=0;return n}var h=ot(n.map(d));return[h,c]}var rr=function(t,r){var e=r(t);return e};function er(t){var r;return r={id:t,send:function(){return void 0},subscribe:function(){return{unsubscribe:function(){return void 0}}},getSnapshot:function(){return undefined},toJSON:function(){return{id:t}}},r[St]=function(){return this},r}function ir(t,r,e,i){var n;var s=Lt(t.src);var a=(n=r===null||r===void 0?void 0:r.options.services)===null||n===void 0?void 0:n[s.type];var o=t.data?ut(t.data,e,i):undefined;var c=a?nr(a,t.id,o):er(t.id);c.meta=t;return c}function nr(t,r,e){var i=er(r);i.deferred=true;if(kt(t)){var n=i.state=rr(undefined,(function(){return(e?t.withContext(e):t).initialState}));i.getSnapshot=function(){return n}}return i}function sr(t){try{return typeof t.send==="function"}catch(t){return false}}function ar(t){return sr(t)&&"id"in t}function or(t){var r;return S((r={subscribe:function(){return{unsubscribe:function(){return void 0}}},id:"anonymous",getSnapshot:function(){return undefined}},r[St]=function(){return this},r),t)}var cr=function(t){return t.type==="atomic"||t.type==="final"};function fr(t){return Object.keys(t.states).map((function(r){return t.states[r]}))}function ur(t){return fr(t).filter((function(t){return t.type!=="history"}))}function lr(t){var r=[t];if(cr(t)){return r}return r.concat(ot(ur(t).map(lr)))}function dr(t,r){var e,i,n,s,a,o,c,f;var u=new Set(t);var l=pr(u);var d=new Set(r);try{for(var h=j(d),p=h.next();!p.done;p=h.next()){var v=p.value;var m=v.parent;while(m&&!d.has(m)){d.add(m);m=m.parent}}}catch(t){e={error:t}}finally{try{if(p&&!p.done&&(i=h.return))i.call(h)}finally{if(e)throw e.error}}var y=pr(d);try{for(var g=j(d),w=g.next();!w.done;w=g.next()){var v=w.value;if(v.type==="compound"&&(!y.get(v)||!y.get(v).length)){if(l.get(v)){l.get(v).forEach((function(t){return d.add(t)}))}else{v.initialStateNodes.forEach((function(t){return d.add(t)}))}}else{if(v.type==="parallel"){try{for(var b=(a=void 0,j(ur(v))),x=b.next();!x.done;x=b.next()){var O=x.value;if(!d.has(O)){d.add(O);if(l.get(O)){l.get(O).forEach((function(t){return d.add(t)}))}else{O.initialStateNodes.forEach((function(t){return d.add(t)}))}}}}catch(t){a={error:t}}finally{try{if(x&&!x.done&&(o=b.return))o.call(b)}finally{if(a)throw a.error}}}}}}catch(t){n={error:t}}finally{try{if(w&&!w.done&&(s=g.return))s.call(g)}finally{if(n)throw n.error}}try{for(var S=j(d),k=S.next();!k.done;k=S.next()){var v=k.value;var m=v.parent;while(m&&!d.has(m)){d.add(m);m=m.parent}}}catch(t){c={error:t}}finally{try{if(k&&!k.done&&(f=S.return))f.call(S)}finally{if(c)throw c.error}}return d}function hr(t,r){var e=r.get(t);if(!e){return{}}if(t.type==="compound"){var i=e[0];if(i){if(cr(i)){return i.key}}else{return{}}}var n={};e.forEach((function(t){n[t.key]=hr(t,r)}));return n}function pr(t){var r,e;var i=new Map;try{for(var n=j(t),s=n.next();!s.done;s=n.next()){var a=s.value;if(!i.has(a)){i.set(a,[])}if(a.parent){if(!i.has(a.parent)){i.set(a.parent,[])}i.get(a.parent).push(a)}}}catch(t){r={error:t}}finally{try{if(s&&!s.done&&(e=n.return))e.call(n)}finally{if(r)throw r.error}}return i}function vr(t,r){var e=dr([t],r);return hr(t,pr(e))}function mr(t,r){if(Array.isArray(t)){return t.some((function(t){return t===r}))}if(t instanceof Set){return t.has(r)}return false}function yr(t){return E([],z(new Set(ot(E([],z(t.map((function(t){return t.ownEvents}))),false)))),false)}function gr(t,r){if(r.type==="compound"){return ur(r).some((function(r){return r.type==="final"&&mr(t,r)}))}if(r.type==="parallel"){return ur(r).every((function(r){return gr(t,r)}))}return false}function wr(t){if(t===void 0){t=[]}return t.reduce((function(t,r){if(r.meta!==undefined){t[r.id]=r.meta}return t}),{})}function br(t){return new Set(ot(t.map((function(t){return t.tags}))))}function xr(t,r){if(t===r){return true}if(t===undefined||r===undefined){return false}if(bt(t)||bt(r)){return t===r}var e=Object.keys(t);var i=Object.keys(r);return e.length===i.length&&e.every((function(e){return xr(t[e],r[e])}))}function Or(t){if(typeof t!=="object"||t===null){return false}return"value"in t&&"_event"in t}function Sr(t,r){var e=t.exec;var i=S(S({},t),{exec:e!==undefined?function(){return e(r.context,r.event,{action:t,state:r,_event:r._event})}:undefined});return i}var kr=function(){function t(t){var r=this;var e;this.actions=[];this.activities=R;this.meta={};this.events=[];this.value=t.value;this.context=t.context;this._event=t._event;this._sessionid=t._sessionid;this.event=this._event.data;this.historyValue=t.historyValue;this.history=t.history;this.actions=t.actions||[];this.activities=t.activities||R;this.meta=wr(t.configuration);this.events=t.events||[];this.matches=this.matches.bind(this);this.toStrings=this.toStrings.bind(this);this.configuration=t.configuration;this.transitions=t.transitions;this.children=t.children;this.done=!!t.done;this.tags=(e=Array.isArray(t.tags)?new Set(t.tags):t.tags)!==null&&e!==void 0?e:new Set;this.machine=t.machine;Object.defineProperty(this,"nextEvents",{get:function(){return yr(r.configuration)}})}t.from=function(r,e){if(r instanceof t){if(r.context!==e){return new t({value:r.value,context:e,_event:r._event,_sessionid:null,historyValue:r.historyValue,history:r.history,actions:[],activities:r.activities,meta:{},events:[],configuration:[],transitions:[],children:{}})}return r}var i=Mt;return new t({value:r,context:e,_event:i,_sessionid:null,historyValue:undefined,history:undefined,actions:[],activities:undefined,meta:undefined,events:[],configuration:[],transitions:[],children:{}})};t.create=function(r){return new t(r)};t.inert=function(r,e){if(r instanceof t){if(!r.actions.length){return r}var i=Mt;return new t({value:r.value,context:e,_event:i,_sessionid:null,historyValue:r.historyValue,history:r.history,activities:r.activities,configuration:r.configuration,transitions:[],children:{}})}return t.from(r,e)};t.prototype.toStrings=function(t,r){var e=this;if(t===void 0){t=this.value}if(r===void 0){r="."}if(bt(t)){return[t]}var i=Object.keys(t);return i.concat.apply(i,E([],z(i.map((function(i){return e.toStrings(t[i],r).map((function(t){return i+r+t}))}))),false))};t.prototype.toJSON=function(){var t=this;var r=t.tags;var e=k(t,["configuration","transitions","tags","machine"]);return S(S({},e),{tags:Array.from(r)})};t.prototype.matches=function(t){return Q(t,this.value)};t.prototype.hasTag=function(t){return this.tags.has(t)};t.prototype.can=function(t){var r;var e=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,t);return!!(e===null||e===void 0?void 0:e.transitions.length)&&e.transitions.some((function(t){return t.target!==undefined||t.actions.length}))};return t}();var jr={deferEvents:false};var zr=function(){function t(t){this.processingEvent=false;this.queue=[];this.initialized=false;this.options=S(S({},jr),t)}t.prototype.initialize=function(t){this.initialized=true;if(t){if(!this.options.deferEvents){this.schedule(t);return}this.process(t)}this.flushEvents()};t.prototype.schedule=function(t){if(!this.initialized||this.processingEvent){this.queue.push(t);return}if(this.queue.length!==0){throw new Error("Event queue should be empty when it is not processing events")}this.process(t);this.flushEvents()};t.prototype.clear=function(){this.queue=[]};t.prototype.flushEvents=function(){var t=this.queue.shift();while(t){this.process(t);t=this.queue.shift()}};t.prototype.process=function(t){this.processingEvent=true;try{t()}catch(t){this.clear();throw t}finally{this.processingEvent=false}};return t}();var Er=new Map;var Cr=0;var _r={bookId:function(){return"x:".concat(Cr++)},register:function(t,r){Er.set(t,r);return t},get:function(t){return Er.get(t)},free:function(t){Er.delete(t)}};function Tr(){if(typeof globalThis!=="undefined"){return globalThis}if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}}function Lr(){var t=Tr();if(t&&"__xstate__"in t){return t.__xstate__}return undefined}function Nr(t){if(!Tr()){return}var r=Lr();if(r){r.register(t)}}function Ar(t,r){if(r===void 0){r={}}var e=t.initialState;var i=new Set;var n=[];var s=false;var a=function(){if(s){return}s=true;while(n.length>0){var r=n.shift();e=t.transition(e,r,c);i.forEach((function(t){return t.next(e)}))}s=false};var o=or({id:r.id,send:function(t){n.push(t);a()},getSnapshot:function(){return e},subscribe:function(t,r,n){var s=Nt(t,r,n);i.add(s);s.next(e);return{unsubscribe:function(){i.delete(s)}}}});var c={parent:r.parent,self:o,id:r.id||"anonymous",observers:i};e=t.start?t.start(c):e;return o}var Ir={sync:false,autoForward:false};var Mr;(function(t){t[t["NotStarted"]=0]="NotStarted";t[t["Running"]=1]="Running";t[t["Stopped"]=2]="Stopped"})(Mr||(Mr={}));var Dr=function(){function t(r,e){if(e===void 0){e=t.defaultOptions}var i=this;this.machine=r;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=false;this.status=Mr.NotStarted;this.children=new Map;this.forwardTo=new Set;this._outgoingQueue=[];this.init=this.start;this.send=function(t,r){if(gt(t)){i.batch(t);return i.state}var e=Et(zt(t,r));if(i.status===Mr.Stopped){return i.state}if(i.status!==Mr.Running&&!i.options.deferEvents){throw new Error('Event "'.concat(e.name,'" was sent to uninitialized service "').concat(i.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: ').concat(JSON.stringify(e.data)))}i.scheduler.schedule((function(){i.forward(e);var t=i._nextState(e);i.update(t,e)}));return i._state};this.sendTo=function(t,r,e){var n=i.parent&&(r===_.Parent||i.parent.id===r);var s=n?i.parent:bt(r)?r===_.Internal?i:i.children.get(r)||_r.get(r):jt(r)?r:undefined;if(!s){if(!n){throw new Error("Unable to send event to child '".concat(r,"' from service '").concat(i.id,"'."))}return}if("machine"in s){if(i.status!==Mr.Stopped||i.parent!==s||i.state.done){var a=S(S({},t),{name:t.name===F?"".concat(Yt(i.id)):t.name,origin:i.sessionId});if(!e&&i.machine.config.predictableActionArguments){i._outgoingQueue.push([s,a])}else{s.send(a)}}}else{if(!e&&i.machine.config.predictableActionArguments){i._outgoingQueue.push([s,t.data])}else{s.send(t.data)}}};this._exec=function(t,r,e,n){if(n===void 0){n=i.machine.options.actions}var s=t.exec||Dt(t.type,n);var a=wt(s)?s:s?s.exec:t.exec;if(a){try{return a(r,e.data,!i.machine.config.predictableActionArguments?{action:t,state:i.state,_event:e}:{action:t,_event:e})}catch(t){if(i.parent){i.parent.send({type:"xstate.error",data:t})}throw t}}switch(t.type){case N:{var o=t;i.defer(o);break}case A:var c=t;if(typeof c.delay==="number"){i.defer(c);return}else{if(c.to){i.sendTo(c._event,c.to,e===Mt)}else{i.send(c._event)}}break;case I:i.cancel(t.sendId);break;case T:{if(i.status!==Mr.Running){return}var f=t.activity;if(!i.machine.config.predictableActionArguments&&!i.state.activities[f.id||f.type]){break}if(f.type===C.Invoke){var u=Lt(f.src);var l=i.machine.options.services?i.machine.options.services[u.type]:undefined;var d=f.id,h=f.data;var p="autoForward"in f?f.autoForward:!!f.forward;if(!l){return}var v=h?ut(h,r,e):undefined;if(typeof l==="string"){return}var m=wt(l)?l(r,e.data,{data:v,src:u,meta:f.meta}):l;if(!m){return}var y=void 0;if(kt(m)){m=v?m.withContext(v):m;y={autoForward:p}}i.spawn(m,d,y)}else{i.spawnActivity(f)}break}case L:{i.stopChild(t.activity.id);break}case P:var g=t,w=g.label,b=g.value;if(w){i.logger(w,b)}else{i.logger(b)}break}};var n=S(S({},t.defaultOptions),e);var s=n.clock,a=n.logger,o=n.parent,c=n.id;var f=c!==undefined?c:r.id;this.id=f;this.logger=a;this.clock=s;this.parent=o;this.options=n;this.scheduler=new zr({deferEvents:this.options.deferEvents});this.sessionId=_r.bookId()}Object.defineProperty(t.prototype,"initialState",{get:function(){var t=this;if(this._initialState){return this._initialState}return rr(this,(function(){t._initialState=t.machine.initialState;return t._initialState}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:false,configurable:true});t.prototype.execute=function(t,r){var e,i;try{for(var n=j(t.actions),s=n.next();!s.done;s=n.next()){var a=s.value;this.exec(a,t,r)}}catch(t){e={error:t}}finally{try{if(s&&!s.done&&(i=n.return))i.call(n)}finally{if(e)throw e.error}}};t.prototype.update=function(t,r){var e,i,n,s,a,o,c,f;var u=this;t._sessionid=this.sessionId;this._state=t;if((!this.machine.config.predictableActionArguments||r===Mt)&&this.options.execute){this.execute(this.state)}else{var l=void 0;while(l=this._outgoingQueue.shift()){l[0].send(l[1])}}this.children.forEach((function(t){u.state.children[t.id]=t}));if(this.devTools){this.devTools.send(r.data,t)}if(t.event){try{for(var d=j(this.eventListeners),h=d.next();!h.done;h=d.next()){var p=h.value;p(t.event)}}catch(t){e={error:t}}finally{try{if(h&&!h.done&&(i=d.return))i.call(d)}finally{if(e)throw e.error}}}try{for(var v=j(this.listeners),m=v.next();!m.done;m=v.next()){var p=m.value;p(t,t.event)}}catch(t){n={error:t}}finally{try{if(m&&!m.done&&(s=v.return))s.call(v)}finally{if(n)throw n.error}}try{for(var y=j(this.contextListeners),g=y.next();!g.done;g=y.next()){var w=g.value;w(this.state.context,this.state.history?this.state.history.context:undefined)}}catch(t){a={error:t}}finally{try{if(g&&!g.done&&(o=y.return))o.call(y)}finally{if(a)throw a.error}}if(this.state.done){var b=t.configuration.find((function(t){return t.type==="final"&&t.parent===u.machine}));var x=b&&b.doneData?ut(b.doneData,t.context,r):undefined;this._doneEvent=Xt(this.id,x);try{for(var O=j(this.doneListeners),S=O.next();!S.done;S=O.next()){var p=S.value;p(this._doneEvent)}}catch(t){c={error:t}}finally{try{if(S&&!S.done&&(f=O.return))f.call(O)}finally{if(c)throw c.error}}this._stop();this._stopChildren();_r.free(this.sessionId)}};t.prototype.onTransition=function(t){this.listeners.add(t);if(this.status===Mr.Running){t(this.state,this.state.event)}return this};t.prototype.subscribe=function(t,r,e){var i=this;var n=Nt(t,r,e);this.listeners.add(n.next);if(this.status!==Mr.NotStarted){n.next(this.state)}var s=function(){i.doneListeners.delete(s);i.stopListeners.delete(s);n.complete()};if(this.status===Mr.Stopped){n.complete()}else{this.onDone(s);this.onStop(s)}return{unsubscribe:function(){i.listeners.delete(n.next);i.doneListeners.delete(s);i.stopListeners.delete(s)}}};t.prototype.onEvent=function(t){this.eventListeners.add(t);return this};t.prototype.onSend=function(t){this.sendListeners.add(t);return this};t.prototype.onChange=function(t){this.contextListeners.add(t);return this};t.prototype.onStop=function(t){this.stopListeners.add(t);return this};t.prototype.onDone=function(t){if(this.status===Mr.Stopped&&this._doneEvent){t(this._doneEvent)}else{this.doneListeners.add(t)}return this};t.prototype.off=function(t){this.listeners.delete(t);this.eventListeners.delete(t);this.sendListeners.delete(t);this.stopListeners.delete(t);this.doneListeners.delete(t);this.contextListeners.delete(t);return this};t.prototype.start=function(t){var r=this;if(this.status===Mr.Running){return this}this.machine._init();_r.register(this.sessionId,this);this.initialized=true;this.status=Mr.Running;var e=t===undefined?this.initialState:rr(this,(function(){return Or(t)?r.machine.resolveState(t):r.machine.resolveState(kr.from(t,r.machine.context))}));if(this.options.devTools){this.attachDev()}this.scheduler.initialize((function(){r.update(e,Mt)}));return this};t.prototype._stopChildren=function(){this.children.forEach((function(t){if(wt(t.stop)){t.stop()}}));this.children.clear()};t.prototype._stop=function(){var t,r,e,i,n,s,a,o,c,f;try{for(var u=j(this.listeners),l=u.next();!l.done;l=u.next()){var d=l.value;this.listeners.delete(d)}}catch(r){t={error:r}}finally{try{if(l&&!l.done&&(r=u.return))r.call(u)}finally{if(t)throw t.error}}try{for(var h=j(this.stopListeners),p=h.next();!p.done;p=h.next()){var d=p.value;d();this.stopListeners.delete(d)}}catch(t){e={error:t}}finally{try{if(p&&!p.done&&(i=h.return))i.call(h)}finally{if(e)throw e.error}}try{for(var v=j(this.contextListeners),m=v.next();!m.done;m=v.next()){var d=m.value;this.contextListeners.delete(d)}}catch(t){n={error:t}}finally{try{if(m&&!m.done&&(s=v.return))s.call(v)}finally{if(n)throw n.error}}try{for(var y=j(this.doneListeners),g=y.next();!g.done;g=y.next()){var d=g.value;this.doneListeners.delete(d)}}catch(t){a={error:t}}finally{try{if(g&&!g.done&&(o=y.return))o.call(y)}finally{if(a)throw a.error}}if(!this.initialized){return this}this.initialized=false;this.status=Mr.Stopped;this._initialState=undefined;try{for(var w=j(Object.keys(this.delayedEventsMap)),b=w.next();!b.done;b=w.next()){var x=b.value;this.clock.clearTimeout(this.delayedEventsMap[x])}}catch(t){c={error:t}}finally{try{if(b&&!b.done&&(f=w.return))f.call(w)}finally{if(c)throw c.error}}this.scheduler.clear();this.scheduler=new zr({deferEvents:this.options.deferEvents})};t.prototype.stop=function(){var t=this;var r=this.scheduler;this._stop();r.schedule((function(){var r=Et({type:"xstate.stop"});var e=rr(t,(function(){var e=ot(E([],z(t.state.configuration),false).sort((function(t,r){return r.order-t.order})).map((function(r){return Vt(r.onExit,t.machine.options.actions)})));var i=z(tr(t.machine,t.state,t.state.context,r,[{type:"exit",actions:e}],t.machine.config.predictableActionArguments?t._exec:undefined,t.machine.config.predictableActionArguments||t.machine.config.preserveActionOrder),2),n=i[0],s=i[1];var a=new kr({value:t.state.value,context:s,_event:r,_sessionid:t.sessionId,historyValue:undefined,history:t.state,actions:n.filter((function(t){return!It(t)})),activities:{},events:[],configuration:[],transitions:[],children:{},done:t.state.done,tags:t.state.tags,machine:t.machine});a.changed=true;return a}));t.update(e,r);t._stopChildren();_r.free(t.sessionId)}));return this};t.prototype.batch=function(t){var r=this;if(this.status===Mr.NotStarted&&this.options.deferEvents);else if(this.status!==Mr.Running){throw new Error("".concat(t.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(!t.length){return}var e=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule((function(){var i,n;var s=r.state;var a=false;var o=[];var c=function(t){var i=Et(t);r.forward(i);s=rr(r,(function(){return r.machine.transition(s,i,undefined,e||undefined)}));o.push.apply(o,E([],z(r.machine.config.predictableActionArguments?s.actions:s.actions.map((function(t){return Sr(t,s)}))),false));a=a||!!s.changed};try{for(var f=j(t),u=f.next();!u.done;u=f.next()){var l=u.value;c(l)}}catch(t){i={error:t}}finally{try{if(u&&!u.done&&(n=f.return))n.call(f)}finally{if(i)throw i.error}}s.changed=a;s.actions=o;r.update(s,Et(t[t.length-1]))}))};t.prototype.sender=function(t){return this.send.bind(this,t)};t.prototype._nextState=function(t,r){var e=this;if(r===void 0){r=!!this.machine.config.predictableActionArguments&&this._exec}var i=Et(t);if(i.name.indexOf($)===0&&!this.state.nextEvents.some((function(t){return t.indexOf($)===0}))){throw i.data.data}var n=rr(this,(function(){return e.machine.transition(e.state,i,undefined,r||undefined)}));return n};t.prototype.nextState=function(t){return this._nextState(t,false)};t.prototype.forward=function(t){var r,e;try{for(var i=j(this.forwardTo),n=i.next();!n.done;n=i.next()){var s=n.value;var a=this.children.get(s);if(!a){throw new Error("Unable to forward event '".concat(t,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(s,"'."))}a.send(t)}}catch(t){r={error:t}}finally{try{if(n&&!n.done&&(e=i.return))e.call(i)}finally{if(r)throw r.error}}};t.prototype.defer=function(t){var r=this;var e=this.clock.setTimeout((function(){if("to"in t&&t.to){r.sendTo(t._event,t.to,true)}else{r.send(t._event)}}),t.delay);if(t.id){this.delayedEventsMap[t.id]=e}};t.prototype.cancel=function(t){this.clock.clearTimeout(this.delayedEventsMap[t]);delete this.delayedEventsMap[t]};t.prototype.exec=function(t,r,e){if(e===void 0){e=this.machine.options.actions}this._exec(t,r.context,r._event,e)};t.prototype.removeChild=function(t){var r;this.children.delete(t);this.forwardTo.delete(t);(r=this.state)===null||r===void 0?true:delete r.children[t]};t.prototype.stopChild=function(t){var r=this.children.get(t);if(!r){return}this.removeChild(t);if(wt(r.stop)){r.stop()}};t.prototype.spawn=function(t,r,e){if(this.status!==Mr.Running){return nr(t,r)}if(dt(t)){return this.spawnPromise(Promise.resolve(t),r)}else if(wt(t)){return this.spawnCallback(t,r)}else if(ar(t)){return this.spawnActor(t,r)}else if(Ot(t)){return this.spawnObservable(t,r)}else if(kt(t)){return this.spawnMachine(t,S(S({},e),{id:r}))}else if(ht(t)){return this.spawnBehavior(t,r)}else{throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof t,'".'))}};t.prototype.spawnMachine=function(r,e){var i=this;if(e===void 0){e={}}var n=new t(r,S(S({},this.options),{parent:this,id:e.id||r.id}));var s=S(S({},Ir),e);if(s.sync){n.onTransition((function(t){i.send(J,{state:t,id:n.id})}))}var a=n;this.children.set(n.id,a);if(s.autoForward){this.forwardTo.add(n.id)}n.onDone((function(t){i.removeChild(n.id);i.send(Et(t,{origin:n.id}))})).start();return a};t.prototype.spawnBehavior=function(t,r){var e=Ar(t,{id:r,parent:this});this.children.set(r,e);return e};t.prototype.spawnPromise=function(t,r){var e;var i=this;var n=false;var s;t.then((function(t){if(!n){s=t;i.removeChild(r);i.send(Et(Xt(r,t),{origin:r}))}}),(function(t){if(!n){i.removeChild(r);var e=Yt(r,t);try{i.send(Et(e,{origin:r}))}catch(t){if(i.devTools){i.devTools.send(e,i.state)}if(i.machine.strict){i.stop()}}}}));var a=(e={id:r,send:function(){return void 0},subscribe:function(r,e,i){var n=Nt(r,e,i);var s=false;t.then((function(t){if(s){return}n.next(t);if(s){return}n.complete()}),(function(t){if(s){return}n.error(t)}));return{unsubscribe:function(){return s=true}}},stop:function(){n=true},toJSON:function(){return{id:r}},getSnapshot:function(){return s}},e[St]=function(){return this},e);this.children.set(r,a);return a};t.prototype.spawnCallback=function(t,r){var e;var i=this;var n=false;var s=new Set;var a=new Set;var o;var c=function(t){o=t;a.forEach((function(r){return r(t)}));if(n){return}i.send(Et(t,{origin:r}))};var f;try{f=t(c,(function(t){s.add(t)}))}catch(t){this.send(Yt(r,t))}if(dt(f)){return this.spawnPromise(f,r)}var u=(e={id:r,send:function(t){return s.forEach((function(r){return r(t)}))},subscribe:function(t){var r=Nt(t);a.add(r.next);return{unsubscribe:function(){a.delete(r.next)}}},stop:function(){n=true;if(wt(f)){f()}},toJSON:function(){return{id:r}},getSnapshot:function(){return o}},e[St]=function(){return this},e);this.children.set(r,u);return u};t.prototype.spawnObservable=function(t,r){var e;var i=this;var n;var s=t.subscribe((function(t){n=t;i.send(Et(t,{origin:r}))}),(function(t){i.removeChild(r);i.send(Et(Yt(r,t),{origin:r}))}),(function(){i.removeChild(r);i.send(Et(Xt(r),{origin:r}))}));var a=(e={id:r,send:function(){return void 0},subscribe:function(r,e,i){return t.subscribe(r,e,i)},stop:function(){return s.unsubscribe()},getSnapshot:function(){return n},toJSON:function(){return{id:r}}},e[St]=function(){return this},e);this.children.set(r,a);return a};t.prototype.spawnActor=function(t,r){this.children.set(r,t);return t};t.prototype.spawnActivity=function(t){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[t.type]:undefined;if(!r){return}var e=r(this.state.context,t);this.spawnEffect(t.id,e)};t.prototype.spawnEffect=function(t,r){var e;this.children.set(t,(e={id:t,send:function(){return void 0},subscribe:function(){return{unsubscribe:function(){return void 0}}},stop:r||undefined,getSnapshot:function(){return undefined},toJSON:function(){return{id:t}}},e[St]=function(){return this},e))};t.prototype.attachDev=function(){var t=Tr();if(this.options.devTools&&t){if(t.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools==="object"?this.options.devTools:undefined;this.devTools=t.__REDUX_DEVTOOLS_EXTENSION__.connect(S(S({name:this.id,autoPause:true,stateSanitizer:function(t){return{value:t.value,context:t.context,actions:t.actions}}},r),{features:S({jump:false,skip:false},r?r.features:undefined)}),this.machine);this.devTools.init(this.state)}Nr(this)}};t.prototype.toJSON=function(){return{id:this.id}};t.prototype[St]=function(){return this};t.prototype.getSnapshot=function(){if(this.status===Mr.NotStarted){return this.initialState}return this._state};t.defaultOptions={execute:true,deferEvents:true,clock:{setTimeout:function(t,r){return setTimeout(t,r)},clearTimeout:function(t){return clearTimeout(t)}},logger:console.log.bind(console),devTools:false};t.interpret=Pr;return t}();function Pr(t,r){var e=new Dr(t,r);return e}function Vr(t){if(typeof t==="string"){var r={type:t};r.toString=function(){return t};return r}return t}function Br(t){return S(S({type:B},t),{toJSON:function(){var r=k(t,["onDone","onError"]);return S(S({},r),{type:B,src:Vr(t.src)})}})}var $r="";var Fr="#";var Jr="*";var Ur={};var Wr=function(t){return t[0]===Fr};var Kr=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}};var Rr=function(){function t(r,e,i,n){if(i===void 0){i="context"in r?r.context:undefined}var s=this;var a;this.config=r;this._context=i;this.order=-1;this.__xstatenode=true;this.__cache={events:undefined,relativeValue:new Map,initialStateValue:undefined,initialState:undefined,on:undefined,transitions:undefined,candidates:{},delayedTransitions:undefined};this.idMap={};this.tags=[];this.options=Object.assign(Kr(),e);this.parent=n===null||n===void 0?void 0:n.parent;this.key=this.config.key||(n===null||n===void 0?void 0:n.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:K);this.id=this.config.id||E([this.machine.key],z(this.path),false).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;this.initial=this.config.initial;this.states=this.config.states?et(this.config.states,(function(r,e){var i;var n=new t(r,{},undefined,{parent:s,key:e});Object.assign(s.idMap,S((i={},i[n.id]=n,i),n.idMap));return n})):Ur;var o=0;function c(t){var r,e;t.order=o++;try{for(var i=j(fr(t)),n=i.next();!n.done;n=i.next()){var s=n.value;c(s)}}catch(t){r={error:t}}finally{try{if(n&&!n.done&&(e=i.return))e.call(i)}finally{if(r)throw r.error}}}c(this);this.history=this.config.history===true?"shallow":this.config.history||false;this._transient=!!this.config.always||(!this.config.on?false:Array.isArray(this.config.on)?this.config.on.some((function(t){var r=t.event;return r===$r})):$r in this.config.on);this.strict=!!this.config.strict;this.onEntry=ft(this.config.entry||this.config.onEntry).map((function(t){return Pt(t)}));this.onExit=ft(this.config.exit||this.config.onExit).map((function(t){return Pt(t)}));this.meta=this.config.meta;this.doneData=this.type==="final"?this.config.data:undefined;this.invoke=ft(this.config.invoke).map((function(t,r){var e,i;if(kt(t)){var n=At(s.id,r);s.machine.options.services=S((e={},e[n]=t,e),s.machine.options.services);return Br({src:n,id:n})}else if(bt(t.src)){var n=t.id||At(s.id,r);return Br(S(S({},t),{id:n,src:t.src}))}else if(kt(t.src)||wt(t.src)){var n=t.id||At(s.id,r);s.machine.options.services=S((i={},i[n]=t.src,i),s.machine.options.services);return Br(S(S({id:n},t),{src:n}))}else{var a=t.src;return Br(S(S({id:At(s.id,r)},t),{src:a}))}}));this.activities=ft(this.config.activities).concat(this.invoke).map((function(t){return Bt(t)}));this.transition=this.transition.bind(this);this.tags=ft(this.config.tags)}t.prototype._init=function(){if(this.__cache.transitions){return}lr(this).forEach((function(t){return t.on}))};t.prototype.withConfig=function(r,e){var i=this.options,n=i.actions,s=i.activities,a=i.guards,o=i.services,c=i.delays;return new t(this.config,{actions:S(S({},n),r.actions),activities:S(S({},s),r.activities),guards:S(S({},a),r.guards),services:S(S({},o),r.services),delays:S(S({},c),r.delays)},e!==null&&e!==void 0?e:this.context)};t.prototype.withContext=function(r){return new t(this.config,this.options,r)};Object.defineProperty(t.prototype,"context",{get:function(){return wt(this._context)?this._context():this._context},enumerable:false,configurable:true});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:et(this.states,(function(t){return t.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:false,configurable:true});t.prototype.toJSON=function(){return this.definition};Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on){return this.__cache.on}var t=this.transitions;return this.__cache.on=t.reduce((function(t,r){t[r.eventType]=t[r.eventType]||[];t[r.eventType].push(r);return t}),{})},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:false,configurable:true});t.prototype.getCandidates=function(t){if(this.__cache.candidates[t]){return this.__cache.candidates[t]}var r=t===$r;var e=this.transitions.filter((function(e){var i=e.eventType===t;return r?i:i||e.eventType===Jr}));this.__cache.candidates[t]=e;return e};t.prototype.getDelayedTransitions=function(){var t=this;var r=this.config.after;if(!r){return[]}var e=function(r,e){var i=wt(r)?"".concat(t.id,":delay[").concat(e,"]"):r;var n=Gt(i,t.id);t.onEntry.push(Jt(n,{delay:r}));t.onExit.push(Kt(n));return n};var i=gt(r)?r.map((function(t,r){var i=e(t.delay,r);return S(S({},t),{event:i})})):ot(Object.keys(r).map((function(t,i){var n=r[t];var s=bt(n)?{target:n}:n;var a=!isNaN(+t)?+t:t;var o=e(a,i);return ft(s).map((function(t){return S(S({},t),{event:o,delay:a})}))})));return i.map((function(r){var e=r.delay;return S(S({},t.formatTransition(r)),{delay:e})}))};t.prototype.getStateNodes=function(t){var r;var e=this;if(!t){return[]}var i=t instanceof kr?t.value:tt(t,this.delimiter);if(bt(i)){var n=this.getStateNode(i).initial;return n!==undefined?this.getStateNodes((r={},r[i]=n,r)):[this,this.states[i]]}var s=Object.keys(i);var a=[this];a.push.apply(a,E([],z(ot(s.map((function(t){return e.getStateNode(t).getStateNodes(i[t])})))),false));return a};t.prototype.handles=function(t){var r=X(t);return this.events.includes(r)};t.prototype.resolveState=function(t){var r=t instanceof kr?t:kr.create(t);var e=Array.from(dr([],this.getStateNodes(r.value)));return new kr(S(S({},r),{value:this.resolve(r.value),configuration:e,done:gr(e,this),tags:br(e),machine:this.machine}))};t.prototype.transitionLeafNode=function(t,r,e){var i=this.getStateNode(t);var n=i.next(r,e);if(!n||!n.transitions.length){return this.next(r,e)}return n};t.prototype.transitionCompoundNode=function(t,r,e){var i=Object.keys(t);var n=this.getStateNode(i[0]);var s=n._transition(t[i[0]],r,e);if(!s||!s.transitions.length){return this.next(r,e)}return s};t.prototype.transitionParallelNode=function(t,r,e){var i,n;var s={};try{for(var a=j(Object.keys(t)),o=a.next();!o.done;o=a.next()){var c=o.value;var f=t[c];if(!f){continue}var u=this.getStateNode(c);var l=u._transition(f,r,e);if(l){s[c]=l}}}catch(t){i={error:t}}finally{try{if(o&&!o.done&&(n=a.return))n.call(a)}finally{if(i)throw i.error}}var d=Object.keys(s).map((function(t){return s[t]}));var h=ot(d.map((function(t){return t.transitions})));var p=d.some((function(t){return t.transitions.length>0}));if(!p){return this.next(r,e)}var v=ot(Object.keys(s).map((function(t){return s[t].configuration})));return{transitions:h,exitSet:ot(d.map((function(t){return t.exitSet}))),configuration:v,source:r,actions:ot(Object.keys(s).map((function(t){return s[t].actions})))}};t.prototype._transition=function(t,r,e){if(bt(t)){return this.transitionLeafNode(t,r,e)}if(Object.keys(t).length===1){return this.transitionCompoundNode(t,r,e)}return this.transitionParallelNode(t,r,e)};t.prototype.getTransitionData=function(t,r){return this._transition(t.value,t,Et(r))};t.prototype.next=function(t,r){var e,i;var n=this;var s=r.name;var a=[];var o=[];var c;try{for(var f=j(this.getCandidates(s)),u=f.next();!u.done;u=f.next()){var l=u.value;var d=l.cond,h=l.in;var p=t.context;var v=h?bt(h)&&Wr(h)?t.matches(tt(this.getStateNodeById(h).path,this.delimiter)):Q(tt(h,this.delimiter),nt(this.path.slice(0,-2))(t.value)):true;var m=false;try{m=!d||Tt(this.machine,d,p,r,t)}catch(t){throw new Error("Unable to evaluate guard '".concat(d.name||d.type,"' in transition for event '").concat(s,"' in state node '").concat(this.id,"':\n").concat(t.message))}if(m&&v){if(l.target!==undefined){o=l.target}a.push.apply(a,E([],z(l.actions),false));c=l;break}}}catch(t){e={error:t}}finally{try{if(u&&!u.done&&(i=f.return))i.call(f)}finally{if(e)throw e.error}}if(!c){return undefined}if(!o.length){return{transitions:[c],exitSet:[],configuration:t.value?[this]:[],source:t,actions:a}}var y=ot(o.map((function(r){return n.getRelativeStateNodes(r,t.historyValue)})));var g=!!c.internal;return{transitions:[c],exitSet:g?[]:ot(o.map((function(t){return n.getPotentiallyReenteringNodes(t)}))),configuration:y,source:t,actions:a}};t.prototype.getPotentiallyReenteringNodes=function(t){if(this.order<t.order){return[this]}var r=[];var e=this;var i=t;while(e&&e!==i){r.push(e);e=e.parent}if(e!==i){return[]}r.push(i);return r};t.prototype.getActions=function(t,r,e,i,n,s,a){var o,c,f,u;var l=this;var d=s?dr([],this.getStateNodes(s.value)):[];var h=new Set;try{for(var p=j(Array.from(t).sort((function(t,r){return t.order-r.order}))),v=p.next();!v.done;v=p.next()){var m=v.value;if(!mr(d,m)||mr(e.exitSet,m)||m.parent&&h.has(m.parent)){h.add(m)}}}catch(t){o={error:t}}finally{try{if(v&&!v.done&&(c=p.return))c.call(p)}finally{if(o)throw o.error}}try{for(var y=j(d),g=y.next();!g.done;g=y.next()){var m=g.value;if(!mr(t,m)||mr(e.exitSet,m.parent)){e.exitSet.push(m)}}}catch(t){f={error:t}}finally{try{if(g&&!g.done&&(u=y.return))u.call(y)}finally{if(f)throw f.error}}e.exitSet.sort((function(t,r){return r.order-t.order}));var w=Array.from(h).sort((function(t,r){return t.order-r.order}));var b=new Set(e.exitSet);var x=ot(w.map((function(t){var r=[];if(t.type!=="final"){return r}var s=t.parent;if(!s.parent){return r}r.push(Qt(t.id,t.doneData),Qt(s.id,t.doneData?ut(t.doneData,i,n):undefined));var a=s.parent;if(a.type==="parallel"){if(ur(a).every((function(t){return gr(e.configuration,t)}))){r.push(Qt(a.id))}}return r})));var O=w.map((function(t){var r=t.onEntry;var e=t.activities.map((function(t){return Rt(t)}));return{type:"entry",actions:Vt(a?E(E([],z(r),false),z(e),false):E(E([],z(e),false),z(r),false),l.machine.options.actions)}})).concat({type:"state_done",actions:x.map((function(t){return $t(t)}))});var S=Array.from(b).map((function(t){return{type:"exit",actions:Vt(E(E([],z(t.onExit),false),z(t.activities.map((function(t){return qt(t)}))),false),l.machine.options.actions)}}));var k=S.concat({type:"transition",actions:Vt(e.actions,this.machine.options.actions)}).concat(O);if(r){var C=Vt(ot(E([],z(t),false).sort((function(t,r){return r.order-t.order})).map((function(t){return t.onExit}))),this.machine.options.actions).filter((function(t){return!It(t)}));return k.concat({type:"stop",actions:C})}return k};t.prototype.transition=function(t,r,e,i){if(t===void 0){t=this.initialState}var n=Et(r);var s;if(t instanceof kr){s=e===undefined?t:this.resolveState(kr.from(t,e))}else{var a=bt(t)?this.resolve(rt(this.getResolvedPath(t))):this.resolve(t);var o=e!==null&&e!==void 0?e:this.machine.context;s=this.resolveState(kr.from(a,o))}if(this.strict){if(!this.events.includes(n.name)&&!lt(n.name)){throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(n.name,"'"))}}var c=this._transition(s.value,s,n)||{transitions:[],configuration:[],exitSet:[],source:s,actions:[]};var f=dr([],this.getStateNodes(s.value));var u=c.configuration.length?dr(f,c.configuration):f;c.configuration=E([],z(u),false);return this.resolveTransition(c,s,s.context,i,n)};t.prototype.resolveRaisedTransition=function(t,r,e,i){var n;var s=t.actions;t=this.transition(t,r,undefined,i);t._event=e;t.event=e.data;(n=t.actions).unshift.apply(n,E([],z(s),false));return t};t.prototype.resolveTransition=function(t,r,e,i,n){var s,a,o,c;var f=this;if(n===void 0){n=Mt}var u=t.configuration;var l=!r||t.transitions.length>0;var d=l?t.configuration:r?r.configuration:[];var h=gr(d,this);var p=l?vr(this.machine,u):undefined;var v=r?r.historyValue?r.historyValue:t.source?this.machine.historyValue(r.value):undefined:undefined;var m=this.getActions(new Set(d),h,t,e,n,r,i);var y=r?S({},r.activities):{};try{for(var g=j(m),w=g.next();!w.done;w=g.next()){var b=w.value;try{for(var x=(o=void 0,j(b.actions)),O=x.next();!O.done;O=x.next()){var k=O.value;if(k.type===T){y[k.activity.id||k.activity.type]=k}else if(k.type===L){y[k.activity.id||k.activity.type]=false}}}catch(t){o={error:t}}finally{try{if(O&&!O.done&&(c=x.return))c.call(x)}finally{if(o)throw o.error}}}}catch(t){s={error:t}}finally{try{if(w&&!w.done&&(a=g.return))a.call(g)}finally{if(s)throw s.error}}var E=z(tr(this,r,e,n,m,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),C=E[0],_=E[1];var N=z(pt(C,It),2),A=N[0],I=N[1];var D=C.filter((function(t){var r;return t.type===T&&((r=t.activity)===null||r===void 0?void 0:r.type)===B}));var P=D.reduce((function(t,r){t[r.activity.id]=ir(r.activity,f.machine,_,n);return t}),r?S({},r.children):{});var V=new kr({value:p||r.value,context:_,_event:n,_sessionid:r?r._sessionid:null,historyValue:p?v?mt(v,p):undefined:r?r.historyValue:undefined,history:!p||t.source?r:undefined,actions:p?I:[],activities:p?y:r?r.activities:{},events:[],configuration:d,transitions:t.transitions,children:P,done:h,tags:br(d),machine:this});var $=e!==_;V.changed=n.name===J||$;var F=V.history;if(F){delete F.history}var U=!h&&(this._transient||u.some((function(t){return t._transient})));if(!l&&(!U||n.name===$r)){return V}var W=V;if(!h){if(U){W=this.resolveRaisedTransition(W,{type:M},n,i)}while(A.length){var K=A.shift();W=this.resolveRaisedTransition(W,K._event,n,i)}}var R=W.changed||(F?!!W.actions.length||$||typeof F.value!==typeof W.value||!xr(W.value,F.value):undefined);W.changed=R;W.history=F;return W};t.prototype.getStateNode=function(t){if(Wr(t)){return this.machine.getStateNodeById(t)}if(!this.states){throw new Error("Unable to retrieve child state '".concat(t,"' from '").concat(this.id,"'; no child states exist."))}var r=this.states[t];if(!r){throw new Error("Child state '".concat(t,"' does not exist on '").concat(this.id,"'"))}return r};t.prototype.getStateNodeById=function(t){var r=Wr(t)?t.slice(Fr.length):t;if(r===this.id){return this}var e=this.machine.idMap[r];if(!e){throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"))}return e};t.prototype.getStateNodeByPath=function(t){if(typeof t==="string"&&Wr(t)){try{return this.getStateNodeById(t.slice(1))}catch(t){}}var r=Y(t,this.delimiter).slice();var e=this;while(r.length){var i=r.shift();if(!i.length){break}e=e.getStateNode(i)}return e};t.prototype.resolve=function(t){var r;var e=this;if(!t){return this.initialStateValue||Ur}switch(this.type){case"parallel":return et(this.initialStateValue,(function(r,i){return r?e.getStateNode(i).resolve(t[i]||r):Ur}));case"compound":if(bt(t)){var i=this.getStateNode(t);if(i.type==="parallel"||i.type==="compound"){return r={},r[t]=i.initialStateValue,r}return t}if(!Object.keys(t).length){return this.initialStateValue||{}}return et(t,(function(t,r){return t?e.getStateNode(r).resolve(t):Ur}));default:return t||Ur}};t.prototype.getResolvedPath=function(t){if(Wr(t)){var r=this.machine.idMap[t.slice(Fr.length)];if(!r){throw new Error("Unable to find state node '".concat(t,"'"))}return r.path}return Y(t,this.delimiter)};Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var t;if(this.__cache.initialStateValue){return this.__cache.initialStateValue}var r;if(this.type==="parallel"){r=it(this.states,(function(t){return t.initialStateValue||Ur}),(function(t){return!(t.type==="history")}))}else if(this.initial!==undefined){if(!this.states[this.initial]){throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"))}r=cr(this.states[this.initial])?this.initial:(t={},t[this.initial]=this.states[this.initial].initialStateValue,t)}else{r={}}this.__cache.initialStateValue=r;return this.__cache.initialStateValue},enumerable:false,configurable:true});t.prototype.getInitialState=function(t,r){this._init();var e=this.getStateNodes(t);return this.resolveTransition({configuration:e,exitSet:[],transitions:[],source:undefined,actions:[]},undefined,r!==null&&r!==void 0?r:this.machine.context,undefined)};Object.defineProperty(t.prototype,"initialState",{get:function(){var t=this.initialStateValue;if(!t){throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."))}return this.getInitialState(t)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"target",{get:function(){var t;if(this.type==="history"){var r=this.config;if(bt(r.target)){t=Wr(r.target)?rt(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target}else{t=r.target}}return t},enumerable:false,configurable:true});t.prototype.getRelativeStateNodes=function(t,r,e){if(e===void 0){e=true}return e?t.type==="history"?t.resolveHistory(r):t.initialStateNodes:[t]};Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var t=this;if(cr(this)){return[this]}if(this.type==="compound"&&!this.initial){return[this]}var r=at(this.initialStateValue);return ot(r.map((function(r){return t.getFromRelativePath(r)})))},enumerable:false,configurable:true});t.prototype.getFromRelativePath=function(t){if(!t.length){return[this]}var r=z(t),e=r[0],i=r.slice(1);if(!this.states){throw new Error("Cannot retrieve subPath '".concat(e,"' from node with no states"))}var n=this.getStateNode(e);if(n.type==="history"){return n.resolveHistory()}if(!this.states[e]){throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"))}return this.states[e].getFromRelativePath(i)};t.prototype.historyValue=function(t){if(!Object.keys(this.states).length){return undefined}return{current:t||this.initialStateValue,states:it(this.states,(function(r,e){if(!t){return r.historyValue()}var i=bt(t)?undefined:t[e];return r.historyValue(i||r.initialStateValue)}),(function(t){return!t.history}))}};t.prototype.resolveHistory=function(t){var r=this;if(this.type!=="history"){return[this]}var e=this.parent;if(!t){var i=this.target;return i?ot(at(i).map((function(t){return e.getFromRelativePath(t)}))):e.initialStateNodes}var n=st(e.path,"states")(t).current;if(bt(n)){return[e.getStateNode(n)]}return ot(at(n).map((function(t){return r.history==="deep"?e.getFromRelativePath(t):[e.states[t[0]]]})))};Object.defineProperty(t.prototype,"stateIds",{get:function(){var t=this;var r=ot(Object.keys(this.states).map((function(r){return t.states[r].stateIds})));return[this.id].concat(r)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"events",{get:function(){var t,r,e,i;if(this.__cache.events){return this.__cache.events}var n=this.states;var s=new Set(this.ownEvents);if(n){try{for(var a=j(Object.keys(n)),o=a.next();!o.done;o=a.next()){var c=o.value;var f=n[c];if(f.states){try{for(var u=(e=void 0,j(f.events)),l=u.next();!l.done;l=u.next()){var d=l.value;s.add("".concat(d))}}catch(t){e={error:t}}finally{try{if(l&&!l.done&&(i=u.return))i.call(u)}finally{if(e)throw e.error}}}}}catch(r){t={error:r}}finally{try{if(o&&!o.done&&(r=a.return))r.call(a)}finally{if(t)throw t.error}}}return this.__cache.events=Array.from(s)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"ownEvents",{get:function(){var t=new Set(this.transitions.filter((function(t){return!(!t.target&&!t.actions.length&&t.internal)})).map((function(t){return t.eventType})));return Array.from(t)},enumerable:false,configurable:true});t.prototype.resolveTarget=function(t){var r=this;if(t===undefined){return undefined}return t.map((function(t){if(!bt(t)){return t}var e=t[0]===r.delimiter;if(e&&!r.parent){return r.getStateNodeByPath(t.slice(1))}var i=e?r.key+t:t;if(r.parent){try{var n=r.parent.getStateNodeByPath(i);return n}catch(t){throw new Error("Invalid transition definition for state node '".concat(r.id,"':\n").concat(t.message))}}else{return r.getStateNodeByPath(i)}}))};t.prototype.formatTransition=function(t){var r=this;var e=_t(t.target);var i="internal"in t?t.internal:e?e.some((function(t){return bt(t)&&t[0]===r.delimiter})):true;var n=this.machine.options.guards;var s=this.resolveTarget(e);var a=S(S({},t),{actions:Vt(ft(t.actions)),cond:xt(t.cond,n),target:s,source:this,internal:i,eventType:t.event,toJSON:function(){return S(S({},a),{target:a.target?a.target.map((function(t){return"#".concat(t.id)})):undefined,source:"#".concat(r.id)})}});return a};t.prototype.formatTransitions=function(){var t,r;var e=this;var i;if(!this.config.on){i=[]}else if(Array.isArray(this.config.on)){i=this.config.on}else{var n=this.config.on,s=Jr,a=n[s],o=a===void 0?[]:a,c=k(n,[typeof s==="symbol"?s:s+""]);i=ot(Object.keys(c).map((function(t){var r=Ct(t,c[t]);return r})).concat(Ct(Jr,o)))}var f=this.config.always?Ct("",this.config.always):[];var u=this.config.onDone?Ct(String(Qt(this.id)),this.config.onDone):[];var l=ot(this.invoke.map((function(t){var r=[];if(t.onDone){r.push.apply(r,E([],z(Ct(String(Xt(t.id)),t.onDone)),false))}if(t.onError){r.push.apply(r,E([],z(Ct(String(Yt(t.id)),t.onError)),false))}return r})));var d=this.after;var h=ot(E(E(E(E([],z(u),false),z(l),false),z(i),false),z(f),false).map((function(t){return ft(t).map((function(t){return e.formatTransition(t)}))})));try{for(var p=j(d),v=p.next();!v.done;v=p.next()){var m=v.value;h.push(m)}}catch(r){t={error:r}}finally{try{if(v&&!v.done&&(r=p.return))r.call(p)}finally{if(t)throw t.error}}return h};return t}();function qr(t,r,e){if(e===void 0){e=t.context}return new Rr(t,r,e)}const Hr=["m","l"];function Gr(t){return Hr.includes(t)}const Qr=({disabled:r,option:e,onRemove:i})=>{const n={};if(e.chipColor){n["color"]=e.chipColor}if(e.chipBackgroundColor){n["background-color"]=e.chipBackgroundColor}return t("label",{class:"wcs-select-chip",style:n,onClick:t=>t.stopImmediatePropagation()},t("div",null,e.displayText),r?null:t("div",{onClick:()=>i(e)},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"12",viewBox:"0 0 20 12",class:"chip"},t("path",{d:"M2,0 6,4 10,0 12,2 8,6 12,10 10,12 6,8 2,12 0,10 4,6 0,2 2,0",fill:e.chipColor,transform:"translate(8 0)"}))))};const Xr='@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-ripple-surface{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-ripple-surface::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}:host{--wcs-select-ligther-percentage:40;--wcs-select-border-radius:var(--wcs-border-radius);--wcs-select-background-color:var(--wcs-light);--wcs-select-placeholder-color:var(--wcs-text-medium);--wcs-select-value-color:var(--wcs-primary);--wcs-select-border-color:transparent;--wcs-select-overlay-max-height:360px;--wcs-select-option-height:var(--wcs-size-m);--wcs-select-border-width:1px;display:block;position:relative;outline:none;user-select:none;box-sizing:border-box}:host svg{flex-shrink:0}:host .arrow{fill:var(--wcs-select-value-color)}:host .chip{fill:var(--wcs-contrast);opacity:calc((100 - var(--wcs-select-ligther-percentage)) / 100)}:host .chip:hover{opacity:100}:host(.expanded){--wcs-select-border-color:var(--wcs-text-light)}:host(.expanded) .wcs-select-options{display:block}:host(:not(.expanded):focus) .wcs-select-control{border:var(--wcs-primary) solid 1px}:host(:not(.expanded):focus-visible) .wcs-select-control{outline:2px dashed var(--wcs-primary);outline-offset:4px;border-radius:var(--wcs-select-border-radius)}:host([disabled]){cursor:not-allowed}:host([disabled]) .wcs-select-control,:host([disabled]) label{cursor:default;pointer-events:none}:host([disabled]) label{color:var(--wcs-text-disabled)}:host([disabled]) .arrow{fill:var(--wcs-text-medium)}label{padding-left:calc(var(--wcs-padding) - var(--wcs-select-border-width));padding-right:calc(var(--wcs-padding) - var(--wcs-select-border-width));font-weight:500;cursor:pointer;color:var(--wcs-select-color);transition:color 125ms ease-in;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host([size=m]){min-height:var(--wcs-size-m);--wcs-select-font-size:1rem}:host([size=m]) .wcs-select-control{min-height:var(--wcs-size-m)}:host([size=l]){min-height:var(--wcs-size-l);--wcs-select-font-size:1.0625rem}:host([size=l]) .wcs-select-control{min-height:var(--wcs-size-l)}:host([chips]) .wcs-select-control{flex-wrap:wrap}.wcs-select-control{box-sizing:border-box;--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity;overflow:hidden;display:flex;align-items:center;padding-right:var(--wcs-text-padding);background-color:var(--wcs-select-background-color);border-radius:var(--wcs-select-border-radius);border:var(--wcs-select-border-color) solid var(--wcs-select-border-width);font-size:var(--wcs-select-font-size, 1rem);line-height:1.5;cursor:pointer}.wcs-select-control::before,.wcs-select-control::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.wcs-select-control::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.wcs-select-control::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.wcs-select-control.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.wcs-select-control.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.wcs-select-control.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.wcs-select-control.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.wcs-select-control.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.wcs-select-control::before,.wcs-select-control::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.wcs-select-control.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.wcs-select-control::before,.wcs-select-control::after{background-color:#999;background-color:var(--mdc-ripple-color, #999)}.wcs-select-control:hover::before,.wcs-select-control.mdc-ripple-surface--hover::before{opacity:0.1;opacity:var(--mdc-ripple-hover-opacity, 0.1)}.wcs-select-control.mdc-ripple-upgraded--background-focused::before,.wcs-select-control:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.wcs-select-control:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.wcs-select-control:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.3;opacity:var(--mdc-ripple-press-opacity, 0.3)}.wcs-select-control.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.3)}.wcs-select-placeholder{color:var(--wcs-select-placeholder-color);font-style:italic;font-weight:400}.wcs-select-value{color:var(--wcs-select-value-color);font-weight:var(--wcs-font-weight-form-value)}.wcs-select-value-container{margin-top:4px;margin-bottom:4px;margin-left:calc(var(--wcs-margin) / 2);max-width:calc(100% - (24px + var(--wcs-base-margin)));display:flex;flex-direction:row;gap:4px;align-items:center;flex-wrap:wrap}.wcs-select-chip{line-height:1.375;color:var(--wcs-contrast);background-color:var(--wcs-base);border-radius:0.75rem;display:flex;align-items:center;padding:calc((var(--wcs-padding) - 8px) / 2) var(--wcs-padding);overflow:initial}.wcs-select-options{display:none;position:absolute;z-index:999999999;border:solid var(--wcs-select-border-width) var(--wcs-select-border-color);border-radius:var(--wcs-select-border-radius);max-height:var(--wcs-select-overlay-max-height);overflow-y:auto;width:calc(100% - 2 * var(--wcs-select-border-width));background-color:var(--wcs-white);color:var(--wcs-text-medium)}';const Yr={key:"select",initial:"closed",states:{closed:{entry:["close"],on:{CLICK:"opened",OPEN:"opened",OPTION_SELECTED:{actions:["selectOption"]}}},opened:{entry:["open"],on:{CLICK:"closed",CLOSE:"closed",OPTION_SELECTED:{actions:["selectOption"]}}}}};const Zr=class{constructor(t){r(this,t);this.wcsChange=e(this,"wcsChange",7);this.wcsFocus=e(this,"wcsFocus",7);this.wcsBlur=e(this,"wcsBlur",7);this.selectId=`wcs-select-${te++}`;this.optionsId=a("OPTIONS");this.expanded=false;this.size="m";this.hasLoaded=false;this.displayText=undefined;this.focused=undefined;this.value=undefined;this.placeholder=undefined;this.disabled=false;this.multiple=false;this.chips=false;this.name=undefined;this.compareWith=(t,r)=>b(t,r);this.overlayDirection="bottom"}async open(){this.stateService.send("OPEN")}async close(){this.stateService.send("CLOSE")}onValueChangeHandler(t){this.updateSelectedValue(t);this.emitChange(this.value)}updateSelectedValue(t){if(!t){this.reset()}if(this.multiple){if(!Array.isArray(t)){t=[t]}this.values=[];this.options.forEach((r=>{const e=t?t.findIndex((t=>this.compareWith(r.value,t)))!==-1:false;if(e){this.values.push({value:r.value,displayText:r.innerText,chipColor:r.chipColor,chipBackgroundColor:r.chipBackgroundColor})}r.selected=e}));this.displayText=this.values.length!==0?this.values.map((t=>t.displayText)).join(", "):undefined}else{this.options.forEach((r=>{const e=this.compareWith(r.value,t);if(e){this.displayText=r.innerText}r.selected=e}))}}reset(){this.values=[];this.displayText=undefined;this.options.forEach((t=>{t.selected=false}))}componentDidLoad(){this.optionsEl=this.el.shadowRoot.querySelector(".wcs-select-options");this.controlEl=this.el.shadowRoot.querySelector(".wcs-select-control");const t=qr(Yr,this.initMachineOptions());this.stateService=Pr(t);if(this.multiple){this.values=[]}this.addRippleEffect();this.stateService.start();if(this.optionsEl.querySelector("slot")===null){this.replaceOptions_firefoxBefore63();this.listenDomUpdate_firefoxBefore63()}if(this.value!==undefined){this.updateSelectedValue(this.value)}this.popper=this.createPopperInstance();this.labelElement=o(this.el);if(this.labelElement){this.labelElement.id=this.selectId+"-lbl"}this.hasLoaded=true}createPopperInstance(){return x(this.controlEl,this.optionsEl,{placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,4]}}]})}emitChange(t){this.wcsChange.emit({value:t})}replaceOptions_firefoxBefore63(){Array.from(this.el.querySelectorAll("wcs-select-option")).forEach((t=>{if(t.parentNode===this.el){this.el.removeChild(t);this.optionsEl.appendChild(t)}}))}listenDomUpdate_firefoxBefore63(){const t=new MutationObserver((t=>{for(const r of t){if(r.type==="childList"){this.replaceOptions_firefoxBefore63()}}}));t.observe(this.el,{childList:true})}componentWillLoad(){if(!Gr(this.size)){console.error(`Invalid size value for wcs-select : "${this.size}". Must be one of "${Hr.join(", ")}"`);this.size="m"}}componentWillUpdate(){if(this.multiple){this.options.forEach((t=>t.multiple=true))}}get options(){var t;const r=(t=this.el)===null||t===void 0?void 0:t.querySelectorAll("wcs-select-option");if(r&&r.length!==0){return r}return[]}get notDisabledOptions(){var t;const r=(t=this.el)===null||t===void 0?void 0:t.querySelectorAll("wcs-select-option:not([disabled])");if(r&&r.length!==0){return r}return[]}initMachineOptions(){return{actions:{open:()=>{var t;if(!this.disabled){this.expanded=true;this.focused=false;if(this.notDisabledOptions.length>0){this.lastFocusedOptionElement=(t=this.lastSelectedOptionElement)!==null&&t!==void 0?t:this.notDisabledOptions[0];requestAnimationFrame((()=>{var t;(t=this.lastFocusedOptionElement)===null||t===void 0?void 0:t.focus()}))}}},close:(t,r)=>{var e,i;if(r.type==="CLOSE"){if((e=r.value)===null||e===void 0?void 0:e.shouldBlur){(i=this.el.closest("wcs-select"))===null||i===void 0?void 0:i.focus();this.focused=false}else{this.el.focus();this.focused=true}}this.expanded=false},selectOption:(t,r)=>{if(r.type==="OPTION_SELECTED"){this.handleClickEvent(r.value)}}},guards:{enabled:()=>!this.disabled}}}handleClickEvent(t){if(this.multiple){this.handleClickOnMultiple(t)}else{this.handleNormalClick(t)}}handleClickOnMultiple(t){const r=this.values.findIndex((r=>r.value===t.value));if(r===-1){const{value:r,displayText:e,chipColor:i,chipBackgroundColor:n}=t;this.values.push({value:r,displayText:e,chipColor:i,chipBackgroundColor:n});t.source.selected=true;this.lastSelectedOptionElement=t.source}else{t.source.selected=false;this.values.splice(r,1);if(this.lastSelectedOptionElement===t.source)this.lastSelectedOptionElement=null}this.updateValueWithValues()}updateValueWithValues(){this.value=this.values.map((t=>t.value));this.displayText=this.values.length!==0?this.values.map((t=>t.displayText)).join(", "):undefined}handleNormalClick(t){this.options.forEach((t=>{if(t.selected)t.selected=false}));t.source.selected=true;this.value=t.value;this.displayText=t.displayText;this.lastSelectedOptionElement=t.source;this.stateService.send("CLOSE")}disconnectedCallback(){var t;(t=this.stateService)===null||t===void 0?void 0:t.stop()}addRippleEffect(){const t=new O(this.controlEl);t.unbounded=false}get hasValue(){return this.displayText!==undefined}onMouseDown(t){const r=w(t.target)&&(t.offsetX>t.target.clientWidth||t.offsetY>t.target.clientHeight||t.offsetY<0);const e=t.composedPath().filter((t=>{const r=t;return r.nodeName==="svg"&&r.classList.contains("chip")})).length>0;if(!r&&!e){this.stateService.send("CLICK")}}onWindowClickEvent(t){const r=t.composedPath().filter((t=>t.nodeName==="WCS-SELECT"))[0];const e=r===this.el;if(this.expanded&&!e){this.stateService.send("CLOSE")}}onKeyDown(t){if(this.stateService.getSnapshot().matches("closed")){if(c(t)||t.altKey&&f(t)||u(t)){t.preventDefault();t.stopPropagation();this.stateService.send("OPEN");return}if(this.multiple){if(f(t)){this.stateService.send("OPEN")}}else{if(f(t)||l(t)){t.preventDefault();this.selectClosestOption("next")}if(d(t)||h(t)){t.preventDefault();this.selectClosestOption("previous")}else if(p(t)){t.preventDefault();this.selectLastOption()}else if(v(t)||m(t)){t.preventDefault();this.selectFirstOption()}}}else if(this.stateService.getSnapshot().matches("opened")){if(y(t)||t.altKey&&d(t)){this.stateService.send({type:"CLOSE",value:{shouldBlur:false}})}else if(g(t)||t.shiftKey&&g(t)){this.stateService.send({type:"CLOSE",value:{shouldBlur:true}})}else if(f(t)){t.preventDefault();this.focusClosestOption("next")}else if(d(t)){t.preventDefault();this.focusClosestOption("previous")}else if(v(t)||m(t)){t.preventDefault();this.focusFirstOption()}else if(p(t)){t.preventDefault();this.focusLastOption()}}}getClosestActiveOptionIndexForState(t,r){let e=Array.from(this.notDisabledOptions).indexOf(r==="focused"?this.lastFocusedOptionElement:this.lastSelectedOptionElement);if(t==="next"&&e<this.notDisabledOptions.length-1){e++}else if(t==="previous"&&e>0){e--}else{return"nothing"}return e}selectOption(t){this.lastSelectedOptionElement=this.notDisabledOptions[t];this.lastSelectedOptionElement.selected=true;this.sendOptionSelectedToStateMachine({source:this.lastSelectedOptionElement,value:this.value,displayText:this.lastSelectedOptionElement.innerText})}selectClosestOption(t){const r=this.getClosestActiveOptionIndexForState(t,"selected");if(r==="nothing")return;this.selectOption(r)}selectFirstOption(){if(this.notDisabledOptions.length<1){return}this.selectOption(0)}selectLastOption(){if(this.notDisabledOptions.length<1){return}this.selectOption(this.notDisabledOptions.length-1)}focusOption(t){var r;this.lastFocusedOptionElement=this.notDisabledOptions[t];(r=this.lastFocusedOptionElement)===null||r===void 0?void 0:r.focus();this.el.setAttribute("aria-activedescendant",this.lastFocusedOptionElement.id)}focusClosestOption(t){const r=this.getClosestActiveOptionIndexForState(t,"focused");if(r==="nothing")return;this.focusOption(r)}focusFirstOption(){this.focusOption(0)}focusLastOption(){this.focusOption(this.notDisabledOptions.length-1)}selectedOptionChanged(t){this.sendOptionSelectedToStateMachine(t.detail)}sendOptionSelectedToStateMachine(t){this.stateService.send({type:"OPTION_SELECTED",value:t})}onSlotchange(){this.updateSelectedValue(this.value)}removeChip(t){this.options.forEach((r=>{if(r.value===t.value){this.sendOptionSelectedToStateMachine(Object.assign(Object.assign({},t),{source:r}))}}))}componentDidRender(){var t;(t=this.popper)===null||t===void 0?void 0:t.update()}render(){const r=`${this.labelElement?this.labelElement.innerText:""} ${this.hasValue?this.displayText:""}`.trimEnd();return t(i,Object.assign({class:this.expanded?"expanded ":"",overlayDirection:this.overlayDirection},this.focusedAttributes(),{role:"combobox","aria-haspopup":"listbox","aria-disabled":this.disabled?"true":null,"aria-expanded":this.expanded?"true":"false","aria-controls":this.optionsId,"aria-owns":this.optionsId,"aria-multiselectable":this.multiple?"true":"false","aria-label":r}),t("div",{class:"wcs-select-control"},t("div",{class:"wcs-select-value-container"},this.hasValue?this.chips?this.values.map((r=>t(Qr,{disabled:this.disabled,option:r,onRemove:this.removeChip.bind(this)}))):t("label",{class:"wcs-select-value"},this.displayText):t("label",{class:"wcs-select-placeholder"},this.placeholder)),t(s,{up:this.expanded})),t("div",{class:"wcs-select-options",id:this.optionsId,role:"listbox"},t("slot",{name:"wcs-select-option",onSlotchange:this.onSlotchange.bind(this)})))}focusedAttributes(){return!this.disabled?{tabIndex:0}:{}}get el(){return n(this)}static get watchers(){return{value:["onValueChangeHandler"]}}};let te=0;Zr.style=Xr;const re='@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-ripple-surface{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-ripple-surface::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}wcs-select-option{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity;overflow:hidden;display:flex;padding:0 var(--wcs-padding);height:var(--wcs-select-option-height);line-height:42px;cursor:pointer;user-select:none;font-weight:500;font-size:1rem;color:var(--wcs-black)}wcs-select-option::before,wcs-select-option::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}wcs-select-option::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}wcs-select-option::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}wcs-select-option.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}wcs-select-option.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}wcs-select-option.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}wcs-select-option.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}wcs-select-option.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}wcs-select-option::before,wcs-select-option::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}wcs-select-option.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}wcs-select-option::before,wcs-select-option::after{background-color:#999;background-color:var(--mdc-ripple-color, #999)}wcs-select-option:hover::before,wcs-select-option.mdc-ripple-surface--hover::before{opacity:0.1;opacity:var(--mdc-ripple-hover-opacity, 0.1)}wcs-select-option.mdc-ripple-upgraded--background-focused::before,wcs-select-option:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}wcs-select-option:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}wcs-select-option:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.3;opacity:var(--mdc-ripple-press-opacity, 0.3)}wcs-select-option.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.3)}wcs-select-option:hover{color:var(--wcs-primary);background-color:var(--wcs-light)}wcs-select-option:focus{outline:none}wcs-select-option[disabled]{cursor:not-allowed;pointer-events:none;color:var(--wcs-text-disabled)}wcs-select-option[selected]{color:var(--wcs-primary);background-color:var(--wcs-light)}wcs-select-option[multiple] wcs-checkbox{pointer-events:none;margin-right:10px}wcs-select-option[multiple]:hover wcs-checkbox{--wcs-checkbox-border-color:var(--wcs-primary)}';const ee=class{constructor(t){r(this,t);this.wcsSelectOptionClick=e(this,"wcsSelectOptionClick",7);this.selectOptionId=a(this.el.tagName);this.disabled=false;this.selected=false;this.value=undefined;this.chipColor=undefined;this.chipBackgroundColor=undefined;this.multiple=false}componentWillLoad(){if(this.value===undefined){this.value=this.el.innerText||""}}componentDidLoad(){this.mdcRipple=new O(this.el)}chooseOption(t){if(!this.disabled){t.stopPropagation();const r=this.el.innerText;this.wcsSelectOptionClick.emit({source:this.el,value:this.value,displayText:r})}}onMouseDown(t){this.chooseOption(t)}handleKeydown(t){if(c(t)||u(t)){this.chooseOption(t);t.preventDefault();t.stopPropagation()}}render(){return t(i,{id:this.selectOptionId,"aria-selected":this.selected?"true":"false",slot:"wcs-select-option",role:"option",tabindex:"-1"},this.multiple&&t("wcs-checkbox",{tabindex:"-1",checked:this.selected}),t("slot",null))}get el(){return n(this)}};ee.style=re;export{Zr as wcs_select,ee as wcs_select_option};
16
+ //# sourceMappingURL=p-405140f9.entry.js.map