@perses-dev/pie-chart-plugin 0.14.0 → 0.15.0-beta.2

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 (123) hide show
  1. package/__mf/js/{PieChart.a102eecb.js → PieChart.5c25af4b.js} +4 -4
  2. package/__mf/js/async/121.3f985aad.js +2 -0
  3. package/__mf/js/async/192.e77db572.js +1 -0
  4. package/__mf/js/async/2.0d6a1680.js +1 -0
  5. package/__mf/js/async/235.2bb8ba2f.js +1 -0
  6. package/__mf/js/async/237.418111c6.js +2 -0
  7. package/__mf/js/async/274.0fa32f07.js +2 -0
  8. package/__mf/js/async/356.b5aee61d.js +1 -0
  9. package/__mf/js/async/376.d72b6d45.js +110 -0
  10. package/__mf/js/async/392.311100c7.js +2 -0
  11. package/__mf/js/async/407.2557a182.js +4 -0
  12. package/__mf/js/async/407.2557a182.js.LICENSE.txt +9 -0
  13. package/__mf/js/async/469.a5d124bd.js +1 -0
  14. package/__mf/js/async/470.7f042d46.js +2 -0
  15. package/__mf/js/async/496.ea85fb9d.js +1 -0
  16. package/__mf/js/async/554.ffbb20fd.js +2 -0
  17. package/__mf/js/async/587.fceb5f76.js +1 -0
  18. package/__mf/js/async/588.a2bbd130.js +1 -0
  19. package/__mf/js/async/603.312da395.js +1 -0
  20. package/__mf/js/async/616.cebd9b21.js +1 -0
  21. package/__mf/js/async/66.77308b27.js +1 -0
  22. package/__mf/js/async/71.87ecdff0.js +1 -0
  23. package/__mf/js/async/77.9d431bfa.js +1 -0
  24. package/__mf/js/async/788.cf73b628.js +43 -0
  25. package/__mf/js/async/{576.9e075806.js.LICENSE.txt → 788.cf73b628.js.LICENSE.txt} +41 -1
  26. package/__mf/js/async/873.48c1c973.js +1 -0
  27. package/__mf/js/async/941.1d0acff2.js +2 -0
  28. package/__mf/js/async/968.69813416.js +1 -0
  29. package/__mf/js/async/978.d64118ad.js +1 -0
  30. package/__mf/js/async/__federation_expose_PieChart.2e3c97fd.js +4 -0
  31. package/__mf/js/async/lib-router.64f2eab9.js +2 -0
  32. package/__mf/js/{main.bb1593b7.js → main.fa92d32d.js} +2 -2
  33. package/lib/PieChart.d.ts +3 -3
  34. package/lib/PieChart.d.ts.map +1 -1
  35. package/lib/PieChart.js +3 -3
  36. package/lib/PieChart.js.map +1 -1
  37. package/lib/PieChartBase.d.ts +2 -2
  38. package/lib/PieChartBase.d.ts.map +1 -1
  39. package/lib/PieChartBase.js +8 -8
  40. package/lib/PieChartBase.js.map +1 -1
  41. package/lib/PieChartOptionsEditorSettings.d.ts +2 -2
  42. package/lib/PieChartOptionsEditorSettings.d.ts.map +1 -1
  43. package/lib/PieChartOptionsEditorSettings.js +13 -10
  44. package/lib/PieChartOptionsEditorSettings.js.map +1 -1
  45. package/lib/PieChartPanel.d.ts +4 -4
  46. package/lib/PieChartPanel.d.ts.map +1 -1
  47. package/lib/PieChartPanel.js +9 -9
  48. package/lib/PieChartPanel.js.map +1 -1
  49. package/lib/bootstrap.js +2 -2
  50. package/lib/colors.js +3 -3
  51. package/lib/colors.js.map +1 -1
  52. package/lib/getPluginModule.d.ts +1 -1
  53. package/lib/getPluginModule.d.ts.map +1 -1
  54. package/lib/getPluginModule.js +3 -1
  55. package/lib/getPluginModule.js.map +1 -1
  56. package/lib/index-federation.js +1 -1
  57. package/lib/index.js +6 -6
  58. package/lib/index.js.map +1 -1
  59. package/lib/pie-chart-model.d.ts +3 -3
  60. package/lib/pie-chart-model.d.ts.map +1 -1
  61. package/lib/pie-chart-model.js +1 -1
  62. package/lib/pie-chart-model.js.map +1 -1
  63. package/lib/setup-tests.d.ts +1 -1
  64. package/lib/setup-tests.d.ts.map +1 -1
  65. package/lib/setup-tests.js +2 -2
  66. package/lib/setup-tests.js.map +1 -1
  67. package/lib/utils.d.ts +3 -3
  68. package/lib/utils.d.ts.map +1 -1
  69. package/lib/utils.js +5 -5
  70. package/lib/utils.js.map +1 -1
  71. package/mf-manifest.json +36 -33
  72. package/mf-stats.json +36 -33
  73. package/package.json +10 -10
  74. package/__mf/js/async/121.61df50b5.js +0 -2
  75. package/__mf/js/async/177.7624b91a.js +0 -1
  76. package/__mf/js/async/187.65618c74.js +0 -7
  77. package/__mf/js/async/187.65618c74.js.LICENSE.txt +0 -39
  78. package/__mf/js/async/192.d45ba757.js +0 -1
  79. package/__mf/js/async/2.651ba6ec.js +0 -1
  80. package/__mf/js/async/235.495df342.js +0 -1
  81. package/__mf/js/async/274.5c1e13d7.js +0 -2
  82. package/__mf/js/async/356.5cd094ae.js +0 -1
  83. package/__mf/js/async/376.196cec5c.js +0 -110
  84. package/__mf/js/async/392.281005cf.js +0 -2
  85. package/__mf/js/async/469.ea0276a5.js +0 -1
  86. package/__mf/js/async/470.0b301928.js +0 -2
  87. package/__mf/js/async/546.b800e1ff.js +0 -24
  88. package/__mf/js/async/546.b800e1ff.js.LICENSE.txt +0 -19
  89. package/__mf/js/async/554.507b3545.js +0 -2
  90. package/__mf/js/async/558.9bb26cf7.js +0 -1
  91. package/__mf/js/async/576.9e075806.js +0 -39
  92. package/__mf/js/async/587.a59f7544.js +0 -1
  93. package/__mf/js/async/603.224eeb96.js +0 -1
  94. package/__mf/js/async/616.702bde53.js +0 -1
  95. package/__mf/js/async/66.13296185.js +0 -1
  96. package/__mf/js/async/663.d4632bd2.js +0 -1
  97. package/__mf/js/async/873.8941a36f.js +0 -1
  98. package/__mf/js/async/941.b972dd8a.js +0 -2
  99. package/__mf/js/async/968.6009cb29.js +0 -1
  100. package/__mf/js/async/__federation_expose_PieChart.9cd45fce.js +0 -4
  101. package/__mf/js/async/lib-router.c182f4dd.js +0 -2
  102. package/lib/cjs/PieChart.js +0 -38
  103. package/lib/cjs/PieChartBase.js +0 -100
  104. package/lib/cjs/PieChartOptionsEditorSettings.js +0 -247
  105. package/lib/cjs/PieChartPanel.js +0 -155
  106. package/lib/cjs/bootstrap.js +0 -26
  107. package/lib/cjs/colors.js +0 -207
  108. package/lib/cjs/env.d.js +0 -14
  109. package/lib/cjs/getPluginModule.js +0 -39
  110. package/lib/cjs/index-federation.js +0 -55
  111. package/lib/cjs/index.js +0 -41
  112. package/lib/cjs/pie-chart-model.js +0 -53
  113. package/lib/cjs/setup-tests.js +0 -19
  114. package/lib/cjs/utils.js +0 -163
  115. /package/__mf/css/async/{187.85c2cbf6.css → 788.85c2cbf6.css} +0 -0
  116. /package/__mf/js/async/{121.61df50b5.js.LICENSE.txt → 121.3f985aad.js.LICENSE.txt} +0 -0
  117. /package/__mf/js/async/{274.5c1e13d7.js.LICENSE.txt → 274.0fa32f07.js.LICENSE.txt} +0 -0
  118. /package/__mf/js/async/{376.196cec5c.js.LICENSE.txt → 376.d72b6d45.js.LICENSE.txt} +0 -0
  119. /package/__mf/js/async/{392.281005cf.js.LICENSE.txt → 392.311100c7.js.LICENSE.txt} +0 -0
  120. /package/__mf/js/async/{470.0b301928.js.LICENSE.txt → 470.7f042d46.js.LICENSE.txt} +0 -0
  121. /package/__mf/js/async/{554.507b3545.js.LICENSE.txt → 554.ffbb20fd.js.LICENSE.txt} +0 -0
  122. /package/__mf/js/async/{941.b972dd8a.js.LICENSE.txt → 941.1d0acff2.js.LICENSE.txt} +0 -0
  123. /package/__mf/js/async/{lib-router.c182f4dd.js.LICENSE.txt → lib-router.64f2eab9.js.LICENSE.txt} +0 -0
@@ -0,0 +1,43 @@
1
+ /*! For license information please see 788.cf73b628.js.LICENSE.txt */
2
+ (self.chunk_PieChart_0_15_0_beta_2=self.chunk_PieChart_0_15_0_beta_2||[]).push([["788"],{70158(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=void 0;var i=n(96844);function o(e){if(void 0!==e)return"boolean"==typeof e?{capture:e}:e}t.bindAll=function(e,t,n){var s=t.map(function(t){var s=null==n?t:r(r({},t),{options:r(r({},o(n)),o(t.options))});return(0,i.bind)(e,s)});return function(){s.forEach(function(e){return e()})}}},96844(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bind=void 0,t.bind=function(e,t){var n=t.type,r=t.listener,i=t.options;return e.addEventListener(n,r,i),function(){e.removeEventListener(n,r,i)}}},96907(e,t,n){"use strict";t.bindAll=t.bind=void 0;var r=n(96844);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return r.bind}});var i=n(70158);Object.defineProperty(t,"bindAll",{enumerable:!0,get:function(){return i.bindAll}})},61527(e,t,n){var r=n(90369),i=n(79912),o=n(23767);function s(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}s.prototype.add=s.prototype.push=i,s.prototype.has=o,e.exports=s},57260(e){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},22122(e,t,n){var r=n(42032),i=n(22934);e.exports=function e(t,n,o,s,a){return t===n||(null!=t&&null!=n&&(i(t)||i(n))?r(t,n,o,s,e,a):t!=t&&n!=n)}},42032(e,t,n){var r=n(86469),i=n(44075),o=n(64622),s=n(62677),a=n(31201),l=n(6397),u=n(30492),c=n(47995),h="[object Arguments]",d="[object Array]",f="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,m,g,v){var y=l(e),b=l(t),x=y?d:a(e),w=b?d:a(t);x=x==h?f:x,w=w==h?f:w;var S=x==f,C=w==f,A=x==w;if(A&&u(e)){if(!u(t))return!1;y=!0,S=!1}if(A&&!S)return v||(v=new r),y||c(e)?i(e,t,n,m,g,v):o(e,t,x,n,m,g,v);if(!(1&n)){var k=S&&p.call(e,"__wrapped__"),M=C&&p.call(t,"__wrapped__");if(k||M){var T=k?e.value():e,D=M?t.value():t;return v||(v=new r),g(T,D,n,m,v)}}return!!A&&(v||(v=new r),s(e,t,n,m,g,v))}},68812(e,t,n){var r=n(62140),i=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(i,""):e}},79151(e){e.exports=function(e,t){return e.has(t)}},44075(e,t,n){var r=n(61527),i=n(57260),o=n(79151);e.exports=function(e,t,n,s,a,l){var u=1&n,c=e.length,h=t.length;if(c!=h&&!(u&&h>c))return!1;var d=l.get(e),f=l.get(t);if(d&&f)return d==t&&f==e;var p=-1,m=!0,g=2&n?new r:void 0;for(l.set(e,t),l.set(t,e);++p<c;){var v=e[p],y=t[p];if(s)var b=u?s(y,v,p,t,e,l):s(v,y,p,e,t,l);if(void 0!==b){if(b)continue;m=!1;break}if(g){if(!i(t,function(e,t){if(!o(g,t)&&(v===e||a(v,e,n,s,l)))return g.push(t)})){m=!1;break}}else if(!(v===y||a(v,y,n,s,l))){m=!1;break}}return l.delete(e),l.delete(t),m}},64622(e,t,n){var r=n(32781),i=n(28944),o=n(39316),s=n(44075),a=n(90953),l=n(15851),u=r?r.prototype:void 0,c=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,h,d){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!h(new i(e),new i(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=a;case"[object Set]":var p=1&r;if(f||(f=l),e.size!=t.size&&!p)break;var m=d.get(e);if(m)return m==t;r|=2,d.set(e,t);var g=s(f(e),f(t),r,u,h,d);return d.delete(e),g;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}},62677(e,t,n){var r=n(90966),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,o,s,a){var l=1&n,u=r(e),c=u.length;if(c!=r(t).length&&!l)return!1;for(var h=c;h--;){var d=u[h];if(!(l?d in t:i.call(t,d)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var m=!0;a.set(e,t),a.set(t,e);for(var g=l;++h<c;){var v=e[d=u[h]],y=t[d];if(o)var b=l?o(y,v,d,t,e,a):o(v,y,d,e,t,a);if(!(void 0===b?v===y||s(v,y,n,o,a):b)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var x=e.constructor,w=t.constructor;x!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof x&&x instanceof x&&"function"==typeof w&&w instanceof w)&&(m=!1)}return a.delete(e),a.delete(t),m}},90953(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}},79912(e){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},23767(e){e.exports=function(e){return this.__data__.has(e)}},15851(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}},62140(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},46177(e,t,n){var r=n(58953),i=n(43664),o=n(95378),s=Math.max,a=Math.min;e.exports=function(e,t,n){var l,u,c,h,d,f,p=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var n=l,r=u;return l=u=void 0,p=t,h=e.apply(r,n)}function b(e){var n=e-f,r=e-p;return void 0===f||n>=t||n<0||g&&r>=c}function x(){var e,n,r,o=i();if(b(o))return w(o);d=setTimeout(x,(e=o-f,n=o-p,r=t-e,g?a(r,c-n):r))}function w(e){return(d=void 0,v&&l)?y(e):(l=u=void 0,h)}function S(){var e,n=i(),r=b(n);if(l=arguments,u=this,f=n,r){if(void 0===d)return p=e=f,d=setTimeout(x,t),m?y(e):h;if(g)return clearTimeout(d),d=setTimeout(x,t),y(f)}return void 0===d&&(d=setTimeout(x,t)),h}return t=o(t)||0,r(n)&&(m=!!n.leading,c=(g="maxWait"in n)?s(o(n.maxWait)||0,t):c,v="trailing"in n?!!n.trailing:v),S.cancel=function(){void 0!==d&&clearTimeout(d),p=0,l=f=u=d=void 0},S.flush=function(){return void 0===d?h:w(i())},S}},18264(e,t,n){var r=n(22122);e.exports=function(e,t){return r(e,t)}},43664(e,t,n){var r=n(41433);e.exports=function(){return r.Date.now()}},95378(e,t,n){var r=n(68812),i=n(58953),o=n(75414),s=0/0,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return s;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=l.test(e);return n||u.test(e)?c(e.slice(2),n?2:8):a.test(e)?s:+e}},24300(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z","Calendar")},29618(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z","Circle")},98029(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z","Delete")},53064(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z","Drag")},26684(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z","Earth")},78536(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z","EyeOffOutline")},1355(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z","EyeOutline")},98599(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z","Magnify")},4491(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z","Pin")},29917(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12M8.8,14L10,12.8V4H14V12.8L15.2,14H8.8Z","PinOutline")},16979(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M16.59,5.41L15.17,4L12,7.17L8.83,4L7.41,5.41L12,10M7.41,18.59L8.83,20L12,16.83L15.17,20L16.58,18.59L12,14L7.41,18.59Z","UnfoldLessHorizontal")},9323(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z","UnfoldMoreHorizontal")},12933(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z","ViewColumn")},40362(e,t,n){"use strict";var r=n(56441);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,s){if(s!==r){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},62688(e,t,n){e.exports=n(40362)()},56441(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},77440(e,t,n){!function(e,t){"use strict";var n=function(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}(t);function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var i={error:null},o=function(e){function t(){for(var t,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state=i,t.resetErrorBoundary=function(){for(var e,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];null==t.props.onReset||(e=t.props).onReset.apply(e,r),t.reset()},t}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e),t.getDerivedStateFromError=function(e){return{error:e}};var o=t.prototype;return o.reset=function(){this.setState(i)},o.componentDidCatch=function(e,t){var n,r;null==(n=(r=this.props).onError)||n.call(r,e,t)},o.componentDidUpdate=function(e,t){var n,r,i,o,s=this.state.error,a=this.props.resetKeys;null!==s&&null!==t.error&&(void 0===(n=e.resetKeys)&&(n=[]),void 0===(r=a)&&(r=[]),n.length!==r.length||n.some(function(e,t){return!Object.is(e,r[t])}))&&(null==(i=(o=this.props).onResetKeysChange)||i.call(o,e.resetKeys,a),this.reset())},o.render=function(){var e=this.state.error,t=this.props,r=t.fallbackRender,i=t.FallbackComponent,o=t.fallback;if(null!==e){var s={error:e,resetErrorBoundary:this.resetErrorBoundary};if(n.isValidElement(o))return o;if("function"==typeof r)return r(s);if(i)return n.createElement(i,s);else throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},t}(n.Component);e.ErrorBoundary=o,e.useErrorHandler=function(e){var t=n.useState(null),r=t[0],i=t[1];if(null!=e)throw e;if(null!=r)throw r;return i},e.withErrorBoundary=function(e,t){var r=function(r){return n.createElement(o,t,n.createElement(e,r))};return r.displayName="withErrorBoundary("+(e.displayName||e.name||"Unknown")+")",r},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(70451))},23420(e){function t(){}t.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,i=n.length;r<i;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],i=[];if(r&&t)for(var o=0,s=r.length;o<s;o++)r[o].fn!==t&&r[o].fn._!==t&&i.push(r[o]);return i.length?n[e]=i:delete n[e],this}},e.exports=t,e.exports.TinyEmitter=t},42915(e){"use strict";var t;t=function(){function e(){return!0}function t(){return!1}function n(){}return function r(){var i=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:function(e){return"object"==typeof e&&null!==e&&e.constructor===Object}},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],o={name:"any",test:e},s=[],a=[],l={types:i,conversions:a,ignore:s};function u(e){var t=j(l.types,function(t){return t.name===e});if(t)return t;if("any"===e)return o;var n=j(l.types,function(t){return t.name.toLowerCase()===e.toLowerCase()});throw TypeError('Unknown type "'+e+'"'+(n?'. Did you mean "'+n.name+'"?':""))}function c(e){return e===o?999:l.types.indexOf(e)}function h(e){var t=j(l.types,function(t){return t.test(e)});if(t)return t.name;throw TypeError("Value has unknown type. Value: "+e)}function d(e){return e.map(function(e){var t=e.types.map(y);return(e.restParam?"...":"")+t.join("|")}).join(",")}function f(e){var t=N(e);return!!t&&t.restParam}function p(e){return e.types.some(function(e){return null!=e.conversion})}function m(t){if(!t||0===t.types.length)return e;if(1===t.types.length)return u(t.types[0].name).test;if(2===t.types.length){var n=u(t.types[0].name).test,r=u(t.types[1].name).test;return function(e){return n(e)||r(e)}}var i=t.types.map(function(e){return u(e.name).test});return function(e){for(var t=0;t<i.length;t++)if(i[t](e))return!0;return!1}}function g(e,t){return t<e.params.length?e.params[t]:f(e.params)?N(e.params):null}function v(e,t,n){var r=g(e,t);return(r?n?r.types.filter(b):r.types:[]).map(y)}function y(e){return e.name}function b(e){return null===e.conversion||void 0===e.conversion}function x(e,t){var n=function(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;return Object.keys(t)}(F(e,function(e){return v(e,t,!1)}));return -1!==n.indexOf("any")?["any"]:n}function w(e,t,n){var r,i,o,s=e||"unnamed",a=n;for(o=0;o<t.length;o++){var l=a.filter(function(e){var n=m(g(e,o));return(o<e.params.length||f(e.params))&&n(t[o])});if(0===l.length){if((i=x(a,o)).length>0){var u=h(t[o]);return(r=TypeError("Unexpected type of argument in function "+s+" (expected: "+i.join(" or ")+", actual: "+u+", index: "+o+")")).data={category:"wrongType",fn:s,index:o,actual:u,expected:i},r}}else a=l}var c=a.map(function(e){return f(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,c))return(r=TypeError("Too few arguments in function "+s+" (expected: "+(i=x(a,o)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:s,index:t.length,expected:i},r;var d=Math.max.apply(null,c);return t.length>d?(r=TypeError("Too many arguments in function "+s+" (expected: "+d+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:s,index:t.length,expectedLength:d}:(r=TypeError('Arguments of type "'+t.join(", ")+'" do not match any of the defined signatures of function '+s+".")).data={category:"mismatch",actual:t.map(h)},r}function S(e){for(var t=999,n=0;n<e.types.length;n++)b(e.types[n])&&(t=Math.min(t,e.types[n].typeIndex));return t}function C(e){for(var t=999,n=0;n<e.types.length;n++)b(e.types[n])||(t=Math.min(t,e.types[n].conversionIndex));return t}function A(e,t){var n,r,i=Math.min(e.params.length,t.params.length);if(0!=(r=e.params.some(p)-t.params.some(p)))return r;for(n=0;n<i;n++)if(0!=(r=p(e.params[n])-p(t.params[n])))return r;for(n=0;n<i;n++)if(0!==(r=function(e,t){var n;return 0!=(n=e.restParam-t.restParam)||0!=(n=p(e)-p(t))||0!=(n=S(e)-S(t))?n:C(e)-C(t)}(e.params[n],t.params[n])))return r;return e.params.length-t.params.length}function k(e){var t,n,r,i,o=[],s=[];switch(e.types.forEach(function(e){e.conversion&&(o.push(u(e.conversion.from).test),s.push(e.conversion.convert))}),s.length){case 0:return function(e){return e};case 1:return t=o[0],r=s[0],function(e){return t(e)?r(e):e};case 2:return t=o[0],n=o[1],r=s[0],i=s[1],function(e){return t(e)?r(e):n(e)?i(e):e};default:return function(e){for(var t=0;t<s.length;t++)if(o[t](e))return s[t](e);return e}}}function M(e,t){return function e(n,r,i){if(!(r<n.length))return[i.map(function(e,t){return{types:e,restParam:t===n.length-1&&f(n)}})];var o,s=n[r],a=t?s.types.filter(b):s.types;if(s.restParam){var l=a.filter(b);o=l.length<a.length?[l,a]:[a]}else o=a.map(function(e){return[e]});return F(o,function(t){return e(n,r+1,i.concat([t]))})}(e,0,[])}function T(e,r){if(0===Object.keys(r).length)throw SyntaxError("No signatures provided");var i,o=[];Object.keys(r).map(function(e){var t,n,i;return t=r[e],n=l.conversions,i=[],(""!==e.trim()&&(i=e.split(",").map(O).map(function(e,t,r){var i,o,s,a,l,h,d,f,p=(i=n,o=l=((a=0===e.indexOf("..."))?e.length>3?e.slice(3):"any":e).split("|").map(O).filter(R).filter(E),s={},i.forEach(function(e){-1!==o.indexOf(e.from)||-1===o.indexOf(e.to)||s[e.from]||(s[e.from]=e)}),h=Object.keys(s).map(function(e){return s[e]}),d=l.map(function(e){var t=u(e);return{name:e,typeIndex:c(t),test:t.test,conversion:null,conversionIndex:-1}}),f=h.map(function(e){var t=u(e.from);return{name:e.from,typeIndex:c(t),test:t.test,conversion:e,conversionIndex:n.indexOf(e)}}),{types:d.concat(f),restParam:a});if(p.restParam&&t!==r.length-1)throw SyntaxError('Unexpected rest parameter "'+e+'": only allowed for the last parameter');return p})),i.some(P))?null:{params:i,fn:t}}).filter(I).forEach(function(e){var t=j(o,function(t){return function(e,t){for(var n=Math.max(e.params.length,t.params.length),r=0;r<n;r++)if(!function(e,t){for(var n,r=0;r<e.length;r++)if(n=e[r],-1!==t.indexOf(n))return!0;return!1}(v(e,r,!0),v(t,r,!0)))return!1;var i=e.params.length,o=t.params.length,s=f(e.params),a=f(t.params);return s?a?i===o:o>=i:a?i>=o:i===o}(t,e)});if(t)throw TypeError('Conflicting signatures "'+d(t.params)+'" and "'+d(e.params)+'".');o.push(e)});var s=F(o,function(e){return(e?M(e.params,!1):[]).map(function(t){return{params:t,fn:e.fn}})}).filter(I);s.sort(A);var a=s[0]&&s[0].params.length<=2&&!f(s[0].params),h=s[1]&&s[1].params.length<=2&&!f(s[1].params),g=s[2]&&s[2].params.length<=2&&!f(s[2].params),y=s[3]&&s[3].params.length<=2&&!f(s[3].params),b=s[4]&&s[4].params.length<=2&&!f(s[4].params),x=s[5]&&s[5].params.length<=2&&!f(s[5].params),w=s.map(function(e){return function(e){var t,n,r;if(f(e)){var i,o=(t=(i=e).slice(0,i.length-1).map(m)).length,s=m(N(e)),a=function(e){for(var t=o;t<e.length;t++)if(!s(e[t]))return!1;return!0};return function(e){for(var n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return a(e)&&e.length>=o+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(n=m(e[0]),function(e){return n(e[0])&&1===e.length}):2===e.length?(n=m(e[0]),r=m(e[1]),function(e){return n(e[0])&&r(e[1])&&2===e.length}):(t=e.map(m),function(e){for(var n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return e.length===t.length})}(e.params)}),S=a?m(s[0].params[0]):t,C=h?m(s[1].params[0]):t,T=g?m(s[2].params[0]):t,D=y?m(s[3].params[0]):t,B=b?m(s[4].params[0]):t,_=x?m(s[5].params[0]):t,z=a?m(s[0].params[1]):t,V=h?m(s[1].params[1]):t,H=g?m(s[2].params[1]):t,$=y?m(s[3].params[1]):t,W=b?m(s[4].params[1]):t,U=x?m(s[5].params[1]):t,q=s.map(function(e){return function(e,t){var n=t;if(e.some(p)){var r=f(e),i=e.map(k);n=function(){for(var e=[],n=r?arguments.length-1:arguments.length,o=0;o<n;o++)e[o]=i[o](arguments[o]);return r&&(e[n]=arguments[n].map(i[n])),t.apply(this,e)}}var o=n;if(f(e)){var s=e.length-1;o=function(){return n.apply(this,L(arguments,0,s).concat([L(arguments,s)]))}}return o}(e.params,e.fn)}),G=a?q[0]:n,Y=h?q[1]:n,K=g?q[2]:n,Z=y?q[3]:n,X=b?q[4]:n,Q=x?q[5]:n,J=a?s[0].params.length:-1,ee=h?s[1].params.length:-1,et=g?s[2].params.length:-1,en=y?s[3].params.length:-1,er=b?s[4].params.length:-1,ei=x?s[5].params.length:-1,eo=6*!!(a&&h&&g&&y&&b&&x),es=s.length,ea=function(){for(var t=eo;t<es;t++)if(w[t](arguments))return q[t].apply(this,arguments);return l.onMismatch(e,arguments,s)},el=function e(t,n){return arguments.length===J&&S(t)&&z(n)?G.apply(e,arguments):arguments.length===ee&&C(t)&&V(n)?Y.apply(e,arguments):arguments.length===et&&T(t)&&H(n)?K.apply(e,arguments):arguments.length===en&&D(t)&&$(n)?Z.apply(e,arguments):arguments.length===er&&B(t)&&W(n)?X.apply(e,arguments):arguments.length===ei&&_(t)&&U(n)?Q.apply(e,arguments):ea.apply(e,arguments)};try{Object.defineProperty(el,"name",{value:e})}catch(e){}return i={},s.forEach(function(e){e.params.some(p)||M(e.params,!0).forEach(function(t){i[d(t)]=e.fn})}),el.signatures=i,el}function D(e,t,n){throw w(e,t,n)}function E(e){return -1===l.ignore.indexOf(e)}function O(e){return e.trim()}function R(e){return!!e}function I(e){return null!==e}function P(e){return 0===e.types.length}function N(e){return e[e.length-1]}function L(e,t,n){return Array.prototype.slice.call(e,t,n)}function j(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function F(e,t){return Array.prototype.concat.apply([],e.map(t))}function B(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(("object"==typeof r.signatures||"string"==typeof r.signature)&&""!==r.name){if(""===t)t=r.name;else if(t!==r.name){var i=Error("Function names do not match (expected: "+t+", actual: "+r.name+")");throw i.data={actual:r.name,expected:t},i}}}return t}function _(e){var t,n={};function r(e,r){if(n.hasOwnProperty(e)&&r!==n[e])throw(t=Error('Signature "'+e+'" is defined twice')).data={signature:e},t}for(var i=0;i<e.length;i++){var o=e[i];if("object"==typeof o.signatures)for(var s in o.signatures)o.signatures.hasOwnProperty(s)&&(r(s,o.signatures[s]),n[s]=o.signatures[s]);else if("string"==typeof o.signature)r(o.signature,o),n[o.signature]=o;else throw(t=TypeError("Function is no typed-function (index: "+i+")")).data={index:i},t}return n}return(l=T("typed",{"string, Object":T,Object:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return T(B(t),e)},"...Function":function(e){return T(B(e),_(e))},"string, ...Function":function(e,t){return T(e,_(t))}})).create=r,l.types=i,l.conversions=a,l.ignore=s,l.onMismatch=D,l.throwMismatchError=D,l.createError=w,l.convert=function(e,t){var n=h(e);if(t===n)return e;for(var r=0;r<l.conversions.length;r++){var i=l.conversions[r];if(i.from===n&&i.to===t)return i.convert(e)}throw Error("Cannot convert from "+n+" to "+t)},l.find=function(e,t){if(!e.signatures)throw TypeError("Function is no typed-function");if("string"==typeof t){n=t.split(",");for(var n,r=0;r<n.length;r++)n[r]=n[r].trim()}else if(Array.isArray(t))n=t;else throw TypeError("String array or a comma separated string expected");var i=n.join(","),o=e.signatures[i];if(o)return o;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+n.join(", ")+"))")},l.addType=function(e,t){if(!e||"string"!=typeof e.name||"function"!=typeof e.test)throw TypeError("Object with properties {name: string, test: function} expected");if(!1!==t){for(var n=0;n<l.types.length;n++)if("Object"===l.types[n].name)return void l.types.splice(n,0,e)}l.types.push(e)},l.addConversion=function(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");l.conversions.push(e)},l}()},"function"==typeof define&&define.amd?define([],t):e.exports=t()},85180(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(70451);function i(e,t,n){return e[t]?e[t][0]?e[t][0][n]:e[t][n]:"contentBoxSize"===t?e.contentRect["inlineSize"===n?"width":"height"]:void 0}function o(e){void 0===e&&(e={});var t,n,o,s,a,l,u=e.onResize,c=(0,r.useRef)(void 0);c.current=u;var h=e.round||Math.round,d=(0,r.useRef)(),f=(0,r.useState)({width:void 0,height:void 0}),p=f[0],m=f[1],g=(0,r.useRef)(!1);(0,r.useEffect)(function(){return g.current=!1,function(){g.current=!0}},[]);var v=(0,r.useRef)({width:void 0,height:void 0}),y=(t=(0,r.useCallback)(function(t){return d.current&&d.current.box===e.box&&d.current.round===h||(d.current={box:e.box,round:h,instance:new ResizeObserver(function(t){var n=t[0],r="border-box"===e.box?"borderBoxSize":"device-pixel-content-box"===e.box?"devicePixelContentBoxSize":"contentBoxSize",o=i(n,r,"inlineSize"),s=i(n,r,"blockSize"),a=o?h(o):void 0,l=s?h(s):void 0;if(v.current.width!==a||v.current.height!==l){var u={width:a,height:l};v.current.width=a,v.current.height=l,c.current?c.current(u):g.current||m(u)}})}),d.current.instance.observe(t,{box:e.box}),function(){d.current&&d.current.instance.unobserve(t)}},[e.box,h]),n=e.ref,o=(0,r.useRef)(null),(s=(0,r.useRef)(null)).current=n,a=(0,r.useRef)(null),(0,r.useEffect)(function(){l()}),l=(0,r.useCallback)(function(){var e=a.current,n=s.current,r=e||(n?n instanceof Element?n:n.current:null);o.current&&o.current.element===r&&o.current.subscriber===t||(o.current&&o.current.cleanup&&o.current.cleanup(),o.current={element:r,subscriber:t,cleanup:r?t(r):void 0})},[t]),(0,r.useEffect)(function(){return function(){o.current&&o.current.cleanup&&(o.current.cleanup(),o.current=null)}},[]),(0,r.useCallback)(function(e){a.current=e,l()},[l]));return(0,r.useMemo)(function(){return{ref:y,width:p.width,height:p.height}},[y,p.width,p.height])}},40391(e,t,n){"use strict";let r,i;n.r(t),n.d(t,{generateChartsTheme:()=>iD,DensitySelector:()=>p2,applyMergeIndexedColumnsTransform:()=>iI,interpolateSelectionIndividual:()=>iM,DragButton:()=>mQ,TimeRangeSelector:()=>Lh,getFormatterStats:()=>na,OptionsEditorGrid:()=>pZ,TOOLTIP_MAX_HEIGHT:()=>Lv,useMousePosition:()=>LD,TextOverlay:()=>Eg,isValidLegendSize:()=>ne,isValidLegendMode:()=>t7,isDateUnit:()=>rT,parseVariables:()=>rY,UnitSelector:()=>L3,PERCENT_UNIT_CONFIG:()=>n9,RepeatGrid:()=>jD,PERCENT_GROUP_CONFIG:()=>n6,YAxisLabel:()=>L9,replaceVariablesForDisplay:()=>rX,TOOLTIP_MIN_WIDTH:()=>Lm,useId:()=>rH,getTitleAction:()=>t5,getYBuffer:()=>LK,PINNED_CROSSHAIR_SERIES_NAME:()=>tX,getPixelXFromGrid:()=>LF,getFormattedAxisLabel:()=>iv,clearHighlightedSeries:()=>rL,FALLBACK_CHART_WIDTH:()=>Lw,restoreChart:()=>rN,FormatControls:()=>L8,transformData:()=>iN,getTimeSeriesValues:()=>lx,DEFAULT_LEGEND:()=>nt,OptionsEditorControl:()=>pK,formatDecimal:()=>rs,DiscardChangesConfirmationDialog:()=>pz,formatTime:()=>nv,SelectionProvider:()=>ej,TimeChartTooltip:()=>L1,legendModes:()=>t6,EMPTY_TOOLTIP_DATA:()=>LT,isThroughputUnit:()=>rk,applyJoinTransform:()=>iO,TextField:()=>pv,SeriesInfo:()=>LI,getClosestTimestamp:()=>r_,DropIndicator:()=>p5,applyMergeColumnsTransform:()=>iR,isTemperatureUnit:()=>rD,limitDecimalPlaces:()=>nc,useSnackbar:()=>tY,dateFormatOptionsWithTimeZone:()=>ip,calculateBarYBounds:()=>LV,DEFAULT_COLUMN_HEIGHT:()=>40,parseVariablesAndFormat:()=>rK,getCommonTimeScale:()=>lw,isBytesUnit:()=>rw,ModeSelector:()=>Ea,OptionsEditorColumn:()=>pH,DECIMAL_UNIT_CONFIG:()=>ro,DEFAULT_PINNED_CROSSHAIR:()=>tQ,TEMPERATURE_GROUP_CONFIG:()=>rt,NoDataOverlay:()=>Ev,getResourceExtendedDisplayName:()=>lA,InterpolationFormat:()=>r$,ErrorBoundary:()=>gz.ErrorBoundary,hasDataFieldPatterns:()=>r7,CURRENCY_UNIT_CONFIG:()=>n4,ToolbarIconButton:()=>L5,DEFAULT_TOOLTIP_CONFIG:()=>LE,TRANSFORM_TEXT:()=>rE,calculateBarBandwidth:()=>L_,ItemActionsProvider:()=>eO,isWithinPercentageRange:()=>LY,OPTIMIZED_MODE_SERIES_LIMIT:()=>1e3,legendPositions:()=>t3,TIME_GROUP_CONFIG:()=>nd,defaultCursorData:()=>LM,createTimezoneAwareAxisFormatter:()=>gF,RefreshIntervalPicker:()=>jT,legendSizes:()=>t8,BITS_GROUP_CONFIG:()=>nK,TOOLTIP_LABELS_MAX_WIDTH:()=>Ly,applyValueMapping:()=>iE,UNIT_GROUP_CONFIG:()=>rd,batchDispatchNearbySeriesActions:()=>rF,DEFAULT_COLUMN_WIDTH:()=>150,getGMTOffset:()=>ig,getPointInGrid:()=>rj,InfoTooltip:()=>pq,AlignSelector:()=>V,JSONEditor:()=>Er,CURRENCY_GROUP_CONFIG:()=>n5,TooltipHeader:()=>L0,SeriesMarker:()=>Lf,FontSizeSelector:()=>gH,THROUGHPUT_UNIT_CONFIG:()=>ru,DEFAULT_COLUMN_MAX_WIDTH:()=>1e3,TOOLTIP_PADDING:()=>Lx,TimeZoneContext:()=>lk,TimeZoneProvider:()=>lM,useDeepMemo:()=>iw,TransformsEditor:()=>jM,combineSx:()=>rV,getFormatterFromCache:()=>ns,applyMergeSeriesTransform:()=>iP,Legend:()=>pO,Dialog:()=>p_,getFormattedMultipleYAxes:()=>rR,replaceVariables:()=>rZ,DECIMAL_GROUP_CONFIG:()=>ri,getResourceDisplayName:()=>lC,SnackbarProvider:()=>tG,formatBytes:()=>n0,getUnitConfig:()=>rm,LoadingOverlay:()=>Ey,formatWithTimeZone:()=>im,legacyCheckforNearbySeries:()=>Lq,replaceVariable:()=>rq,UNIT_CONFIG:()=>rf,testChartsTheme:()=>je,TOOLTIP_ADJUST_Y_POS_MULTIPLIER:()=>Lb,interpolate:()=>rU,THROUGHPUT_GROUP_CONFIG:()=>ra,BYTES_UNIT_CONFIG:()=>nJ,useChartsTheme:()=>eD,calculateBarSegmentBounds:()=>Lz,checkCrosshairPinnedStatus:()=>rB,mockChartsContext:()=>jt,checkforNearbyTimeSeries:()=>LU,TOOLTIP_DATE_FORMAT:()=>Lk,hasDecimalPlaces:()=>nu,isCurrencyUnit:()=>rM,DEFAULT_COLUMN_MIN_WIDTH:()=>60,handleMoveUp:()=>mZ,ContentWithLegend:()=>pI,OptionsEditorGroup:()=>pX,isUnitWithDecimalPlaces:()=>rC,SeriesLabelsStack:()=>Lp,getDateAndTime:()=>iy,getTableCellLayout:()=>dV,ChartsThemeContext:()=>eM,TooltipContent:()=>LZ,isValidTraceId:()=>lS,formatCurrency:()=>n3,ValueMappingsEditor:()=>jI,BYTES_GROUP_CONFIG:()=>nQ,interpolateSelectionBatch:()=>iT,isLegendItemVisuallySelected:()=>lP,getFormattedAxis:()=>rO,getClosestTimestampInFullDataset:()=>rz,ChartsProvider:()=>ek,TimeZoneSelector:()=>Ld,LinkEditorForm:()=>Eo,SortSelector:()=>Ex,formatValue:()=>rp,persesColumnsToTanstackColumns:()=>dH,NEARBY_SERIES_DESCRIPTION:()=>LS,calculateVisualYForSeries:()=>LB,hasIndexedPatterns:()=>r9,ColorPicker:()=>eS,useItemActions:()=>eP,getUnitGroup:()=>rg,formatThroughput:()=>rc,getTheme:()=>jm,shouldShortenValues:()=>nl,MIN_STEP_INTERVAL_MS:()=>lb,buildRelativeTimeOption:()=>t1,useSelection:()=>e_,TEMPERATURE_UNIT_CONFIG:()=>rn,SortSelectorButtons:()=>Ew,formatBits:()=>nX,getTimeZoneOptions:()=>t2,DYNAMIC_NEARBY_SERIES_MULTIPLIER:()=>L$,isUnitWithShortValues:()=>rA,getTooltipStyles:()=>Lj,interpolateHeaders:()=>iA,ErrorAlert:()=>g_,OptionsColorPicker:()=>lD,getUnitGroupConfig:()=>rv,TOOLTIP_BG_COLOR_FALLBACK:()=>LA,TOOLTIP_MAX_WIDTH:()=>Lg,DragAndDropElement:()=>mY,extractFieldNames:()=>ie,isBitsUnit:()=>rS,SHOW_FEWER_SERIES_LIMIT:()=>LW,TIME_UNIT_CONFIG:()=>nf,INCREASE_NEARBY_SERIES_MULTIPLIER:()=>LH,isPercentUnit:()=>rb,getLegendSize:()=>ni,getSubmitText:()=>t4,handleMoveDown:()=>mX,PIN_TOOLTIP_HELP_TEXT:()=>LO,Table:()=>pk,typography:()=>jf,formatPercent:()=>n7,assembleTransform:()=>LL,formatTemperature:()=>rr,useTimeZone:()=>lT,createRegexFromString:()=>iC,hasBatchPatterns:()=>r8,PersesTimeToIntlTime:()=>np,parseFormat:()=>r4,FormActions:()=>g$,getNearbySeriesData:()=>LG,useMemoized:()=>ix,isValidLegendPosition:()=>t9,getLegendMode:()=>nr,EMPHASIZED_SERIES_DESCRIPTION:()=>LC,replaceDataFields:()=>r3,Drawer:()=>gh,getLegendPosition:()=>nn,BITS_UNIT_CONFIG:()=>nZ,EChart:()=>gL,isTimeUnit:()=>ry,useChartsContext:()=>eT,interpolateQueryParams:()=>ik,UNPIN_TOOLTIP_HELP_TEXT:()=>LR,DateTimeRangePicker:()=>Lc,SettingsAutocomplete:()=>p0,ThresholdsEditor:()=>ED,isDecimalUnit:()=>rx,enableDataZoom:()=>rP,replaceDataFieldsBatch:()=>r6,useDragAndDropMonitor:()=>mG,useLocalStorage:()=>rI,isRegexPattern:()=>iS});var o,s,a,l,u,c,h,d,f,p,m,g,v,y,b,x=n(62540),w=n(70451),S=n.n(w),C=n(11750),A=n(81023),k=n(59238),M=n(41953),T=n(24726),D=n(77308),E=n(23434),O=n(26952),R=n(72052),I=n(29009),P=n(46733);function N(e){return(0,P.Ay)("MuiButtonGroup",e)}let L=(0,I.A)("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","firstButton","fullWidth","horizontal","vertical","colorPrimary","colorSecondary","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary","lastButton","middleButton"]);var j=n(94580),F=n(30016);let B=(0,D.A)("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${L.grouped}`]:t.grouped},{[`& .${L.grouped}`]:t[`grouped${(0,T.A)(n.orientation)}`]},{[`& .${L.grouped}`]:t[`grouped${(0,T.A)(n.variant)}`]},{[`& .${L.grouped}`]:t[`grouped${(0,T.A)(n.variant)}${(0,T.A)(n.orientation)}`]},{[`& .${L.grouped}`]:t[`grouped${(0,T.A)(n.variant)}${(0,T.A)(n.color)}`]},{[`& .${L.firstButton}`]:t.firstButton},{[`& .${L.lastButton}`]:t.lastButton},{[`& .${L.middleButton}`]:t.middleButton},t.root,t[n.variant],!0===n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,"vertical"===n.orientation&&t.vertical]}})((0,E.A)(({theme:e})=>({display:"inline-flex",borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{variant:"contained"},style:{boxShadow:(e.vars||e).shadows[2]}},{props:{disableElevation:!0},style:{boxShadow:"none"}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${L.lastButton},& .${L.middleButton}`]:{borderTopRightRadius:0,borderTopLeftRadius:0},[`& .${L.firstButton},& .${L.middleButton}`]:{borderBottomRightRadius:0,borderBottomLeftRadius:0}}},{props:{orientation:"horizontal"},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${L.lastButton},& .${L.middleButton}`]:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}},{props:{variant:"text",orientation:"horizontal"},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderRight:e.vars?`1px solid rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:`1px solid ${"light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${L.disabled}`]:{borderRight:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},{props:{variant:"text",orientation:"vertical"},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderBottom:e.vars?`1px solid rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:`1px solid ${"light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${L.disabled}`]:{borderBottom:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},...Object.entries(e.palette).filter((0,O.A)()).flatMap(([t])=>[{props:{variant:"text",color:t},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / 0.5)`:(0,k.X4)(e.palette[t].main,.5)}}}]),{props:{variant:"outlined",orientation:"horizontal"},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderRightColor:"transparent","&:hover":{borderRightColor:"currentColor"}},[`& .${L.lastButton},& .${L.middleButton}`]:{marginLeft:-1}}},{props:{variant:"outlined",orientation:"vertical"},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderBottomColor:"transparent","&:hover":{borderBottomColor:"currentColor"}},[`& .${L.lastButton},& .${L.middleButton}`]:{marginTop:-1}}},{props:{variant:"contained",orientation:"horizontal"},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderRight:`1px solid ${(e.vars||e).palette.grey[400]}`,[`&.${L.disabled}`]:{borderRight:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},{props:{variant:"contained",orientation:"vertical"},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderBottom:`1px solid ${(e.vars||e).palette.grey[400]}`,[`&.${L.disabled}`]:{borderBottom:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},...Object.entries(e.palette).filter((0,O.A)(["dark"])).map(([t])=>({props:{variant:"contained",color:t},style:{[`& .${L.firstButton},& .${L.middleButton}`]:{borderColor:(e.vars||e).palette[t].dark}}}))],[`& .${L.grouped}`]:{minWidth:40,boxShadow:"none",props:{variant:"contained"},style:{"&:hover":{boxShadow:"none"}}}}))),_=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiButtonGroup"}),{children:r,className:i,color:o="primary",component:s="div",disabled:a=!1,disableElevation:l=!1,disableFocusRipple:u=!1,disableRipple:c=!1,fullWidth:h=!1,orientation:d="horizontal",size:f="medium",variant:p="outlined",...m}=n,g={...n,color:o,component:s,disabled:a,disableElevation:l,disableFocusRipple:u,disableRipple:c,fullWidth:h,orientation:d,size:f,variant:p},v=(e=>{let{classes:t,color:n,disabled:r,disableElevation:i,fullWidth:o,orientation:s,variant:a}=e,l={root:["root",a,s,o&&"fullWidth",i&&"disableElevation",`color${(0,T.A)(n)}`],grouped:["grouped",`grouped${(0,T.A)(s)}`,`grouped${(0,T.A)(a)}`,`grouped${(0,T.A)(a)}${(0,T.A)(s)}`,`grouped${(0,T.A)(a)}${(0,T.A)(n)}`,r&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return(0,A.A)(l,N,t)})(g),y=w.useMemo(()=>({className:v.grouped,color:o,disabled:a,disableElevation:l,disableFocusRipple:u,disableRipple:c,fullWidth:h,size:f,variant:p}),[o,a,l,u,c,h,f,p,v.grouped]),b=(0,M.A)(r),S=b.length;return(0,x.jsx)(B,{as:s,role:"group",className:(0,C.A)(v.root,i),ref:t,ownerState:g,...m,children:(0,x.jsx)(j.A.Provider,{value:y,children:b.map((e,t)=>{let n,r;return(0,x.jsx)(F.A.Provider,{value:(n=0===t,r=t===S-1,n&&r?"":n?v.firstButton:r?v.lastButton:v.middleButton),children:e},t)})})})});var z=n(7013);function V({onChange:e,value:t="left",...n}){let r=t=>{e(t)};return(0,x.jsxs)(_,{"aria-label":"Alignement",...n,children:[(0,x.jsx)(z.A,{onClick:()=>r("left"),variant:"left"===t?"contained":"outlined",children:"Left"},"left"),(0,x.jsx)(z.A,{onClick:()=>r("center"),variant:"center"===t?"contained":"outlined",children:"Center"},"center"),(0,x.jsx)(z.A,{onClick:()=>r("right"),variant:"right"===t?"contained":"outlined",children:"Right"},"right")]})}var H=n(315),$=n(47095),W=n(93648),U=n(29618),q=n(98029);function G(){return(G=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Y(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function K(e){var t=(0,w.useRef)(e),n=(0,w.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var Z,X=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e<t?t:e},Q=function(e){return"touches"in e},J=function(e){return e&&e.ownerDocument.defaultView||self},ee=function(e,t,n){var r=e.getBoundingClientRect(),i=Q(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:X((i.pageX-(r.left+J(e).pageXOffset))/r.width),top:X((i.pageY-(r.top+J(e).pageYOffset))/r.height)}},et=function(e){Q(e)||e.preventDefault()},en=S().memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,i=Y(e,["onMove","onKey","onEnd"]),o=(0,w.useRef)(null),s=K(t),a=K(n),l=K(r),u=(0,w.useRef)(null),c=(0,w.useRef)(!1),h=(0,w.useMemo)(function(){var e=function(e){et(e),(Q(e)?e.touches.length>0:e.buttons>0)&&o.current?s(ee(o.current,e,u.current)):(n(!1),l())},t=function(){n(!1),l()};function n(n){var r=c.current,i=J(o.current),s=n?i.addEventListener:i.removeEventListener;s(r?"touchmove":"mousemove",e),s(r?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,r=o.current;if(r&&(et(t),(!c.current||Q(t))&&r)){if(Q(t)){c.current=!0;var i=t.changedTouches||[];i.length&&(u.current=i[0].identifier)}r.focus(),s(ee(r,t,u.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),a({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},function(e){var t=e.which||e.keyCode;t>=37&&t<=40&&l()},n]},[a,s,l]),d=h[0],f=h[1],p=h[2],m=h[3];return(0,w.useEffect)(function(){return m},[m]),S().createElement("div",G({},i,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:o,onKeyDown:f,onKeyUp:p,tabIndex:0,role:"slider"}))}),er=function(e){return e.filter(Boolean).join(" ")},ei=function(e){var t=e.color,n=e.left,r=e.top,i=er(["react-colorful__pointer",e.className]);return S().createElement("div",{className:i,style:{top:100*(void 0===r?.5:r)+"%",left:100*n+"%"}},S().createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},eo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n},es=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?eo(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?eo(parseInt(e.substring(6,8),16)/255,2):1}},ea=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:eo(e.h),s:eo(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:eo(i/2),a:eo(r,2)}},el=function(e){var t=ea(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},eu=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var o=Math.floor(t),s=r*(1-n),a=r*(1-(t-o)*n),l=r*(1-(1-t+o)*n),u=o%6;return{r:eo(255*[r,a,s,s,l,r][u]),g:eo(255*[l,r,r,a,s,s][u]),b:eo(255*[s,s,l,r,r,a][u]),a:eo(i,2)}},ec=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},eh=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=i<1?ec(eo(255*i)):"";return"#"+ec(t)+ec(n)+ec(r)+o},ed=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=Math.max(t,n,r),s=o-Math.min(t,n,r),a=s?o===t?(n-r)/s:o===n?2+(r-t)/s:4+(t-n)/s:0;return{h:eo(60*(a<0?a+6:a)),s:eo(o?s/o*100:0),v:eo(o/255*100),a:i}},ef=S().memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,i=er(["react-colorful__hue",e.className]);return S().createElement("div",{className:i},S().createElement(en,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:X(t+360*e.left,0,360)})},onEnd:r,"aria-label":"Hue","aria-valuenow":eo(t),"aria-valuemax":"360","aria-valuemin":"0"},S().createElement(ei,{className:"react-colorful__hue-pointer",left:t/360,color:el({h:t,s:100,v:100,a:1})})))}),ep=S().memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,i={backgroundColor:el({h:t.h,s:100,v:100,a:1})};return S().createElement("div",{className:"react-colorful__saturation",style:i},S().createElement(en,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:X(t.s+100*e.left,0,100),v:X(t.v-100*e.top,0,100)})},onEnd:r,"aria-label":"Color","aria-valuetext":"Saturation "+eo(t.s)+"%, Brightness "+eo(t.v)+"%"},S().createElement(ei,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:el(t)})))}),em=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},eg="u">typeof window?w.useLayoutEffect:w.useEffect,ev=new Map,ey=function(e){eg(function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!ev.has(t)){var r=t.createElement("style");r.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',ev.set(t,r);var i=Z||n.nc;i&&r.setAttribute("nonce",i),t.head.appendChild(r)}},[])},eb=function(e){var t,n,r,i,o,s,a,l=e.className,u=e.colorModel,c=e.color,h=void 0===c?u.defaultColor:c,d=e.onChange,f=e.onChangeEnd,p=Y(e,["className","colorModel","color","onChange","onChangeEnd"]),m=(0,w.useRef)(null);ey(m);var g=(t=K(d),n=K(f),i=(r=(0,w.useState)(function(){return u.toHsva(h)}))[0],o=r[1],s=(0,w.useRef)({color:h,hsva:i}),a=(0,w.useRef)(!1),(0,w.useEffect)(function(){if(!u.equal(h,s.current.color)){var e=u.toHsva(h);s.current={hsva:e,color:h},o(e),a.current=!1}},[h,u]),(0,w.useEffect)(function(){var e;em(i,s.current.hsva)||u.equal(e=u.fromHsva(i),s.current.color)||(s.current={hsva:i,color:e},t(e),a.current=!0)},[i,u,t]),[i,(0,w.useCallback)(function(e){o(function(t){return Object.assign({},t,e)})},[]),(0,w.useCallback)(function(){a.current&&(a.current=!1,n(s.current.color))},[n])]),v=g[0],y=g[1],b=g[2],x=er(["react-colorful",l]);return S().createElement("div",G({},p,{ref:m,className:x}),S().createElement(ep,{hsva:v,onChange:y,onChangeEnd:b}),S().createElement(ef,{hue:v.h,onChange:y,onChangeEnd:b,className:"react-colorful__last-control"}))},ex={defaultColor:"000",toHsva:function(e){return ed(es(e))},fromHsva:function(e){return eh(eu({h:e.h,s:e.s,v:e.v,a:1}))},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||em(es(e),es(t))}},ew=function(e){return S().createElement(eb,G({},e,{colorModel:ex}))};let eS=({color:e,onChange:t,onClear:n,palette:r})=>{let[i,o]=(0,w.useState)(e),s=e=>{o(e),t?.(e)};return(0,x.jsxs)(H.A,{spacing:1,children:[(0,x.jsx)(ew,{color:e,onChange:s,style:{width:"100%"}}),(0,x.jsx)(H.A,{direction:"row",flexWrap:"wrap",justifyContent:"space-evenly",width:"200px",children:r&&r.map((e,t)=>(0,x.jsx)($.A,{size:"small","aria-label":`change color to ${e}`,sx:{color:e},onClick:()=>s(e),children:(0,x.jsx)(U,{})},t))}),(0,x.jsxs)(H.A,{direction:"row",gap:1,alignItems:"center",children:[(0,x.jsx)(W.A,{inputProps:{"aria-label":"enter hex color"},fullWidth:!0,value:i,onChange:e=>{let n=e.target.value.replace(/([^0-9A-F]+)/gi,"").substring(0,8);o(`#${n}`),eC(e.target.value)&&t?.(e.target.value)}}),n&&(0,x.jsx)($.A,{onClick:n,children:(0,x.jsx)(q,{})})]})]})},eC=(e,t)=>{let n=/^#?([0-9A-F]{3,8})$/i.exec(e),r=n&&n[1]?n[1].length:0;return 3===r||6===r||!!t&&4===r||!!t&&8===r};var eA=n(91823);function ek(e){let{children:t,chartsTheme:n,enablePinning:r=!1,enableSyncGrouping:i=!0}=e,[o,s]=(0,w.useState)(null),a=(0,w.useMemo)(()=>({chartsTheme:n,enablePinning:r,lastTooltipPinnedCoords:o,enableSyncGrouping:i,setLastTooltipPinnedCoords:s}),[n,r,i,o,s]);return(0,x.jsx)(eM.Provider,{value:a,children:t})}let eM=(0,w.createContext)(void 0);function eT(){let e=(0,w.useContext)(eM);if(void 0===e)throw Error("No ChartsThemeContext found. Did you forget a Provider?");return e}function eD(){return eT().chartsTheme}let eE=(0,w.createContext)(void 0);function eO({children:e}){let[t,n]=(0,w.useState)(new Map),r=(0,w.useCallback)((e,t,r)=>{n(n=>{let i=new Map(n),o=i.get(e)||{loading:!1};if(void 0!==r){let n=new Map(o.itemStatuses||new Map),s=n.get(r)||{loading:!1};n.set(r,{...s,...t}),i.set(e,{...o,itemStatuses:n})}else i.set(e,{...o,...t});return i})},[]),i=(0,w.useCallback)(e=>{n(t=>{if(void 0===e)return new Map;if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),o=(0,w.useMemo)(()=>({actionStatuses:t,setActionStatus:r,clearActionStatus:i}),[t,r,i]);return(0,x.jsx)(eE.Provider,{value:o,children:e})}let eR=()=>{},eI={actionStatuses:new Map,setActionStatus:eR,clearActionStatus:eR,hasContext:!1};function eP(){let e=(0,w.useContext)(eE);return(0,w.useMemo)(()=>e?{...e,hasContext:!0}:eI,[e])}let eN=(0,w.createContext)(void 0),eL=(e,t)=>t;function ej({children:e}){let[t,n]=(0,w.useState)(new Map),r=(0,w.useRef)(eL),i=(0,w.useCallback)(e=>{r.current=e},[]),o=(0,w.useCallback)(e=>{let t=new Map;e.forEach(({item:e,id:n})=>t.set(n,e)),n(t)},[]),s=(0,w.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.has(t)?r.delete(t):r.set(t,e),r})},[]),a=(0,w.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),l=(0,w.useCallback)(()=>n(new Map),[]),u=(0,w.useCallback)((e,n)=>t.has(r.current(e,n)),[t]),c=(0,w.useMemo)(()=>({selectionMap:t,setSelection:o,toggleSelection:s,removeFromSelection:a,clearSelection:l,isSelected:u,registerGetId:i}),[t,o,s,a,l,u,i]);return(0,x.jsx)(eN.Provider,{value:c,children:e})}let eF=()=>{},eB={selectionMap:new Map,setSelection:eF,toggleSelection:eF,removeFromSelection:eF,clearSelection:eF,isSelected:()=>!1,hasContext:!1};function e_(e){let t=(0,w.useContext)(eN);return(0,w.useEffect)(()=>{t&&e?.getId&&t.registerGetId(e.getId)},[t,e?.getId]),(0,w.useMemo)(()=>{if(!t)return eB;let{registerGetId:e,...n}=t;return{...n,hasContext:!0}},[t])}var ez=n(20231),eV=n.n(ez);let eH=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=function e(t){var n,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t))for(n=0;n<t.length;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=" "),i+=r);else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}(e))&&(r&&(r+=" "),r+=t);return r},e$={data:""},eW=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,eU=/\/\*[^]*?\*\/| +/g,eq=/\n+/g,eG=(e,t)=>{let n="",r="",i="";for(let o in e){let s=e[o];"@"==o[0]?"i"==o[1]?n=o+" "+s+";":r+="f"==o[1]?eG(s,o):o+"{"+eG(s,"k"==o[1]?"":t)+"}":"object"==typeof s?r+=eG(s,t?t.replace(/([^,])+/g,e=>o.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):o):null!=s&&(o="-"==o[1]?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=eG.p?eG.p(o,s):o+":"+s+";")}return n+(t&&i?t+"{"+i+"}":i)+r},eY={},eK=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+eK(e[n]);return t}return e};function eZ(e){let t,n,r=this||{},i=e.call?e(r.p):e;return((e,t,n,r,i)=>{var o;let s=eK(e),a=eY[s]||(eY[s]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(s));if(!eY[a]){let t=s!==e?e:(e=>{let t,n,r=[{}];for(;t=eW.exec(e.replace(eU,""));)t[4]?r.shift():t[3]?(n=t[3].replace(eq," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(eq," ").trim();return r[0]})(e);eY[a]=eG(i?{["@keyframes "+a]:t}:t,n?"":"."+a)}let l=n&&eY.g;return n&&(eY.g=eY[a]),o=eY[a],l?t.data=t.data.replace(l,o):-1===t.data.indexOf(o)&&(t.data=r?o+t.data:t.data+o),a})(i.unshift?i.raw?(t=[].slice.call(arguments,1),n=r.p,i.reduce((e,r,i)=>{let o=t[i];if(o&&o.call){let e=o(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":eG(e,""):!1===e?"":e}return e+r+(null==o?"":o)},"")):i.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):i,(e=>{if("object"==typeof window){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||e$})(r.target),r.g,r.o,r.k)}function eX(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function eQ(e,t,n){return t&&eX(e.prototype,t),n&&eX(e,n),e}function eJ(){return(eJ=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function e0(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function e1(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function e2(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}eZ.bind({g:1}),eZ.bind({k:1});var e5=function(){return""},e4=S().createContext({enqueueSnackbar:e5,closeSnackbar:e5}),e3="@media (max-width:599.95px)",e6="@media (min-width:600px)",e8=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},e9=function(e){return""+e8(e.vertical)+e8(e.horizontal)},e7=function(e){return!!e||0===e},te="unmounted",tt="exited",tn="entering",tr="entered",ti="exiting",to=function(e){function t(t){var n,r=e.call(this,t)||this,i=t.appear;return r.appearStatus=null,t.in?i?(n=tt,r.appearStatus=tn):n=tr:n=t.unmountOnExit||t.mountOnEnter?te:tt,r.state={status:n},r.nextCallback=null,r}e0(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===te?{status:tt}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==tn&&n!==tr&&(t=tn):(n===tn||n===tr)&&(t=ti)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=e,n=e;return null!=e&&"number"!=typeof e&&"string"!=typeof e&&(n=e.exit,t=e.enter),{exit:n,enter:t}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===tn?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===tt&&this.setState({status:te})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.getTimeouts();e||n?(this.props.onEnter&&this.props.onEnter(this.node,e),this.safeSetState({status:tn},function(){t.props.onEntering&&t.props.onEntering(t.node,e),t.onTransitionEnd(r.enter,function(){t.safeSetState({status:tr},function(){t.props.onEntered&&t.props.onEntered(t.node,e)})})})):this.safeSetState({status:tr},function(){t.props.onEntered&&t.props.onEntered(t.node,e)})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts();t?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:ti},function(){e.props.onExiting&&e.props.onExiting(e.node),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:tt},function(){e.props.onExited&&e.props.onExited(e.node)})})})):this.safeSetState({status:tt},function(){e.props.onExited&&e.props.onExited(e.node)})},n.cancelNextCallback=function(){null!==this.nextCallback&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(){n&&(n=!1,t.nextCallback=null,e())},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=null==e&&!this.props.addEndListener;!this.node||n?setTimeout(this.nextCallback,0):(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e))},n.render=function(){var e=this.state.status;if(e===te)return null;var t=this.props;return(0,t.children)(e,e1(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},eQ(t,[{key:"node",get:function(){var e,t=null==(e=this.props.nodeRef)?void 0:e.current;if(!t)throw Error("notistack - Custom snackbar is not refForwarding");return t}}]),t}(S().Component);function ts(){}function ta(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function tl(e,t){return(0,w.useMemo)(function(){return null==e&&null==t?null:function(n){ta(e,n),ta(t,n)}},[e,t])}function tu(e){var t=e.timeout,n=e.style,r=void 0===n?{}:n,i=e.mode;return{duration:"object"==typeof t?t[i]||0:t,easing:r.transitionTimingFunction,delay:r.transitionDelay}}to.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ts,onEntering:ts,onEntered:ts,onExit:ts,onExiting:ts,onExited:ts};var tc=function(e){e.scrollTop=e.scrollTop},th=function(e){return Math.round(e)+"ms"};function td(e,t){void 0===e&&(e=["all"]);var n=t||{},r=n.duration,i=void 0===r?300:r,o=n.easing,s=void 0===o?"cubic-bezier(0.4, 0, 0.2, 1)":o,a=n.delay,l=void 0===a?0:a;return(Array.isArray(e)?e:[e]).map(function(e){return e+" "+("string"==typeof i?i:th(i))+" "+s+" "+("string"==typeof l?l:th(l))}).join(",")}function tf(e){return(e&&e.ownerDocument||document).defaultView||window}function tp(e,t){if(t){var n=function(e,t){var n,r=t.getBoundingClientRect(),i=tf(t);if(t.fakeTransform)n=t.fakeTransform;else{var o=i.getComputedStyle(t);n=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform")}var s=0,a=0;if(n&&"none"!==n&&"string"==typeof n){var l=n.split("(")[1].split(")")[0].split(",");s=parseInt(l[4],10),a=parseInt(l[5],10)}switch(e){case"left":return"translateX("+(i.innerWidth+s-r.left)+"px)";case"right":return"translateX(-"+(r.left+r.width-s)+"px)";case"up":return"translateY("+(i.innerHeight+a-r.top)+"px)";default:return"translateY(-"+(r.top+r.height-a)+"px)"}}(e,t);n&&(t.style.webkitTransform=n,t.style.transform=n)}}var tm=(0,w.forwardRef)(function(e,t){var n=e.children,r=e.direction,i=void 0===r?"down":r,o=e.in,s=e.style,a=e.timeout,l=void 0===a?0:a,u=e.onEnter,c=e.onEntered,h=e.onExit,d=e.onExited,f=e1(e,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),p=(0,w.useRef)(null),m=tl(n.ref,p),g=tl(m,t),v=(0,w.useCallback)(function(){p.current&&tp(i,p.current)},[i]);return(0,w.useEffect)(function(){if(!o&&"down"!==i&&"right"!==i){var e=function(e,t){var n;function r(){for(var r=this,i=arguments.length,o=Array(i),s=0;s<i;s++)o[s]=arguments[s];clearTimeout(n),n=setTimeout(function(){e.apply(r,o)},t)}return void 0===t&&(t=166),r.clear=function(){clearTimeout(n)},r}(function(){p.current&&tp(i,p.current)}),t=tf(p.current);return t.addEventListener("resize",e),function(){e.clear(),t.removeEventListener("resize",e)}}},[i,o]),(0,w.useEffect)(function(){o||v()},[o,v]),(0,w.createElement)(to,Object.assign({appear:!0,nodeRef:p,onEnter:function(e,t){tp(i,e),tc(e),u&&u(e,t)},onEntered:c,onEntering:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||"cubic-bezier(0.0, 0, 0.2, 1)",n=tu({timeout:l,mode:"enter",style:eJ({},s,{transitionTimingFunction:t})});e.style.webkitTransition=td("-webkit-transform",n),e.style.transition=td("transform",n),e.style.webkitTransform="none",e.style.transform="none"},onExit:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||"cubic-bezier(0.4, 0, 0.6, 1)",n=tu({timeout:l,mode:"exit",style:eJ({},s,{transitionTimingFunction:t})});e.style.webkitTransition=td("-webkit-transform",n),e.style.transition=td("transform",n),tp(i,e),h&&h(e)},onExited:function(e){e.style.webkitTransition="",e.style.transition="",d&&d(e)},in:o,timeout:l},f),function(e,t){return(0,w.cloneElement)(n,eJ({ref:g,style:eJ({visibility:"exited"!==e||o?void 0:"hidden"},s,{},n.props.style)},t))})});tm.displayName="Slide";var tg=function(e){return S().createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},e))},tv={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:S().createElement(function(){return S().createElement(tg,null,S().createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},null),warning:S().createElement(function(){return S().createElement(tg,null,S().createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},null),error:S().createElement(function(){return S().createElement(tg,null,S().createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},null),info:S().createElement(function(){return S().createElement(tg,null,S().createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:tm,transitionDuration:{enter:225,exit:195}},ty=function(e,t){var n=function(e){return"number"==typeof e||null===e};return n(e)?e:n(t)?t:tv.autoHideDuration},tb=function(e,t){var n=function(e,t){return t.some(function(t){return typeof e===t})};return n(e,["string","number"])?e:n(e,["object"])?eJ({},tv.transitionDuration,{},n(t,["object"])&&t,{},e):n(t,["string","number"])?t:n(t,["object"])?eJ({},tv.transitionDuration,{},t):tv.transitionDuration};function tx(e){return Object.entries(e).reduce(function(e,t){var n,r=t[0],i=t[1];return eJ({},e,((n={})[r]=eZ(i),n))},{})}var tw="notistack-CollapseWrapper",tS=tx({root:{height:0},entered:{height:"auto"}}),tC=(0,w.forwardRef)(function(e,t){var n=e.children,r=e.in,i=e.onExited,o=(0,w.useRef)(null),s=(0,w.useRef)(null),a=tl(t,s),l=function(){return o.current?o.current.clientHeight:0};return(0,w.createElement)(to,{in:r,unmountOnExit:!0,onEnter:function(e){e.style.height="0px"},onEntered:function(e){e.style.height="auto"},onEntering:function(e){var t=l(),n=tu({timeout:175,mode:"enter"}),r=n.duration,i=n.easing;e.style.transitionDuration="string"==typeof r?r:r+"ms",e.style.height=t+"px",e.style.transitionTimingFunction=i||""},onExit:function(e){e.style.height=l()+"px"},onExited:i,onExiting:function(e){tc(e);var t=tu({timeout:175,mode:"exit"}),n=t.duration,r=t.easing;e.style.transitionDuration="string"==typeof n?n:n+"ms",e.style.height="0px",e.style.transitionTimingFunction=r||""},nodeRef:s,timeout:175},function(e,t){return(0,w.createElement)("div",Object.assign({ref:a,className:eH(tS.root,"entered"===e&&tS.entered),style:eJ({pointerEvents:"all",overflow:"hidden",minHeight:"0px",transition:td("height")},"entered"===e&&{overflow:"visible"},{},"exited"===e&&!r&&{visibility:"hidden"})},t),(0,w.createElement)("div",{ref:o,className:tw,style:{display:"flex",width:"100%"}},n))})});tC.displayName="Collapse";var tA={right:"left",left:"right",bottom:"up",top:"down"},tk=function(e){void 0===e&&(e={});var t={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(e).filter(function(e){return!t[e]}).reduce(function(t,n){var r;return eJ({},t,((r={})[n]=e[n],r))},{})},tM=function(){};function tT(e,t){return e.reduce(function(e,n){return null==n?e:function(){for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];var s=[].concat(i);t&&-1===s.indexOf(t)&&s.push(t),e.apply(this,s),n.apply(this,s)}},tM)}var tD="u">typeof window?w.useLayoutEffect:w.useEffect;function tE(e){var t=(0,w.useRef)(e);return tD(function(){t.current=e}),(0,w.useCallback)(function(){return t.current.apply(void 0,arguments)},[])}var tO=(0,w.forwardRef)(function(e,t){var n=e.children,r=e.className,i=e.autoHideDuration,o=e.disableWindowBlurListener,s=void 0!==o&&o,a=e.onClose,l=e.id,u=e.open,c=e.SnackbarProps,h=void 0===c?{}:c,d=(0,w.useRef)(),f=tE(function(){a&&a.apply(void 0,arguments)}),p=tE(function(e){a&&null!=e&&(d.current&&clearTimeout(d.current),d.current=setTimeout(function(){f(null,"timeout",l)},e))});(0,w.useEffect)(function(){return u&&p(i),function(){d.current&&clearTimeout(d.current)}},[u,i,p]);var m=function(){d.current&&clearTimeout(d.current)},g=(0,w.useCallback)(function(){null!=i&&p(.5*i)},[i,p]);return(0,w.useEffect)(function(){if(!s&&u)return window.addEventListener("focus",g),window.addEventListener("blur",m),function(){window.removeEventListener("focus",g),window.removeEventListener("blur",m)}},[s,g,u]),(0,w.createElement)("div",Object.assign({ref:t},h,{className:eH("notistack-Snackbar",r),onMouseEnter:function(e){h.onMouseEnter&&h.onMouseEnter(e),m()},onMouseLeave:function(e){h.onMouseLeave&&h.onMouseLeave(e),g()}}),n)});tO.displayName="Snackbar";var tR=tx({root:((oJ={display:"flex",flexWrap:"wrap",flexGrow:1})[e6]={flexGrow:"initial",minWidth:"288px"},oJ)}),tI=(0,w.forwardRef)(function(e,t){var n=e.className,r=e1(e,["className"]);return S().createElement("div",Object.assign({ref:t,className:eH(tR.root,n)},r))});tI.displayName="SnackbarContent";var tP=tx({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),tN="notistack-snackbar",tL=(0,w.forwardRef)(function(e,t){var n=e.id,r=e.message,i=e.action,o=e.iconVariant,s=e.variant,a=e.hideIconVariant,l=e.style,u=e.className,c=o[s],h=i;return"function"==typeof h&&(h=h(n)),S().createElement(tI,{ref:t,role:"alert","aria-describedby":tN,style:l,className:eH("notistack-MuiContent","notistack-MuiContent-"+s,tP.root,tP[s],u,!a&&c&&tP.lessPadding)},S().createElement("div",{id:tN,className:tP.message},a?null:c,r),h&&S().createElement("div",{className:tP.action},h))});tL.displayName="MaterialDesignContent";var tj=(0,w.memo)(tL),tF=tx({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),tB=function(e){var t,n=(0,w.useRef)(),r=(0,w.useState)(!0),i=r[0],o=r[1],s=tT([e.snack.onClose,e.onClose]),a=(0,w.useCallback)(function(){n.current=setTimeout(function(){o(function(e){return!e})},125)},[]);(0,w.useEffect)(function(){return function(){n.current&&clearTimeout(n.current)}},[]);var l=e.snack,u=e.classes,c=e.Component,h=(0,w.useMemo)(function(){return tk(u)},[u]),d=l.open,f=l.SnackbarProps,p=l.TransitionComponent,m=l.TransitionProps,g=l.transitionDuration,v=l.disableWindowBlurListener,y=l.content,b=e1(l,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),x=eJ({direction:"center"!==(t=b.anchorOrigin).horizontal?tA[t.horizontal]:tA[t.vertical],timeout:g},m),C=y;"function"==typeof C&&(C=C(b.id,b.message));var A=["onEnter","onEntered","onExit","onExited"].reduce(function(t,n){var r;return eJ({},t,((r={})[n]=tT([e.snack[n],e[n]],b.id),r))},{});return S().createElement(tC,{in:i,onExited:A.onExited},S().createElement(tO,{open:d,id:b.id,disableWindowBlurListener:v,autoHideDuration:b.autoHideDuration,className:eH(tF.wrappedRoot,h.root,h["anchorOrigin"+e9(b.anchorOrigin)]),SnackbarProps:f,onClose:s},S().createElement(p,Object.assign({},x,{appear:!0,in:d,onExit:A.onExit,onExited:a,onEnter:A.onEnter,onEntered:tT([A.onEntered,function(){e.snack.requestClose&&s(null,"instructed",e.snack.id)}],b.id)}),C||S().createElement(void 0===c?tj:c,Object.assign({},b)))))},t_=20,tz=6,tV=2,tH="."+tw,t$=tx({root:((o0={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:td(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"})[tH]={padding:tz+"px 0px",transition:"padding 300ms ease 0ms"},o0.maxWidth="calc(100% - "+2*t_+"px)",o0[e3]={width:"100%",maxWidth:"calc(100% - 32px)"},o0),rootDense:((o1={})[tH]={padding:tV+"px 0px"},o1),top:{top:t_-tz+"px",flexDirection:"column"},bottom:{bottom:t_-tz+"px",flexDirection:"column-reverse"},left:((o2={left:t_+"px"})[e6]={alignItems:"flex-start"},o2[e3]={left:"16px"},o2),right:((o5={right:t_+"px"})[e6]={alignItems:"flex-end"},o5[e3]={right:"16px"},o5),center:((o4={left:"50%",transform:"translateX(-50%)"})[e6]={alignItems:"center"},o4)}),tW=(0,w.memo)(function(e){var t=e.classes,n=void 0===t?{}:t,r=e.anchorOrigin,i=e.dense,o=e.children,s=eH("notistack-SnackbarContainer",t$[r.vertical],t$[r.horizontal],t$.root,n.containerRoot,n["containerAnchorOrigin"+e9(r)],i&&t$.rootDense);return S().createElement("div",{className:s},o)}),tU=function(e){return!("string"==typeof e||(0,w.isValidElement)(e))},tq=function(e){function t(t){var n;return(n=e.call(this,t)||this).enqueueSnackbar=function(e,t){if(void 0===t&&(t={}),null==e)throw Error("enqueueSnackbar called with invalid argument");var r,i=tU(e)?e:t,o=tU(e)?e.message:e,s=i.key,a=i.preventDuplicate,l=e1(i,["key","preventDuplicate"]),u=e7(s),c=u?s:new Date().getTime()+Math.random(),h=(r=n.props,function(e,t){return(void 0===t&&(t=!1),t)?eJ({},tv[e],{},r[e],{},l[e]):"autoHideDuration"===e?ty(l.autoHideDuration,r.autoHideDuration):"transitionDuration"===e?tb(l.transitionDuration,r.transitionDuration):l[e]||r[e]||tv[e]}),d=eJ({id:c},l,{message:o,open:!0,entered:!1,requestClose:!1,persist:h("persist"),action:h("action"),content:h("content"),variant:h("variant"),anchorOrigin:h("anchorOrigin"),disableWindowBlurListener:h("disableWindowBlurListener"),autoHideDuration:h("autoHideDuration"),hideIconVariant:h("hideIconVariant"),TransitionComponent:h("TransitionComponent"),transitionDuration:h("transitionDuration"),TransitionProps:h("TransitionProps",!0),iconVariant:h("iconVariant",!0),style:h("style",!0),SnackbarProps:h("SnackbarProps",!0),className:eH(n.props.className,l.className)});return d.persist&&(d.autoHideDuration=void 0),n.setState(function(e){if(void 0===a&&n.props.preventDuplicate||a){var t=function(e){return u?e.id===c:e.message===o},r=e.queue.findIndex(t)>-1,i=e.snacks.findIndex(t)>-1;if(r||i)return e}return n.handleDisplaySnack(eJ({},e,{queue:[].concat(e.queue,[d])}))}),c},n.handleDisplaySnack=function(e){return e.snacks.length>=n.maxSnack?n.handleDismissOldest(e):n.processQueue(e)},n.processQueue=function(e){var t=e.queue,n=e.snacks;return t.length>0?eJ({},e,{snacks:[].concat(n,[t[0]]),queue:t.slice(1,t.length)}):e},n.handleDismissOldest=function(e){if(e.snacks.some(function(e){return!e.open||e.requestClose}))return e;var t=!1,r=!1;e.snacks.reduce(function(e,t){return e+(t.open&&t.persist?1:0)},0)===n.maxSnack&&(r=!0);var i=e.snacks.map(function(e){return t||e.persist&&!r?eJ({},e):(t=!0,e.entered)?(e.onClose&&e.onClose(null,"maxsnack",e.id),n.props.onClose&&n.props.onClose(null,"maxsnack",e.id),eJ({},e,{open:!1})):eJ({},e,{requestClose:!0})});return eJ({},e,{snacks:i})},n.handleEnteredSnack=function(e,t,r){if(!e7(r))throw Error("handleEnteredSnack Cannot be called with undefined key");n.setState(function(e){return{snacks:e.snacks.map(function(e){return e.id===r?eJ({},e,{entered:!0}):eJ({},e)})}})},n.handleCloseSnack=function(e,t,r){n.props.onClose&&n.props.onClose(e,t,r);var i=void 0===r;n.setState(function(e){var t=e.snacks,n=e.queue;return{snacks:t.map(function(e){return i||e.id===r?e.entered?eJ({},e,{open:!1}):eJ({},e,{requestClose:!0}):eJ({},e)}),queue:n.filter(function(e){return e.id!==r})}})},n.closeSnackbar=function(e){var t=n.state.snacks.find(function(t){return t.id===e});e7(e)&&t&&t.onClose&&t.onClose(null,"instructed",e),n.handleCloseSnack(null,"instructed",e)},n.handleExitedSnack=function(e,t){if(!e7(t))throw Error("handleExitedSnack Cannot be called with undefined key");n.setState(function(e){var r=n.processQueue(eJ({},e,{snacks:e.snacks.filter(function(e){return e.id!==t})}));return 0===r.queue.length?r:n.handleDismissOldest(r)})},n.enqueueSnackbar,n.closeSnackbar,n.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:n.enqueueSnackbar.bind(e2(n)),closeSnackbar:n.closeSnackbar.bind(e2(n))}},n}return e0(t,e),t.prototype.render=function(){var e=this,t=this.state.contextValue,n=this.props,r=n.domRoot,i=n.children,o=n.dense,s=void 0!==o&&o,a=n.Components,l=void 0===a?{}:a,u=n.classes,c=this.state.snacks.reduce(function(e,t){var n,r=e9(t.anchorOrigin),i=e[r]||[];return eJ({},e,((n={})[r]=[].concat(i,[t]),n))},{}),h=Object.keys(c).map(function(t){var n=c[t],r=n[0];return S().createElement(tW,{key:t,dense:s,anchorOrigin:r.anchorOrigin,classes:u},n.map(function(t){return S().createElement(tB,{key:t.id,snack:t,classes:u,Component:l[t.variant],onClose:e.handleCloseSnack,onEnter:e.props.onEnter,onExit:e.props.onExit,onExited:tT([e.handleExitedSnack,e.props.onExited],t.id),onEntered:tT([e.handleEnteredSnack,e.props.onEntered],t.id)})}))});return S().createElement(e4.Provider,{value:t},i,r?(0,ez.createPortal)(h,r):h)},eQ(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||tv.maxSnack}}]),t}(w.Component);function tG({children:e,...t}){return(0,x.jsx)(tq,{...t,Components:{error:(0,D.A)(tj)(()=>({"&.notistack-MuiContent-error":{whiteSpace:"pre-wrap"}}))},children:e})}function tY(){let{enqueueSnackbar:e,closeSnackbar:t}=(0,w.useContext)(e4),n=tK(e,"error"),r=tK(e,"info"),i=tK(e,"warning"),o=tK(e,"success"),s=(0,w.useCallback)((e,t)=>n(e instanceof Error?e.message:`An unexpected error occurred: ${e}`,t),[n]);return{enqueueSnackbar:e,closeSnackbar:t,errorSnackbar:n,infoSnackbar:r,warningSnackbar:i,successSnackbar:o,exceptionSnackbar:s}}function tK(e,t){return(0,w.useCallback)((n,r)=>e(n,{...r,variant:t}),[e,t])}var tZ=n(25632);let tX="Pinned Crosshair",tQ={name:tX,type:"line",markLine:{data:[],lineStyle:{type:"dashed",width:2},emphasis:{lineStyle:{width:2,opacity:1}},blur:{lineStyle:{width:2,opacity:1}}}};var tJ=n(97618),t0=n(94461);function t1(e){return{value:{pastDuration:e},display:`Last ${(0,t0.formatDuration)((0,tJ.pW)(e),{delimiter:", "})}`}}function t2(){return["local","UTC",...Intl.supportedValuesOf?.("timeZone")??[]].filter((e,t,n)=>n.indexOf(e)===t).map(e=>({value:e,display:"local"===e?"Local":e.replace(/_/g," ")}))}function t5(e,t){return"read"===e?"View":t&&"create"===e?"Add":t||"create"!==e?"update"===e?"Edit":"":"Create"}function t4(e,t){return t&&"create"===e?"Add":t&&"update"===e?"Apply":t?"":"Save"}let t3=["bottom","right"],t6=["list","table"],t8=["small","medium"];function t9(e){return t3.includes(e)}function t7(e){return t6.includes(e)}function ne(e){return t8.includes(e)}let nt={position:"bottom",mode:"list",size:"medium"};function nn(e){return void 0===e?nt.position:t9(e)?e:nt.position}function nr(e){return e&&t7(e)?e:nt.mode}function ni(e){return e&&ne(e)?e:nt.size}let no=new Map([["time",new Map],["decimal",new Map],["bits",new Map],["bytes",new Map],["currency",new Map],["percent",new Map],["temperature",new Map],["throughput",new Map]]);function ns(e,t,n,r="en-US"){let i=`${e.filter(e=>![void 0,null,"",NaN].includes(e)).join("|")}|${r}`,o=no.get(t);if(!o)throw Error("No formatter found for the input type");let s=o.get(i);if(s)return s.format;let a=Intl.NumberFormat(r,n);return o?.set(`${i}`,a),a.format}let na=()=>({countCacheItems:e=>"all"!==e?no.get(e)?.size??0:Array.from(no.values()).reduce((e,t)=>e+(t?.size??0),0),getKeys:e=>[...no.get(e)?.keys()||[]]});function nl(e){return!1!==e}function nu(e){return"number"==typeof e}function nc(e){return e&&(e<0?e=0:e>20&&(e=20)),e}let nh="Time",nd={label:"Time",decimalPlaces:!0},nf={nanoseconds:{group:nh,label:"Nanoseconds"},microseconds:{group:nh,label:"Microseconds"},milliseconds:{group:nh,label:"Milliseconds"},seconds:{group:nh,label:"Seconds"},minutes:{group:nh,label:"Minutes"},hours:{group:nh,label:"Hours"},days:{group:nh,label:"Days"},weeks:{group:nh,label:"Weeks"},months:{group:nh,label:"Months"},years:{group:nh,label:"Years"}};var np=((oX={}).nanoseconds="nanosecond",oX.microseconds="microsecond",oX.milliseconds="millisecond",oX.seconds="second",oX.minutes="minute",oX.hours="hour",oX.days="day",oX.weeks="week",oX.months="month",oX.years="year",oX);let nm={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001,microseconds:1e-6,nanoseconds:1e-9},ng=["years","months","weeks","days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"];function nv(e,{unit:t,decimalPlaces:n}){var r;if(0===e)return"0s";let i=function(e,t){let n=e*nm[t],r=ng[0]||"years",i=r,o=n/nm[r];for(i of ng)if((o=n/nm[i])>=1)break;return{value:o,unit:i}}(e,t??"seconds"),o={style:"unit",unit:np[i.unit],unitDisplay:"months"===(r=i.unit)||"years"===r?"long":"narrow"};return nu(n)?(o.minimumFractionDigits=nc(n),o.maximumFractionDigits=nc(n)):o.maximumSignificantDigits=3,ns([o.style,o.unit,o.unitDisplay,o.maximumSignificantDigits,n,t??"seconds"],"time",o,"en-US")(i.value)}var ny="u">typeof globalThis?globalThis:"u">typeof window?window:void 0!==n.g?n.g:"u">typeof self?self:{};function nb(){if(o9)return o8;o9=1;let e=[{key:"ZiB",factor:11805916207174113e5},{key:"ZB",factor:1e21},{key:"YiB",factor:12089258196146292e8},{key:"YB",factor:1e24},{key:"TiB",factor:0x10000000000},{key:"TB",factor:1e12},{key:"PiB",factor:0x4000000000000},{key:"PB",factor:1e15},{key:"MiB",factor:1048576},{key:"MB",factor:1e6},{key:"KiB",factor:1024},{key:"KB",factor:1e3},{key:"GiB",factor:0x40000000},{key:"GB",factor:1e9},{key:"EiB",factor:0x1000000000000000},{key:"EB",factor:1e18},{key:"B",factor:1}];function t(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}return o8={unformat:function(n,r){let i,o=nS(),s=o.currentDelimiters(),a=o.currentCurrency().symbol,l=o.currentOrdinal(),u=o.getZeroFormat(),c=o.currentAbbreviations();if("string"==typeof n)if(function(e,t){if(!(e.indexOf(":")&&":"!==t.thousands))return!1;let n=e.split(":");if(3!==n.length)return!1;let r=+n[0],i=+n[1],o=+n[2];return!isNaN(r)&&!isNaN(i)&&!isNaN(o)}(n,s)){let e,t,r;t=+(e=n.split(":"))[0],r=+e[1],i=+e[2]+60*r+3600*t}else i=function(n,r,i="",o,s,a){if(""!==n)return n===s?0:function n(r,i,o,s,a,l,u){if(!isNaN(+r))return+r;let c="",h=r.replace(/(^[^(]*)\((.*)\)([^)]*$)/,"$1$2$3");if(h!==r)return -1*n(h,i,o,s,a,l);for(let t=0;t<e.length;t++){let u=e[t];if((c=r.replace(RegExp(`([0-9 ])(${u.key})$`),"$1"))!==r)return n(c,i,o,s,a,l)*u.factor}if((c=r.replace("%",""))!==r)return n(c,i,o,s,a,l)/100;let d=parseFloat(r);if(isNaN(d))return;let f=s(d);if(f&&"."!==f&&(c=r.replace(RegExp(`${t(f)}$`),""))!==r)return n(c,i,o,s,a,l);let p={};Object.keys(l).forEach(e=>{p[l[e]]=e});let m=Object.keys(p).sort().reverse(),g=m.length;for(let e=0;e<g;e++){let t=m[e],u=p[t];if((c=r.replace(t,""))!==r){let e;switch(u){case"thousand":e=1e3;break;case"million":e=1e6;break;case"billion":e=1e9;break;case"trillion":e=1e12}return n(c,i,o,s,a,l)*e}}}(n.replace(i,"").replace(RegExp(`([0-9])${t(r.thousands)}([0-9])`,"g"),"$1$2").replace(r.decimal,"."),r,i,o,s,a)}(n,s,a,l,u,c);else{if("number"!=typeof n)return;i=n}if(void 0!==i)return i}}}function nx(){if(se)return o7;se=1;let e=nb(),t=/^[a-z]{2,3}(-[a-zA-Z]{4})?(-([A-Z]{2}|[0-9]{3}))?$/,n={output:{type:"string",validValues:["currency","percent","byte","time","ordinal","number"]},base:{type:"string",validValues:["decimal","binary","general"],restriction:(e,t)=>"byte"===t.output,message:"`base` must be provided only when the output is `byte`",mandatory:e=>"byte"===e.output},characteristic:{type:"number",restriction:e=>e>=0,message:"value must be positive"},prefix:"string",postfix:"string",forceAverage:{type:"string",validValues:["trillion","billion","million","thousand"]},average:"boolean",lowPrecision:{type:"boolean",restriction:(e,t)=>!0===t.average,message:"`lowPrecision` must be provided only when the option `average` is set"},currencyPosition:{type:"string",validValues:["prefix","infix","postfix"]},currencySymbol:"string",totalLength:{type:"number",restrictions:[{restriction:e=>e>=0,message:"value must be positive"},{restriction:(e,t)=>!t.exponential,message:"`totalLength` is incompatible with `exponential`"}]},mantissa:{type:"number",restriction:e=>e>=0,message:"value must be positive"},optionalMantissa:"boolean",trimMantissa:"boolean",roundingFunction:"function",optionalCharacteristic:"boolean",thousandSeparated:"boolean",spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",spaceSeparatedAbbreviation:"boolean",abbreviations:{type:"object",children:{thousand:"string",million:"string",billion:"string",trillion:"string"}},negative:{type:"string",validValues:["sign","parenthesis"]},forceSign:"boolean",exponential:{type:"boolean"},prefixSymbol:{type:"boolean",restriction:(e,t)=>"percent"===t.output,message:"`prefixSymbol` can be provided only when the output is `percent`"}},r={languageTag:{type:"string",mandatory:!0,restriction:e=>e.match(t),message:"the language tag must follow the BCP 47 specification (see https://tools.ieft.org/html/bcp47)"},delimiters:{type:"object",children:{thousands:"string",decimal:"string",thousandsSize:"number"},mandatory:!0},abbreviations:{type:"object",children:{thousand:{type:"string",mandatory:!0},million:{type:"string",mandatory:!0},billion:{type:"string",mandatory:!0},trillion:{type:"string",mandatory:!0}},mandatory:!0},spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",ordinal:{type:"function",mandatory:!0},bytes:{type:"object",children:{binarySuffixes:"object",decimalSuffixes:"object"}},currency:{type:"object",children:{symbol:"string",position:"string",code:"string"},mandatory:!0},defaults:"format",ordinalFormat:"format",byteFormat:"format",percentageFormat:"format",currencyFormat:"format",timeDefaults:"format",formats:{type:"object",children:{fourDigits:{type:"format",mandatory:!0},fullWithTwoDecimals:{type:"format",mandatory:!0},fullWithTwoDecimalsNoCurrency:{type:"format",mandatory:!0},fullWithNoDecimals:{type:"format",mandatory:!0}}}};function i(t){return void 0!==e.unformat(t)}function o(e,t,r,i=!1){let s=Object.keys(e).map(i=>{if(!t[i])return console.error(`${r} Invalid key: ${i}`),!1;let s=e[i],a=t[i];if("string"==typeof a&&(a={type:a}),"format"===a.type){if(!o(s,n,`[Validate ${i}]`,!0))return!1}else if(typeof s!==a.type)return console.error(`${r} ${i} type mismatched: "${a.type}" expected, "${typeof s}" provided`),!1;if(a.restrictions&&a.restrictions.length){let t=a.restrictions.length;for(let n=0;n<t;n++){let{restriction:t,message:o}=a.restrictions[n];if(!t(s,e))return console.error(`${r} ${i} invalid value: ${o}`),!1}}return a.restriction&&!a.restriction(s,e)?(console.error(`${r} ${i} invalid value: ${a.message}`),!1):a.validValues&&-1===a.validValues.indexOf(s)?(console.error(`${r} ${i} invalid value: must be among ${JSON.stringify(a.validValues)}, "${s}" provided`),!1):(!a.children||!!o(s,a.children,`[Validate ${i}]`))&&!0});return i||s.push(...Object.keys(t).map(n=>{let i=t[n];if("string"==typeof i&&(i={type:i}),i.mandatory){let t=i.mandatory;if("function"==typeof t&&(t=t(e)),t&&void 0===e[n])return console.error(`${r} Missing mandatory key "${n}"`),!1}return!0})),s.reduce((e,t)=>e&&t,!0)}function s(e){return o(e,n,"[Validate format]")}return o7={validate:function(e,t){let n=i(e),r=s(t);return n&&r},validateFormat:s,validateInput:i,validateLanguage:function(e){return o(e,r,"[Validate language]")}}}var nw=function(e,t={}){var n,r,i,o,s,a;let l,u,c,h,d;if("string"!=typeof e)return e;r=e=(l=(n=e).match(/^{([^}]*)}/))?(t.prefix=l[1],n.slice(l[0].length)):n,function(e,t){if(-1!==e.indexOf("$")){t.output="currency";return}if(-1!==e.indexOf("%")){t.output="percent";return}if(-1!==e.indexOf("bd")){t.output="byte",t.base="general";return}if(-1!==e.indexOf("b")){t.output="byte",t.base="binary";return}if(-1!==e.indexOf("d")){t.output="byte",t.base="decimal";return}if(-1!==e.indexOf(":")){t.output="time";return}-1!==e.indexOf("o")&&(t.output="ordinal")}(e=(u=r.match(/{([^}]*)}$/))?(t.postfix=u[1],r.slice(0,-u[0].length)):r,t),(c=e.match(/[1-9]+[0-9]*/))&&(t.totalLength=+c[0]),(h=e.split(".")[0].match(/0+/))&&(t.characteristic=h[0].length),-1!==(i=e).indexOf(".")&&(t.optionalCharacteristic=-1===i.split(".")[0].indexOf("0")),-1!==e.indexOf("a")&&(t.average=!0),-1!==(o=e).indexOf("K")?t.forceAverage="thousand":-1!==o.indexOf("M")?t.forceAverage="million":-1!==o.indexOf("B")?t.forceAverage="billion":-1!==o.indexOf("T")&&(t.forceAverage="trillion");let f=e.split(".")[1];if(f){let e=f.match(/0+/);e&&(t.mantissa=e[0].length)}return(s=e).match(/\[\.]/)?t.optionalMantissa=!0:s.match(/\./)&&(t.optionalMantissa=!1),(d=e.split(".")[1])&&(t.trimMantissa=-1!==d.indexOf("[")),-1!==e.indexOf(",")&&(t.thousandSeparated=!0),-1!==e.indexOf(" ")&&(t.spaceSeparated=!0,t.spaceSeparatedCurrency=!0,(t.average||t.forceAverage)&&(t.spaceSeparatedAbbreviation=!0)),(a=e).match(/^\+?\([^)]*\)$/)&&(t.negative="parenthesis"),a.match(/^\+?-/)&&(t.negative="sign"),e.match(/^\+/)&&(t.forceSign=!0),t};function nS(){let e;if(sn)return st;sn=1;let t=o6?o3:(o6=1,o3={languageTag:"en-US",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},spaceSeparated:!1,ordinal:function(e){let t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},bytes:{binarySuffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],decimalSuffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},currency:{symbol:"$",position:"prefix",code:"USD"},currencyFormat:{thousandSeparated:!0,totalLength:4,spaceSeparated:!0,spaceSeparatedCurrency:!0},formats:{fourDigits:{totalLength:4,spaceSeparated:!0},fullWithTwoDecimals:{output:"currency",thousandSeparated:!0,mantissa:2},fullWithTwoDecimalsNoCurrency:{thousandSeparated:!0,mantissa:2},fullWithNoDecimals:{output:"currency",thousandSeparated:!0,mantissa:0}}}),n=nx(),r={},i={},o=null,s={};function a(){return i[e]}return r.languages=()=>Object.assign({},i),r.currentLanguage=()=>e,r.currentBytes=()=>a().bytes||{},r.currentCurrency=()=>a().currency,r.currentAbbreviations=()=>a().abbreviations,r.currentDelimiters=()=>a().delimiters,r.currentOrdinal=()=>a().ordinal,r.currentDefaults=()=>Object.assign({},a().defaults,s),r.currentOrdinalDefaultFormat=()=>Object.assign({},r.currentDefaults(),a().ordinalFormat),r.currentByteDefaultFormat=()=>Object.assign({},r.currentDefaults(),a().byteFormat),r.currentPercentageDefaultFormat=()=>Object.assign({},r.currentDefaults(),a().percentageFormat),r.currentCurrencyDefaultFormat=()=>Object.assign({},r.currentDefaults(),a().currencyFormat),r.currentTimeDefaultFormat=()=>Object.assign({},r.currentDefaults(),a().timeFormat),r.setDefaults=e=>{e=nw(e),n.validateFormat(e)&&(s=e)},r.getZeroFormat=()=>o,r.setZeroFormat=e=>o="string"==typeof e?e:null,r.hasZeroFormat=()=>null!==o,r.languageData=e=>{if(e){if(i[e])return i[e];throw Error(`Unknown tag "${e}"`)}return a()},r.registerLanguage=(t,r=!1)=>{if(!n.validateLanguage(t))throw Error("Invalid language data");i[t.languageTag]=t,r&&(e=t.languageTag)},r.setLanguage=(n,r=t.languageTag)=>{if(!i[n]){let t=n.split("-")[0],o=Object.keys(i).find(e=>e.split("-")[0]===t);return i[o]?void(e=o):void(e=r)}e=n},r.registerLanguage(t),e=t.languageTag,st=r}var nC={exports:{}};(function(e){var t,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,r=Math.ceil,i=Math.floor,o="[BigNumber Error] ",s=o+"Number primitive has more than 15 significant digits: ",a=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13];function l(e){var t=0|e;return e>0||e===t?t:t-1}function u(e){for(var t,n,r=1,i=e.length,o=e[0]+"";r<i;){for(n=14-(t=e[r++]+"").length;n--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function c(e,t){var n,r,i=e.c,o=t.c,s=e.s,a=t.s,l=e.e,u=t.e;if(!s||!a)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=l==u,!i||!o)return r?0:!i^n?1:-1;if(!r)return l>u^n?1:-1;for(s=0,a=(l=i.length)<(u=o.length)?l:u;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return l==u?0:l>u^n?1:-1}function h(e,t,n,r){if(e<t||e>n||e!==i(e))throw Error(o+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function d(e){var t=e.c.length-1;return l(e.e/14)==t&&e.c[t]%2!=0}function f(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function p(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}(t=function e(t){var m,g,v,y,b,x,w,S,C,A=B.prototype={constructor:B,toString:null,valueOf:null},k=new B(1),M=20,T=4,D=-7,E=21,O=-1e7,R=1e7,I=!1,P=1,N=0,L={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz",F=!0;function B(e,t){var r,o,a,l,u,c,d,f,p=this;if(!(p instanceof B))return new B(e,t);if(null==t){if(e&&!0===e._isBigNumber){p.s=e.s,!e.c||e.e>R?p.c=p.e=null:e.e<O?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice());return}if((c="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,u=e;u>=10;u/=10,l++);l>R?p.c=p.e=null:(p.e=l,p.c=[e]);return}f=String(e)}else{if(!n.test(f=String(e)))return C(p,f,c);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(l=f.indexOf("."))>-1&&(f=f.replace(".","")),(u=f.search(/e/i))>0?(l<0&&(l=u),l+=+f.slice(u+1),f=f.substring(0,u)):l<0&&(l=f.length)}else{if(h(t,2,j.length,"Base"),10==t&&F)return H(p=new B(e),M+p.e+1,T);if(f=String(e),c="number"==typeof e){if(0*e!=0)return C(p,f,c,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,B.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(s+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(r=j.slice(0,t),l=u=0,d=f.length;u<d;u++)if(0>r.indexOf(o=f.charAt(u))){if("."==o){if(u>l){l=d;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,u=-1,l=0;continue}return C(p,String(e),c,t)}c=!1,(l=(f=S(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):l=f.length}for(u=0;48===f.charCodeAt(u);u++);for(d=f.length;48===f.charCodeAt(--d););if(f=f.slice(u,++d)){if(d-=u,c&&B.DEBUG&&d>15&&(e>0x1fffffffffffff||e!==i(e)))throw Error(s+p.s*e);if((l=l-u-1)>R)p.c=p.e=null;else if(l<O)p.c=[p.e=0];else{if(p.e=l,p.c=[],u=(l+1)%14,l<0&&(u+=14),u<d){for(u&&p.c.push(+f.slice(0,u)),d-=14;u<d;)p.c.push(+f.slice(u,u+=14));u=14-(f=f.slice(u)).length}else u-=d;for(;u--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function _(e,t,n,r){var i,o,s,a,l;if(null==n?n=T:h(n,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)l=u(e.c),l=1==r||2==r&&(s<=D||s>=E)?f(l,s):p(l,s,"0");else if(o=(e=H(new B(e),t,n)).e,a=(l=u(e.c)).length,1==r||2==r&&(t<=o||o<=D)){for(;a<t;l+="0",a++);l=f(l,o)}else if(t-=s,l=p(l,o,"0"),o+1>a){if(--t>0)for(l+=".";t--;l+="0");}else if((t+=o-a)>0)for(o+1==a&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function z(e,t){for(var n,r,i=1,o=new B(e[0]);i<e.length;i++)(r=new B(e[i])).s&&(n=c(o,r))!==t&&(0!==n||o.s!==t)||(o=r);return o}function V(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+14*n-1)>R?e.c=e.e=null:n<O?e.c=[e.e=0]:(e.e=n,e.c=t),e}function H(e,t,n,o){var s,l,u,c,h,d,f,p=e.c;if(p){e:{for(s=1,c=p[0];c>=10;c/=10,s++);if((l=t-s)<0)l+=14,u=t,f=i((h=p[d=0])/a[s-u-1]%10);else if((d=r((l+1)/14))>=p.length)if(o){for(;p.length<=d;p.push(0));h=f=0,s=1,l%=14,u=l-14+1}else break e;else{for(s=1,h=c=p[d];c>=10;c/=10,s++);l%=14,f=(u=l-14+s)<0?0:i(h/a[s-u-1]%10)}if(o=o||t<0||null!=p[d+1]||(u<0?h:h%a[s-u-1]),o=n<4?(f||o)&&(0==n||n==(e.s<0?3:2)):f>5||5==f&&(4==n||o||6==n&&(l>0?u>0?h/a[s-u]:0:p[d-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,o?(t-=e.e+1,p[0]=a[(14-t%14)%14],e.e=-t||0):p[0]=e.e=0,e;if(0==l?(p.length=d,c=1,d--):(p.length=d+1,c=a[14-l],p[d]=u>0?i(h/a[s-u]%a[u])*c:0),o)for(;;)if(0==d){for(l=1,u=p[0];u>=10;u/=10,l++);for(u=p[0]+=c,c=1;u>=10;u/=10,c++);l!=c&&(e.e++,1e14==p[0]&&(p[0]=1));break}else{if(p[d]+=c,1e14!=p[d])break;p[d--]=0,c=1}for(l=p.length;0===p[--l];p.pop());}e.e>R?e.c=e.e=null:e.e<O&&(e.c=[e.e=0])}return e}function $(e){var t,n=e.e;return null===n?e.toString():(t=u(e.c),t=n<=D||n>=E?f(t,n):p(t,n,"0"),e.s<0?"-"+t:t)}return B.clone=e,B.ROUND_UP=0,B.ROUND_DOWN=1,B.ROUND_CEIL=2,B.ROUND_FLOOR=3,B.ROUND_HALF_UP=4,B.ROUND_HALF_DOWN=5,B.ROUND_HALF_EVEN=6,B.ROUND_HALF_CEIL=7,B.ROUND_HALF_FLOOR=8,B.EUCLID=9,B.config=B.set=function(e){var t,n;if(null!=e)if("object"==typeof e){if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(h(n=e[t],0,1e9,t),M=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(h(n=e[t],0,8,t),T=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(h(n[0],-1e9,0,t),h(n[1],0,1e9,t),D=n[0],E=n[1]):(h(n,-1e9,1e9,t),D=-(E=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)h(n[0],-1e9,-1,t),h(n[1],1,1e9,t),O=n[0],R=n[1];else if(h(n,-1e9,1e9,t),n)O=-(R=n<0?-n:n);else throw Error(o+t+" cannot be zero: "+n);if(e.hasOwnProperty(t="CRYPTO"))if(!!(n=e[t])===n)if(n)if("u">typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))I=n;else throw I=!n,Error(o+"crypto unavailable");else I=n;else throw Error(o+t+" not true or false: "+n);if(e.hasOwnProperty(t="MODULO_MODE")&&(h(n=e[t],0,9,t),P=n),e.hasOwnProperty(t="POW_PRECISION")&&(h(n=e[t],0,1e9,t),N=n),e.hasOwnProperty(t="FORMAT"))if("object"==typeof(n=e[t]))L=n;else throw Error(o+t+" not an object: "+n);if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(o+t+" invalid: "+n);F="0123456789"==n.slice(0,10),j=n}}else throw Error(o+"Object expected: "+e);return{DECIMAL_PLACES:M,ROUNDING_MODE:T,EXPONENTIAL_AT:[D,E],RANGE:[O,R],CRYPTO:I,MODULO_MODE:P,POW_PRECISION:N,FORMAT:L,ALPHABET:j}},B.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!B.DEBUG)return!0;var t,n,r=e.c,s=e.e,a=e.s;e:if("[object Array]"==({}).toString.call(r)){if((1===a||-1===a)&&s>=-1e9&&s<=1e9&&s===i(s)){if(0===r[0]){if(0===s&&1===r.length)return!0;break e}if((t=(s+1)%14)<1&&(t+=14),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=1e14||n!==i(n))break e;if(0!==n)return!0}}}else if(null===r&&null===s&&(null===a||1===a||-1===a))return!0;throw Error(o+"Invalid BigNumber: "+e)},B.maximum=B.max=function(){return z(arguments,-1)},B.minimum=B.min=function(){return z(arguments,1)},m=0x20000000000000*Math.random()&2097151?function(){return i(0x20000000000000*Math.random())}:function(){return(0x40000000*Math.random()|0)*8388608+(8388608*Math.random()|0)},B.random=function(e){var t,n,s,l,u,c=0,d=[],f=new B(k);if(null==e?e=M:h(e,0,1e9),l=r(e/14),I)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(l*=2));c<l;)(u=131072*t[c]+(t[c+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[c]=n[0],t[c+1]=n[1]):(d.push(u%1e14),c+=2);c=l/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(l*=7);c<l;)(u=(31&t[c])*0x1000000000000+0x10000000000*t[c+1]+0x100000000*t[c+2]+0x1000000*t[c+3]+(t[c+4]<<16)+(t[c+5]<<8)+t[c+6])>=9e15?crypto.randomBytes(7).copy(t,c):(d.push(u%1e14),c+=7);c=l/7}else throw I=!1,Error(o+"crypto unavailable");if(!I)for(;c<l;)(u=m())<9e15&&(d[c++]=u%1e14);for(l=d[--c],e%=14,l&&e&&(u=a[14-e],d[c]=i(l/u)*u);0===d[c];d.pop(),c--);if(c<0)d=[s=0];else{for(s=-1;0===d[0];d.splice(0,1),s-=14);for(c=1,u=d[0];u>=10;u/=10,c++);c<14&&(s-=14-c)}return f.e=s,f.c=d,f},B.sum=function(){for(var e=1,t=arguments,n=new B(t[0]);e<t.length;)n=n.plus(t[e++]);return n},S=function(){var e="0123456789";function t(e,t,n,r){for(var i,o,s=[0],a=0,l=e.length;a<l;){for(o=s.length;o--;s[o]*=t);for(s[0]+=r.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(n,r,i,o,s){var a,l,c,h,d,f,m,g,v=n.indexOf("."),y=M,b=T;for(v>=0&&(h=N,N=0,n=n.replace(".",""),f=(g=new B(r)).pow(n.length-v),N=h,g.c=t(p(u(f.c),f.e,"0"),10,i,e),g.e=g.c.length),c=h=(m=t(n,r,i,s?(a=j,e):(a=e,j))).length;0==m[--h];m.pop());if(!m[0])return a.charAt(0);if(v<0?--c:(f.c=m,f.e=c,f.s=o,m=(f=w(f,g,y,b,i)).c,d=f.r,c=f.e),v=m[l=c+y+1],h=i/2,d=d||l<0||null!=m[l+1],d=b<4?(null!=v||d)&&(0==b||b==(f.s<0?3:2)):v>h||v==h&&(4==b||d||6==b&&1&m[l-1]||b==(f.s<0?8:7)),l<1||!m[0])n=d?p(a.charAt(1),-y,a.charAt(0)):a.charAt(0);else{if(m.length=l,d)for(--i;++m[--l]>i;)m[l]=0,l||(++c,m=[1].concat(m));for(h=m.length;!m[--h];);for(v=0,n="";v<=h;n+=a.charAt(m[v++]));n=p(n,c,a.charAt(0))}return n}}(),w=function(){function e(e,t,n){var r,i,o,s,a=0,l=e.length,u=t%1e7,c=t/1e7|0;for(e=e.slice();l--;)r=c*(o=e[l]%1e7)+(s=e[l]/1e7|0)*u,a=((i=u*o+r%1e7*1e7+a)/n|0)+(r/1e7|0)+c*s,e[l]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,o,s,a,u){var c,h,d,f,p,m,g,v,y,b,x,w,S,C,A,k,M,T=r.s==o.s?1:-1,D=r.c,E=o.c;if(!D||!D[0]||!E||!E[0])return new B(!r.s||!o.s||(D?E&&D[0]==E[0]:!E)?NaN:D&&0==D[0]||!E?0*T:T/0);for(y=(v=new B(T)).c=[],T=s+(h=r.e-o.e)+1,u||(u=1e14,h=l(r.e/14)-l(o.e/14),T=T/14|0),d=0;E[d]==(D[d]||0);d++);if(E[d]>(D[d]||0)&&h--,T<0)y.push(1),f=!0;else{for(C=D.length,k=E.length,d=0,T+=2,(p=i(u/(E[0]+1)))>1&&(E=e(E,p,u),D=e(D,p,u),k=E.length,C=D.length),S=k,x=(b=D.slice(0,k)).length;x<k;b[x++]=0);M=[0].concat(M=E.slice()),A=E[0],E[1]>=u/2&&A++;do{if(p=0,(c=t(E,b,k,x))<0){if(w=b[0],k!=x&&(w=w*u+(b[1]||0)),(p=i(w/A))>1)for(p>=u&&(p=u-1),g=(m=e(E,p,u)).length,x=b.length;1==t(m,b,g,x);)p--,n(m,k<g?M:E,g,u),g=m.length,c=1;else 0==p&&(c=p=1),g=(m=E.slice()).length;if(g<x&&(m=[0].concat(m)),n(b,m,x,u),x=b.length,-1==c)for(;1>t(E,b,k,x);)p++,n(b,k<x?M:E,x,u),x=b.length}else 0===c&&(p++,b=[0]);y[d++]=p,b[0]?b[x++]=D[S]||0:(b=[D[S]],x=1)}while((S++<C||null!=b[0])&&T--);f=null!=b[0],y[0]||y.splice(0,1)}if(1e14==u){for(d=1,T=y[0];T>=10;T/=10,d++);H(v,s+(v.e=d+14*h-1)+1,a,f)}else v.e=h,v.r=+f;return v}}(),g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,y=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g,C=function(e,t,n,r){var i,s=n?t:t.replace(x,"");if(b.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!n&&(s=s.replace(g,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,s=s.replace(v,"$1").replace(y,"0.$1")),t!=s))return new B(s,i);if(B.DEBUG)throw Error(o+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},A.absoluteValue=A.abs=function(){var e=new B(this);return e.s<0&&(e.s=1),e},A.comparedTo=function(e,t){return c(this,new B(e,t))},A.decimalPlaces=A.dp=function(e,t){var n,r,i;if(null!=e)return h(e,0,1e9),null==t?t=T:h(t,0,8),H(new B(this),e+this.e+1,t);if(!(n=this.c))return null;if(r=((i=n.length-1)-l(this.e/14))*14,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},A.dividedBy=A.div=function(e,t){return w(this,new B(e,t),M,T)},A.dividedToIntegerBy=A.idiv=function(e,t){return w(this,new B(e,t),0,1)},A.exponentiatedBy=A.pow=function(e,t){var n,s,a,l,u,c,h,f,p,m=this;if((e=new B(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+$(e));if(null!=t&&(t=new B(t)),c=e.e>14,!m.c||!m.c[0]||1==m.c[0]&&!m.e&&1==m.c.length||!e.c||!e.c[0])return p=new B(Math.pow(+$(m),c?e.s*(2-d(e)):+$(e))),t?p.mod(t):p;if(h=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new B(NaN);(s=!h&&m.isInteger()&&t.isInteger())&&(m=m.mod(t))}else{if(e.e>9&&(m.e>0||m.e<-1||(0==m.e?m.c[0]>1||c&&m.c[1]>=24e7:m.c[0]<8e13||c&&m.c[0]<=9999975e7)))return l=m.s<0&&d(e)?-0:0,m.e>-1&&(l=1/l),new B(h?1/l:l);N&&(l=r(N/14+2))}for(c?(n=new B(.5),h&&(e.s=1),f=d(e)):f=(a=Math.abs(+$(e)))%2,p=new B(k);;){if(f){if(!(p=p.times(m)).c)break;l?p.c.length>l&&(p.c.length=l):s&&(p=p.mod(t))}if(a){if(0===(a=i(a/2)))break;f=a%2}else if(H(e=e.times(n),e.e+1,1),e.e>14)f=d(e);else{if(0==(a=+$(e)))break;f=a%2}m=m.times(m),l?m.c&&m.c.length>l&&(m.c.length=l):s&&(m=m.mod(t))}return s?p:(h&&(p=k.div(p)),t?p.mod(t):l?H(p,N,T,u):p)},A.integerValue=function(e){var t=new B(this);return null==e?e=T:h(e,0,8),H(t,t.e+1,e)},A.isEqualTo=A.eq=function(e,t){return 0===c(this,new B(e,t))},A.isFinite=function(){return!!this.c},A.isGreaterThan=A.gt=function(e,t){return c(this,new B(e,t))>0},A.isGreaterThanOrEqualTo=A.gte=function(e,t){return 1===(t=c(this,new B(e,t)))||0===t},A.isInteger=function(){return!!this.c&&l(this.e/14)>this.c.length-2},A.isLessThan=A.lt=function(e,t){return 0>c(this,new B(e,t))},A.isLessThanOrEqualTo=A.lte=function(e,t){return -1===(t=c(this,new B(e,t)))||0===t},A.isNaN=function(){return!this.s},A.isNegative=function(){return this.s<0},A.isPositive=function(){return this.s>0},A.isZero=function(){return!!this.c&&0==this.c[0]},A.minus=function(e,t){var n,r,i,o,s=this.s;if(t=(e=new B(e,t)).s,!s||!t)return new B(NaN);if(s!=t)return e.s=-t,this.plus(e);var a=this.e/14,u=e.e/14,c=this.c,h=e.c;if(!a||!u){if(!c||!h)return c?(e.s=-t,e):new B(h?this:NaN);if(!c[0]||!h[0])return h[0]?(e.s=-t,e):new B(c[0]?this:3==T?-0:0)}if(a=l(a),u=l(u),c=c.slice(),s=a-u){for((o=s<0)?(s=-s,i=c):(u=a,i=h),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(r=(o=(s=c.length)<(t=h.length))?s:t,s=t=0;t<r;t++)if(c[t]!=h[t]){o=c[t]<h[t];break}if(o&&(i=c,c=h,h=i,e.s=-e.s),(t=(r=h.length)-(n=c.length))>0)for(;t--;c[n++]=0);for(t=1e14-1;r>s;){if(c[--r]<h[r]){for(n=r;n&&!c[--n];c[n]=t);--c[n],c[r]+=1e14}c[r]-=h[r]}for(;0==c[0];c.splice(0,1),--u);return c[0]?V(e,c,u):(e.s=3==T?-1:1,e.c=[e.e=0],e)},A.modulo=A.mod=function(e,t){var n,r;return(e=new B(e,t),this.c&&e.s&&(!e.c||e.c[0]))?e.c&&(!this.c||this.c[0])?(9==P?(r=e.s,e.s=1,n=w(this,e,0,3),e.s=r,n.s*=r):n=w(this,e,0,P),(e=this.minus(n.times(e))).c[0]||1!=P||(e.s=this.s),e):new B(this):new B(NaN)},A.multipliedBy=A.times=function(e,t){var n,r,i,o,s,a,u,c,h,d,f,p,m,g=this.c,v=(e=new B(e,t)).c;if(!g||!v||!g[0]||!v[0])return this.s&&e.s&&(!g||g[0]||v)&&(!v||v[0]||g)?(e.s*=this.s,g&&v?(e.c=[0],e.e=0):e.c=e.e=null):e.c=e.e=e.s=null,e;for(r=l(this.e/14)+l(e.e/14),e.s*=this.s,(u=g.length)<(d=v.length)&&(m=g,g=v,v=m,i=u,u=d,d=i),i=u+d,m=[];i--;m.push(0));for(i=d;--i>=0;){for(n=0,f=v[i]%1e7,p=v[i]/1e7|0,o=i+(s=u);o>i;)a=p*(c=g[--s]%1e7)+(h=g[s]/1e7|0)*f,n=((c=f*c+a%1e7*1e7+m[o]+n)/1e14|0)+(a/1e7|0)+p*h,m[o--]=c%1e14;m[o]=n}return n?++r:m.splice(0,1),V(e,m,r)},A.negated=function(){var e=new B(this);return e.s=-e.s||null,e},A.plus=function(e,t){var n,r=this.s;if(t=(e=new B(e,t)).s,!r||!t)return new B(NaN);if(r!=t)return e.s=-t,this.minus(e);var i=this.e/14,o=e.e/14,s=this.c,a=e.c;if(!i||!o){if(!s||!a)return new B(r/0);if(!s[0]||!a[0])return a[0]?e:new B(s[0]?this:0*r)}if(i=l(i),o=l(o),s=s.slice(),r=i-o){for(r>0?(o=i,n=a):(r=-r,n=s),n.reverse();r--;n.push(0));n.reverse()}for((r=s.length)-(t=a.length)<0&&(n=a,a=s,s=n,t=r),r=0;t;)r=(s[--t]=s[t]+a[t]+r)/1e14|0,s[t]=1e14===s[t]?0:s[t]%1e14;return r&&(s=[r].concat(s),++o),V(e,s,o)},A.precision=A.sd=function(e,t){var n,r,i;if(null!=e&&!!e!==e)return h(e,1,1e9),null==t?t=T:h(t,0,8),H(new B(this),e,t);if(!(n=this.c))return null;if(r=14*(i=n.length-1)+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&this.e+1>r&&(r=this.e+1),r},A.shiftedBy=function(e){return h(e,-0x1fffffffffffff,0x1fffffffffffff),this.times("1e"+e)},A.squareRoot=A.sqrt=function(){var e,t,n,r,i,o=this.c,s=this.s,a=this.e,c=M+4,h=new B("0.5");if(1!==s||!o||!o[0])return new B(!s||s<0&&(!o||o[0])?NaN:o?this:1/0);if(0==(s=Math.sqrt(+$(this)))||s==1/0?(((t=u(o)).length+a)%2==0&&(t+="0"),s=Math.sqrt(+t),a=l((a+1)/2)-(a<0||a%2),n=new B(t=s==1/0?"5e"+a:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+a)):n=new B(s+""),n.c[0]){for((s=(a=n.e)+c)<3&&(s=0);;)if(i=n,n=h.times(i.plus(w(this,i,c,1))),u(i.c).slice(0,s)===(t=u(n.c)).slice(0,s)){if(n.e<a&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(r||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(H(n,n.e+M+2,1),e=!n.times(n).eq(this));break}if(!r&&(H(i,i.e+M+2,0),i.times(i).eq(this))){n=i;break}c+=4,s+=4,r=1}}return H(n,n.e+M+1,T,e)},A.toExponential=function(e,t){return null!=e&&(h(e,0,1e9),e++),_(this,e,t,1)},A.toFixed=function(e,t){return null!=e&&(h(e,0,1e9),e=e+this.e+1),_(this,e,t)},A.toFormat=function(e,t,n){var r;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=L;else if("object"!=typeof n)throw Error(o+"Argument not an object: "+n);if(r=this.toFixed(e,t),this.c){var i,s=r.split("."),a=+n.groupSize,l=+n.secondaryGroupSize,u=n.groupSeparator||"",c=s[0],h=s[1],d=this.s<0,f=d?c.slice(1):c,p=f.length;if(l&&(i=a,a=l,l=i,p-=i),a>0&&p>0){for(i=p%a||a,c=f.substr(0,i);i<p;i+=a)c+=u+f.substr(i,a);l>0&&(c+=u+f.slice(i)),d&&(c="-"+c)}r=h?c+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?h.replace(RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):c}return(n.prefix||"")+r+(n.suffix||"")},A.toFraction=function(e){var t,n,r,i,s,l,c,h,d,f,p,m,g=this.c;if(null!=e&&(!(c=new B(e)).isInteger()&&(c.c||1!==c.s)||c.lt(k)))throw Error(o+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+$(c));if(!g)return new B(this);for(t=new B(k),d=n=new B(k),r=h=new B(k),m=u(g),s=t.e=m.length-this.e-1,t.c[0]=a[(l=s%14)<0?14+l:l],e=!e||c.comparedTo(t)>0?s>0?t:d:c,l=R,R=1/0,c=new B(m),h.c[0]=0;f=w(c,t,0,1),1!=(i=n.plus(f.times(r))).comparedTo(e);)n=r,r=i,d=h.plus(f.times(i=d)),h=i,t=c.minus(f.times(i=t)),c=i;return i=w(e.minus(n),r,0,1),h=h.plus(i.times(d)),n=n.plus(i.times(r)),h.s=d.s=this.s,s*=2,p=1>w(d,r,s,T).minus(this).abs().comparedTo(w(h,n,s,T).minus(this).abs())?[d,r]:[h,n],R=l,p},A.toNumber=function(){return+$(this)},A.toPrecision=function(e,t){return null!=e&&h(e,1,1e9),_(this,e,t,2)},A.toString=function(e){var t,n=this,r=n.s,i=n.e;return null===i?r?(t="Infinity",r<0&&(t="-"+t)):t="NaN":(null==e?t=i<=D||i>=E?f(u(n.c),i):p(u(n.c),i,"0"):10===e&&F?t=p(u((n=H(new B(n),M+i+1,T)).c),n.e,"0"):(h(e,2,j.length,"Base"),t=S(p(u(n.c),i,"0"),10,e,r,!0)),r<0&&n.c[0]&&(t="-"+t)),t},A.valueOf=A.toJSON=function(){return $(this)},A._isBigNumber=!0,null!=t&&B.set(t),B}()).default=t.BigNumber=t,nC.exports?nC.exports=t:(e||(e="u">typeof self&&self?self:window),e.BigNumber=t)})(ny);var nA=nC.exports;let nk=nS(),nM=nx(),nT={trillion:1e12,billion:1e9,million:1e6,thousand:1e3},nD={totalLength:0,characteristic:0,forceAverage:!1,average:!1,mantissa:-1,optionalMantissa:!0,thousandSeparated:!1,spaceSeparated:!1,negative:"sign",forceSign:!1,roundingFunction:Math.round,spaceSeparatedAbbreviation:!1},{binarySuffixes:nE,decimalSuffixes:nO}=nk.currentBytes(),nR={scale:1024,suffixes:nO,marker:"bd"},nI={scale:1024,suffixes:nE,marker:"b"},nP={scale:1e3,suffixes:nO,marker:"d"};function nN(e,t,n){let r=t[0],i=Math.abs(e);if(i>=n){for(let o=1;o<t.length;++o){let s=Math.pow(n,o),a=Math.pow(n,o+1);if(i>=s&&i<a){r=t[o],e/=s;break}}r===t[0]&&(e/=Math.pow(n,t.length-1),r=t[t.length-1])}return{value:e,suffix:r}}function nL(e){let t="";for(let n=0;n<e;n++)t+="0";return t}function nj({instance:e,providedFormat:t,state:n=nk,decimalSeparator:r,defaults:i=n.currentDefaults()}){var o,s,a,l,u;let c,h,d,f,p,m,g,v=e._value;if(0===v&&n.hasZeroFormat())return n.getZeroFormat();if(!isFinite(v))return v.toString();let y=Object.assign({},nD,i,t),b=y.totalLength,x=b?0:y.characteristic,w=y.optionalCharacteristic,S=y.forceAverage,C=y.lowPrecision,A=!!b||!!S||y.average,k=b?-1:A&&void 0===t.mantissa?0:y.mantissa,M=!b&&(void 0===t.optionalMantissa?-1===k:y.optionalMantissa),T=y.trimMantissa,D=y.thousandSeparated,E=y.spaceSeparated,O=y.negative,R=y.forceSign,I=y.exponential,P=y.roundingFunction,N="";if(A){let e=function({value:e,forceAverage:t,lowPrecision:n=!0,abbreviations:r,spaceSeparated:i=!1,totalLength:o=0,roundingFunction:s=Math.round}){let a="",l=Math.abs(e),u=-1;if(t&&r[t]&&nT[t]?(a=r[t],e/=nT[t]):l>=nT.trillion||n&&1===s(l/nT.trillion)?(a=r.trillion,e/=nT.trillion):l<nT.trillion&&l>=nT.billion||n&&1===s(l/nT.billion)?(a=r.billion,e/=nT.billion):l<nT.billion&&l>=nT.million||n&&1===s(l/nT.million)?(a=r.million,e/=nT.million):(l<nT.million&&l>=nT.thousand||n&&1===s(l/nT.thousand))&&(a=r.thousand,e/=nT.thousand),a&&(a=(i?" ":"")+a),o){let t=e<0,n=e.toString().split(".")[0];u=Math.max(o-(t?n.length-1:n.length),0)}return{value:e,abbreviation:a,mantissaPrecision:u}}({value:v,forceAverage:S,lowPrecision:C,abbreviations:n.currentAbbreviations(),spaceSeparated:E,roundingFunction:P,totalLength:b});v=e.value,N+=e.abbreviation,b&&(k=e.mantissaPrecision)}if(I){let e=function({value:e,characteristicPrecision:t}){let[n,r]=e.toExponential().split("e"),i=+n;return t&&1<t&&(i*=Math.pow(10,t-1),r-=t-1,r=r>=0?`+${r}`:r),{value:i,abbreviation:`e${r}`}}({value:v,characteristicPrecision:x});v=e.value,N=e.abbreviation+N}let L=function(e,t,n,r,i,o){if(-1===r)return e;let s=function(e,t,n=Math.round){return -1!==e.toString().indexOf("e")?function(e,t){let n=e.toString(),[r,i]=n.split("e"),[o,s=""]=r.split(".");if(+i>0)n=o+s+nL(i-s.length);else{let e=".";e=0>+o?`-0${e}`:`0${e}`;let r=(nL(-i-1)+Math.abs(o)+s).substr(0,t);r.length<t&&(r+=nL(t-r.length)),n=e+r}return+i>0&&t>0&&(n+=`.${nL(t)}`),n}(e,t):new nA(n(+`${e}e+${t}`)/Math.pow(10,t)).toFixed(t)}(t,r,o),[a,l=""]=s.toString().split(".");if(l.match(/^0+$/)&&(n||i))return a;let u=l.match(/0+$/);return i&&u?`${a}.${l.toString().slice(0,u.index)}`:s.toString()}(v.toString(),v,M,k,T,P);return o=L=function(e,t,n,r){let i=e,[o,s]=i.toString().split(".");if(o.match(/^-?0$/)&&n)return s?`${o.replace("0","")}.${s}`:o.replace("0","");let a=t<0&&0===o.indexOf("-");if(a&&(o=o.slice(1),i=i.slice(1)),o.length<r){let e=r-o.length;for(let t=0;t<e;t++)i=`0${i}`}return a&&(i=`-${i}`),i.toString()}(L,v,w,x),s=v,a=r,h=(c=n.currentDelimiters()).thousands,a=a||c.decimal,d=c.thousandsSize||3,p=(f=o.toString()).split(".")[0],m=f.split(".")[1],g=s<0&&0===p.indexOf("-"),D&&(g&&(p=p.slice(1)),(function(e,t){let n=[],r=0;for(let i=e;i>0;i--)r===t&&(n.unshift(i),r=0),r++;return n})(p.length,d).forEach((e,t)=>{p=p.slice(0,e+t)+h+p.slice(e+t)}),g&&(p=`-${p}`)),L=f=m?p+a+m:p,(A||I)&&(L+=N),(R||v<0)&&(l=L,L=0===(u=v)?l:0==+l?l.replace("-",""):u>0?`+${l}`:"sign"===O?l:`(${l.replace("-","")})`),L}function nF(e,t){if(!e)return t;let n=Object.keys(e);return 1===n.length&&"output"===n[0]?t:e}function nB(e,t,n){let r=new nA(e._value),i=t;return n.isNumbro(t)&&(i=t._value),i=new nA(i),e._value=r.minus(i).toNumber(),e}let n_=nS(),nz=nx(),nV={loadLanguagesInNode:e=>{e.forEach(e=>{let t;try{t=function(e){throw Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(`../languages/${e}`)}catch(t){console.error(`Unable to load "${e}". No matching language file found.`)}t&&nG.registerLanguage(t)})}},nH=nb(),n$={format:(...e)=>(function(e,t={},n){if("string"==typeof t&&(t=nw(t)),!nM.validateFormat(t))return"ERROR: invalid format";let r=t.prefix||"",i=t.postfix||"",o=function(e,t,n){var r,i,o;switch(t.output){case"currency":let s,a,l,u,c,h,d,f,p,m;return r=t=nF(t,nk.currentCurrencyDefaultFormat()),s=nk.currentCurrency(),l=Object.assign({},nD,a=Object.assign({},r)),c="",h=!!l.totalLength||!!l.forceAverage||l.average,d=a.currencyPosition||s.position,f=a.currencySymbol||s.symbol,p=void 0!==l.spaceSeparatedCurrency?l.spaceSeparatedCurrency:l.spaceSeparated,void 0===a.lowPrecision&&(a.lowPrecision=!1),p&&(c=" "),"infix"===d&&(u=c+f+c),m=nj({instance:e,providedFormat:a,state:nk,decimalSeparator:u}),"prefix"===d&&(m=e._value<0&&"sign"===l.negative?`-${c}${f}${m.slice(1)}`:e._value>0&&l.forceSign?`+${c}${f}${m.slice(1)}`:f+c+m),d&&"postfix"!==d||(m=m+(c=!l.spaceSeparatedAbbreviation&&h?"":c)+f),m;case"percent":let g,v,y;return i=t=nF(t,nk.currentPercentageDefaultFormat()),g=i.prefixSymbol,v=nj({instance:n(100*e._value),providedFormat:i,state:nk}),y=Object.assign({},nD,i),g?`%${y.spaceSeparated?" ":""}${v}`:`${v}${y.spaceSeparated?" ":""}%`;case"byte":return function(e,t,n,r){let i=t.base||"binary",o=Object.assign({},nD,t),{binarySuffixes:s,decimalSuffixes:a}=n.currentBytes(),l={general:{scale:1024,suffixes:a||nO,marker:"bd"},binary:{scale:1024,suffixes:s||nE,marker:"b"},decimal:{scale:1e3,suffixes:a||nO,marker:"d"}}[i],{value:u,suffix:c}=nN(e._value,l.suffixes,l.scale),h=nj({instance:r(u),providedFormat:t,state:n,defaults:n.currentByteDefaultFormat()});return`${h}${o.spaceSeparated?" ":""}${c}`}(e,t=nF(t,nk.currentByteDefaultFormat()),nk,n);case"time":let b,x,w;return t=nF(t,nk.currentTimeDefaultFormat()),b=Math.floor(e._value/60/60),x=Math.floor((e._value-60*b*60)/60),w=Math.round(e._value-60*b*60-60*x),`${b}:${x<10?"0":""}${x}:${w<10?"0":""}${w}`;case"ordinal":let S,C,A,k;return o=t=nF(t,nk.currentOrdinalDefaultFormat()),S=nk.currentOrdinal(),C=Object.assign({},nD,o),A=nj({instance:e,providedFormat:o,state:nk}),k=S(e._value),`${A}${C.spaceSeparated?" ":""}${k}`;default:return nj({instance:e,providedFormat:t,numbro:n})}}(e,t,n);return(o=r+o)+i})(...e,nG),getByteUnit:(...e)=>(function(e){return nN(e._value,nR.suffixes,nR.scale).suffix})(...e),getBinaryByteUnit:(...e)=>(function(e){return nN(e._value,nI.suffixes,nI.scale).suffix})(...e),getDecimalByteUnit:(...e)=>(function(e){return nN(e._value,nP.suffixes,nP.scale).suffix})(...e),formatOrDefault:nF},nW={add:(e,t)=>{let n,r;return n=new nA(e._value),r=t,nG.isNumbro(t)&&(r=t._value),r=new nA(r),e._value=n.plus(r).toNumber(),e},subtract:(e,t)=>nB(e,t,nG),multiply:(e,t)=>{let n,r;return n=new nA(e._value),r=t,nG.isNumbro(t)&&(r=t._value),r=new nA(r),e._value=n.times(r).toNumber(),e},divide:(e,t)=>{let n,r;return n=new nA(e._value),r=t,nG.isNumbro(t)&&(r=t._value),r=new nA(r),e._value=n.dividedBy(r).toNumber(),e},set:(e,t)=>{let n;return n=t,nG.isNumbro(t)&&(n=t._value),e._value=n,e},difference:(e,t)=>{let n;return nB(n=nG(e._value),t,nG),Math.abs(n._value)},BigNumber:nA};class nU{constructor(e){this._value=e}clone(){return nG(this._value)}format(e={}){return n$.format(this,e)}formatCurrency(e){return"string"==typeof e&&(e=nw(e)),(e=n$.formatOrDefault(e,n_.currentCurrencyDefaultFormat())).output="currency",n$.format(this,e)}formatTime(e={}){return e.output="time",n$.format(this,e)}binaryByteUnits(){return n$.getBinaryByteUnit(this)}decimalByteUnits(){return n$.getDecimalByteUnit(this)}byteUnits(){return n$.getByteUnit(this)}difference(e){return nW.difference(this,e)}add(e){return nW.add(this,e)}subtract(e){return nW.subtract(this,e)}multiply(e){return nW.multiply(this,e)}divide(e){return nW.divide(this,e)}set(e){return nW.set(this,nq(e))}value(){return this._value}valueOf(){return this._value}}function nq(e){let t=e;return nG.isNumbro(e)?t=e._value:"string"==typeof e?t=nG.unformat(e):isNaN(e)&&(t=NaN),t}function nG(e){return new nU(nq(e))}nG.version="2.5.0",nG.isNumbro=function(e){return e instanceof nU},nG.language=n_.currentLanguage,nG.registerLanguage=n_.registerLanguage,nG.setLanguage=n_.setLanguage,nG.languages=n_.languages,nG.languageData=n_.languageData,nG.zeroFormat=n_.setZeroFormat,nG.defaultFormat=n_.currentDefaults,nG.setDefaults=n_.setDefaults,nG.defaultCurrencyFormat=n_.currentCurrencyDefaultFormat,nG.validate=nz.validate,nG.loadLanguagesInNode=nV.loadLanguagesInNode,nG.unformat=nH.unformat,nG.BigNumber=nW.BigNumber;var nY=nG&&nG.__esModule&&Object.prototype.hasOwnProperty.call(nG,"default")?nG.default:nG;let nK={label:"Bits",decimalPlaces:!0,shortValues:!0},nZ={bits:{group:"Bits",label:"Bits (IEC)"},decbits:{group:"Bits",label:"Bits (SI)"}};function nX(e,{unit:t="bits",shortValues:n,decimalPlaces:r}){let i="decbits"===t;if(!nl(n)||Math.abs(e)<(i?1e3:1024)){let i={style:"decimal",useGrouping:!0};nu(r)?(i.minimumFractionDigits=nc(r),i.maximumFractionDigits=nc(r)):nl(n)&&(i.maximumSignificantDigits=3);let o=[i.style,i.useGrouping,i.maximumSignificantDigits,r,n,t];return`${ns(o,"bits",i,"en-US")(e)} bits`}return nY(e).format({output:"byte",base:i?"decimal":"binary",spaceSeparated:!0,mantissa:nu(r)?r:2,trimMantissa:!nu(r),optionalMantissa:!nu(r)}).replace(/KB/g,"Kb").replace(/MB/g,"Mb").replace(/GB/g,"Gb").replace(/TB/g,"Tb").replace(/PB/g,"Pb").replace(/EB/g,"Eb").replace(/KiB/g,"Kib").replace(/MiB/g,"Mib").replace(/GiB/g,"Gib").replace(/TiB/g,"Tib").replace(/PiB/g,"Pib").replace(/EiB/g,"Eib")}let nQ={label:"Bytes",decimalPlaces:!0,shortValues:!0},nJ={bytes:{group:"Bytes",label:"Bytes (IEC)"},decbytes:{group:"Bytes",label:"Bytes (SI)"}};function n0(e,{unit:t="bytes",shortValues:n,decimalPlaces:r}){let i="decbytes"===t;if(!nl(n)||Math.abs(e)<(i?1e3:1024)){let i={style:"unit",unit:"byte",unitDisplay:"long",useGrouping:!0};return nu(r)?(i.minimumFractionDigits=nc(r),i.maximumFractionDigits=nc(r)):nl(n)&&(i.maximumSignificantDigits=3),ns([i.style,i.unit,i.unitDisplay,i.useGrouping,i.maximumSignificantDigits,r,n,t],"bytes",i,"en-US")(e)}return nY(e).format({output:"byte",base:i?"decimal":"binary",spaceSeparated:!0,mantissa:nu(r)?r:2,trimMantissa:!nu(r),optionalMantissa:!nu(r)})}var n1=n(40224);let n2="Currency",n5={label:"Currency",decimalPlaces:!0},n4={aud:{group:n2,label:"Australian Dollar (A$)"},cad:{group:n2,label:"Canadian Dollar (CA$)"},chf:{group:n2,label:"Swiss Franc (CHF)"},cny:{group:n2,label:"Renminbi (CN\xa5)"},eur:{group:n2,label:"Euro (€)"},gbp:{group:n2,label:"Pound (\xa3)"},hkd:{group:n2,label:"Hong Kong Dollar (HK$)"},inr:{group:n2,label:"Indian Rupee (₹)"},jpy:{group:n2,label:"Yen (\xa5)"},krw:{group:n2,label:"South Korean Won (₩)"},nok:{group:n2,label:"Norwegian Krone (NOK)"},nzd:{group:n2,label:"New Zealand Dollar (NZ$)"},sek:{group:n2,label:"Swedish Krona (SEK)"},sgd:{group:n2,label:"Singapore Dollar (S$)"},usd:{group:n2,label:"US Dollar ($)"}};function n3(e,{unit:t,decimalPlaces:n}){let r={style:"currency",currency:(0,n1.toUpper)(t),currencyDisplay:"symbol"};return nu(n)?(r.minimumFractionDigits=nc(n),r.maximumFractionDigits=nc(n)):r.maximumSignificantDigits=3,ns([r.style,r.currency,r.currencyDisplay,r.maximumSignificantDigits,n,t],"currency",r,"en-US")(e)}let n6={label:"percent",decimalPlaces:!0},n8="Percent",n9={percent:{group:n8,label:"Percent (0-100)"},"percent-decimal":{group:n8,label:"Percent (0.0-1.0)"},"%":{disableSelectorOption:!0,group:n8,label:"%"}};function n7(e,{unit:t,decimalPlaces:n}){let r={style:"percent",useGrouping:!0};return nu(n)?(r.minimumFractionDigits=nc(n),r.maximumFractionDigits=nc(n)):r.maximumSignificantDigits=3,"percent"===t&&(e/=100),ns([r.style,r.useGrouping,r.maximumSignificantDigits,n,t],"percent",r,"en-US")(e)}let re="Temperature",rt={label:re,decimalPlaces:!0},rn={celsius:{group:re,label:"Celsius (\xb0C)"},fahrenheit:{group:re,label:"Fahrenheit (\xb0F)"}},rr=(e,{unit:t,decimalPlaces:n})=>{let r={unit:t,style:"unit"};nu(n)?(r.minimumFractionDigits=nc(n),r.maximumFractionDigits=nc(n)):r.maximumSignificantDigits=3;let i="celsius"===t?"en-GB":"en-US";return ns([r.style,r.unit,r.maximumSignificantDigits,n,i],"temperature",r,i)(e)},ri={label:"Decimal",decimalPlaces:!0,shortValues:!0},ro={decimal:{group:"Decimal",label:"Decimal"}};function rs(e,{shortValues:t,decimalPlaces:n}){let r={style:"decimal",useGrouping:!0};return nl(t)&&(r.notation="compact"),nu(n)?(r.minimumFractionDigits=nc(n),r.maximumFractionDigits=nc(n)):nl(t)&&(r.maximumSignificantDigits=3),ns([r.style,r.useGrouping,r.notation,r.maximumSignificantDigits,n],"decimal",r,"en-US")(e)}let ra={label:"Throughput",decimalPlaces:!0},rl="Throughput",ru={"bits/sec":{group:rl,label:"Bits/sec (IEC)"},"decbits/sec":{group:rl,label:"Bits/sec (SI)"},"bytes/sec":{group:rl,label:"Bytes/sec (IEC)"},"decbytes/sec":{group:rl,label:"Bytes/sec (SI)"},"counts/sec":{group:rl,label:"Counts/sec"},"events/sec":{group:rl,label:"Events/sec"},"messages/sec":{group:rl,label:"Messages/sec"},"ops/sec":{group:rl,label:"Ops/sec"},"packets/sec":{group:rl,label:"Packets/sec"},"reads/sec":{group:rl,label:"Reads/sec"},"requests/sec":{group:rl,label:"Requests/sec"},"records/sec":{group:rl,label:"Records/sec"},"rows/sec":{group:rl,label:"Rows/sec"},"writes/sec":{group:rl,label:"Writes/sec"}};function rc(e,{unit:t,shortValues:n,decimalPlaces:r}){if("bits/sec"===t){let t=1024>Math.abs(e)?"sec":"s";return nX(e,{unit:"bits",shortValues:n,decimalPlaces:r})+"/"+t}if("decbits/sec"===t){let t=1e3>Math.abs(e)?"sec":"s";return nX(e,{unit:"decbits",shortValues:n,decimalPlaces:r})+"/"+t}if("decbytes/sec"===t){let t=1e3>Math.abs(e)?"sec":"s";return n0(e,{unit:"decbytes",shortValues:n,decimalPlaces:r})+"/"+t}if("bytes/sec"===t){let t=1024>Math.abs(e)?"sec":"s";return n0(e,{unit:"bytes",shortValues:n,decimalPlaces:r})+"/"+t}let i={style:"decimal",useGrouping:!0};nl(n)&&(i.notation="compact"),nu(r)?(i.minimumFractionDigits=nc(r),i.maximumFractionDigits=nc(r)):nl(n)&&(i.maximumSignificantDigits=3);let o=[i.style,i.useGrouping,i.notation,i.maximumSignificantDigits,r,n,t];return`${ns(o,"throughput",i,"en-US")(e)} ${t}`}let rh="Date",rd={Time:nd,Percent:n6,Decimal:ri,Bytes:nQ,Bits:nK,Throughput:ra,Currency:n5,Temperature:rt,Date:{label:"Date & Time"}},rf={...nf,...n9,...ro,...nJ,...nZ,...ru,...n4,...rn,"datetime-iso":{group:rh,label:"DateTime (GMT)"},"datetime-us":{group:rh,label:"DateTime (US-East)"},"datetime-local":{group:rh,label:"DateTime (Browser Local)"},"date-iso":{group:rh,label:"Date (GMT)"},"date-us":{group:rh,label:"Date (US-East)"},"date-local":{group:rh,label:"Date (Browser Local)"},"time-local":{group:rh,label:"Time (Browser Local)"},"time-iso":{group:rh,label:"Time (GMT)"},"time-us":{group:rh,label:"Time (US-East)"},"relative-time":{group:rh,label:"Relative Time"},"unix-timestamp":{group:rh,label:"Unix Timestamp (s)"},"unix-timestamp-ms":{group:rh,label:"Unix Timestamp (ms)"}};function rp(e,t){if(!t)return e.toString();if(rw(t))return n0(e,t);if(rS(t))return nX(e,t);if(rx(t))return rs(e,t);if(rb(t))return n7(e,t);if(ry(t))return nv(e,t);if(rk(t))return rc(e,t);if(rM(t))return n3(e,t);if(rT(t))return function(e,t={}){let n=Intl.DateTimeFormat().resolvedOptions().timeZone,{unit:r="datetime-local",locale:i=(()=>{if("u">typeof navigator){if(navigator.language)return navigator.language;if(navigator.languages&&navigator.languages.length>0){let e=navigator.languages[0];if(e)return e}let e=navigator;if(e.userLanguage)return e.userLanguage;if(e.browserLanguage)return e.browserLanguage;if(e.systemLanguage)return e.systemLanguage}return Intl.DateTimeFormat().resolvedOptions().locale||"en-US"})(),timeZone:o=n,referenceTime:s=Date.now()}=t;if("unix-timestamp"===r)return(e>1e12?Math.floor(e/1e3):e).toString();if("unix-timestamp-ms"===r)return Math.floor(e<1e11?1e3*e:e).toString();let a=function(e){if(e<0)if(Math.abs(e)>1e10)return new Date(e);else return new Date(1e3*e);if(e>=25e10&&e<=26e10){let t=new Date(1e3*e);if(t.getUTCFullYear()>=9999)return t}return new Date(e<1e10?1e3*e:e)}(e);if("relative-time"===r){let e=new Date(s),t=a.getTime()-e.getTime();for(let{unit:e,ms:n}of[{unit:"year",ms:31536e6},{unit:"month",ms:2592e6},{unit:"week",ms:6048e5},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}]){let r=Math.round(t/n);if(Math.abs(r)>=1)return new Intl.RelativeTimeFormat(i,{numeric:"auto"}).format(r,e)}return new Intl.RelativeTimeFormat(i,{numeric:"auto"}).format(0,"second")}let l={timeZone:o};switch(r){case"datetime-iso":return a.toISOString();case"datetime-us":return l.timeZone="America/New_York",l.year="numeric",l.month="2-digit",l.day="2-digit",l.hour="2-digit",l.minute="2-digit",l.second="2-digit",l.hour12=!0,new Intl.DateTimeFormat("en-US",l).format(a);case"datetime-local":l.year="numeric",l.month="2-digit",l.day="2-digit",l.hour="2-digit",l.minute="2-digit",l.second="2-digit",l.hour12=!1;break;case"date-iso":return a.toISOString().split("T")[0];case"date-us":return l.timeZone="America/New_York",l.year="numeric",l.month="2-digit",l.day="2-digit",new Intl.DateTimeFormat("en-US",l).format(a);case"date-local":l.year="numeric",l.month="2-digit",l.day="2-digit";break;case"time-local":l.hour="2-digit",l.minute="2-digit",l.second="2-digit",l.hour12=!1;break;case"time-iso":return a.toISOString().split("T")[1].replace("Z","");case"time-us":return l.timeZone="America/New_York",l.hour="2-digit",l.minute="2-digit",l.second="2-digit",l.hour12=!0,new Intl.DateTimeFormat("en-US",l).format(a);default:throw Error(`Unknown date unit: ${r}`)}return new Intl.DateTimeFormat(i,l).format(a)}(e,t);if(rD(t))return rr(e,t);throw Error(`Unknown unit options ${t}`)}function rm(e){return rf[e.unit??"decimal"]}function rg(e){return rm(e).group??"Decimal"}function rv(e){return rd[rm(e).group??"Decimal"]}function ry(e){return"Time"===rg(e)}function rb(e){return"Percent"===rg(e)}function rx(e){return"Decimal"===rg(e)}function rw(e){return"Bytes"===rg(e)}function rS(e){return"Bits"===rg(e)}function rC(e){return!!rv(e).decimalPlaces}function rA(e){return!!rv(e).shortValues}function rk(e){return"Throughput"===rg(e)}function rM(e){return"Currency"===rg(e)}function rT(e){return"Date"===rg(e)}function rD(e){return"Temperature"===rg(e)}let rE={JoinByColumnValue:"Join by column value",MergeColumns:"Merge columns",MergeIndexedColumns:"Merge indexed columns",MergeSeries:"Merge series",ExtractColumnFields:"Extract column fields"};function rO(e,t){return[tZ({type:"value",boundaryGap:[0,"10%"],axisLabel:{formatter:e=>rp(e,t)}},e)]}function rR(e,t,n,r){let i=[],o=tZ({type:"value",position:"left",boundaryGap:[0,"10%"],axisLabel:{formatter:e=>rp(e,t),overflow:"truncate"}},e);i.push(o);let s=0;return n.forEach((t,n)=>{let o,a,l={type:"value",position:"right",offset:s,boundaryGap:[0,"10%"],axisLabel:{formatter:e=>rp(e,t)},splitLine:{show:!1},show:e?.show};i.push(l),r&&(s+=(o=rp(r[n]??1e3,t),((a=document.createElement("canvas").getContext("2d"))?(a.font="12px sans-serif",a.measureText(o).width):6*o.length)+10))}),i}function rI(e,t){let{value:n,setValueAndStore:r}=function(e,t,n){let[r,i]=(0,w.useState)(()=>{try{let n=e.getItem(t);if(null!==n)return JSON.parse(n)}catch{}return e.setItem(t,JSON.stringify(n)),n}),o=(0,w.useCallback)(n=>{i(n),e.setItem(t,JSON.stringify(n))},[i,e,t]);return{value:r,setValue:i,setValueAndStore:o}}(window.localStorage,e,t);return[n,r]}function rP(e){let t=e._model;void 0!==t&&void 0!==t.option.toolbox&&t.option.toolbox.length>0&&"normal"===t.option.toolbox[0].feature.dataZoom.iconStatus.zoom&&e.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:!0})}function rN(e){e.dispatchAction({type:"restore"})}function rL(e){void 0!==e.dispatchAction&&(e.dispatchAction({type:"unselect"}),e.dispatchAction({type:"downplay"}))}function rj(e,t,n){if(void 0===n)return null;let r=[e,t];return n.containPixel("grid",r)?n.convertFromPixel("grid",r):null}function rF(e,t,n,r,i,o){let s=o.length>0?o[o.length-1]:i[i.length-1];void 0!==s&&e.dispatchAction({type:"select",seriesIndex:s.seriesIndex,dataIndex:s.dataIndex,escapeConnect:!0}),e.dispatchAction({type:"downplay"}),r.length>0&&e.dispatchAction({type:"downplay",seriesIndex:r}),n.length>0?e.dispatchAction({type:"highlight",seriesIndex:n,notBlur:!1,escapeConnect:!0}):(e.dispatchAction({type:"highlight",seriesIndex:t,notBlur:!0,escapeConnect:!0}),e.dispatchAction({type:"toggleSelect"}))}function rB(e){return e[e.length-1]?.name===tX}function r_(e,t){if(void 0===e||void 0===t)return null;let n=null,r=1/0;for(let[i]of e){let e=Math.abs(i-t);e<r&&(n=i,r=e)}return n}function rz(e,t){if(void 0===t)return null;let n=e.length,r=null;for(let i=0;i<n;i++){let o=n>0?e[i]:null;if(!o)break;r=r_(o.values,t)}return r}function rV(...e){return e.flatMap(e=>void 0===e?[]:Array.isArray(e)?e:[e])}function rH(e){void 0===globalThis.useIdValue&&(globalThis.useIdValue=0);let t=(0,w.useRef)(void 0);return void 0===t.current&&(t.current=`${e}-${globalThis.useIdValue++}`),t.current}var r$=((oQ={}).CSV="csv",oQ.DISTRIBUTED="distributed",oQ.DOUBLEQUOTE="doublequote",oQ.GLOB="glob",oQ.JSON="json",oQ.LUCENE="lucene",oQ.PERCENTENCODE="percentencode",oQ.PIPE="pipe",oQ.PROMETHEUS="prometheus",oQ.RAW="raw",oQ.REGEX="regex",oQ.SINGLEQUOTE="singlequote",oQ.SQLSTRING="sqlstring",oQ.TEXT="text",oQ.QUERYPARAM="queryparam",oQ.REGEX_LITERAL="regexliteral",oQ);function rW(e){if(!e)return;let t=e.toLowerCase();return Object.values(r$).find(e=>e===t)||void 0}function rU(e,t,n){switch(n){case"csv":case"raw":return e.join(",");case"distributed":{let[n,...r]=e;return`${[n,...r.map(e=>`${t}=${e}`)].join(",")}`}case"doublequote":return e.map(e=>`"${e}"`).join(",");case"glob":return`{${e.join(",")}}`;case"json":return JSON.stringify(e.map(e=>{try{return JSON.parse(e)}catch{return e}}));case"lucene":return`(${e.map(e=>`"${e}"`).join(" OR ")})`;case"percentencode":return encodeURIComponent(e.join(","));case"pipe":return e.join("|");case"regex":{let t=e.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"));return`(${t.join("|")})`}case"regexliteral":{let t=e.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\\\$&"));return`(${t.join("|")})`}case"singlequote":return e.map(e=>`'${e}'`).join(",");case"sqlstring":return e.map(e=>`'${e.replace(/'/g,"''")}'`).join(",");case"text":return e.join(" + ");case"queryparam":return e.map(e=>`${t}=${encodeURIComponent(e)}`).join("&");default:return`(${e.join("|")})`}}function rq(e,t,n,r){let i="$"+t,o="${"+t+(r?":"+r:"")+"}",s="";return Array.isArray(n)&&(s=rU(n,t,r||"prometheus")),"string"==typeof n&&(s=rU([n],t,r||"raw")),(e=e.replaceAll(i,s)).replaceAll(o,s)}let rG=/\$(\w+)|\${(\w+)(?:\.([^:^}]+))?(?::([^}]+))?}/gm;function rY(e){let t,n=new Set;for(;null!==(t=rG.exec(e));)t&&(t[1]?n.add(t[1]):t[2]&&n.add(t[2]));return Array.from(n.values())}function rK(e){let t,n=new Map;for(;null!==(t=rG.exec(e));)if(t){let e;t[4]&&(e=t[4]),t[1]?n.set(t[1],rW(e)):t[2]&&n.set(t[2],rW(e))}return n}function rZ(e,t){let n=rK(e),r=Array.from(n.keys()),i=e;return r.toSorted((e,t)=>t.length-e.length).forEach(e=>{let r=t[e];r&&void 0!==r.value&&(i=rq(i,e,r?.value,n.get(e)))}),i}function rX(e,t){let n={};for(let[e,r]of Object.entries(t))n[e]=void 0===r.displayValue?r:{...r,value:r.displayValue};return rZ(e,n)}let rQ=/\$\{__data\.fields(?:\[(?:"|')([^"']+)(?:"|')\]|\.([a-zA-Z_][a-zA-Z0-9_]*))(?::([a-z]+))?\}/g,rJ=/\$\{__data\[(\d+)\]\.fields\[(?:"|')([^"']+)(?:"|')\]\}/g,r0=/\$\{__data\.index\}/g,r1=/\$\{__data\.count\}/g,r2=/("|')?\$\{__data(?::([a-z]+))?\}("|')?/g;function r5(e,t){if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];return null==n?"":"object"==typeof n?JSON.stringify(n):String(n)}if(t.includes(".")){let n=t.split("."),r=e;for(let e of n){if(null==r||"object"!=typeof r)return"";r=r[e]}return null==r?"":"object"==typeof r?JSON.stringify(r):String(r)}return""}function r4(e){if(!e)return;let t=e.toLowerCase();return Object.values(r$).find(e=>e===t)}function r3(e,t,n={}){let{urlEncode:r=!0,index:i,count:o}=n,s=e,a=[];return void 0!==i&&(s=s.replaceAll(r0,String(i))),void 0!==o&&(s=s.replaceAll(r1,String(o))),s=s.replaceAll(r2,(e,n,r,i)=>{let o=r4(r)??r$.RAW;return o===r$.JSON?JSON.stringify(t):rU(Object.values(t).map(e=>JSON.stringify(e)),"",o)}),rQ.lastIndex=0,{text:s=s.replaceAll(rQ,(e,n,i,o)=>{let s=n??i??"",l=r5(t,s);""===l&&void 0===t[s]&&a.push(`Field "${s}" not found in data`);let u=r4(o);if(u)return rU([l],s,u);if(r){if(u===r$.RAW)return l;if(u!==r$.QUERYPARAM&&u!==r$.PERCENTENCODE)return encodeURIComponent(l)}return l}),errors:a.length>0?a:void 0}}function r6(e,t,n={}){let{urlEncode:r=!0}=n,i=e,o=[];return i=i.replaceAll(r1,String(t.length)),rJ.lastIndex=0,rQ.lastIndex=0,{text:i=(i=(i=i.replaceAll(r2,(e,n,r,i)=>{let o=r4(r)??r$.RAW,s=rU(Object.values(t).map(e=>JSON.stringify(e)),"",o);return n&&i?s:`${n??""}${s}${i??""}`})).replaceAll(rJ,(e,n,i)=>{let s=parseInt(n,10);if(s<0||s>=t.length)return o.push(`Index ${s} out of bounds (0-${t.length-1})`),e;let a=r5(t[s],i);return""===a&&void 0===t[s][i]&&o.push(`Field "${i}" not found in data at index ${s}`),r?encodeURIComponent(a):a})).replaceAll(rQ,(e,n,r,i)=>{let o=n??r??"";return rU(t.map(e=>r5(e,o)),o,r4(i)||r$.CSV)}),errors:o.length>0?o:void 0}}function r8(e){return rJ.lastIndex=0,rJ.test(e)||/\$\{__data\.fields(?:\[["'][^"']+["']\]|\.[a-zA-Z_][a-zA-Z0-9_]*):[a-z]+\}/.test(e)}function r9(e){return rJ.lastIndex=0,rJ.test(e)}function r7(e){return rQ.lastIndex=0,rJ.lastIndex=0,rQ.test(e)||rJ.test(e)}function ie(e){let t,n=new Set;for(rQ.lastIndex=0,rJ.lastIndex=0;null!==(t=rQ.exec(e));)n.add(t[1]??t[2]);for(;null!==(t=rJ.exec(e));)n.add(t[2]);return Array.from(n)}Symbol.for("constructDateFrom");let it={},ir={};function ii(e,t){try{let n=(it[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];if(n in ir)return ir[n];return is(n,n.split(":"))}catch{if(e in ir)return ir[e];let t=e?.match(io);if(t)return is(e,t.slice(1));return NaN}}let io=/([+-]\d\d):?(\d\d)?/;function is(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return ir[e]=60*n+r>0?60*n+r+i:60*n-r-i}class ia extends Date{constructor(...e){super(),e.length>1&&"string"==typeof e[e.length-1]&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(ii(this.timeZone,this))?this.setTime(NaN):e.length?"number"==typeof e[0]&&(1===e.length||2===e.length&&"number"!=typeof e[1])?this.setTime(e[0]):"string"==typeof e[0]?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),ic(this,e)):this.setTime(Date.now())}static tz(e,...t){return t.length?new ia(...t,e):new ia(Date.now(),e)}withTimeZone(e){return new ia(+this,e)}getTimezoneOffset(){let e=-ii(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),iu(this),+this}[Symbol.for("constructDateFrom")](e){return new ia(+new Date(e),this.timeZone)}}let il=/^(get|set)(?!UTC)/;function iu(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-(60*ii(e.timeZone,e))))}function ic(e,t){var n;let r=Array.isArray(t)?Date.UTC((n=t)[0],n.length>1?n[1]:0,n.length>2?n[2]:1,...n.slice(3)):+e.internal,i=ii(e.timeZone,e),o=i>0?Math.floor(i):Math.ceil(i),s=new Date(+e);s.setUTCHours(s.getUTCHours()-1);let a=-new Date(+e).getTimezoneOffset(),l=-new Date(+s).getTimezoneOffset(),u=a;if(a-l&&a!==o&&Date.prototype.getHours.apply(e)!==(Array.isArray(t)?t[3]||0:e.internal.getUTCHours())){let t=new Date(+e),n=a-o;n&&t.setUTCMinutes(t.getUTCMinutes()+n);let r=ii(e.timeZone,t);(r>0?Math.floor(r):Math.ceil(r))===o&&(u=l)}let c=u-o;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);let h=new Date(+e);h.setUTCSeconds(0);let d=a>0?h.getSeconds():(h.getSeconds()-60)%60,f=Math.round(-(60*ii(e.timeZone,e)))%60;(f||d)&&Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+f+d);let p=ii(e.timeZone,e),m=p>0?Math.floor(p):Math.ceil(p),g=-new Date(+e).getTimezoneOffset()-m-c,v=m-o,y=v>0&&ih(e)-r==60*v*1e3&&ih(e,r-60*m*1e3)!==r;if(m!==o&&g&&!y){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+g);let t=ii(e.timeZone,e),n=m-(t>0?Math.floor(t):Math.ceil(t));n&&g<0&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n)}iu(e);let b=(t?r:r+1e3*f)-e.internal;b&&18e5>Math.abs(b)&&(Date.prototype.setTime.call(e,+e+b),iu(e))}function ih(e,t){let n=new Date(t??+e);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-(60*ii(e.timeZone,n)))),+n}Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!il.test(e))return;let t=e.replace(il,"$1UTC");ia.prototype[t]&&(e.startsWith("get")?ia.prototype[e]=function(){return this.internal[t]()}:(ia.prototype[e]=function(){var e;return Date.prototype[t].apply(this.internal,arguments),e=this,Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),ic(e),+this},ia.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),iu(this),+this}))});class id extends ia{static tz(e,...t){return t.length?new id(...t,e):new id(Date.now(),e)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(" ")[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${function(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset(),t=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),n=String(Math.abs(e)%60).padStart(2,"0");return[e>0?"-":"+",t,n]}withTimeZone(e){return new id(+this,e)}[Symbol.for("constructDateFrom")](e){return new id(+new Date(e),this.timeZone)}}function ip(e,t){if(t){let n=t.toLowerCase();if("local"!==n&&"browser"!==n)return{...e,timeZone:"utc"===n?"UTC":t}}return e}function im(e,t,n){let r,i=n?.toLowerCase();if(!n||"local"===i||"browser"===i)return(0,t0.format)(e,t);return(0,t0.format)(e,t,{in:(r="utc"===i?"UTC":n,e=>id.tz(r,+new Date(e)))})}function ig(e){let t=e?.toLowerCase(),n=e;e&&"local"!==t&&"browser"!==t?"utc"===t&&(n="UTC"):n=Intl.DateTimeFormat().resolvedOptions().timeZone;try{let e=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"shortOffset"}).formatToParts(new Date).find(e=>"timeZoneName"===e.type),t=e?.value??"";if("GMT"===t)return"GMT+0";return t}catch{return"GMT+0"}}function iv(e){return e>15768e7?"{yyyy}":e>63072e6?"{MMM} {yyyy}":e>432e6&&e<1577664e4?"{MM}/{dd}":e>1728e5&&e<=432e6?"{MM}/{dd} {HH}:{mm}":{year:"{yearStyle|{yyyy}}\n{monthStyle|{MMM}}",month:"{MMM}",day:"{MM}/{dd}"}}let iy=(e,t)=>{if(!e)return{formattedDate:"",formattedTime:""};let n=new Date(e);return{formattedDate:t?t(n,"MMM dd, yyyy"):(0,t0.format)(n,"MMM dd, yyyy"),formattedTime:t?t(n,"HH:mm:ss"):(0,t0.format)(n,"HH:mm:ss")}};var ib=n(18264);function ix(e,t){let n=(0,w.useRef)(),r=!0;for(let e=0;e<t.length;e++)if(n.current?.deps[e]!==t[e]){r=!1;break}return(void 0===n.current||!1===r)&&(n.current={value:e(),deps:t}),n.current.value}function iw(e,t){let n=(0,w.useRef)();return(void 0===n.current||!1===ib(t,n.current.deps))&&(n.current={value:e(),deps:t}),n.current.value}function iS(e){return!!e?.startsWith("/")}function iC(e){if(!e)throw Error("Input string cannot be empty");if(!iS(e))return RegExp(`^${e}$`);let t=e.match(/^\/(.+)\/([gimy]*)$/);if(!t)throw Error(`Invalid regular expression format: ${e}`);let[,n="",r=""]=t;try{return new RegExp(n,r)}catch(e){throw Error(`Failed to create RegExp ${e}`,{cause:e})}}function iA(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=rZ(i,t);return n}function ik(e,t){let n={};for(let[r,i]of Object.entries(e))Array.isArray(i)?n[r]=i.map(e=>rZ(e,t)):n[r]=function e(t,n){if(Array.isArray(t))return t.map(t=>e(t,n));for(let[e,r]of rK(t)){let i,o=n[e];if(!o)continue;let s=o.options??[],a=s.map(e=>e.value),l=Array.isArray(o.value),u=void 0!==o.customAllValue;if(l)i=o.value;else if(u)try{let e=iC(o.customAllValue),t=s.filter(t=>e.test(t.value)).map(e=>e.value);i=t.length>0?t:a}catch{i=a}if(i&&(!r||r===r$.QUERYPARAM)){let o="$"+e,s=r?"${"+e+":"+r+"}":"${"+e+"}";return i.map(e=>{let r=t;return rZ(r=(r=r.replaceAll(s,e)).replaceAll(o,e),n)})}}return rZ(t,n)}(i,t);return n}function iM(e,t,n,r,i){let o=r3(e,t,{index:n,count:r}),s=o.text,a=[];return o.errors&&a.push(...o.errors.map(e=>e.replace("in data","in selection data"))),i&&(s=rZ(s,i)),{text:s,errors:a.length>0?a:void 0}}function iT(e,t,n){let r=r6(e,t),i=r.text,o=[];return r.errors&&o.push(...r.errors.map(e=>e.replace("in data","in selection data"))),n&&(i=rZ(i,n)),{text:i,errors:o.length>0?o:void 0}}function iD(e,t){let n=e.palette.text?.primary??"#222";return tZ({echartsTheme:{title:{show:!1},textStyle:{color:n,fontFamily:e.typography.fontFamily,fontSize:12},grid:{top:5,right:20,bottom:0,left:20,containLabel:!0},color:["#56B4E9","#009E73","#0072B2","#CC79A7","#F0E442","#E69F00","#D55E00"],categoryAxis:{show:!0,axisLabel:{show:!0,color:n,margin:15},axisTick:{show:!1,length:6,lineStyle:{color:e.palette.grey[600]}},axisLine:{show:!0,lineStyle:{color:e.palette.grey[600]}},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.4}},splitArea:{show:!1,areaStyle:{color:[e.palette.grey[300]]}}},timeAxis:{show:!0,axisLabel:{show:!0,color:n,margin:15},axisTick:{show:!1,length:6,lineStyle:{color:e.palette.grey[600]}},axisLine:{show:!0,lineStyle:{color:e.palette.grey[600]}},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.4}},splitArea:{show:!1,areaStyle:{color:[e.palette.grey[300]]}}},valueAxis:{show:!0,axisLabel:{color:n,margin:12},axisLine:{show:!1},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.6}}},legend:{orient:"horizontal",textStyle:{color:n},pageTextStyle:{color:e.palette.grey[600]},pageIconColor:e?.palette?.action?.active,pageIconInactiveColor:e?.palette?.action?.disabled},toolbox:{show:!0,top:10,right:10,iconStyle:{borderColor:n}},tooltip:{backgroundColor:e.palette.designSystem?.grey[800],borderColor:e.palette.designSystem?.grey[800],textStyle:{color:"#fff",fontSize:11}},axisPointer:{lineStyle:{color:e.palette.grey[500]}},markLine:{symbol:"none",symbolSize:0,itemStyle:{color:e.palette.grey[500]},lineStyle:{type:"dashed",width:1}},line:{showSymbol:!1,symbol:"circle",symbolSize:4,smooth:!1,lineStyle:{width:1},emphasis:{lineStyle:{width:1.5}}},bar:{barMaxWidth:150,itemStyle:{borderWidth:0,borderRadius:0,borderColor:e.palette.grey[300]},label:{show:!1,color:n}},gauge:{detail:{fontSize:18,fontWeight:600,valueAnimation:!1},splitLine:{distance:0,length:4,lineStyle:{width:1}},splitNumber:12}},noDataOption:{title:{show:!0,textStyle:{color:n,fontSize:16,fontWeight:400},text:"No data",left:"center",top:"center"},xAxis:{show:!1},yAxis:{show:!1}},sparkline:{width:2,color:"#1976d2"},container:{padding:{default:parseInt(e.spacing(1.5),10)}},thresholds:{defaultColor:e.palette.success.main,palette:["#FFCC00",e.palette.warning.main,e.palette.error.main]}},t)}function iE(e,t=[]){if(!t.length)return{value:e};let n={value:e};return t.forEach(t=>{switch(t.kind){case"Value":{let r=t.spec;String(r.value)===String(e)&&(n.value=r.result.value||n.value,n.color=r.result.color);break}case"Range":{let r=t.spec;if(void 0===r.from&&void 0===r.to)break;let i=void 0!==r.from?r.from:-1/0,o=void 0!==r.to?r.to:1/0;e>=i&&e<=o&&(n.value=r.result.value||n.value,n.color=r.result.color);break}case"Regex":{let r=t.spec,i=e.toString();if(!r.pattern)break;let o=iC(r.pattern);i.match(o)&&null!==r.result.value&&(n.value=i.replace(o,r.result.value.toString()||"")||n.value,n.color=r.result.color);break}case"Misc":{let r=t.spec;(function(e,t){switch(e){case"empty":return""===t;case"null":return null==t;case"NaN":return Number.isNaN(t);case"true":return!0===t;case"false":return!1===t;default:return!1}})(r.value,e)&&(n.value=r.result.value||n.value,n.color=r.result.color)}}}),n}function iO(e,t){if(0===t.length)return e;let n={};for(let r of e){let e=Object.keys(r).filter(e=>t.includes(e)).map(e=>r[e]).join("|"),i=n[e];i?n[e]={...i,...r}:n[e]={...r}}return Object.values(n)}function iR(e,t,n){let r=[];for(let i of e){let e=Object.keys(i).filter(e=>t.includes(e)),o={};for(let t of e)o[t]=i[t],delete i[t];for(let t of e)r.push({...i,[n]:o[t]});0===e.length&&r.push(i)}return r}function iI(e,t){let n=[];for(let r of e){let e=Object.keys(r).filter(e=>RegExp("^(("+t+" #\\d+)|("+t+"))$").test(e)),i={};for(let t of e)i[t]=r[t],delete r[t];for(let o of e)n.push({...r,[t]:i[o]});0===e.length&&n.push(r)}return n}function iP(e){let t=[...e],n=Array.from(new Set(e.flatMap(Object.keys).map(e=>e.replace(/ #\d+/,"")).filter(e=>"value"!==e)));for(let e of n)t=iI(t,e);return iO(t,n)}function iN(e,t){let n=e;for(let e of t??[])if(!e.spec.disabled)switch(e.kind){case"JoinByColumnValue":e.spec.columns&&e.spec.columns.length>0&&(n=iO(n,e.spec.columns));break;case"MergeIndexedColumns":e.spec.column&&(n=iI(n,e.spec.column));break;case"MergeColumns":e.spec.columns&&e.spec.columns.length>0&&e.spec.name&&(n=iR(n,e.spec.columns,e.spec.name));break;case"MergeSeries":n=iP(n)}return n.map(e=>Object.keys(e).toSorted().reduce((t,n)=>(t[n]=e[n],t),{}))}var iL=n(68102);function ij(e){return"number"==typeof e}function iF(e){return!!e&&"object"==typeof e&&"function"==typeof e.constructor&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function iB(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function i_(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function iz(e){return e&&!0===e.constructor.prototype.isUnit||!1}function iV(e){return"string"==typeof e}var iH=Array.isArray;function i$(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function iW(e){return Array.isArray(e)||i$(e)}function iU(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function iq(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function iG(e){return e&&!0===e.constructor.prototype.isRange||!1}function iY(e){return e&&!0===e.constructor.prototype.isIndex||!1}function iK(e){return"boolean"==typeof e}function iZ(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function iX(e){return e&&!0===e.constructor.prototype.isHelp||!1}function iQ(e){return"function"==typeof e}function iJ(e){return e instanceof Date}function i0(e){return e instanceof RegExp}function i1(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!iB(e)&&!i_(e))}function i2(e){return null===e}function i5(e){return void 0===e}function i4(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function i3(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function i6(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function i8(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function i9(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function i7(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function oe(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function ot(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function on(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function or(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function oi(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function oo(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function os(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function oa(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function ol(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function ou(e){return e&&!0===e.constructor.prototype.isChain||!1}function oc(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":iF(e)?"BigNumber":iB(e)?"Complex":i_(e)?"Fraction":i$(e)?"Matrix":iz(e)?"Unit":iY(e)?"Index":iG(e)?"Range":iZ(e)?"ResultSet":or(e)?e.type:ou(e)?"Chain":iX(e)?"Help":"Object":"function"===t?"Function":t}function oh(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return oh(e)});if(e instanceof Date)return new Date(e.valueOf());if(iF(e))return e;if(e instanceof RegExp)throw TypeError("Cannot clone "+e);return od(e,oh)}function od(e,t){var n={};for(var r in e)om(e,r)&&(n[r]=t(e[r]));return n}function of(e,t){var n,r,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(r=0,i=e.length;r<i;r++)if(!of(e[r],t[r]))return!1;return!0}if("function"==typeof e)return e===t;if(!(e instanceof Object))return e===t;if(Array.isArray(t)||!(t instanceof Object))return!1;for(n in e)if(!(n in t)||!of(e[n],t[n]))return!1;for(n in t)if(!(n in e))return!1;return!0}function op(e,t,n){var r,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(r=n(),i=!1),r},set:function(e){r=e,i=!1},configurable:!0,enumerable:!0})}function om(e,t){return e&&Object.hasOwnProperty.call(e,t)}function og(e){return Object.keys(e).map(t=>e[t])}var ov=n(23420);function oy(e,t,n,r){function i(r){var i=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r],o=e[i];void 0!==o&&(n[i]=o)}return n}(r,t.map(ox));return function(e,t,n){if(!t.filter(e=>{var t;return!((t=e)&&"?"===t[0])}).every(e=>void 0!==n[e])){var r=t.filter(e=>void 0===n[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(r.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,t,r),n(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),r&&(i.meta=r),i}function ob(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function ox(e){return e&&"?"===e[0]?e.slice(1):e}function ow(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function oS(e,t,n){var r="";if(n){if(n<1)throw Error("size must be in greater than 0");if(!ow(n))throw Error("size must be an integer");if(e>2**(n-1)-1||e<-(2**(n-1)))throw Error("Value must be in range [-2^".concat(n-1,", 2^").concat(n-1,"-1]"));if(!ow(e))throw Error("Value must be an integer");e<0&&(e+=2**n),r="i".concat(n)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(r)}function oC(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var n,r,i="auto";if(t&&(t.notation&&(i=t.notation),ij(t)?n=t:ij(t.precision)&&(n=t.precision),t.wordSize)&&"number"!=typeof(r=t.wordSize))throw Error('Option "wordSize" must be a number');switch(i){case"fixed":return ok(e,n);case"exponential":return oM(e,n);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var n=oT(oA(e),t),r=n.exponent,i=n.coefficients,o=r%3==0?r:r<0?r-3-r%3:r-r%3;if(ij(t))for(;t>i.length||r-o+1>i.length;)i.push(0);else for(var s=Math.abs(r-o)-(i.length-1),a=0;a<s;a++)i.push(0);for(var l=Math.abs(r-o),u=1;l>0;)u++,l--;var c=i.slice(u).join(""),h=ij(t)&&c.length||c.match(/[1-9]/)?"."+c:"",d=i.slice(0,u).join("")+h+"e"+(r>=0?"+":"")+o.toString();return n.sign+d}(e,n);case"bin":return oS(e,2,r);case"oct":return oS(e,8,r);case"hex":return oS(e,16,r);case"auto":return(function(e,t,n){if(isNaN(e)||!isFinite(e))return String(e);var r=n&&void 0!==n.lowerExp?n.lowerExp:-3,i=n&&void 0!==n.upperExp?n.upperExp:5,o=oA(e),s=t?oT(o,t):o;if(s.exponent<r||s.exponent>=i)return oM(e,t);var a=s.coefficients,l=s.exponent;a.length<t&&(a=a.concat(oD(t-a.length))),a=a.concat(oD(l-a.length+1+(a.length<t?t-a.length:0))),a=oD(-l).concat(a);var u=l>0?l:0;return u<a.length-1&&a.splice(u+1,0,"."),s.sign+a.join("")})(e,n,t&&t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function oA(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError("Invalid number "+e);var n=t[1],r=t[2],i=parseFloat(t[4]||"0"),o=r.indexOf(".");i+=-1!==o?o-1:r.length-1;var s=r.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===s.length&&(s.push(0),i++),{sign:n,coefficients:s,exponent:i}}function ok(e,t){if(isNaN(e)||!isFinite(e))return String(e);var n=oA(e),r="number"==typeof t?oT(n,n.exponent+1+t):n,i=r.coefficients,o=r.exponent+1,s=o+(t||0);return i.length<s&&(i=i.concat(oD(s-i.length))),o<0&&(i=oD(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),r.sign+i.join("")}function oM(e,t){if(isNaN(e)||!isFinite(e))return String(e);var n=oA(e),r=t?oT(n,t):n,i=r.coefficients,o=r.exponent;i.length<t&&(i=i.concat(oD(t-i.length)));var s=i.shift();return r.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function oT(e,t){for(var n={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},r=n.coefficients;t<=0;)r.unshift(0),n.exponent++,t++;if(r.length>t&&r.splice(t,r.length-t)[0]>=5){var i=t-1;for(r[i]++;10===r[i];)r.pop(),0===i&&(r.unshift(0),n.exponent++,i++),i--,r[i]++}return n}function oD(e){for(var t=[],n=0;n<e;n++)t.push(0);return t}var oE=Number.EPSILON||2220446049250313e-31;function oO(e,t,n){if(null==n)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var r=Math.abs(e-t);return r<oE||r<=Math.max(Math.abs(e),Math.abs(t))*n}return!1}function oR(e,t,n){var r=new e.constructor(2),i="";if(n){if(n<1)throw Error("size must be in greater than 0");if(!ow(n))throw Error("size must be an integer");if(e.greaterThan(r.pow(n-1).sub(1))||e.lessThan(r.pow(n-1).mul(-1)))throw Error("Value must be in range [-2^".concat(n-1,", 2^").concat(n-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(r.pow(n))),i="i".concat(n)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(t," not supported "))}}function oI(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function oP(e,t){var n=function(e,t){var n;if("number"==typeof e)return oC(e,t);if(iF(e))return function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var n="auto";if(void 0!==t&&(t.notation&&(n=t.notation),"number"==typeof t?h=t:t.precision&&(h=t.precision),t.wordSize)&&"number"!=typeof(d=t.wordSize))throw Error('Option "wordSize" must be a number');switch(n){case"fixed":return r=e,i=h,r.toFixed(i);case"exponential":return oI(e,h);case"engineering":return o=e,s=h,l=(a=o.e)%3==0?a:a<0?a-3-a%3:a-a%3,-1!==(c=(u=o.mul(Math.pow(10,-l))).toPrecision(s)).indexOf("e")&&(c=u.toString()),c+"e"+(a>=0?"+":"")+l.toString();case"bin":return oR(e,2,d);case"oct":return oR(e,8,d);case"hex":return oR(e,16,d);case"auto":var r,i,o,s,a,l,u,c,h,d,f=t&&void 0!==t.lowerExp?t.lowerExp:-3,p=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var m=e.toSignificantDigits(h),g=m.e;return(g>=f&&g<p?m.toFixed():oI(e,h)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);if((n=e)&&"object"==typeof n&&"number"==typeof n.s&&"number"==typeof n.n&&"number"==typeof n.d)if(!t||"decimal"!==t.fraction)return e.s*e.n+"/"+e.d;else return e.toString();if(Array.isArray(e))return function e(t,n){if(!Array.isArray(t))return oP(t,n);for(var r="[",i=t.length,o=0;o<i;o++)0!==o&&(r+=", "),r+=e(t[o],n);return r+"]"}(e,t);if(iV(e))return'"'+e+'"';if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(t);else return e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(n=>'"'+n+'": '+oP(e[n],t)).join(", ")+"}";return String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&n.length>t.truncate?n.substring(0,t.truncate-3)+"...":n}function oN(e,t,n){if(!(this instanceof oN))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=Error().stack}function oL(e,t,n){if(!(this instanceof oL))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function oj(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function oF(e,t){if(0===t.length){if(Array.isArray(e))throw new oN(e.length,0)}else!function e(t,n,r){var i,o=t.length;if(o!==n[r])throw new oN(o,n[r]);if(r<n.length-1){var s=r+1;for(i=0;i<o;i++){if(!Array.isArray(t[i]))throw new oN(n.length-1,n.length,"<");e(t[i],n,s)}}else for(i=0;i<o;i++)if(Array.isArray(t[i]))throw new oN(n.length+1,n.length,">")}(e,t,0)}function oB(e,t){if(!ij(e)||!ow(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new oL(e,t)}function o_(e,t,n){if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!ij(e)||!ow(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+oP(t)+")")}),function e(t,n,r,i){var o,s,a=t.length,l=n[r],u=Math.min(a,l);if(t.length=l,r<n.length-1){var c=r+1;for(o=0;o<u;o++)Array.isArray(s=t[o])||(s=[s],t[o]=s),e(s,n,c,i);for(o=u;o<l;o++)s=[],t[o]=s,e(s,n,c,i)}else{for(o=0;o<u;o++)for(;Array.isArray(t[o]);)t[o]=t[o][0];for(o=u;o<l;o++)t[o]=i}}(e,t,0,void 0!==n?n:0),e}function oz(e,t){var n=oV(e),r=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(t%n==0)r[i]=-t/n;else throw Error("Could not replace wildcard, since "+t+" is no multiple of "+-n);return r}function oV(e){return e.reduce((e,t)=>e*t,1)}function oH(e,t,n,r){var i=r||oj(e);if(n)for(var o=0;o<n;o++)e=[e],i.unshift(1);for(e=function e(t,n,r){var i,o;if(Array.isArray(t)){var s=r+1;for(i=0,o=t.length;i<o;i++)t[i]=e(t[i],n,s)}else for(var a=r;a<n;a++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function o$(e,t){for(var n,r=0,i=0;i<e.length;i++){var o=e[i],s=Array.isArray(o);if(0===i&&s&&(r=o.length),s&&o.length!==r)return;var a=s?o$(o,t):t(o);if(void 0===n)n=a;else if(n!==a)return"mixed"}return n}function oW(e,t){return -1!==e.indexOf(t)}function oU(e,t,n,r){if(!(this instanceof oU))throw SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=n,this.max=r,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(null!=r?"-"+r:"")+" expected)",this.stack=Error().stack}oN.prototype=RangeError(),oN.prototype.constructor=RangeError,oN.prototype.name="DimensionError",oN.prototype.isDimensionError=!0,oL.prototype=RangeError(),oL.prototype.constructor=RangeError,oL.prototype.name="IndexError",oL.prototype.isIndexError=!0,oU.prototype=Error(),oU.prototype.constructor=Error,oU.prototype.name="ArgumentsError",oU.prototype.isArgumentsError=!0;var oq={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},oG=["Matrix","Array"],oY=["number","BigNumber","Fraction"];function oK(e,t,n){var r;void 0!==e[t]&&(r=e[t],-1===n.indexOf(r))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+n.map(e=>JSON.stringify(e)).join(", ")+".")}function oZ(e,t){var n,r,i,o=(0,iL.A)({},oq,t);if("function"!=typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var s=((n={isNumber:ij,isComplex:iB,isBigNumber:iF,isFraction:i_,isUnit:iz,isString:iV,isArray:iH,isMatrix:i$,isCollection:iW,isDenseMatrix:iU,isSparseMatrix:iq,isRange:iG,isIndex:iY,isBoolean:iK,isResultSet:iZ,isHelp:iX,isFunction:iQ,isDate:iJ,isRegExp:i0,isObject:i1,isNull:i2,isUndefined:i5,isAccessorNode:i4,isArrayNode:i3,isAssignmentNode:i6,isBlockNode:i8,isConditionalNode:i9,isConstantNode:i7,isFunctionAssignmentNode:oe,isFunctionNode:ot,isIndexNode:on,isNode:or,isObjectNode:oi,isOperatorNode:oo,isParenthesisNode:os,isRangeNode:oa,isSymbolNode:ol,isChain:ou}).on=(r=new ov).on.bind(r),n.off=r.off.bind(r),n.once=r.once.bind(r),n.emit=r.emit.bind(r),n);s.config=function(e,t){function n(n){if(!n)return od(e,oh);var r=od(e,oh);oK(n,"matrix",oG),oK(n,"number",oY),function e(t,n){if(Array.isArray(n))throw TypeError("Arrays are not supported by deepExtend");for(var r in n)if(om(n,r)&&!(r in Object.prototype)&&!(r in Function.prototype))if(n[r]&&n[r].constructor===Object)void 0===t[r]&&(t[r]={}),t[r]&&t[r].constructor===Object?e(t[r],n[r]):t[r]=n[r];else if(Array.isArray(n[r]))throw TypeError("Arrays are not supported by deepExtend");else t[r]=n[r];return t}(e,n);var i=od(e,oh);return t("config",i,r,od(n,oh)),i}return n.MATRIX_OPTIONS=oG,n.NUMBER_OPTIONS=oY,Object.keys(oq).forEach(t=>{Object.defineProperty(n,t,{get:()=>e[t],enumerable:!0,configurable:!0})}),n}(o,s.emit),s.expression={transform:{},mathWithTransform:{config:s.config}};var a={},l=function(e,t,n){function r(e,n){n&&"function"==typeof n.transform?(t.expression.transform[e]=n.transform,om(s,e)||(t.expression.mathWithTransform[e]=n.transform)):(delete t.expression.transform[e],om(s,e)||(t.expression.mathWithTransform[e]=n))}function i(e){return"function"==typeof e&&"object"==typeof e.signatures}function o(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction}var s={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(a,l){var u=arguments.length;if(1!==u&&2!==u)throw new oU("import",u,1,2);l||(l={});var c={};for(var h in!function e(t,n,r){if(Array.isArray(n))n.forEach(n=>e(t,n));else if("object"==typeof n)for(var i in n)om(n,i)&&e(t,n[i],i);else if(ob(n)||void 0!==r){var s=ob(n)?o(n)?n.fn+".transform":n.fn:r;if(om(t,s)&&t[s]!==n&&!l.silent)throw Error('Cannot import "'+s+'" twice');t[s]=n}else if(!l.silent)throw TypeError("Factory, Object, or Array expected")}(c,a),c)if(om(c,h)){var d,f=c[h];if(ob(f))!function(r,a){var l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.fn;if(oW(u,"."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(u));var c=o(r)?t.expression.transform:t,h=u in t.expression.transform,d=om(c,u)?c[u]:void 0,f=function(){var n={};r.dependencies.map(ox).forEach(e=>{if(oW(e,"."))throw Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?n.math=t:"mathWithTransform"===e?n.mathWithTransform=t.expression.mathWithTransform:"classes"===e?n.classes=t:n[e]=t[e]});var o=r(n);if(o&&"function"==typeof o.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===d||a.override)return o;if(i(d)&&i(o))return e(d,o);if(a.silent)return d;throw Error('Cannot import "'+u+'": already exists')};r.meta&&!1===r.meta.lazy?c[u]=f():op(c,u,f),d&&h?function(e){delete t.expression.transform[e],om(s,e)?delete t.expression.mathWithTransform[e]:t.expression.mathWithTransform[e]=t[e]}(u):!o(r)&&(-1!==(l=r).fn.indexOf(".")||om(s,l.fn)||l.meta&&l.meta.isClass)||op(t.expression.mathWithTransform,u,()=>c[u]),n[u]=r,t.emit("import",u,f)}(f,l);else{if("function"==typeof(d=f)||"number"==typeof d||"string"==typeof d||"boolean"==typeof d||null===d||iz(d)||iB(d)||iF(d)||i_(d)||i$(d)||Array.isArray(d))!function(o,s,a){var l;if(a.wrap&&"function"==typeof s&&(s=function(e){var n=function(){for(var n=[],r=0,i=arguments.length;r<i;r++){var o=arguments[r];n[r]=o&&o.valueOf()}return e.apply(t,n)};return e.transform&&(n.transform=e.transform),n}(s)),"function"==typeof(l=s)&&"string"==typeof l.signature&&(s=e(o,{[s.signature]:s})),i(t[o])&&i(s)){s=a.override?e(o,s.signatures):e(t[o],s),t[o]=s,delete n[o],r(o,s),t.emit("import",o,function(){return s});return}if(void 0===t[o]||a.override){t[o]=s,delete n[o],r(o,s),t.emit("import",o,function(){return s});return}if(!a.silent)throw Error('Cannot import "'+o+'": already exists')}(h,f,l);else if(!l.silent)throw TypeError("Factory, Object, or Array expected")}}}}(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.typed.apply(s.typed,t)},s,a);return s.import=l,s.on("config",()=>{og(a).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&l(e,{override:!0})})}),s.create=oZ.bind(null,e),s.factory=oy,s.import(og((function e(t,n){for(var r in t)if(om(t,r)){var i=t[r];"object"==typeof i&&null!==i?e(i,n):n[r]=i}}(e,i={}),i))),s.ArgumentsError=oU,s.DimensionError=oN,s.IndexError=oL,s}var oX,oQ,oJ,o0,o1,o2,o5,o4,o3,o6,o8,o9,o7,se,st,sn,sr,si,so="0123456789abcdef",ss="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",sa="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",sl={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},su=!0,sc="[DecimalError] ",sh=sc+"Invalid argument: ",sd=sc+"Precision limit exceeded",sf=sc+"crypto unavailable",sp="[object Decimal]",sm=Math.floor,sg=Math.pow,sv=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,sy=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,sb=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,sx=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,sw=ss.length-1,sS=sa.length-1,sC={toStringTag:sp};function sA(e){var t,n,r,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(o+=sL(n)),o+=r;(n=7-(r=(s=e[t])+"").length)&&(o+=sL(n))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function sk(e,t,n){if(e!==~~e||e<t||e>n)throw Error(sh+e)}function sM(e,t,n,r){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=sg(10,7-t),a=e[i]%o|0,null==r?t<3?(0==t?a=a/100|0:1==t&&(a=a/10|0),s=n<4&&99999==a||n>3&&49999==a||5e4==a||0==a):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(e[i+1]/o/100|0)==sg(10,t-2)-1||(a==o/2||0==a)&&(e[i+1]/o/100|0)==0:t<4?(0==t?a=a/1e3|0:1==t?a=a/100|0:2==t&&(a=a/10|0),s=(r||n<4)&&9999==a||!r&&n>3&&4999==a):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==sg(10,t-3)-1,s}function sT(e,t,n){for(var r,i,o=[0],s=0,a=e.length;s<a;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=so.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}sC.absoluteValue=sC.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),sE(e)},sC.ceil=function(){return sE(new this.constructor(this),this.e+1,2)},sC.clampedTo=sC.clamp=function(e,t){var n=this.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(sh+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new n(this)},sC.comparedTo=sC.cmp=function(e){var t,n,r,i,o=this.d,s=(e=new this.constructor(e)).d,a=this.s,l=e.s;if(!o||!s)return a&&l?a!==l?a:o===s?0:!o^a<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?a:s[0]?-l:0;if(a!==l)return a;if(this.e!==e.e)return this.e>e.e^a<0?1:-1;for(t=0,n=(r=o.length)<(i=s.length)?r:i;t<n;++t)if(o[t]!==s[t])return o[t]>s[t]^a<0?1:-1;return r===i?0:r>i^a<0?1:-1},sC.cosine=sC.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;(r=t.d.length)<32?i=(1/sW(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=s$(e,1,t.times(i),new e(1));for(var o=n;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}(r,sU(r,n)),r.precision=e,r.rounding=t,sE(2==si||3==si?n.neg():n,e,t,!0)):new r(1):new r(NaN)},sC.cubeRoot=sC.cbrt=function(){var e,t,n,r,i,o,s,a,l,u,c=this.constructor;if(!this.isFinite()||this.isZero())return new c(this);for(su=!1,(o=this.s*sg(this.s*this,1/3))&&Math.abs(o)!=1/0?r=new c(o.toString()):(n=sA(this.d),(o=((e=this.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=sg(n,1/3),e=sm((e+1)/3)-(e%3==(e<0?-1:2)),(r=new c(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=this.s),s=(e=c.precision)+3;;)if(r=sD((u=(l=(a=r).times(a).times(a)).plus(this)).plus(this).times(a),u.plus(l),s+2,1),sA(a.d).slice(0,s)===(n=sA(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(sE(r,e+1,1),t=!r.times(r).times(r).eq(this));break}if(!i&&(sE(a,e+1,0),a.times(a).times(a).eq(this))){r=a;break}s+=4,i=1}return su=!0,sE(r,e,c.rounding,t)},sC.decimalPlaces=sC.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=((e=t.length-1)-sm(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},sC.dividedBy=sC.div=function(e){return sD(this,new this.constructor(e))},sC.dividedToIntegerBy=sC.divToInt=function(e){var t=this.constructor;return sE(sD(this,new t(e),0,1,1),t.precision,t.rounding)},sC.equals=sC.eq=function(e){return 0===this.cmp(e)},sC.floor=function(){return sE(new this.constructor(this),this.e+1,3)},sC.greaterThan=sC.gt=function(e){return this.cmp(e)>0},sC.greaterThanOrEqualTo=sC.gte=function(e){var t=this.cmp(e);return 1==t||0===t},sC.hyperbolicCosine=sC.cosh=function(){var e,t,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?t=(1/sW(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=s$(s,1,o.times(t),new s(1),!0);for(var l,u=e,c=new s(8);u--;)l=o.times(o),o=a.minus(l.times(c.minus(l.times(c))));return sE(o,s.precision=n,s.rounding=r,!0)},sC.hyperbolicSine=sC.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=s$(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=s$(o,2,i=i.times(1/sW(5,e)),i,!0);for(var s,a=new o(5),l=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(l.times(s).plus(u))))}return o.precision=t,o.rounding=n,sE(i,t,n,!0)},sC.hyperbolicTangent=sC.tanh=function(){var e,t,n=this.constructor;return this.isFinite()?this.isZero()?new n(this):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,sD(this.sinh(),this.cosh(),n.precision=e,n.rounding=t)):new n(this.s)},sC.inverseCosine=sC.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return -1!==n?0===n?e.isNeg()?sP(t,r,i):new t(0):new t(NaN):e.isZero()?sP(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2))},sC.inverseHyperbolicCosine=sC.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,su=!1,n=n.times(n).minus(1).sqrt().plus(n),su=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},sC.inverseHyperbolicSine=sC.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,su=!1,n=n.times(n).plus(1).sqrt().plus(n),su=!0,r.precision=e,r.rounding=t,n.ln())},sC.inverseHyperbolicTangent=sC.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,Math.max(r=i.sd(),e)<-(2*i.e)-1)?sE(new o(i),e,t,!0):(o.precision=n=r-i.e,i=sD(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5)):new o(NaN)},sC.inverseSine=sC.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t)?0===t?((e=sP(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2))},sC.inverseTangent=sC.atan=function(){var e,t,n,r,i,o,s,a,l,u=this,c=u.constructor,h=c.precision,d=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);else if(u.abs().eq(1)&&h+4<=sS)return(s=sP(c,h+4,d).times(.25)).s=u.s,s}else{if(!u.s)return new c(NaN);if(h+4<=sS)return(s=sP(c,h+4,d).times(.5)).s=u.s,s}for(c.precision=a=h+10,c.rounding=1,e=n=Math.min(28,a/7+2|0);e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(su=!1,t=Math.ceil(a/7),r=1,l=u.times(u),s=new c(u),i=u;-1!==e;)if(i=i.times(l),o=s.minus(i.div(r+=2)),i=i.times(l),void 0!==(s=o.plus(i.div(r+=2))).d[t])for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),su=!0,sE(s,c.precision=h,c.rounding=d,!0)},sC.isFinite=function(){return!!this.d},sC.isInteger=sC.isInt=function(){return!!this.d&&sm(this.e/7)>this.d.length-2},sC.isNaN=function(){return!this.s},sC.isNegative=sC.isNeg=function(){return this.s<0},sC.isPositive=sC.isPos=function(){return this.s>0},sC.isZero=function(){return!!this.d&&0===this.d[0]},sC.lessThan=sC.lt=function(e){return 0>this.cmp(e)},sC.lessThanOrEqualTo=sC.lte=function(e){return 1>this.cmp(e)},sC.logarithm=sC.log=function(e){var t,n,r,i,o,s,a,l=this.constructor,u=l.precision,c=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=this.d,this.s<0||!n||!n[0]||this.eq(1))return new l(n&&!n[0]?-1/0:1!=this.s?NaN:n?0:1/0);if(t)if(n.length>1)i=!0;else{for(r=n[0];r%10==0;)r/=10;i=1!==r}if(su=!1,sM((a=sD(o=sz(this,s=u+5),t?sI(l,s+10):sz(e,s),s,1)).d,r=u,c))do if(s+=10,a=sD(o=sz(this,s),t?sI(l,s+10):sz(e,s),s,1),!i){+sA(a.d).slice(r+1,r+15)+1==1e14&&(a=sE(a,u+1,0));break}while(sM(a.d,r+=10,c));return su=!0,sE(a,u,c)},sC.minus=sC.sub=function(e){var t,n,r,i,o,s,a,l,u,c,h,d,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new f(e.d||this.s!==e.s?this:NaN):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(u=this.d,d=e.d,a=f.precision,l=f.rounding,!u[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!u[0])return new f(3===l?-0:0);e=new f(this)}return su?sE(e,a,l):e}if(n=sm(e.e/7),c=sm(this.e/7),u=u.slice(),o=c-n){for((h=o<0)?(t=u,o=-o,s=d.length):(t=d,n=c,s=u.length),o>(r=Math.max(Math.ceil(a/7),s)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((h=(r=u.length)<(s=d.length))&&(s=r),r=0;r<s;r++)if(u[r]!=d[r]){h=u[r]<d[r];break}o=0}for(h&&(t=u,u=d,d=t,e.s=-e.s),s=u.length,r=d.length-s;r>0;--r)u[s++]=0;for(r=d.length;r>o;){if(u[--r]<d[r]){for(i=r;i&&0===u[--i];)u[i]=1e7-1;--u[i],u[r]+=1e7}u[r]-=d[r]}for(;0===u[--s];)u.pop();for(;0===u[0];u.shift())--n;return u[0]?(e.d=u,e.e=sR(u,n),su?sE(e,a,l):e):new f(3===l?-0:0)},sC.modulo=sC.mod=function(e){var t,n=this.constructor;return(e=new n(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(su=!1,9==n.modulo?(t=sD(this,e.abs(),0,3,1),t.s*=e.s):t=sD(this,e,0,n.modulo,1),t=t.times(e),su=!0,this.minus(t)):sE(new n(this),n.precision,n.rounding):new n(NaN)},sC.naturalExponential=sC.exp=function(){return s_(this)},sC.naturalLogarithm=sC.ln=function(){return sz(this)},sC.negated=sC.neg=function(){var e=new this.constructor(this);return e.s=-e.s,sE(e)},sC.plus=sC.add=function(e){var t,n,r,i,o,s,a,l,u,c,h=this.constructor;if(e=new h(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new h(e.d||this.s===e.s?this:NaN)):e=new h(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(u=this.d,c=e.d,a=h.precision,l=h.rounding,!u[0]||!c[0])return c[0]||(e=new h(this)),su?sE(e,a,l):e;if(o=sm(this.e/7),r=sm(e.e/7),u=u.slice(),i=o-r){for(i<0?(n=u,i=-i,s=c.length):(n=c,r=o,s=u.length),i>(s=(o=Math.ceil(a/7))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=u.length)-(i=c.length)<0&&(i=s,n=c,c=u,u=n),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/1e7|0,u[i]%=1e7;for(t&&(u.unshift(t),++r),s=u.length;0==u[--s];)u.pop();return e.d=u,e.e=sR(u,r),su?sE(e,a,l):e},sC.precision=sC.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(sh+e);return this.d?(t=sN(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},sC.round=function(){var e=this.constructor;return sE(new e(this),this.e+1,e.rounding)},sC.sine=sC.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:s$(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=s$(e,2,t=t.times(1/sW(5,n)),t);for(var i,o=new e(5),s=new e(16),a=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}(r,sU(r,n)),r.precision=e,r.rounding=t,sE(si>2?n.neg():n,e,t,!0)):new r(NaN)},sC.squareRoot=sC.sqrt=function(){var e,t,n,r,i,o,s=this.d,a=this.e,l=this.s,u=this.constructor;if(1!==l||!s||!s[0])return new u(!l||l<0&&(!s||s[0])?NaN:s?this:1/0);for(su=!1,0==(l=Math.sqrt(+this))||l==1/0?(((t=sA(s)).length+a)%2==0&&(t+="0"),l=Math.sqrt(t),a=sm((a+1)/2)-(a<0||a%2),r=new u(t=l==1/0?"5e"+a:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+a)):r=new u(l.toString()),n=(a=u.precision)+3;;)if(r=(o=r).plus(sD(this,o,n+2,1)).times(.5),sA(o.d).slice(0,n)===(t=sA(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(sE(r,a+1,1),e=!r.times(r).eq(this));break}if(!i&&(sE(o,a+1,0),o.times(o).eq(this))){r=o;break}n+=4,i=1}return su=!0,sE(r,a,u.rounding,e)},sC.tangent=sC.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=sD(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,sE(2==si||4==si?n.neg():n,e,t,!0)):new r(NaN)},sC.times=sC.mul=function(e){var t,n,r,i,o,s,a,l,u,c=this.constructor,h=this.d,d=(e=new c(e)).d;if(e.s*=this.s,!h||!h[0]||!d||!d[0])return new c(!e.s||h&&!h[0]&&!d||d&&!d[0]&&!h?NaN:!h||!d?e.s/0:0*e.s);for(n=sm(this.e/7)+sm(e.e/7),(l=h.length)<(u=d.length)&&(o=h,h=d,d=o,s=l,l=u,u=s),o=[],r=s=l+u;r--;)o.push(0);for(r=u;--r>=0;){for(t=0,i=l+r;i>r;)a=o[i]+d[r]*h[i-r-1]+t,o[i--]=a%1e7|0,t=a/1e7|0;o[i]=(o[i]+t)%1e7|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=sR(o,n),su?sE(e,c.precision,c.rounding):e},sC.toBinary=function(e,t){return sq(this,2,e,t)},sC.toDecimalPlaces=sC.toDP=function(e,t){var n=this,r=n.constructor;return(n=new r(n),void 0===e)?n:(sk(e,0,1e9),void 0===t?t=r.rounding:sk(t,0,8),sE(n,e+n.e+1,t))},sC.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=sO(r,!0):(sk(e,0,1e9),void 0===t?t=i.rounding:sk(t,0,8),n=sO(r=sE(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},sC.toFixed=function(e,t){var n,r,i=this.constructor;return void 0===e?n=sO(this):(sk(e,0,1e9),void 0===t?t=i.rounding:sk(t,0,8),n=sO(r=sE(new i(this),e+this.e+1,t),!1,e+r.e+1)),this.isNeg()&&!this.isZero()?"-"+n:n},sC.toFraction=function(e){var t,n,r,i,o,s,a,l,u,c,h,d,f=this.d,p=this.constructor;if(!f)return new p(this);if(u=n=new p(1),r=l=new p(0),s=(o=(t=new p(r)).e=sN(f)-this.e-1)%7,t.d[0]=sg(10,s<0?7+s:s),null==e)e=o>0?t:u;else{if(!(a=new p(e)).isInt()||a.lt(u))throw Error(sh+a);e=a.gt(t)?o>0?t:u:a}for(su=!1,a=new p(sA(f)),c=p.precision,p.precision=o=7*f.length*2;h=sD(a,t,0,1,1),1!=(i=n.plus(h.times(r))).cmp(e);)n=r,r=i,i=u,u=l.plus(h.times(i)),l=i,i=t,t=a.minus(h.times(i)),a=i;return i=sD(e.minus(n),r,0,1,1),l=l.plus(i.times(u)),n=n.plus(i.times(r)),l.s=u.s=this.s,d=1>sD(u,r,o,1).minus(this).abs().cmp(sD(l,n,o,1).minus(this).abs())?[u,r]:[l,n],p.precision=c,su=!0,d},sC.toHexadecimal=sC.toHex=function(e,t){return sq(this,16,e,t)},sC.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:sk(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(su=!1,n=sD(n,e,0,t,1).times(e),su=!0,sE(n)):(e.s=n.s,n=e),n},sC.toNumber=function(){return+this},sC.toOctal=function(e,t){return sq(this,8,e,t)},sC.toPower=sC.pow=function(e){var t,n,r,i,o,s,a=this,l=a.constructor,u=+(e=new l(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new l(sg(+a,u));if((a=new l(a)).eq(1))return a;if(r=l.precision,o=l.rounding,e.eq(1))return sE(a,r,o);if((t=sm(e.e/7))>=e.d.length-1&&(n=u<0?-u:u)<=0x1fffffffffffff)return i=sj(l,a,n,r),e.s<0?new l(1).div(i):sE(i,r,o);if((s=a.s)<0){if(t<e.d.length-1)return new l(NaN);if((1&e.d[t])==0&&(s=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=s,a}return(t=0!=(n=sg(+a,u))&&isFinite(n)?new l(n+"").e:sm(u*(Math.log("0."+sA(a.d))/Math.LN10+a.e+1)))>l.maxE+1||t<l.minE-1?new l(t>0?s/0:0):(su=!1,l.rounding=a.s=1,n=Math.min(12,(t+"").length),(i=s_(e.times(sz(a,r+n)),r)).d&&sM((i=sE(i,r+5,1)).d,r,o)&&(t=r+10,+sA((i=sE(s_(e.times(sz(a,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=sE(i,r+1,0))),i.s=s,su=!0,l.rounding=o,sE(i,r,o))},sC.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=sO(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(sk(e,1,1e9),void 0===t?t=i.rounding:sk(t,0,8),n=sO(r=sE(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},sC.toSignificantDigits=sC.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(sk(e,1,1e9),void 0===t?t=n.rounding:sk(t,0,8)),sE(new n(this),e,t)},sC.toString=function(){var e=this.constructor,t=sO(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},sC.truncated=sC.trunc=function(){return sE(new this.constructor(this),this.e+1,1)},sC.valueOf=sC.toJSON=function(){var e=this.constructor,t=sO(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var sD=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s,a,l){var u,c,h,d,f,p,m,g,v,y,b,x,w,S,C,A,k,M,T,D,E=r.constructor,O=r.s==i.s?1:-1,R=r.d,I=i.d;if(!R||!R[0]||!I||!I[0])return new E(!r.s||!i.s||(R?I&&R[0]==I[0]:!I)?NaN:R&&0==R[0]||!I?0*O:O/0);for(l?(f=1,c=r.e-i.e):(l=1e7,f=7,c=sm(r.e/f)-sm(i.e/f)),T=I.length,k=R.length,y=(v=new E(O)).d=[],h=0;I[h]==(R[h]||0);h++);if(I[h]>(R[h]||0)&&c--,null==o?(S=o=E.precision,s=E.rounding):S=a?o+(r.e-i.e)+1:o,S<0)y.push(1),p=!0;else{if(S=S/f+2|0,h=0,1==T){for(d=0,I=I[0],S++;(h<k||d)&&S--;h++)C=d*l+(R[h]||0),y[h]=C/I|0,d=C%I|0;p=d||h<k}else{for((d=l/(I[0]+1)|0)>1&&(I=e(I,d,l),R=e(R,d,l),T=I.length,k=R.length),A=T,x=(b=R.slice(0,T)).length;x<T;)b[x++]=0;(D=I.slice()).unshift(0),M=I[0],I[1]>=l/2&&++M;do d=0,(u=t(I,b,T,x))<0?(w=b[0],T!=x&&(w=w*l+(b[1]||0)),(d=w/M|0)>1?(d>=l&&(d=l-1),g=(m=e(I,d,l)).length,x=b.length,1==(u=t(m,b,g,x))&&(d--,n(m,T<g?D:I,g,l))):(0==d&&(u=d=1),m=I.slice()),(g=m.length)<x&&m.unshift(0),n(b,m,x,l),-1==u&&(x=b.length,(u=t(I,b,T,x))<1&&(d++,n(b,T<x?D:I,x,l))),x=b.length):0===u&&(d++,b=[0]),y[h++]=d,u&&b[0]?b[x++]=R[A]||0:(b=[R[A]],x=1);while((A++<k||void 0!==b[0])&&S--);p=void 0!==b[0]}y[0]||y.shift()}if(1==f)v.e=c,sr=p;else{for(h=1,d=y[0];d>=10;d/=10)h++;v.e=h+c*f-1,sE(v,a?o+v.e+1:o,s,p)}return v}}();function sE(e,t,n,r){var i,o,s,a,l,u,c,h,d,f=e.constructor;e:if(null!=t){if(!(h=e.d))return e;for(i=1,a=h[0];a>=10;a/=10)i++;if((o=t-i)<0)o+=7,s=t,l=(c=h[d=0])/sg(10,i-s-1)%10|0;else if((d=Math.ceil((o+1)/7))>=(a=h.length))if(r){for(;a++<=d;)h.push(0);c=l=0,i=1,o%=7,s=o-7+1}else break e;else{for(i=1,c=a=h[d];a>=10;a/=10)i++;o%=7,l=(s=o-7+i)<0?0:c/sg(10,i-s-1)%10|0}if(r=r||t<0||void 0!==h[d+1]||(s<0?c:c%sg(10,i-s-1)),u=n<4?(l||r)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(o>0?s>0?c/sg(10,i-s):0:h[d-1])%10&1||n==(e.s<0?8:7)),t<1||!h[0])return h.length=0,u?(t-=e.e+1,h[0]=sg(10,(7-t%7)%7),e.e=-t||0):h[0]=e.e=0,e;if(0==o?(h.length=d,a=1,d--):(h.length=d+1,a=sg(10,7-o),h[d]=s>0?(c/sg(10,i-s)%sg(10,s)|0)*a:0),u)for(;;)if(0==d){for(o=1,s=h[0];s>=10;s/=10)o++;for(s=h[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,1e7==h[0]&&(h[0]=1));break}else{if(h[d]+=a,1e7!=h[d])break;h[d--]=0,a=1}for(o=h.length;0===h[--o];)h.pop()}return su&&(e.e>f.maxE?(e.d=null,e.e=NaN):e.e<f.minE&&(e.e=0,e.d=[0])),e}function sO(e,t,n){if(!e.isFinite())return sV(e);var r,i=e.e,o=sA(e.d),s=o.length;return t?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+sL(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+sL(-i-1)+o,n&&(r=n-s)>0&&(o+=sL(r))):i>=s?(o+=sL(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+sL(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=sL(r))),o}function sR(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function sI(e,t,n){if(t>sw)throw su=!0,n&&(e.precision=n),Error(sd);return sE(new e(ss),t,1,!0)}function sP(e,t,n){if(t>sS)throw Error(sd);return sE(new e(sa),t,n,!0)}function sN(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function sL(e){for(var t="";e--;)t+="0";return t}function sj(e,t,n,r){var i,o=new e(1),s=Math.ceil(r/7+4);for(su=!1;;){if(n%2&&sG((o=o.times(t)).d,s)&&(i=!0),0===(n=sm(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}sG((t=t.times(t)).d,s)}return su=!0,o}function sF(e){return 1&e.d[e.d.length-1]}function sB(e,t,n){for(var r,i,o=new e(t[0]),s=0;++s<t.length;){if(!(i=new e(t[s])).s){o=i;break}((r=o.cmp(i))===n||0===r&&o.s===n)&&(o=i)}return o}function s_(e,t){var n,r,i,o,s,a,l,u=0,c=0,h=0,d=e.constructor,f=d.rounding,p=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==t?(su=!1,l=p):l=t,a=new d(.03125);e.e>-2;)e=e.times(a),h+=5;for(l+=r=Math.log(sg(2,h))/Math.LN10*2+5|0,n=o=s=new d(1),d.precision=l;;){if(o=sE(o.times(e),l,1),n=n.times(++c),sA((a=s.plus(sD(o,n,l,1))).d).slice(0,l)===sA(s.d).slice(0,l)){for(i=h;i--;)s=sE(s.times(s),l,1);if(null!=t)return d.precision=p,s;if(!(u<3&&sM(s.d,l-r,f,u)))return sE(s,d.precision=p,f,su=!0);d.precision=l+=10,n=o=a=new d(1),c=0,u++}s=a}}function sz(e,t){var n,r,i,o,s,a,l,u,c,h,d,f=1,p=e,m=p.d,g=p.constructor,v=g.rounding,y=g.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(su=!1,c=y):c=t,g.precision=c+=10,r=(n=sA(m)).charAt(0),!(15e14>Math.abs(o=p.e)))return u=sI(g,c+2,y).times(o+""),p=sz(new g(r+"."+n.slice(1)),c-10).plus(u),g.precision=y,null==t?sE(p,y,v,su=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=sA((p=p.times(e)).d)).charAt(0),f++;for(o=p.e,r>1?(p=new g("0."+n),o++):p=new g(r+"."+n.slice(1)),h=p,l=s=p=sD(p.minus(1),p.plus(1),c,1),d=sE(p.times(p),c,1),i=3;;){if(s=sE(s.times(d),c,1),sA((u=l.plus(sD(s,new g(i),c,1))).d).slice(0,c)===sA(l.d).slice(0,c)){if(l=l.times(2),0!==o&&(l=l.plus(sI(g,c+2,y).times(o+""))),l=sD(l,new g(f),c,1),null!=t)return g.precision=y,l;if(!sM(l.d,c-10,v,a))return sE(l,g.precision=y,v,su=!0);g.precision=c+=10,u=s=p=sD(h.minus(1),h.plus(1),c,1),d=sE(p.times(p),c,1),i=a=1}l=u,i+=2}}function sV(e){return String(e.s*e.s/0)}function sH(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";e.d.push(+t),su&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function s$(e,t,n,r,i){var o,s,a,l,u=e.precision,c=Math.ceil(u/7);for(su=!1,l=n.times(n),a=new e(r);;){if(s=sD(a.times(l),new e(t++*t++),u,1),a=i?r.plus(s):r.minus(s),r=sD(s.times(l),new e(t++*t++),u,1),void 0!==(s=a.plus(r)).d[c]){for(o=c;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=r,r=s,s=o}return su=!0,s.d.length=c+1,s}function sW(e,t){for(var n=e;--t;)n*=e;return n}function sU(e,t){var n,r=t.s<0,i=sP(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return si=r?4:1,t;if((n=t.divToInt(i)).isZero())si=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return si=sF(n)?r?2:3:r?4:1,t;si=sF(n)?r?1:4:r?3:2}return t.minus(i).abs()}function sq(e,t,n,r){var i,o,s,a,l,u,c,h,d,f=e.constructor,p=void 0!==n;if(p?(sk(n,1,1e9),void 0===r?r=f.rounding:sk(r,0,8)):(n=f.precision,r=f.rounding),e.isFinite()){for(s=(c=sO(e)).indexOf("."),p?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,s>=0&&(c=c.replace(".",""),(d=new f(1)).e=c.length-s,d.d=sT(sO(d),10,i),d.e=d.d.length),o=l=(h=sT(c,10,i)).length;0==h[--l];)h.pop();if(h[0]){if(s<0?o--:((e=new f(e)).d=h,e.e=o,h=(e=sD(e,d,n,r,0,i)).d,o=e.e,u=sr),s=h[n],a=i/2,u=u||void 0!==h[n+1],u=r<4?(void 0!==s||u)&&(0===r||r===(e.s<0?3:2)):s>a||s===a&&(4===r||u||6===r&&1&h[n-1]||r===(e.s<0?8:7)),h.length=n,u)for(;++h[--n]>i-1;)h[n]=0,n||(++o,h.unshift(1));for(l=h.length;!h[l-1];--l);for(s=0,c="";s<l;s++)c+=so.charAt(h[s]);if(p){if(l>1)if(16==t||8==t){for(s=16==t?4:3,--l;l%s;l++)c+="0";for(l=(h=sT(c,i,t)).length;!h[l-1];--l);for(s=1,c="1.";s<l;s++)c+=so.charAt(h[s])}else c=c.charAt(0)+"."+c.slice(1);c=c+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)c="0"+c;c="0."+c}else if(++o>l)for(o-=l;o--;)c+="0";else o<l&&(c=c.slice(0,o)+"."+c.slice(o))}else c=p?"0p+0":"0";c=(16==t?"0x":2==t?"0b":8==t?"0o":"")+c}else c=sV(e);return e.s<0?"-"+c:c}function sG(e,t){if(e.length>t)return e.length=t,!0}function sY(e){return new this(e).abs()}function sK(e){return new this(e).acos()}function sZ(e){return new this(e).acosh()}function sX(e,t){return new this(e).plus(t)}function sQ(e){return new this(e).asin()}function sJ(e){return new this(e).asinh()}function s0(e){return new this(e).atan()}function s1(e){return new this(e).atanh()}function s2(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?sP(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=sP(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(sD(e,t,o,1)),t=sP(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(sD(e,t,o,1)):(n=sP(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function s5(e){return new this(e).cbrt()}function s4(e){return sE(e=new this(e),e.e+1,2)}function s3(e,t,n){return new this(e).clamp(t,n)}function s6(e){if(!e||"object"!=typeof e)throw Error(sc+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=sl[n]),void 0!==(r=e[n]))if(sm(r)===r&&r>=o[t+1]&&r<=o[t+2])this[n]=r;else throw Error(sh+n+": "+r);if(n="crypto",i&&(this[n]=sl[n]),void 0!==(r=e[n]))if(!0===r||!1===r||0===r||1===r)if(r)if("u">typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(sf);else this[n]=!1;else throw Error(sh+n+": "+r);return this}function s8(e){return new this(e).cos()}function s9(e){return new this(e).cosh()}function s7(e,t){return new this(e).div(t)}function ae(e){return new this(e).exp()}function at(e){return sE(e=new this(e),e.e+1,3)}function an(){var e,t,n=new this(0);for(e=0,su=!1;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return su=!0,new this(1/0);n=t}return su=!0,n.sqrt()}function ar(e){return e instanceof aA||e&&e.toStringTag===sp||!1}function ai(e){return new this(e).ln()}function ao(e,t){return new this(e).log(t)}function as(e){return new this(e).log(2)}function aa(e){return new this(e).log(10)}function al(){return sB(this,arguments,-1)}function au(){return sB(this,arguments,1)}function ac(e,t){return new this(e).mod(t)}function ah(e,t){return new this(e).mul(t)}function ad(e,t){return new this(e).pow(t)}function af(e){var t,n,r,i,o=0,s=new this(1),a=[];if(void 0===e?e=this.precision:sk(e,1,1e9),r=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));o<r;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);o<r;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=r/4}else throw Error(sf);else for(;o<r;)a[o++]=1e7*Math.random()|0;for(r=a[--o],e%=7,r&&e&&(i=sg(10,7-e),a[o]=(r/i|0)*i);0===a[o];o--)a.pop();if(o<0)n=0,a=[0];else{for(n=-1;0===a[0];n-=7)a.shift();for(r=1,i=a[0];i>=10;i/=10)r++;r<7&&(n-=7-r)}return s.e=n,s.d=a,s}function ap(e){return sE(e=new this(e),e.e+1,this.rounding)}function am(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function ag(e){return new this(e).sin()}function av(e){return new this(e).sinh()}function ay(e){return new this(e).sqrt()}function ab(e,t){return new this(e).sub(t)}function ax(){var e=0,t=arguments,n=new this(t[0]);for(su=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return su=!0,sE(n,this.precision,this.rounding)}function aw(e){return new this(e).tan()}function aS(e){return new this(e).tanh()}function aC(e){return sE(e=new this(e),e.e+1,1)}sC[Symbol.for("nodejs.util.inspect.custom")]=sC.toString,sC[Symbol.toStringTag]="Decimal";var aA=sC.constructor=function e(t){var n,r,i;function o(e){var t,n,r;if(!(this instanceof o))return new o(e);if(this.constructor=o,ar(e)){this.s=e.s,su?!e.d||e.e>o.maxE?(this.e=NaN,this.d=null):e.e<o.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(r=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;su?t>o.maxE?(this.e=NaN,this.d=null):t<o.minE?(this.e=0,this.d=[0]):(this.e=t,this.d=[e]):(this.e=t,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return sH(this,e.toString())}if("string"===r)return 45===(n=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===n&&(e=e.slice(1)),this.s=1),sx.test(e)?sH(this,e):function(e,t){var n,r,i,o,s,a,l,u,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),sx.test(t))return sH(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(sy.test(t))n=16,t=t.toLowerCase();else if(sv.test(t))n=2;else if(sb.test(t))n=8;else throw Error(sh+t);for((o=t.search(/p/i))>0?(l=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),s=(o=t.indexOf("."))>=0,r=e.constructor,s&&(o=(a=(t=t.replace(".","")).length)-o,i=sj(r,new r(n),o,2*o)),o=c=(u=sT(t,n,1e7)).length-1;0===u[o];--o)u.pop();return o<0?new r(0*e.s):(e.e=sR(u,c),e.d=u,su=!1,s&&(e=sD(e,i,4*a)),l&&(e=e.times(54>Math.abs(l)?sg(2,l):aA.pow(2,l))),su=!0,e)}(this,e);if("bigint"===r)return e<0?(e=-e,this.s=-1):this.s=1,sH(this,e.toString());throw Error(sh+e)}if(o.prototype=sC,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=s6,o.clone=e,o.isDecimal=ar,o.abs=sY,o.acos=sK,o.acosh=sZ,o.add=sX,o.asin=sQ,o.asinh=sJ,o.atan=s0,o.atanh=s1,o.atan2=s2,o.cbrt=s5,o.ceil=s4,o.clamp=s3,o.cos=s8,o.cosh=s9,o.div=s7,o.exp=ae,o.floor=at,o.hypot=an,o.ln=ai,o.log=ao,o.log10=aa,o.log2=as,o.max=al,o.min=au,o.mod=ac,o.mul=ah,o.pow=ad,o.random=af,o.round=ap,o.sign=am,o.sin=ag,o.sinh=av,o.sqrt=ay,o.sub=ab,o.sum=ax,o.tan=aw,o.tanh=aS,o.trunc=aC,void 0===t&&(t={}),t&&!0!==t.defaults)for(n=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return o.config(t),o}(sl);ss=new aA(ss),sa=new aA(sa);var ak={createBigNumberClass:oy("BigNumber",["?on","config"],e=>{var{on:t,config:n}=e,r=aA.clone({precision:n.precision,modulo:aA.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(e){return new r(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&r.config({precision:e.precision})}),r},{isClass:!0})},aM={createMatrixClass:oy("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,n){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,n){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0})},aT={MatrixDependencies:aM,createDenseMatrixClass:oy("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");if(t&&!iV(t))throw Error("Invalid datatype: "+t);if(i$(e))"DenseMatrix"===e.type?(this._data=oh(e._data),this._size=oh(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&iH(e.data)&&iH(e.size))this._data=e.data,this._size=e.size,oF(this._data,this._size),this._datatype=t||e.datatype;else if(iH(e))this._data=function e(t){for(var n=0,r=t.length;n<r;n++){var i=t[n];iH(i)?t[n]=e(i):i&&!0===i.isMatrix&&(t[n]=e(i.valueOf()))}return t}(e),this._size=oj(this._data),oF(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+oc(e)+")");else this._data=[],this._size=[0],this._datatype=t}function r(e,t,n){if(0===t.length){for(var r=e._data;iH(r);)r=r[0];return r}return e._size=t.slice(0),e._data=o_(e._data,e._size,n),e}function i(e,t,n){for(var i=e._size.slice(0),o=!1;i.length<t.length;)i.push(0),o=!0;for(var s=0,a=t.length;s<a;s++)t[s]>i[s]&&(i[s]=t[s],o=!0);o&&r(e,i,n)}return n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},n.prototype.type="DenseMatrix",n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return o$(this._data,oc)},n.prototype.storage=function(){return"dense"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,r){switch(arguments.length){case 1:return function(e,t){if(!iY(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r=t.size();if(r.length!==e._size.length)throw new oN(r.length,e._size.length);for(var i=t.min(),o=t.max(),s=0,a=e._size.length;s<a;s++)oB(i[s],e._size[s]),oB(o[s],e._size[s]);return new n(function e(t,n,r,i){var o=i===r-1,s=n.dimension(i);return o?s.map(function(e){return oB(e,t.length),t[e]}).valueOf():s.map(function(o){return oB(o,t.length),e(t[o],n,r,i+1)}).valueOf()}(e._data,t,r.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var o,s=t.size(),a=t.isScalar();if(i$(n)?(o=n.size(),n=n.valueOf()):o=oj(n),a){if(0!==o.length)throw TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(s.length<e._size.length)throw new oN(s.length,e._size.length,"<");if(o.length<s.length){for(var l=0,u=0;1===s[l]&&1===o[l];)l++;for(;1===s[l];)u++,l++;n=oH(n,s.length,u,o)}if(!of(s,o))throw new oN(s,o,">");i(e,t.max().map(function(e){return e+1}),r);var c=s.length;!function e(t,n,r,i,o){var s=o===i-1,a=n.dimension(o);s?a.forEach(function(e,n){oB(e),t[e]=r[n[0]]}):a.forEach(function(s,a){oB(s),e(t[s],n,r[a[0]],i,o+1)})}(e._data,t,n,c,0)}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},n.prototype.get=function(e){if(!iH(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new oN(e.length,this._size.length);for(var t=0;t<e.length;t++)oB(e[t],this._size[t]);for(var n=this._data,r=0,i=e.length;r<i;r++){var o=e[r];oB(o,n.length),n=n[o]}return n},n.prototype.set=function(e,t,n){if(!iH(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new oN(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),n);var r,o,s,a=this._data;for(r=0,o=e.length-1;r<o;r++)oB(s=e[r],a.length),a=a[s];return oB(s=e[e.length-1],a.length),a[s]=t,this},n.prototype.resize=function(e,t,n){if(!iW(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return r(n?this.clone():this,i,t)},n.prototype.reshape=function(e,t){var n=t?this.clone():this;n._data=function(e,t){var n=function(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(n){Array.isArray(n)?n.forEach(e):t.push(n)}),t}(e),r=n.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw new oN(0,r,"!=");var i=oV(t=oz(t,r));if(r!==i)throw new oN(i,r,"!=");try{return function(e,t){for(var n,r=e,i=t.length-1;i>0;i--){var o=t[i];n=[];for(var s=r.length/o,a=0;a<s;a++)n.push(r.slice(a*o,(a+1)*o));r=n}return r}(n,t)}catch(e){if(e instanceof oN)throw new oN(i,r,"!=");throw e}}(n._data,e);var r=n._size.reduce((e,t)=>e*t);return n._size=oz(e,r),n},n.prototype.clone=function(){return new n({data:oh(this._data),size:oh(this._size),datatype:this._datatype})},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(e){var t=this,r=function n(r,i){return iH(r)?r.map(function(e,t){return n(e,i.concat(t))}):e(r,i,t)}(this._data,[]),i=void 0!==this._datatype?o$(r,oc):void 0;return new n(r,i)},n.prototype.forEach=function(e){var t=this;!function n(r,i){iH(r)?r.forEach(function(e,t){n(e,i.concat(t))}):e(r,i,t)}(this._data,[])},n.prototype[Symbol.iterator]=function*(){var e=function* e(t,n){if(iH(t))for(var r=0;r<t.length;r++)yield*e(t[r],n.concat(r));else yield{value:t,index:n}};yield*e(this._data,[])},n.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var t of this._data)e.push(new n([t],this._datatype));return e},n.prototype.columns=function(){var e=this,t=[],r=this.size();if(2!==r.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,o=function(r){var o=i.map(e=>[e[r]]);t.push(new n(o,e._datatype))},s=0;s<r[1];s++)o(s);return t},n.prototype.toArray=function(){return oh(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return oP(this._data,e)},n.prototype.toString=function(){return oP(this._data)},n.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(iF(e)&&(e=e.toNumber()),!ij(e)||!ow(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,r=e<0?-e:0,i=Math.min(this._size[0]-r,this._size[1]-t),o=[],s=0;s<i;s++)o[s]=this._data[s+r][s+t];return new n({data:o,size:[i],datatype:this._datatype})},n.diagonal=function(e,t,r,i){if(!iH(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(iF(e)&&(e=e.toNumber()),!ij(e)||!ow(e)||e<1)throw Error("Size values must be positive integers");return e}),r){if(iF(r)&&(r=r.toNumber()),!ij(r)||!ow(r))throw TypeError("The parameter k must be an integer number")}else r=0;var o,s=r>0?r:0,a=r<0?-r:0,l=e[0],u=e[1],c=Math.min(l-a,u-s);if(iH(t)){if(t.length!==c)throw Error("Invalid value array length");o=function(e){return t[e]}}else if(i$(t)){var h=t.size();if(1!==h.length||h[0]!==c)throw Error("Invalid matrix length");o=function(e){return t.get([e])}}else o=function(){return t};i||(i=iF(o(0))?o(0).mul(0):0);var d=[];if(e.length>0){d=o_(d,e,i);for(var f=0;f<c;f++)d[f+a][f+s]=o(f)}return new n({data:d,size:[l,u]})},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(e,t){if(!ij(e)||!ow(e)||!ij(t)||!ow(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return oB(e,this._size[0]),oB(t,this._size[0]),n._swapRows(e,t,this._data),this},n._swapRows=function(e,t,n){var r=n[e];n[e]=n[t],n[t]=r},n},{isClass:!0})};let aD=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},aE=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},aO=function(e,t){return((e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8)?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},aR=function(){throw SyntaxError("Invalid Param")};function aI(e,t){let n=Math.abs(e),r=Math.abs(t);return 0===e?Math.log(r):0===t?Math.log(n):n<3e3&&r<3e3?.5*Math.log(e*e+t*t):.5*Math.log((e*=.5)*e+(t*=.5)*t)+Math.LN2}let aP={re:0,im:0},aN=function(e,t){if(null==e)aP.re=aP.im=0;else if(void 0!==t)aP.re=e,aP.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)aP.re=e.re,aP.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return aL.INFINITY;aP.re=e.abs*Math.cos(e.arg),aP.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return aL.INFINITY;aP.re=e.r*Math.cos(e.phi),aP.im=e.r*Math.sin(e.phi)}else 2===e.length?(aP.re=e[0],aP.im=e[1]):aR();break;case"string":aP.im=aP.re=0;let n=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),r=1,i=0;null===n&&aR();for(let e=0;e<n.length;e++){let t=n[e];" "===t||" "===t||"\n"===t||("+"===t?r++:"-"===t?i++:("i"===t||"I"===t?(r+i===0&&aR()," "===n[e+1]||isNaN(n[e+1])?aP.im+=parseFloat((i%2?"-":"")+"1"):(aP.im+=parseFloat((i%2?"-":"")+n[e+1]),e++)):((r+i===0||isNaN(t))&&aR(),"i"===n[e+1]||"I"===n[e+1]?(aP.im+=parseFloat((i%2?"-":"")+t),e++):aP.re+=parseFloat((i%2?"-":"")+t)),r=i=0))}r+i>0&&aR();break;case"number":aP.im=0,aP.re=e;break;default:aR()}return isNaN(aP.re)||isNaN(aP.im),aP};function aL(e,t){if(!(this instanceof aL))return new aL(e,t);let n=aN(e,t);this.re=n.re,this.im=n.im}aL.prototype={re:0,im:0,sign:function(){let e=aO(this.re,this.im);return new aL(this.re/e,this.im/e)},add:function(e,t){let n=aN(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?aL.NAN:aL.INFINITY:new aL(this.re+n.re,this.im+n.im)},sub:function(e,t){let n=aN(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?aL.NAN:aL.INFINITY:new aL(this.re-n.re,this.im-n.im)},mul:function(e,t){let n=aN(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,s=0===n.re&&0===n.im;return r&&s||i&&o?aL.NAN:r||i?aL.INFINITY:0===n.im&&0===this.im?new aL(this.re*n.re,0):new aL(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(e,t){let n=aN(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,s=0===n.re&&0===n.im;if(o&&s||r&&i)return aL.NAN;if(s||r)return aL.INFINITY;if(o||i)return aL.ZERO;if(0===n.im)return new aL(this.re/n.re,this.im/n.re);if(Math.abs(n.re)<Math.abs(n.im)){let e=n.re/n.im,t=n.re*e+n.im;return new aL((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{let e=n.im/n.re,t=n.im*e+n.re;return new aL((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let n=aN(e,t),r=0===this.re&&0===this.im;if(0===n.re&&0===n.im)return aL.ONE;if(0===n.im){if(0===this.im&&this.re>0)return new aL(Math.pow(this.re,n.re),0);else if(0===this.re)switch((n.re%4+4)%4){case 0:return new aL(Math.pow(this.im,n.re),0);case 1:return new aL(0,Math.pow(this.im,n.re));case 2:return new aL(-Math.pow(this.im,n.re),0);case 3:return new aL(0,-Math.pow(this.im,n.re))}}if(r&&n.re>0)return aL.ZERO;let i=Math.atan2(this.im,this.re),o=aI(this.re,this.im),s=Math.exp(n.re*o-n.im*i),a=n.im*o+n.re*i;return new aL(s*Math.cos(a),s*Math.sin(a))},sqrt:function(){let e=this.re,t=this.im;if(0===t)if(e>=0)return new aL(Math.sqrt(e),0);else return new aL(0,Math.sqrt(-e));let n=Math.sqrt(.5*(aO(e,t)+Math.abs(e))),r=Math.abs(t)/(2*n);return e>=0?new aL(n,t<0?-r:r):new aL(r,t<0?-n:n)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new aL(e,0):new aL(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e,t=this.re,n=this.im;return new aL(Math.expm1(t)*Math.cos(n)+-2*(e=Math.sin(.5*n))*e,Math.exp(t)*Math.sin(n))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new aL(Math.log(e),0):new aL(aI(e,t),Math.atan2(t,e))},abs:function(){return aO(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new aL(Math.sin(e)*aD(t),Math.cos(e)*aE(t))},cos:function(){let e=this.re,t=this.im;return new aL(Math.cos(e)*aD(t),-Math.sin(e)*aE(t))},tan:function(){let e=2*this.re,t=2*this.im,n=Math.cos(e)+aD(t);return new aL(Math.sin(e)/n,aE(t)/n)},cot:function(){let e=2*this.re,t=2*this.im,n=Math.cos(e)-aD(t);return new aL(-Math.sin(e)/n,aE(t)/n)},sec:function(){let e=this.re,t=this.im,n=.5*aD(2*t)+.5*Math.cos(2*e);return new aL(Math.cos(e)*aD(t)/n,Math.sin(e)*aE(t)/n)},csc:function(){let e=this.re,t=this.im,n=.5*aD(2*t)-.5*Math.cos(2*e);return new aL(Math.sin(e)*aD(t)/n,-Math.cos(e)*aE(t)/n)},asin:function(){let e=this.re,t=this.im,n=new aL(t*t-e*e+1,-2*e*t).sqrt(),r=new aL(n.re-t,n.im+e).log();return new aL(r.im,-r.re)},acos:function(){let e=this.re,t=this.im,n=new aL(t*t-e*e+1,-2*e*t).sqrt(),r=new aL(n.re-t,n.im+e).log();return new aL(Math.PI/2-r.im,r.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new aL(0,1/0);if(-1===t)return new aL(0,-1/0)}let n=e*e+(1-t)*(1-t),r=new aL((1-t*t-e*e)/n,-2*e/n).log();return new aL(-.5*r.im,.5*r.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new aL(Math.atan2(1,e),0);let n=e*e+t*t;return 0!==n?new aL(e/n,-t/n).atan():new aL(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new aL(0,1/0);let n=e*e+t*t;return 0!==n?new aL(e/n,-t/n).acos():new aL(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new aL(Math.PI/2,1/0);let n=e*e+t*t;return 0!==n?new aL(e/n,-t/n).asin():new aL(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new aL(aE(e)*Math.cos(t),aD(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new aL(aD(e)*Math.cos(t),aE(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,n=aD(e)+Math.cos(t);return new aL(aE(e)/n,Math.sin(t)/n)},coth:function(){let e=2*this.re,t=2*this.im,n=aD(e)-Math.cos(t);return new aL(aE(e)/n,-Math.sin(t)/n)},csch:function(){let e=this.re,t=this.im,n=Math.cos(2*t)-aD(2*e);return new aL(-2*aE(e)*Math.cos(t)/n,2*aD(e)*Math.sin(t)/n)},sech:function(){let e=this.re,t=this.im,n=Math.cos(2*t)+aD(2*e);return new aL(2*aD(e)*Math.cos(t)/n,-2*aE(e)*Math.sin(t)/n)},asinh:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new aL(0,0);let t=Math.abs(e),n=Math.log(t+Math.sqrt(t*t+1));return new aL(e<0?-n:n,0)}let n=new aL(e*e-t*t+1,2*e*t).sqrt();return new aL(e+n.re,t+n.im).log()},acosh:function(){let e=this.re,t=this.im;if(0===t){if(e>1)return new aL(Math.log(e+Math.sqrt(e-1)*Math.sqrt(e+1)),0);if(e<-1){let t=Math.sqrt(e*e-1);return new aL(Math.log(-e+t),Math.PI)}return new aL(0,Math.acos(e))}let n=new aL(e-1,t).sqrt(),r=new aL(e+1,t).sqrt();return new aL(e+n.re*r.re-n.im*r.im,t+n.re*r.im+n.im*r.re).log()},atanh:function(){let e=this.re,t=this.im;if(0===t)return 0===e?new aL(0,0):1===e?new aL(1/0,0):-1===e?new aL(-1/0,0):-1<e&&e<1?new aL(.5*Math.log((1+e)/(1-e)),0):e>1?new aL(.5*Math.log((e+1)/(e-1)),-Math.PI/2):new aL(.5*Math.log(-((1+e)/(1-e))),Math.PI/2);let n=1-e,r=1+e,i=n*n+t*t;if(0===i)return new aL(-1!==e?e/0:0,0!==t?t/0:0);let o=(r*n-t*t)/i,s=(t*n+r*t)/i;return new aL(aI(o,s)/2,Math.atan2(s,o)/2)},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new aL(0,Math.PI/2);let n=e*e+t*t;return 0!==n?new aL(e/n,-t/n).atanh():new aL(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new aL(1/0,0);let t=1/e;return new aL(Math.log(t+Math.sqrt(t*t+1)),0)}let n=e*e+t*t;return 0!==n?new aL(e/n,-t/n).asinh():new aL(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return aL.INFINITY;let n=e*e+t*t;return 0!==n?new aL(e/n,-t/n).acosh():new aL(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return aL.INFINITY;if(this.isInfinite())return aL.ZERO;let e=this.re,t=this.im,n=e*e+t*t;return new aL(e/n,-t/n)},conjugate:function(){return new aL(this.re,-this.im)},neg:function(){return new aL(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new aL(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new aL(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new aL(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let n=aN(e,t);return Math.abs(n.re-this.re)<=aL.EPSILON&&Math.abs(n.im-this.im)<=aL.EPSILON},clone:function(){return new aL(this.re,this.im)},toString:function(){let e=this.re,t=this.im,n="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<aL.EPSILON&&(e=0),Math.abs(t)<aL.EPSILON&&(t=0),0===t)?n+e:(0!==e?(n+=e,n+=" ",t<0?(t=-t,n+="-"):n+="+",n+=" "):t<0&&(t=-t,n+="-"),1!==t&&(n+=t),n+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},aL.ZERO=new aL(0,0),aL.ONE=new aL(1,0),aL.I=new aL(0,1),aL.PI=new aL(Math.PI,0),aL.E=new aL(Math.E,0),aL.INFINITY=new aL(1/0,1/0),aL.NAN=new aL(NaN,NaN),aL.EPSILON=1e-15;var aj=oy("Complex",[],()=>(aL.prototype.type="Complex",aL.prototype.isComplex=!0,aL.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},aL.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},aL.prototype.format=function(e){var t=this.im,n=this.re,r=oC(this.re,e),i=oC(this.im,e),o=ij(e)?e:e?e.precision:null;if(null!==o){var s=Math.pow(10,-o);Math.abs(n/t)<s&&(n=0),Math.abs(t/n)<s&&(t=0)}return 0===t?r:0===n?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?r+" - i":r+" - "+i.substring(1)+"i":1===t?r+" + i":r+" + "+i+"i"},aL.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return aL(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var n=arguments[0],r=arguments[1];if(ij(n)){if(iz(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),ij(r))return new aL({r:n,phi:r});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},aL.prototype.valueOf=aL.prototype.toString,aL.fromJSON=function(e){return new aL(e)},aL.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},aL),{isClass:!0}),aF={s:1,n:0,d:1};function aB(e,t){if(isNaN(e=parseInt(e,10)))throw aU();return e*t}function a_(e,t){if(0===t)throw aW();var n=Object.create(a$.prototype);n.s=e<0?-1:1;var r=aH(e=e<0?-e:e,t);return n.n=e/r,n.d=t/r,n}function az(e){for(var t={},n=e,r=2,i=4;i<=n;){for(;n%r==0;)n/=r,t[r]=(t[r]||0)+1;i+=1+2*r++}return n!==e?n>1&&(t[n]=(t[n]||0)+1):t[e]=(t[e]||0)+1,t}var aV=function(e,t){var n,r=0,i=1,o=1,s=0,a=0,l=0,u=1,c=1,h=0,d=1,f=1,p=1;if(null==e);else if(void 0!==t){if(o=(r=e)*(i=t),r%1!=0||i%1!=0)throw aq()}else switch(typeof e){case"object":if("d"in e&&"n"in e)r=e.n,i=e.d,"s"in e&&(r*=e.s);else if(0 in e)r=e[0],1 in e&&(i=e[1]);else throw aU();o=r*i;break;case"number":if(e<0&&(o=e,e=-e),e%1==0)r=e;else if(e>0){for(e>=1&&(c=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=c);d<=1e7&&p<=1e7;){if(e===(n=(h+f)/(d+p))){d+p<=1e7?(r=h+f,i=d+p):p>d?(r=f,i=p):(r=h,i=d);break}e>n?(h+=f,d+=p):(f+=h,p+=d),d>1e7?(r=f,i=p):(r=h,i=d)}r*=c}else(isNaN(e)||isNaN(t))&&(i=r=NaN);break;case"string":if(null===(d=e.match(/\d+|./g)))throw aU();if("-"===d[h]?(o=-1,h++):"+"===d[h]&&h++,d.length===h+1?a=aB(d[h++],o):"."===d[h+1]||"."===d[h]?("."!==d[h]&&(s=aB(d[h++],o)),(++h+1===d.length||"("===d[h+1]&&")"===d[h+3]||"'"===d[h+1]&&"'"===d[h+3])&&(a=aB(d[h],o),u=Math.pow(10,d[h].length),h++),("("===d[h]&&")"===d[h+2]||"'"===d[h]&&"'"===d[h+2])&&(l=aB(d[h+1],o),c=Math.pow(10,d[h+1].length)-1,h+=3)):"/"===d[h+1]||":"===d[h+1]?(a=aB(d[h],o),u=aB(d[h+2],1),h+=3):"/"===d[h+3]&&" "===d[h+1]&&(s=aB(d[h],o),a=aB(d[h+2],o),u=aB(d[h+4],1),h+=5),d.length<=h){o=r=l+(i=u*c)*s+c*a;break}default:throw aU()}if(0===i)throw aW();aF.s=o<0?-1:1,aF.n=Math.abs(r),aF.d=Math.abs(i)};function aH(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function a$(e,t){if(aV(e,t),!(this instanceof a$))return a_(aF.s*aF.n,aF.d);e=aH(aF.d,aF.n),this.s=aF.s,this.n=aF.n/e,this.d=aF.d/e}var aW=function(){return Error("Division by Zero")},aU=function(){return Error("Invalid argument")},aq=function(){return Error("Parameters must be integer")};a$.prototype={s:1,n:0,d:1,abs:function(){return a_(this.n,this.d)},neg:function(){return a_(-this.s*this.n,this.d)},add:function(e,t){return aV(e,t),a_(this.s*this.n*aF.d+aF.s*this.d*aF.n,this.d*aF.d)},sub:function(e,t){return aV(e,t),a_(this.s*this.n*aF.d-aF.s*this.d*aF.n,this.d*aF.d)},mul:function(e,t){return aV(e,t),a_(this.s*aF.s*this.n*aF.n,this.d*aF.d)},div:function(e,t){return aV(e,t),a_(this.s*aF.s*this.n*aF.d,this.d*aF.n)},clone:function(){return a_(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new a$(NaN);if(void 0===e)return a_(this.s*this.n%this.d,1);if(aV(e,t),0===aF.n&&0===this.d)throw aW();return a_(this.s*(aF.d*this.n)%(aF.n*this.d),aF.d*this.d)},gcd:function(e,t){return aV(e,t),a_(aH(aF.n,this.n)*aH(aF.d,this.d),aF.d*this.d)},lcm:function(e,t){return(aV(e,t),0===aF.n&&0===this.n)?a_(0,1):a_(aF.n*this.n,aH(aF.n,this.n)*aH(aF.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a$(NaN):a_(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a$(NaN):a_(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a$(NaN):a_(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return aV(e,t),a_(this.s*Math.round(this.n*aF.d/(this.d*aF.n))*aF.n,aF.d)},inverse:function(){return a_(this.s*this.d,this.n)},pow:function(e,t){if(aV(e,t),1===aF.d)if(aF.s<0)return a_(Math.pow(this.s*this.d,aF.n),Math.pow(this.n,aF.n));else return a_(Math.pow(this.s*this.n,aF.n),Math.pow(this.d,aF.n));if(this.s<0)return null;var n=az(this.n),r=az(this.d),i=1,o=1;for(var s in n)if("1"!==s){if("0"===s){i=0;break}if(n[s]*=aF.n,n[s]%aF.d!=0)return null;n[s]/=aF.d,i*=Math.pow(s,n[s])}for(var s in r)if("1"!==s){if(r[s]*=aF.n,r[s]%aF.d!=0)return null;r[s]/=aF.d,o*=Math.pow(s,r[s])}return aF.s<0?a_(o,i):a_(i,o)},equals:function(e,t){return aV(e,t),this.s*this.n*aF.d==aF.s*aF.n*this.d},compare:function(e,t){aV(e,t);var n=this.s*this.n*aF.d-aF.s*aF.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),n=t.toContinued(),r=1;r<n.length;r++){for(var i=a_(n[r-1],1),o=r-2;o>=0;o--)i=i.inverse().add(n[o]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return aV(e,t),!(!(aF.n*this.d)||this.n*aF.d%(aF.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,n="",r=this.n,i=this.d;return this.s<0&&(n+="-"),1===i?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,n+=" ",r%=i),n+=r,n+="/",n+=i),n},toLatex:function(e){var t,n="",r=this.n,i=this.d;return this.s<0&&(n+="-"),1===i?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,r%=i),n+="\\frac{",n+=r,n+="}{",n+=i,n+="}"),n},toContinued:function(){var e,t=this.n,n=this.d,r=[];if(isNaN(t)||isNaN(n))return r;do r.push(Math.floor(t/n)),e=t%n,t=n,n=e;while(1!==t);return r},toString:function(e){var t=this.n,n=this.d;if(isNaN(t)||isNaN(n))return"NaN";e=e||15;var r=function(e){for(;e%2==0;e/=2);for(;e%5==0;e/=5);if(1===e)return 0;for(var t=10%e,n=1;1!==t;n++)if(t=10*t%e,n>2e3)return 0;return n}(n),i=function(e,t){for(var n=1,r=function(e,t,n){for(var r=1;t>0;e=e*e%n,t>>=1)1&t&&(r=r*e%n);return r}(10,t,e),i=0;i<300;i++){if(n===r)return i;n=10*n%e,r=10*r%e}return 0}(n,r),o=this.s<0?"-":"";if(o+=t/n|0,t%=n,(t*=10)&&(o+="."),r){for(var s=i;s--;)o+=t/n|0,t%=n,t*=10;o+="(";for(var s=r;s--;)o+=t/n|0,t%=n,t*=10;o+=")"}else for(var s=e;t&&s--;)o+=t/n|0,t%=n,t*=10;return o}};var aG=oy("Fraction",[],()=>(a$.prototype.type="Fraction",a$.prototype.isFraction=!0,a$.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},a$.fromJSON=function(e){return new a$(e)},a$),{isClass:!0}),aY=n(42915);function aK(e,t){return!!e&&"object"==typeof e&&(!!om(aX,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function aZ(e){return"object"==typeof e&&e&&e.constructor===Object}var aX={length:!0,name:!0},aQ={toString:!0,valueOf:!0,toLocaleString:!0};class aJ{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){var t,n,r=this.wrappedObject;if(aZ(r)&&aK(r,e))return r[e];if("function"==typeof r[e]&&(t=r,n=e,!(null==t||"function"!=typeof t[n]||om(t,n)&&Object.getPrototypeOf&&n in Object.getPrototypeOf(t))&&(om(aQ,n)||!(n in Object.prototype)&&!(n in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}set(e,t){return!function(e,t,n){if(aZ(e)&&aK(e,t))return e[t]=n;throw Error('No access to property "'+t+'"')}(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}}function a0(e){return!!e&&(e instanceof Map||e instanceof aJ||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var a1=function(){return a1=aY.create,aY};function a2(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function a5(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function a4(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var a3={BigNumberDependencies:ak,ComplexDependencies:{createComplexClass:aj},DenseMatrixDependencies:aT,FractionDependencies:{createFractionClass:aG},createTyped:oy("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:n,DenseMatrix:r,Fraction:i}=e,o=a1();return o.types=[{name:"number",test:ij},{name:"Complex",test:iB},{name:"BigNumber",test:iF},{name:"Fraction",test:i_},{name:"Unit",test:iz},{name:"string",test:iV},{name:"Chain",test:ou},{name:"Array",test:iH},{name:"Matrix",test:i$},{name:"DenseMatrix",test:iU},{name:"SparseMatrix",test:iq},{name:"Range",test:iG},{name:"Index",test:iY},{name:"boolean",test:iK},{name:"ResultSet",test:iZ},{name:"Help",test:iX},{name:"function",test:iQ},{name:"Date",test:iJ},{name:"RegExp",test:i0},{name:"null",test:i2},{name:"undefined",test:i5},{name:"AccessorNode",test:i4},{name:"ArrayNode",test:i3},{name:"AssignmentNode",test:i6},{name:"BlockNode",test:i8},{name:"ConditionalNode",test:i9},{name:"ConstantNode",test:i7},{name:"FunctionNode",test:ot},{name:"FunctionAssignmentNode",test:oe},{name:"IndexNode",test:on},{name:"Node",test:or},{name:"ObjectNode",test:oi},{name:"OperatorNode",test:oo},{name:"ParenthesisNode",test:os},{name:"RangeNode",test:oa},{name:"SymbolNode",test:ol},{name:"Map",test:a0},{name:"Object",test:i1}],o.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(t||a2(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return n||a5(e),new n(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return n||a5(e),new n(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return n||a5(e),new n(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||a4(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||a2(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||a4(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){n||a5(e);try{return new n(e)}catch(t){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||a2(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||a4(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return r||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new r(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}],o})},a6="equalScalar",a8=oy(a6,["typed","config"],e=>{var{typed:t,config:n}=e;return t(a6,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return oO(e,t,n.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||function(e,t,n){if(null==n)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var r=e.minus(t).abs();if(r.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return r.lte(i.times(n))}return!1}(e,t,n.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){var r;return r=n.epsilon,oO(e.re,t.re,r)&&oO(e.im,t.im,r)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw Error("Cannot compare units with different base");return this(e.value,t.value)}})});oy(a6,["typed","config"],e=>{var{typed:t,config:n}=e;return t(a6,{"number, number":function(e,t){return oO(e,t,n.epsilon)}})});var a9={typedDependencies:a3,createEqualScalar:a8},a7=oy("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:n,Matrix:r}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(t&&!iV(t))throw Error("Invalid datatype: "+t);if(i$(e)){var n,r,s;n=this,r=e,s=t,"SparseMatrix"===r.type?(n._values=r._values?oh(r._values):void 0,n._index=oh(r._index),n._ptr=oh(r._ptr),n._size=oh(r._size),n._datatype=s||r._datatype):o(n,r.valueOf(),s||r._datatype)}else if(e&&iH(e.index)&&iH(e.ptr)&&iH(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(iH(e))o(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+oc(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function o(e,r,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var o=r.length,s=0,a=n,l=0;if(iV(i)&&(a=t.find(n,[i,i])||n,l=t.convert(0,i)),o>0){var u=0;do{e._ptr.push(e._index.length);for(var c=0;c<o;c++){var h=r[c];if(iH(h)){if(0===u&&s<h.length&&(s=h.length),u<h.length){var d=h[u];a(d,l)||(e._values.push(d),e._index.push(c))}}else 0===u&&s<1&&(s=1),a(h,l)||(e._values.push(h),e._index.push(c))}u++}while(u<s)}e._ptr.push(e._index.length),e._size=[o,s]}function s(e,t,n,r){if(n-t==0)return n;for(var i=t;i<n;i++)if(r[i]===e)return i;return t}function a(e,t,n,r,i,o,s){i.splice(e,0,r),o.splice(e,0,t);for(var a=n+1;a<s.length;a++)s[a]++}function l(e,r,i,o){var s,a,l,u=o||0,c=n,h=0;iV(e._datatype)&&(c=t.find(n,[e._datatype,e._datatype])||n,h=t.convert(0,e._datatype),u=t.convert(u,e._datatype));var d=!c(u,h),f=e._size[0],p=e._size[1];if(i>p){for(a=p;a<i;a++)if(e._ptr[a]=e._values.length,d)for(s=0;s<f;s++)e._values.push(u),e._index.push(s);e._ptr[i]=e._values.length}else i<p&&(e._ptr.splice(i+1,p-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(p=i,r>f){if(d){var m=0;for(a=0;a<p;a++){e._ptr[a]=e._ptr[a]+m,l=e._ptr[a+1]+m;var g=0;for(s=f;s<r;s++,g++)e._values.splice(l+g,0,u),e._index.splice(l+g,0,s),m++}e._ptr[p]=e._values.length}}else if(r<f){var v=0;for(a=0;a<p;a++){e._ptr[a]=e._ptr[a]-v;var y=e._ptr[a],b=e._ptr[a+1]-v;for(l=y;l<b;l++)(s=e._index[l])>r-1&&(e._values.splice(l,1),e._index.splice(l,1),v++)}e._ptr[a]=e._values.length}return e._size[0]=r,e._size[1]=i,e}function u(e,t,n,r,i){var o,s,a=r[0],l=r[1],u=[];for(o=0;o<a;o++)for(s=0,u[o]=[];s<l;s++)u[o][s]=0;for(s=0;s<l;s++)for(var c=n[s],h=n[s+1],d=c;d<h;d++)u[o=t[d]][s]=e?i?oh(e[d]):e[d]:1;return u}return i.prototype=new r,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return o$(this._values,oc)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,n){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!iY(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var n,r,o,s,a=t.size();if(a.length!==e._size.length)throw new oN(a.length,e._size.length);var l=t.min(),u=t.max();for(n=0,r=e._size.length;n<r;n++)oB(l[n],e._size[n]),oB(u[n],e._size[n]);var c=e._values,h=e._index,d=e._ptr,f=t.dimension(0),p=t.dimension(1),m=[],g=[];f.forEach(function(e,t){g[e]=t[0],m[e]=!0});var v=c?[]:void 0,y=[],b=[];return p.forEach(function(e){for(b.push(y.length),o=d[e],s=d[e+1];o<s;o++)!0===m[n=h[o]]&&(y.push(g[n]),v&&v.push(c[o]))}),b.push(y.length),new i({values:v,index:y,ptr:b,size:a,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var i,o=t.size(),s=t.isScalar();if(i$(n)?(i=n.size(),n=n.toArray()):i=oj(n),s){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(1!==o.length&&2!==o.length)throw new oN(o.length,e._size.length,"<");if(i.length<o.length){for(var a=0,l=0;1===o[a]&&1===i[a];)a++;for(;1===o[a];)l++,a++;n=oH(n,o.length,l,i)}if(!of(o,i))throw new oN(o,i,">");if(1===o.length)t.dimension(0).forEach(function(t,i){oB(t),e.set([t,0],n[i[0]],r)});else{var u=t.dimension(0),c=t.dimension(1);u.forEach(function(t,i){oB(t),c.forEach(function(o,s){oB(o),e.set([t,o],n[i[0]][s[0]],r)})})}}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!iH(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new oN(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var t=e[0],n=e[1];oB(t,this._size[0]),oB(n,this._size[1]);var r=s(t,this._ptr[n],this._ptr[n+1],this._index);return r<this._ptr[n+1]&&this._index[r]===t?this._values[r]:0},i.prototype.set=function(e,r,i){if(!iH(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new oN(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=e[0],u=e[1],c=this._size[0],h=this._size[1],d=n,f=0;iV(this._datatype)&&(d=t.find(n,[this._datatype,this._datatype])||n,f=t.convert(0,this._datatype)),(o>c-1||u>h-1)&&(l(this,Math.max(o+1,c),Math.max(u+1,h),i),c=this._size[0],h=this._size[1]),oB(o,c),oB(u,h);var p=s(o,this._ptr[u],this._ptr[u+1],this._index);return p<this._ptr[u+1]&&this._index[p]===o?d(r,f)?function(e,t,n,r,i){n.splice(e,1),r.splice(e,1);for(var o=t+1;o<i.length;o++)i[o]--}(p,u,this._values,this._index,this._ptr):this._values[p]=r:a(p,o,u,r,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,n){if(!iW(e))throw TypeError("Array or Matrix expected");var r=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==r.length)throw Error("Only two dimensions matrix are supported");return r.forEach(function(e){if(!ij(e)||!ow(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+oP(r)+")")}),l(n?this.clone():this,r[0],r[1],t)},i.prototype.reshape=function(e,t){if(!iH(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(t){if(!ij(t)||!ow(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+oP(e)+")")});var n=this._size[0]*this._size[1],r=(e=oz(e,n))[0]*e[1];if(n!==r)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var o=[],l=0;l<i._ptr.length;l++)for(var u=0;u<i._ptr[l+1]-i._ptr[l];u++)o.push(l);for(var c=i._values.slice(),h=i._index.slice(),d=0;d<i._index.length;d++){var f=h[d],p=o[d],m=f*i._size[1]+p;o[d]=m%e[1],h[d]=Math.floor(m/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var g=0;g<i._ptr.length;g++)i._ptr[g]=0;for(var v=0;v<c.length;v++){var y=h[v],b=o[v],x=c[v];a(s(y,i._ptr[b],i._ptr[b+1],i._index),y,b,x,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?oh(this._values):void 0,index:oh(this._index),ptr:oh(this._ptr),size:oh(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,r){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var o=this;return function(e,r,o,s,a){var l=[],u=[],c=[],h=n,d=0;iV(e._datatype)&&(h=t.find(n,[e._datatype,e._datatype])||n,d=t.convert(0,e._datatype));for(var f=function(e,t,n){e=s(e,t,n),h(e,d)||(l.push(e),u.push(t))},p=0;p<=o;p++){c.push(l.length);var m=e._ptr[p],g=e._ptr[p+1];if(a)for(var v=m;v<g;v++){var y=e._index[v];y>=0&&y<=r&&f(e._values[v],y-0,p-0)}else{for(var b={},x=m;x<g;x++)b[e._index[x]]=e._values[x];for(var w=0;w<=r;w++)f(w in b?b[w]:0,w-0,p-0)}}return c.push(l.length),new i({values:l,index:u,ptr:c,size:[r-0+1,o-0+1]})}(this,this._size[0]-1,this._size[1]-1,function(t,n,r){return e(t,[n,r],o)},r)},i.prototype.forEach=function(e,t){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var n=this._size[0],r=this._size[1],i=0;i<r;i++){var o=this._ptr[i],s=this._ptr[i+1];if(t)for(var a=o;a<s;a++){var l=this._index[a];e(this._values[a],[l,i],this)}else{for(var u={},c=o;c<s;c++)u[this._index[c]]=this._values[c];for(var h=0;h<n;h++)e(h in u?u[h]:0,[h,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var n=this._ptr[t],r=this._ptr[t+1],i=n;i<r;i++){var o=this._index[i];yield{value:this._values[i],index:[o,t]}}},i.prototype.toArray=function(){return u(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return u(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],n=this._size[1],r=this.density(),i="Sparse Matrix ["+oP(t,e)+" x "+oP(n,e)+"] density: "+oP(r,e)+"\n",o=0;o<n;o++)for(var s=this._ptr[o],a=this._ptr[o+1],l=s;l<a;l++)i+="\n ("+oP(this._index[l],e)+", "+oP(o,e)+") ==> "+(this._values?oP(this._values[l],e):"X");return i},i.prototype.toString=function(){return oP(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(iF(e)&&(e=e.toNumber()),!ij(e)||!ow(e))throw TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,n=e<0?-e:0,r=this._size[0],o=this._size[1],s=Math.min(r-n,o-t),a=[],l=[],u=[];u[0]=0;for(var c=t;c<o&&a.length<s;c++)for(var h=this._ptr[c],d=this._ptr[c+1],f=h;f<d;f++){var p=this._index[f];if(p===c-t+n){a.push(this._values[f]),l[a.length-1]=p-n;break}}return u.push(a.length),new i({values:a,index:l,ptr:u,size:[s,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,r,o,s,a){if(!iH(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(iF(e)&&(e=e.toNumber()),!ij(e)||!ow(e)||e<1)throw Error("Size values must be positive integers");return e}),o){if(iF(o)&&(o=o.toNumber()),!ij(o)||!ow(o))throw TypeError("The parameter k must be an integer number")}else o=0;var l,u=n,c=0;iV(a)&&(u=t.find(n,[a,a])||n,c=t.convert(0,a));var h=o>0?o:0,d=o<0?-o:0,f=e[0],p=e[1],m=Math.min(f-d,p-h);if(iH(r)){if(r.length!==m)throw Error("Invalid value array length");l=function(e){return r[e]}}else if(i$(r)){var g=r.size();if(1!==g.length||g[0]!==m)throw Error("Invalid matrix length");l=function(e){return r.get([e])}}else l=function(){return r};for(var v=[],y=[],b=[],x=0;x<p;x++){b.push(v.length);var w=x-h;if(w>=0&&w<m){var S=l(w);u(S,c)||(y.push(w+d),v.push(S))}}return b.push(v.length),new i({values:v,index:y,ptr:b,size:[f,p]})},i.prototype.swapRows=function(e,t){if(!ij(e)||!ow(e)||!ij(t)||!ow(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return oB(e,this._size[0]),oB(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,n,r,i){for(var o=r[e],s=r[e+1],a=o;a<s;a++)i(n[a],t[a])},i._swapRows=function(e,t,n,r,i,o){for(var a=0;a<n;a++){var l=o[a],u=o[a+1],c=s(e,l,u,i),h=s(t,l,u,i);if(c<u&&h<u&&i[c]===e&&i[h]===t){if(r){var d=r[c];r[c]=r[h],r[h]=d}continue}if(c<u&&i[c]===e&&(h>=u||i[h]!==t)){var f=r?r[c]:void 0;i.splice(h,0,t),r&&r.splice(h,0,f),i.splice(h<=c?c+1:c,1),r&&r.splice(h<=c?c+1:c,1);continue}if(h<u&&i[h]===t&&(c>=u||i[c]!==e)){var p=r?r[h]:void 0;i.splice(c,0,e),r&&r.splice(c,0,p),i.splice(c<=h?h+1:h,1),r&&r.splice(c<=h?h+1:h,1)}}},i},{isClass:!0}),le="matrix",lt={DenseMatrixDependencies:aT,MatrixDependencies:aM,SparseMatrixDependencies:{MatrixDependencies:aM,equalScalarDependencies:a9,typedDependencies:a3,createSparseMatrixClass:a7},typedDependencies:a3,createMatrix:oy(le,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(le,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,n){if("dense"===t||"default"===t||void 0===t)return new r(e,n);if("sparse"===t)return new i(e,n);throw TypeError("Unknown matrix type "+JSON.stringify(t)+".")}})},ln="zeros",lr=oy(ln,["typed","config","matrix","BigNumber"],e=>{var{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(ln,{"":function(){return"Array"===n.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var t=e.pop();return o(e,t)}return"Array"===n.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){var t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){var n,o=(n=!1,e.forEach(function(e,t,r){iF(e)&&(n=!0,r[t]=e.toNumber())}),n)?new i(0):0;if(e.forEach(function(e){if("number"!=typeof e||!ow(e)||e<0)throw Error("Parameters in function zeros must be positive integers")}),t){var s=r(t);return e.length>0?s.resize(e,o):s}var a=[];return e.length>0?o_(a,e,o):a}}),li=oy("algorithm11",["typed","equalScalar"],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i,o){var s,a=e._values,l=e._index,u=e._ptr,c=e._size,h=e._datatype;if(!a)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=c[0],f=c[1],p=n,m=0,g=i;"string"==typeof h&&(s=h,p=t.find(n,[s,s]),m=t.convert(0,s),r=t.convert(r,s),g=t.find(i,[s,s]));for(var v=[],y=[],b=[],x=0;x<f;x++){b[x]=y.length;for(var w=u[x],S=u[x+1],C=w;C<S;C++){var A=l[C],k=o?g(r,a[C]):g(a[C],r);p(k,m)||(y.push(A),v.push(k))}}return b[f]=y.length,e.createSparseMatrix({values:v,index:y,ptr:b,size:[d,f],datatype:s})}}),lo=oy("algorithm12",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){var s,a=e._values,l=e._index,u=e._ptr,c=e._size,h=e._datatype;if(!a)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=c[0],f=c[1],p=i;"string"==typeof h&&(s=h,r=t.convert(r,s),p=t.find(i,[s,s]));for(var m=[],g=[],v=[],y=0;y<f;y++){for(var b=y+1,x=u[y],w=u[y+1],S=x;S<w;S++){var C=l[S];g[C]=a[S],v[C]=b}for(var A=0;A<d;A++)0===y&&(m[A]=[]),v[A]===b?m[A][y]=o?p(r,g[A]):p(g[A],r):m[A][y]=o?p(r,0):p(0,r)}return new n({data:m,size:[d,f],datatype:s})}}),ls=oy("algorithm14",["typed"],e=>{var{typed:t}=e;return function(e,n,r,i){var o,s=e._data,a=e._size,l=e._datatype,u=r;"string"==typeof l&&(o=l,n=t.convert(n,o),u=t.find(r,[o,o]));var c=a.length>0?function e(t,n,r,i,o,s,a){var l=[];if(n===r.length-1)for(var u=0;u<i;u++)l[u]=a?t(s,o[u]):t(o[u],s);else for(var c=0;c<i;c++)l[c]=e(t,n+1,r,r[n+1],o[c],s,a);return l}(u,0,a,a[0],s,n,i):[];return e.createDenseMatrix({data:c,size:oh(a),datatype:o})}});function la(e,t){var n;if(!ow(e)||!ow(t))throw Error("Parameters in function gcd must be integer numbers");for(;0!==t;)n=e%t,e=t,t=n;return e<0?-e:e}function ll(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ow(t)||t<0||t>15)throw Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(ok(e,t))}la.signature="number, number";var lu="Number of decimals in function round must be an integer",lc="round",lh=oy(lc,["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,BigNumber:o,DenseMatrix:s}=e,a=li({typed:t,equalScalar:r}),l=lo({typed:t,DenseMatrix:s}),u=ls({typed:t});return t(lc,{number:ll,"number, number":ll,"number, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(lu);return new o(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw TypeError(lu);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(lu);var n=t.toNumber();return e.round(n)},BigNumber:function(e){return e.toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(lu);return e.toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw TypeError(lu);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(lu);return e.round(t.toNumber())},"Array | Matrix":function(e){return function e(t,n,r){return t&&"function"==typeof t.map?t.map(function(t){return e(t,n,r)}):n(t)}(e,this,!0)},"SparseMatrix, number | BigNumber":function(e,t){return a(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"Array, number | BigNumber":function(e,t){return u(n(e),t,this,!1).valueOf()},"number | Complex | BigNumber | Fraction, SparseMatrix":function(e,t){return r(e,0)?i(t.size(),t.storage()):l(t,e,this,!0)},"number | Complex | BigNumber | Fraction, DenseMatrix":function(e,t){return r(e,0)?i(t.size(),t.storage()):u(t,e,this,!0)},"number | Complex | BigNumber | Fraction, Array":function(e,t){return u(n(t),e,this,!0).valueOf()}})}),ld=oy("algorithm01",["typed"],e=>{var{typed:t}=e;return function(e,n,r,i){var o,s,a=e._data,l=e._size,u=e._datatype,c=n._values,h=n._index,d=n._ptr,f=n._size,p=n._datatype;if(l.length!==f.length)throw new oN(l.length,f.length);if(l[0]!==f[0]||l[1]!==f[1])throw RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+f+")");if(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=l[0],g=l[1],v="string"==typeof u&&u===p?u:void 0,y=v?t.find(r,[v,v]):r,b=[];for(o=0;o<m;o++)b[o]=[];var x=[],w=[];for(s=0;s<g;s++){for(var S=s+1,C=d[s],A=d[s+1],k=C;k<A;k++)x[o=h[k]]=i?y(c[k],a[o][s]):y(a[o][s],c[k]),w[o]=S;for(o=0;o<m;o++)w[o]===S?b[o][s]=x[o]:b[o][s]=a[o][s]}return e.createDenseMatrix({data:b,size:[m,g],datatype:v})}}),lf=oy("algorithm04",["typed","equalScalar"],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var o,s,a,l,u,c,h=e._values,d=e._index,f=e._ptr,p=e._size,m=e._datatype,g=r._values,v=r._index,y=r._ptr,b=r._size,x=r._datatype;if(p.length!==b.length)throw new oN(p.length,b.length);if(p[0]!==b[0]||p[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+b+")");var w=p[0],S=p[1],C=n,A=0,k=i;"string"==typeof m&&m===x&&(o=m,C=t.find(n,[o,o]),A=t.convert(0,o),k=t.find(i,[o,o]));var M=h&&g?[]:void 0,T=[],D=[],E=h&&g?[]:void 0,O=h&&g?[]:void 0,R=[],I=[];for(a=0;a<S;a++){D[a]=T.length;var P=a+1;for(u=f[a],c=f[a+1],l=u;l<c;l++)s=d[l],T.push(s),R[s]=P,E&&(E[s]=h[l]);for(u=y[a],c=y[a+1],l=u;l<c;l++)if(R[s=v[l]]===P){if(E){var N=k(E[s],g[l]);C(N,A)?R[s]=null:E[s]=N}}else T.push(s),I[s]=P,O&&(O[s]=g[l]);if(E&&O)for(l=D[a];l<T.length;)R[s=T[l]]===P?(M[l]=E[s],l++):I[s]===P?(M[l]=O[s],l++):T.splice(l,1)}return D[S]=T.length,e.createSparseMatrix({values:M,index:T,ptr:D,size:[w,S],datatype:o})}}),lp=oy("algorithm10",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){var s,a=e._values,l=e._index,u=e._ptr,c=e._size,h=e._datatype;if(!a)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=c[0],f=c[1],p=i;"string"==typeof h&&(s=h,r=t.convert(r,s),p=t.find(i,[s,s]));for(var m=[],g=[],v=[],y=0;y<f;y++){for(var b=y+1,x=u[y],w=u[y+1],S=x;S<w;S++){var C=l[S];g[C]=a[S],v[C]=b}for(var A=0;A<d;A++)0===y&&(m[A]=[]),v[A]===b?m[A][y]=o?p(r,g[A]):p(g[A],r):m[A][y]=r}return new n({data:m,size:[d,f],datatype:s})}}),lm=oy("algorithm13",["typed"],e=>{var{typed:t}=e;return function(e,n,r){var i,o=e._data,s=e._size,a=e._datatype,l=n._data,u=n._size,c=n._datatype,h=[];if(s.length!==u.length)throw new oN(s.length,u.length);for(var d=0;d<s.length;d++){if(s[d]!==u[d])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+u+")");h[d]=s[d]}var f=r;"string"==typeof a&&a===c&&(i=a,f=t.find(r,[i,i]));var p=h.length>0?function e(t,n,r,i,o,s){var a=[];if(n===r.length-1)for(var l=0;l<i;l++)a[l]=t(o[l],s[l]);else for(var u=0;u<i;u++)a[u]=e(t,n+1,r,r[n+1],o[u],s[u]);return a}(f,0,h,h[0],o,l):[];return e.createDenseMatrix({data:p,size:h,datatype:i})}}),lg=oy("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:n,equalScalar:r,BigNumber:i,DenseMatrix:o}=e,s=ld({typed:t}),a=lf({typed:t,equalScalar:r}),l=lp({typed:t,DenseMatrix:o}),u=lm({typed:t}),c=ls({typed:t});return t("gcd",{"number, number":la,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var n=new i(0);!t.isZero();){var r=e.mod(t);e=t,t=r}return e.lt(n)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)},"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,this)},"Array, Array":function(e,t){return this(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return this(n(e),t)},"Matrix, Array":function(e,t){return this(e,n(t))},"SparseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return c(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return l(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return c(n(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return c(n(t),e,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,n){for(var r=this(e,t),i=0;i<n.length;i++)r=this(r,n[i]);return r}})});let{round:lv}=oZ({roundDependencies:{BigNumberDependencies:ak,DenseMatrixDependencies:aT,equalScalarDependencies:a9,matrixDependencies:lt,typedDependencies:a3,zerosDependencies:{BigNumberDependencies:ak,matrixDependencies:lt,typedDependencies:a3,createZeros:lr},createRound:lh}}),{gcd:ly}=oZ({gcdDependencies:{BigNumberDependencies:ak,DenseMatrixDependencies:aT,equalScalarDependencies:a9,matrixDependencies:lt,typedDependencies:a3,createGcd:lg}}),lb=10;function lx(e,t){let n=t.startMs,r=e.values,i=[];for(let e of r){for(;n<e[0];)i.push([n,null]),n+=t.stepMs;i.push([n,e[1]]),n+=t.stepMs}for(;n<=t.endMs;)i.push([n,null]),n+=t.stepMs;return i}function lw(e){let t,n,r=[];for(let t of e)if(t&&"timeRange"in t){if(void 0===t||void 0===t.timeRange||void 0===t.stepMs)continue;if(r.push(t.stepMs),void 0===n){n=t.timeRange;continue}t.timeRange.start<n.start&&(n.start=t.timeRange.start),t.timeRange.end>n.end&&(n.end=t.timeRange.end)}else if(t&&"values"in t){for(let e=0;e<t.values.length;e++){let r=t.values[e];if(void 0===r)continue;let[i]=r,o=new Date(i),s=new Date(i);if(void 0===n){n={start:o,end:s};continue}o<n.start&&(n.start=o),s>n.end&&(n.end=s)}if(void 0===n)return;let e=n.start.valueOf(),r=n.end.valueOf(),i=r-e;return{startMs:e,endMs:r,rangeMs:i,stepMs:lb}}if(void 0===n)return;if(1===r.length)t=r[0];else{let e=ly(...r);t=e<lb?lb:e}let i=n.start.valueOf(),o=n.end.valueOf();return{startMs:i,endMs:o,stepMs:t,rangeMs:o-i}}function lS(e){return/^[0-9a-fA-F]+$/.test(e)}function lC(e){return e.spec?.spec?.display?.name?e.spec.spec.display.name:e.spec?.display?.name?e.spec.display.name:e.metadata.name}function lA(e){return e.spec?.spec?.display?.name?`${e.spec.spec.display.name} (ID: ${e.metadata.name})`:e.spec?.display?.name?`${e.spec.display.name} (ID: ${e.metadata.name})`:e.metadata.name}let lk=(0,w.createContext)(void 0);function lM(e){let{children:t,timeZone:n}=e;return(0,x.jsx)(lk.Provider,{value:n,children:t})}function lT(){let e=(0,w.useContext)(lk);return{timeZone:e??"local",formatWithUserTimeZone:(t,n)=>im(t,n,e),dateFormatOptionsWithUserTimeZone:t=>ip(t,e)}}function lD({label:e,color:t,size:n="small",onColorChange:r,onClear:i}){let[o,s]=(0,w.useState)(null),a=!!o,{thresholds:{defaultColor:l,palette:u}}=eD();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(lE,{size:n,"aria-label":`change ${e} color`,isSelected:a,iconColor:t,onClick:e=>{s(e.currentTarget)},children:(0,x.jsx)(U,{})}),(0,x.jsx)(eA.Ay,{"data-testid":"options color picker",open:a,anchorEl:o,onClose:()=>{s(null)},slotProps:{paper:{sx:{padding:e=>e.spacing(2)}}},anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,x.jsx)(eS,{color:t,palette:[l,...u],onChange:r,onClear:i})})]})}let lE=(0,D.A)($.A,{shouldForwardProp:e=>"isSelected"!==e&&"iconColor"!==e})(({iconColor:e,isSelected:t})=>({backgroundColor:t&&e?`${e}3F`:"undefined",color:e}));var lO=n(56599),lR=n(74628),lI=n(38662);function lP(e,t){return"ALL"!==t&&!!t[e.id]}var lN=n(83926),lL=n(1337),lj=n(54382),lF=n(29424),lB=n(67214);function l_(e){return(0,P.Ay)("MuiListItemButton",e)}let lz=(0,I.A)("MuiListItemButton",["root","focusVisible","dense","alignItemsFlexStart","disabled","divider","gutters","selected"]),lV=(0,D.A)(lL.A,{shouldForwardProp:e=>(0,lN.A)(e)||"classes"===e,name:"MuiListItemButton",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,"flex-start"===n.alignItems&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters]}})((0,E.A)(({theme:e})=>({display:"flex",flexGrow:1,justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minWidth:0,boxSizing:"border-box",textAlign:"left",paddingTop:8,paddingBottom:8,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${lz.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,k.X4)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${lz.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,k.X4)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${lz.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,k.X4)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,k.X4)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${lz.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${lz.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:{alignItems:"flex-start"},style:{alignItems:"flex-start"}},{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.dense,style:{paddingTop:4,paddingBottom:4}}]}))),lH=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiListItemButton"}),{alignItems:r="center",autoFocus:i=!1,component:o="div",children:s,dense:a=!1,disableGutters:l=!1,divider:u=!1,focusVisibleClassName:c,selected:h=!1,className:d,...f}=n,p=w.useContext(lB.A),m=w.useMemo(()=>({dense:a||p.dense||!1,alignItems:r,disableGutters:l}),[r,p.dense,a,l]),g=w.useRef(null);(0,lj.A)(()=>{i&&g.current&&g.current.focus()},[i]);let v={...n,alignItems:r,dense:m.dense,disableGutters:l,divider:u,selected:h},y=(e=>{let{alignItems:t,classes:n,dense:r,disabled:i,disableGutters:o,divider:s,selected:a}=e,l=(0,A.A)({root:["root",r&&"dense",!o&&"gutters",s&&"divider",i&&"disabled","flex-start"===t&&"alignItemsFlexStart",a&&"selected"]},l_,n);return{...n,...l}})(v),b=(0,lF.A)(g,t);return(0,x.jsx)(lB.A.Provider,{value:m,children:(0,x.jsx)(lV,{ref:b,href:f.href||f.to,component:(f.href||f.to)&&"div"===o?"button":o,focusVisibleClassName:(0,C.A)(y.focusVisible,c),ownerState:v,className:(0,C.A)(y.root,d),...f,classes:y,children:s})})});var l$=n(14045);let lW=(0,w.memo)(function({color:e,sx:t,...n}){return(0,x.jsx)(lR.A,{...n,sx:rV({height:4,width:16,margin:e=>e.spacing(.5)},t),style:{backgroundColor:e}})}),lU=(0,w.forwardRef)(function({item:e,sx:t,truncateLabel:n,onClick:r,isVisuallySelected:i,onMouseOver:o,onMouseOut:s,index:a,...l},u){let[c,h]=(0,w.useState)(n);return(0,x.jsxs)(lH,{...l,role:"listitem",sx:rV({padding:0,cursor:"pointer"},t),dense:!0,onClick:t=>{r(t,e.id),e.onClick?.(t)},onMouseOver:t=>o?.(t,{id:e.id,index:a}),onMouseOut:t=>s?.(t,{id:e.id,index:a}),selected:i,ref:u,children:[(0,x.jsx)(lR.A,{sx:{display:"flex",alignItems:"center"},children:(0,x.jsx)(lW,{color:e.color})}),(0,x.jsx)(l$.A,{primary:e.label,primaryTypographyProps:{noWrap:c},onMouseOver:function(){n&&h(!1)},onMouseOut:function(){n&&h(!0)}})]})}),lq=(0,w.memo)(lU);function lG({height:e,items:t,selectedItems:n,onLegendItemClick:r,onItemMouseOver:i,onItemMouseOut:o}){return(0,x.jsx)(lR.A,{component:"ul",sx:{width:"100%",height:e,padding:[0,1,0,0],overflowY:"scroll",margin:0},children:t.map((e,t)=>(0,x.jsx)(lq,{item:e,index:t,isVisuallySelected:lP(e,n),onMouseOver:i,onMouseOut:o,onClick:r,sx:{width:"auto",float:"left",paddingRight:1.5}},e.id))})}function lY(e){e()}function lK(e,t){return n=>e(t(n))}function lZ(e){return void 0!==e}function lX(){}function lQ(e,t){return t(e)}function lJ(...e){return e}function l0(e){e(2)}function l1(e){return e(4)}function l2(e,t){return e(1,e=>t(0,e))}function l5(e,t){let n=e(1,e=>{n(),t(e)});return n}function l4(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function l3(e,t){return e===t}function l6(e=l3){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function l8(e){return t=>n=>{e(n)&&t(n)}}function l9(e){return t=>lK(t,e)}function l7(e){return t=>()=>{t(e)}}function ue(e,...t){let n=function(...e){return t=>e.reduceRight(lQ,t)}(...t);return(t,r)=>{switch(t){case 2:l0(e);return;case 1:return e(1,n(r))}}}function ut(e,t){return n=>r=>{n(t=e(t,r))}}function un(e){return t=>n=>{e>0?e--:t(n)}}function ur(e){let t=null,n;return r=>i=>{t=i,n||(n=setTimeout(()=>{n=void 0,r(t)},e))}}function ui(...e){let t=Array.from({length:e.length}),n=0,r=null,i=2**e.length-1;return e.forEach((e,o)=>{let s=2**o;e(1,e=>{let a=n;n|=s,t[o]=e,a!==i&&n===i&&r&&(r(),r=null)})}),e=>o=>{let s=()=>{e([o].concat(t))};n===i?s():r=s}}function uo(e){let t=e,n=ua();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function us(e,t){var n;return n=uo(t),l2(e,n),n}function ua(){let e=[];return(t,n)=>{switch(t){case 0:e.slice().forEach(e=>{e(n)});return;case 2:e.splice(0);return;case 1:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function ul(e){var t;return t=ua(),l2(e,t),t}let uu={singleton:!0};function uc(e,t=[],n=uu){let{singleton:r}=n;return{constructor:e,dependencies:t,id:uh(),singleton:r}}let uh=()=>Symbol("id");function ud(...e){let t=ua(),n=Array.from({length:e.length}),r=0,i=2**e.length-1;return e.forEach((e,o)=>{let s=2**o;e(1,e=>{n[o]=e,(r|=s)===i&&t(0,n)})}),function(e,o){switch(e){case 2:return void l0(t);case 1:return r===i&&o(n),t(1,o)}}}function uf(e,t=l3){return ue(e,l6(t))}function up(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(lY)}}(...e.map(e=>e(1,n)))}}}let um=1,ug={0:"debug",3:"error",[um]:"log",2:"warn"},uv=uc(()=>{let e=uo(3);return{log:uo((t,n,r=um)=>{r>=((typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL??l1(e))&&console[ug[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0}),uy=new WeakMap;function ub(e){return"self"in e?e.document.documentElement:e}function ux(e){uy.delete(ub(e))}function uw(e,t){return!function(e){let t=ub(e),n=uy.get(t);if(void 0!==n)return n;let r="rtl"===t.ownerDocument.defaultView.getComputedStyle(t).direction;return uy.set(t,r),r}(e)?t:-t}function uS(e,t,n){return uC(e,t,n).callbackRef}function uC(e,t,n){let r=S().useRef(null),i=S().useMemo(()=>"u">typeof ResizeObserver?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;null!==n.offsetParent&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return{callbackRef:e=>{e&&t?(i?.observe(e),r.current=e):(r.current&&i?.unobserve(r.current),r.current=null)},ref:r}}function uA(e,t,n,r,i,o,s,a,l){return uC(S().useCallback(n=>{let l,u=function(e,t,n,r){let i=e.length;if(0===i)return null;let o=[];for(let s=0;s<i;s++){let i=e.item(s);if(void 0===i.dataset.index)continue;let a=parseInt(i.dataset.index,10),l=parseFloat(i.dataset.knownSize),u=t(i,n);if(0===u&&r("Zero-sized element, this should not happen",{child:i},3),u===l)continue;let c=o[o.length-1];0===o.length||c.size!==u||c.endIndex!==a-1?o.push({endIndex:a,size:u,startIndex:a}):o[o.length-1].endIndex++}return o}(n.children,t,a?"offsetWidth":"offsetHeight",i),c=n.parentElement;for(;void 0===c.dataset.virtuosoScroller;)c=c.parentElement;let h=c.lastElementChild?.dataset.viewportType==="window";h&&(l=c.ownerDocument.defaultView);let d=s?a?s.scrollWidth:s.scrollHeight:h?a?l.document.documentElement.scrollWidth:l.document.documentElement.scrollHeight:a?c.scrollWidth:c.scrollHeight,f=s?a?s.offsetWidth:s.offsetHeight:h?a?l.innerWidth:l.innerHeight:a?c.offsetWidth:c.offsetHeight;r({scrollHeight:d,scrollTop:Math.max(s?a?uw(s,s.scrollLeft):s.scrollTop:h?a?uw(l,l.scrollX||l.document.documentElement.scrollLeft):l.scrollY||l.document.documentElement.scrollTop:a?uw(c,c.scrollLeft):c.scrollTop,0),viewportHeight:f}),o?.(a?uk("column-gap",getComputedStyle(n).columnGap,i):uk("row-gap",getComputedStyle(n).rowGap,i)),null!==u&&e(u)},[e,t,i,o,s,r,a]),n,l)}function uk(e,t,n){return"normal"!==t&&t?.endsWith("px")!==!0&&n(`${e} was not resolved to pixel value correctly`,t,2),"normal"===t?0:parseInt(t??"0",10)}function uM(e,t,n){let r=S().useRef(null),i=S().useCallback(n=>{let i,o;if(!n?.offsetParent)return;let a=n.getBoundingClientRect(),l=a.width;if(t){let e=t.getBoundingClientRect(),n=a.top-e.top;o=e.height-Math.max(0,n),i=n+t.scrollTop}else{let e=s.current.ownerDocument.defaultView;o=e.innerHeight-Math.max(0,a.top),i=a.top+e.scrollY}r.current={listHeight:a.height,offsetTop:i,visibleHeight:o,visibleWidth:l},e(r.current)},[e,t]),{callbackRef:o,ref:s}=uC(i,!0,n),a=S().useCallback(()=>{i(s.current)},[i,s]);return S().useEffect(()=>{if(t){t.addEventListener("scroll",a);let e=new ResizeObserver(()=>{requestAnimationFrame(a)});return e.observe(t),()=>{t.removeEventListener("scroll",a),e.unobserve(t)}}let e=s.current?.ownerDocument.defaultView;return e?.addEventListener("scroll",a),e?.addEventListener("resize",a),()=>{e?.removeEventListener("scroll",a),e?.removeEventListener("resize",a)}},[a,t,s]),o}let uT=uc(()=>{let e=ua(),t=ua(),n=uo(0),r=ua(),i=uo(0),o=ua(),s=ua(),a=uo(0),l=uo(0),u=uo(0),c=uo(0),h=ua(),d=ua(),f=uo(!1),p=uo(!1),m=uo(!1);return l2(ue(e,l9(({scrollTop:e})=>e)),t),l2(ue(e,l9(({scrollHeight:e})=>e)),s),l2(t,i),{deviation:n,fixedFooterHeight:u,fixedHeaderHeight:l,footerHeight:c,headerHeight:a,horizontalDirection:p,scrollBy:d,scrollContainerState:e,scrollHeight:s,scrollingInProgress:f,scrollTo:h,scrollTop:t,skipAnimationFrameInResizeObserver:m,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:o}},[],{singleton:!0}),uD={lvl:0};function uE(e,t){let n=e.length;if(0===n)return[];let{index:r,value:i}=t(e[0]),o=[];for(let s=1;s<n;s++){let{index:n,value:a}=t(e[s]);o.push({end:n-1,start:r,value:i}),r=n,i=a}return o.push({end:1/0,start:r,value:i}),o}function uO(e){return e===uD}function uR(e,t){if(!uO(e))return t===e.k?e.v:t<e.k?uR(e.l,t):uR(e.r,t)}function uI(e,t,n="k"){if(uO(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=uI(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return uI(e.l,t,n)}function uP(e,t,n){return uO(e)?u_(t,n,1):t===e.k?uF(e,{k:t,v:n}):t<e.k?uV(uz(uF(e,{l:uP(e.l,t,n)}))):uV(uz(uF(e,{r:uP(e.r,t,n)})))}function uN(e,t,n){if(uO(e))return[];let r=uI(e,t)[0];return uE(function e(t,n,r){if(uO(t))return[];let{k:i,l:o,r:s,v:a}=t,l=[];return i>n&&(l=l.concat(e(o,n,r))),i>=n&&i<=r&&l.push({k:i,v:a}),i<=r&&(l=l.concat(e(s,n,r))),l}(e,r,n),({k:e,v:t})=>({index:e,value:t}))}function uL(e){return uO(e)?[]:[...uL(e.l),{k:e.k,v:e.v},...uL(e.r)]}function uj(e){let{l:t,lvl:n,r:r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(uB(t))return uz(uF(e,{lvl:n-1}));if(!uO(t)&&!uO(t.r))return uF(t.r,{l:uF(t,{r:t.r.l}),lvl:n,r:uF(e,{l:t.r.r,lvl:n-1})});throw Error("Unexpected empty nodes")}if(uB(e))return uV(uF(e,{lvl:n-1}));if(!uO(r)&&!uO(r.l)){let t=r.l,i=uB(t)?r.lvl-1:r.lvl;return uF(t,{l:uF(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:uV(uF(r,{l:t.r,lvl:i}))})}throw Error("Unexpected empty nodes")}function uF(e,t){return u_(void 0===t.k?e.k:t.k,void 0===t.v?e.v:t.v,void 0===t.lvl?e.lvl:t.lvl,void 0===t.l?e.l:t.l,void 0===t.r?e.r:t.r)}function uB(e){return uO(e)||e.lvl>e.r.lvl}function u_(e,t,n,r=uD,i=uD){return{k:e,l:r,lvl:n,r:i,v:t}}function uz(e){let{l:t}=e;return uO(t)||t.lvl!==e.lvl?e:uF(t,{r:uF(e,{l:t.r})})}function uV(e){let{lvl:t,r:n}=e;return uO(n)||uO(n.r)||n.lvl!==t||n.r.lvl!==t?e:uF(n,{l:uF(e,{r:n.l}),lvl:t+1})}function uH(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function u$(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}let uW=uc(()=>({recalcInProgress:uo(!1)}),[],{singleton:!0});function uU(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let o=Math.floor((r+i)/2),s=n(e[o],t);if(0===s)return o;if(-1===s){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function uq(e,t){return Math.round(e.getBoundingClientRect()[t])}function uG(e){return!uO(e.groupOffsetTree)}function uY({index:e},t){return t===e?0:t<e?-1:1}function uK({offset:e},t){return t===e?0:t<e?-1:1}function uZ(e,t,n){if(0===t.length)return 0;let{index:r,offset:i,size:o}=t[uU(t,e,uY)],s=e-r,a=o*s+(s-1)*n+i;return a>0?a+n:a}function uX(e,t){if(!uG(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function uQ(e,t,n){if(void 0!==e.groupIndex)return t.groupIndices[e.groupIndex]+1;let r=uX("LAST"===e.index?n:e.index,t);return Math.max(0,Math.min(n,r))}function uJ(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,0);let o=e.sizeTree,s=o,a=0;if(n.length>0&&uO(o)&&2===t.length){let e=t[0].size,r=t[1].size;s=n.reduce((t,n)=>uP(uP(t,n,e),n+1,r),s)}else[s,a]=function(e,t){let n=uO(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),uO(e)){e=uP(e,0,i);continue}let s=uN(e,o-1,t+1);if(s.some(function(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}(r)))continue;let a=!1,l=!1;for(let{end:n,start:r,value:o}of s)a?(t>=r||i===o)&&(e=function e(t,n){if(uO(t))return uD;let{k:r,l:i,r:o}=t;if(n===r){if(uO(i))return o;if(uO(o))return i;let[e,n]=function e(t){return uO(t.r)?[t.k,t.v]:e(t.r)}(i);return uj(uF(t,{k:e,l:function e(t){return uO(t.r)?t.l:uj(uF(t,{r:e(t.r)}))}(i),v:n}))}return n<r?uj(uF(t,{l:e(i,n)})):uj(uF(t,{r:e(o,n)}))}(e,r)):(l=o!==i,a=!0),n>t&&t>=r&&o!==i&&(e=uP(e,t+1,o));l&&(e=uP(e,o,i))}return[e,n]}(s,t);if(s===o)return e;let{lastIndex:l,lastOffset:u,lastSize:c,offsetTree:h}=u1(e.offsetTree,a,s,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>uP(e,t,uZ(t,h,i)),uD),lastIndex:l,lastOffset:u,lastSize:c,offsetTree:h,sizeTree:s}}function u0(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n!==e)}function u1(e,t,n,r){let i=e,o=0,s=0,a=0,l=0;if(0===t)i=[];else{l=uU(i,t-1,uY),a=i[l].offset;let e=uI(n,t-1);o=e[0],s=e[1],i.length&&i[l].size===uI(n,t)[1]&&(l-=1),i=i.slice(0,l+1)}for(let{start:e,value:l}of uN(n,t,1/0)){let t=e-o,n=t*s+a+t*r;i.push({index:e,offset:n,size:l}),o=e,a=n,s=l}return{lastIndex:o,lastOffset:a,lastSize:s,offsetTree:i}}function u2(e){return{index:e.index,value:e}}let u5={offsetHeight:"height",offsetWidth:"width"},u4=uc(([{log:e},{recalcInProgress:t}])=>{let n=ua(),r=ua(),i=us(r,0),o=ua(),s=ua(),a=uo(0),l=uo([]),u=uo(void 0),c=uo(void 0),h=uo(void 0),d=uo(void 0),f=uo((e,t)=>uq(e,u5[t])),p=uo(void 0),m=uo(0),g={groupIndices:[],groupOffsetTree:uD,lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:uD},v=us(ue(n,ui(l,e,m),ut(uJ,g),l6()),g),y=us(ue(l,l6(),ut((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),l9(({prev:e})=>e)),[]);l2(ue(l,l8(e=>e.length>0),ui(v,m),l9(([e,t,n])=>{let r=e.reduce((e,r,i)=>uP(e,r,uZ(r,t.offsetTree,n)||i),uD);return{...t,groupIndices:e,groupOffsetTree:r}})),v),l2(ue(r,ui(v),l8(([e,{lastIndex:t}])=>e<t),l9(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),l2(u,c);let b=us(ue(u,l9(e=>void 0===e)),!0);l2(ue(c,l8(e=>void 0!==e&&uO(l1(v).sizeTree)),l9(e=>{let t=l1(h),n=l1(l).length>0;return void 0!==t&&0!==t?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),l2(ue(d,l8(e=>void 0!==e&&e.length>0&&uO(l1(v).sizeTree)),l9(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let o=e[i];o!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=o,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),l2(ue(l,ui(h,c),l8(([,e,t])=>void 0!==e&&void 0!==t),l9(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let o=e[i],s=e[i+1];r.push({startIndex:o,endIndex:o,size:t}),void 0!==s&&r.push({startIndex:o+1,endIndex:s-1,size:n})}return r})),n);let x=ul(ue(n,ui(v),ut(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),l9(e=>e.changed)));ue(a,ut((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),l9(e=>e.diff))(1,e=>{let{groupIndices:n}=l1(v);if(e>0)t(0,!0),o(0,e+u0(e,n));else if(e<0){let t=l1(y);t.length>0&&(e-=u0(-e,t)),s(0,e)}}),ue(a,ui(e))(1,([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},3)});let w=ul(o);l2(ue(o,ui(v),l9(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=uR(t.sizeTree,0),o=0,s=0;for(;o<e;){let e=t.groupIndices[s],a=t.groupIndices.length===s+1?1/0:t.groupIndices[s+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+a-1,size:i,startIndex:e+1}),s++,o+=a+1}let a=uL(t.sizeTree);return o!==e&&a.shift(),a.reduce((t,{k:n,v:r})=>{let i=t.ranges;return 0!==t.prevSize&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return uL(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=ul(ue(s,ui(v,m),l9(([e,{offsetTree:t},n])=>uZ(-e,t,n))));return l2(ue(s,ui(v,m),l9(([e,t,n])=>{if(t.groupIndices.length>0){if(uO(t.sizeTree))return t;let r=uD,i=l1(y),o=0,s=0,a=0;for(;o<-e;){a=i[s];let e=i[s+1]-a-1;s++,o+=e+1}return r=uL(t.sizeTree).reduce((t,{k:n,v:r})=>uP(t,Math.max(0,n+e),r),r),o!==-e&&(r=uP(r,0,uR(t.sizeTree,a)),r=uP(r,1,uI(t.sizeTree,-e+1)[1])),{...t,sizeTree:r,...u1(t.offsetTree,0,r,n)}}let r=uL(t.sizeTree).reduce((t,{k:n,v:r})=>uP(t,Math.max(0,n+e),r),uD);return{...t,sizeTree:r,...u1(t.offsetTree,0,r,n)}})),v),{beforeUnshiftWith:w,data:p,defaultItemSize:c,firstItemIndex:a,fixedItemSize:u,fixedGroupSize:h,gap:m,groupIndices:l,heightEstimates:d,itemSize:f,listRefresh:x,shiftWith:s,shiftWithOffset:S,sizeRanges:n,sizes:v,statefulTotalCount:i,totalCount:r,trackItemSizes:b,unshiftWith:o}},lJ(uv,uW),{singleton:!0});function u3(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}let u6=uc(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let o=ua(),s=ua(),a=ul(ue(o,l9(u3)));return l2(ue(a,l9(e=>e.totalCount)),n),l2(ue(a,l9(e=>e.groupIndices)),e),l2(ue(ud(i,t,r),l8(([e,t])=>uG(t)),l9(([e,t,n])=>uI(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),l6(),l9(e=>[e])),s),{groupCounts:o,topItemsIndexes:s}},lJ(u4,uT)),u8=uc(([{log:e}])=>{let t=uo(!1),n=ul(ue(t,l8(e=>e),l6()));return t(1,t=>{t&&l1(e)("props updated",{},0)}),{didMount:n,propsReady:t}},lJ(uv),{singleton:!0}),u9="u">typeof document&&"scrollBehavior"in document.documentElement.style;function u7(e){let t="number"==typeof e?{index:e}:{...e};return t.align||(t.align="start"),t.behavior&&u9||(t.behavior="auto"),void 0===t.offset&&(t.offset=0),t}let ce=uc(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:s,headerHeight:a,scrollingInProgress:l,scrollTo:u,smoothScrollTargetReached:c,viewportHeight:h},{log:d}])=>{let f=ua(),p=ua(),m=uo(0),g=null,v=null,y=null;function b(){null!==g&&(g(),g=null),null!==y&&(y(),y=null),v&&(clearTimeout(v),v=null),l(0,!1)}return l2(ue(f,ui(n,h,r,m,a,s,d),ui(e,o,i),l9(([[e,n,r,i,o,s,a,u],h,d,m])=>{let x=u7(e),{align:w,behavior:S,offset:C}=x,A=i-1,k=uQ(x,n,A),M=uZ(k,n.offsetTree,h)+s;"end"===w?(M+=d+uI(n.sizeTree,k)[1]-r+m,k===A&&(M+=a)):"center"===w?M+=(d+uI(n.sizeTree,k)[1]-r+m)/2:M-=o,void 0!==C&&0!==C&&(M+=C);let T=t=>{b(),t?(u("retrying to scroll to",{location:e},0),f(0,e)):(p(0,!0),u("list did not change, scroll successful",{},0))};if(b(),"smooth"===S){let e=!1;y=t(1,t=>{e=e||t}),g=l5(c,()=>{T(e)})}else g=l5(ue(t,e=>{let t=setTimeout(()=>{e(!1)},150);return n=>{n&&(e(!0),clearTimeout(t))}}),T);return v=setTimeout(()=>{b()},1200),l(0,!0),u("scrolling from index to",{behavior:S,index:k,top:M},0),{behavior:S,top:M}})),u),{scrollTargetReached:p,scrollToIndex:f,topListHeight:m}},lJ(u4,uT,uv),{singleton:!0});function ct(e,t){0===e?t():requestAnimationFrame(()=>{ct(e-1,t)})}function cn(e,t){if(void 0===e)return 0;let n=t-1;return Math.max(0,Math.min("number"==typeof e?e:"LAST"===e.index?n:e.index,n))}function cr(e){return void 0===e||("number"==typeof e?0===e:0===e.index&&(void 0===e.align||"start"===e.align)&&(void 0===e.offset||0===e.offset))}let ci=uc(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:s}])=>{let a=uo(!0),l=uo(0),u=uo(!0);return l2(ue(s,ui(l),l8(([e,t])=>!cr(t)),l7(!1)),a),l2(ue(s,ui(l),l8(([e,t])=>!cr(t)),l7(!1)),u),ue(ud(t,s),ui(a,n,e,u),l8(([[,e],t,{sizeTree:n},r,i])=>e&&(!uO(n)||lZ(r))&&!t&&!i),ui(l))(1,([,e])=>{if(void 0===e){a(0,!0),u(0,!0);return}l5(i,()=>{u(0,!0)}),ct(4,()=>{l5(r,()=>{a(0,!0)}),o(0,e)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:l,scrolledToInitialItem:a}},lJ(u4,uT,ce,u8),{singleton:!0});function co(e,t){return 1.01>Math.abs(e-t)}let cs="down",ca={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},cl=uc(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{let s=uo(!1),a=uo(!0),l=ua(),u=ua(),c=uo(4),h=uo(0),d=us(ue(up(ue(uf(i),un(1),l7(!0)),ue(uf(i),un(1),l7(!1),l4(100))),l6()),!1),f=us(ue(up(ue(n,l7(!0)),ue(n,l7(!1),l4(200))),l6()),!1);l2(ue(ud(uf(i),uf(h)),l9(([e,t])=>e<=t),l6()),a),l2(ue(a,ur(50)),u);let p=ul(ue(ud(r,uf(o),uf(t),uf(e),uf(c)),ut((e,[{scrollHeight:t,scrollTop:n},r,i,o,s])=>{let a={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-s){let t,r;return n>e.state.scrollTop?(t="SCROLLED_DOWN",r=e.state.scrollTop-n):(t="SIZE_DECREASED",r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:a}}return{atBottom:!1,notAtBottomBecause:a.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":r<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":n<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:a}},ca),l6((e,t)=>void 0!==e&&e.atBottom===t.atBottom))),m=us(ue(r,ut((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!co(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),l8(e=>e.changed),l9(e=>e.jump)),0);l2(ue(p,l9(e=>e.atBottom)),s),l2(ue(s,ur(50)),l);let g=uo(cs);l2(ue(r,l9(({scrollTop:e})=>e),l6(),ut((e,t)=>l1(f)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?"up":cs,prevScrollTop:t},{direction:cs,prevScrollTop:0}),l9(e=>e.direction)),g),l2(ue(r,ur(50),l7("none")),g);let v=uo(0);return l2(ue(d,l8(e=>!e),l7(0)),v),l2(ue(i,ur(100),ui(d),l8(([e,t])=>t),ut(([e,t],[n])=>[t,n],[0,0]),l9(([e,t])=>t-e)),v),{atBottomState:p,atBottomStateChange:l,atBottomThreshold:c,atTopStateChange:u,atTopThreshold:h,isAtBottom:s,isAtTop:a,isScrolling:d,lastJumpDueToItemResize:m,scrollDirection:g,scrollVelocity:v}},lJ(uT)),cu="bottom",cc="none";function ch(e,t,n){return"number"==typeof e?"up"===n&&"top"===t||n===cs&&t===cu?e:0:"up"===n?"top"===t?e.main:e.reverse:t===cu?e.main:e.reverse}function cd(e,t){return"number"==typeof e?e:e[t]??0}let cf=uc(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let o=ua(),s=uo(0),a=uo(0),l=uo(0),u=us(ue(ud(uf(r),uf(i),uf(n),uf(o,u$),uf(l),uf(s),uf(t),uf(e),uf(a)),l9(([e,t,n,[r,i],o,s,a,l,u])=>{let c=e-l,h=Math.max(n-c,0),d=cc,f=cd(u,"top"),p=cd(u,cu);return r-=l,r+=n+a,i+=n+a,r>e+(s+a)-f&&(d="up"),(i-=l)<e-h+t+p&&(d=cs),d!==cc?[Math.max(c-n-ch(o,"top",d)-f,0),c-h-a+t+ch(o,cu,d)+p]:null}),l8(e=>null!==e),l6(u$)),[0,0]);return{increaseViewportBy:a,listBoundary:o,overscan:l,topListHeight:s,visibleRange:u}},lJ(uT),{singleton:!0}),cp={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function cm(e,t,n,r,i,o){let{lastIndex:s,lastOffset:a,lastSize:l}=i,u=0,c=0;if(e.length>0){u=e[0].offset;let t=e[e.length-1];c=t.offset+t.size}let h=n-s,d=u,f=a+h*l+(h-1)*r-c;return{bottom:c,firstItemIndex:o,items:cv(e,i,o),offsetBottom:f,offsetTop:u,top:d,topItems:cv(t,i,o),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function cg(e,t,n,r,i,o){let s=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-s>=e)break;s++}let a=e+s,l=cn(t,a);return cm(Array.from({length:a}).map((e,t)=>({data:o[t+l],index:t+l,offset:0,size:0})),[],a,i,n,r)}function cv(e,t,n){if(0===e.length)return[];if(!uG(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,o=[],s=uN(t.groupOffsetTree,r,i),a,l=0;for(let r of e){let e;(!a||a.end<r.index)&&(a=s.shift(),l=t.groupIndices.indexOf(a.start)),e=r.index===a.start?{index:l,type:"group"}:{groupIndex:l,index:r.index-(l+1)+n},o.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return o}function cy(e,t){return void 0===e?0:"number"==typeof e?e:e[t]??0}let cb=uc(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:s,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:u,scrolledToInitialItem:c},{topListHeight:h},d,{didMount:f},{recalcInProgress:p}])=>{let m=uo([]),g=uo(0),v=ua(),y=uo(0);l2(o.topItemsIndexes,m);let b=us(ue(ud(f,p,uf(l,u$),uf(i),uf(r),uf(u),c,uf(m),uf(t),uf(n),uf(y),e),l8(([e,t,,n,,,,,,,,r])=>{let i=void 0!==r&&r.length!==n;return e&&!t&&!i}),l9(([,,[e,t],n,r,i,o,s,a,l,u,c])=>{var h;let{offsetTree:d,sizeTree:f}=r,p=l1(g);if(0===n)return{...cp,totalCount:n};if(0===e&&0===t)return 0===p?{...cp,totalCount:n}:cg(p,i,r,a,l,c||[]);if(uO(f))return p>0?null:cm(function(e,t,n){if(uG(t)){let r=uX(e,t);return[{index:uI(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}(cn(i,n),r,c),[],n,l,r,a);let m=[];if(s.length>0){let e=s[0],t=s[s.length-1],n=0;for(let r of uN(f,e,t)){let i=r.value,o=Math.max(r.start,e),s=Math.min(r.end,t);for(let e=o;e<=s;e++)m.push({data:c?.[e],index:e,offset:n,size:i}),n+=i}}if(!o)return cm([],m,n,l,r,a);let v=s.length>0?s[s.length-1]+1:0,y=function(e,t,n,r=0){let i,o;return r>0&&(t=Math.max(t,e[uU(e,r,uY)].offset)),uE((i=uU(e,t,uK),o=uU(e,n,uK,i),e.slice(i,o+1)),u2)}(d,e,t,v);if(0===y.length)return null;let b=n-1,x=((n=>{for(let r of y){let i=r.value,o=i.offset,s=r.start,a=i.size;if(i.offset<e){let t=(s+=Math.floor((e-i.offset+l)/(a+l)))-r.start;o+=t*a+t*l}s<v&&(o+=(v-s)*a,s=v);let u=Math.min(r.end,b);for(let e=s;e<=u&&!(o>=t);e++)n.push({data:c?.[e],index:e,offset:o,size:a}),o+=a+l}})(h=[]),h),w=cy(u,"top"),S=cy(u,cu);if(x.length>0&&(w>0||S>0)){let e=x[0],t=x[x.length-1];if(w>0&&e.index>v){let t=Math.min(w,e.index-v),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=uN(f,i,i)[0]?.value??e.size;r-=t+l,n.unshift({data:c?.[i],index:i,offset:r,size:t})}x.unshift(...n)}if(S>0&&t.index<b){let e=Math.min(S,b-t.index),n=t.offset+t.size+l;for(let r=t.index+1;r<=t.index+e;r++){let e=uN(f,r,r)[0]?.value??t.size;x.push({data:c?.[r],index:r,offset:n,size:e}),n+=e+l}}}return cm(x,m,n,l,r,a)}),l8(e=>null!==e),l6()),cp);l2(ue(e,l8(lZ),l9(e=>e?.length)),i),l2(ue(b,l9(e=>e.topListHeight)),h),l2(h,a),l2(ue(b,l9(e=>[e.top,e.bottom])),s),l2(ue(b,l9(e=>e.items)),v);let x=ul(ue(b,l8(({items:e})=>e.length>0),ui(i,e),l8(([{items:e},t])=>e[e.length-1].originalIndex===t-1),l9(([,e,t])=>[e-1,t]),l6(u$),l9(([e])=>e))),w=ul(ue(b,ur(200),l8(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),l9(({items:e})=>e[0].index),l6())),S=ul(ue(b,l8(({items:e})=>e.length>0),l9(({items:e})=>{let t=0,n=e.length-1;for(;"group"===e[t].type&&t<n;)t++;for(;"group"===e[n].type&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),l6(uH)));return{endReached:x,initialItemCount:g,itemsRendered:v,listState:b,minOverscanItemCount:y,rangeChanged:S,startReached:w,topItemsIndexes:m,...d}},lJ(u4,u6,cf,ci,ce,cl,u8,uW),{singleton:!0}),cx=uc(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let o=ua(),s=us(ue(ud(n,e,r,t,i),l9(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return l2(uf(s),o),{totalListHeight:s,totalListHeightChanged:o}},lJ(uT,cb),{singleton:!0}),cw=uc(([{viewportHeight:e},{totalListHeight:t}])=>{let n=uo(!1),r=us(ue(ud(n,e,t),l8(([e])=>e),l9(([,e,t])=>Math.max(0,e-t)),ur(0),l6()),0);return{alignToBottom:n,paddingTopAddition:r}},lJ(uT,cx),{singleton:!0}),cS=uc(()=>({context:uo(null)})),cC=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:s})=>t<s?{...i,align:n??"start",...void 0===r?{}:{behavior:r}}:e>o?{...i,align:n??"end",...void 0===r?{}:{behavior:r}}:null,cA=uc(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:s,scrollTop:a,viewportHeight:l},{scrollToIndex:u}])=>{let c=ua();return l2(ue(c,ui(t,l,n,o,i,r,a),ui(e),l9(([[e,t,n,r,i,o,a,l],u])=>{let{calculateViewLocation:c=cC,done:h,...d}=e,f=uQ(e,t,r-1),p=uZ(f,t.offsetTree,u)+i+o,m=c({itemBottom:p+uI(t.sizeTree,f)[1],itemTop:p,locationParams:d,viewportBottom:l+n-a,viewportTop:l+o});return null===m?h?.():h&&l5(ue(s,l8(e=>!e),un(l1(s)?1:2)),h),m}),l8(e=>null!==e)),u),{scrollIntoView:c}},lJ(u4,uT,ce,cb,uv),{singleton:!0});function ck(e){return!1!==e&&("smooth"===e?"smooth":"auto")}let cM=uc(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:o},{scrollToIndex:s},{scrolledToInitialItem:a},{didMount:l,propsReady:u},{log:c},{scrollingInProgress:h},{context:d},{scrollIntoView:f}])=>{let p=uo(!1),m=ua(),g=null;function v(e){s(0,{align:"end",behavior:e,index:"LAST"})}function y(e){setTimeout(l5(i,t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&null===g&&(l1(c)("scrolling to bottom due to increased size",{},0),v("auto"))}),100)}ue(ud(ue(uf(t),un(1)),l),ui(uf(p),o,a,h),l9(([[e,t],n,r,i,o])=>{let s,a=t&&i,l="auto";return a&&(s=r||o,l="function"==typeof n?ck(n(s)):s&&ck(n),a=a&&!1!==l),{followOutputBehavior:l,shouldFollow:a,totalCount:e}}),l8(({shouldFollow:e})=>e))(1,({followOutputBehavior:t,totalCount:r})=>{null!==g&&(g(),g=null),void 0===l1(n)?g=l5(e,()=>{l1(c)("following output to ",{totalCount:r},0),v(t),g=null}):requestAnimationFrame(()=>{l1(c)("following output to ",{totalCount:r},0),v(t)})}),ue(ud(uf(p),t,u),l8(([e,,t])=>!1!==e&&t),ut(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),l8(({refreshed:e})=>e),ui(p,t))(1,([,e])=>{l1(a)&&y(!1!==e)}),m(1,()=>{y(!1!==l1(p))}),ud(uf(p),i)(1,([e,t])=>{!1===e||t.atBottom||"VIEWPORT_HEIGHT_DECREASING"!==t.notAtBottomBecause||v("auto")});let b=uo(null),x=ua();return l2(up(ue(uf(r),l9(e=>e?.length??0)),ue(uf(t))),x),ue(ud(ue(x,un(1)),l),ui(uf(b),a,h,d),l9(([[e,t],n,r,i,o])=>t&&r&&n?.({context:o,totalCount:e,scrollingInProgress:i})),l8(e=>!!e),ur(0))(1,t=>{null!==g&&(g(),g=null),void 0===l1(n)?g=l5(e,()=>{l1(c)("scrolling into view",{}),f(0,t),g=null}):requestAnimationFrame(()=>{l1(c)("scrolling into view",{}),f(0,t)})}),{autoscrollToBottom:m,followOutput:p,scrollIntoViewOnChange:b}},lJ(u4,cl,ce,ci,u8,uv,uT,cS,cA)),cT=uc(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:s},{didMount:a}])=>(l2(ue(a,ui(o),l8(([,e])=>0!==e),ui(i,r,t,n,e),l9(([[,e],t,n,r,i,o=[]])=>cg(e,t,n,r,i,o))),s),{}),lJ(u4,ci,cb,u8),{singleton:!0}),cD=uc(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=uo(0);return ue(e,ui(r),l8(([,e])=>0!==e),l9(([,e])=>({top:e})))(1,e=>{l5(ue(n,un(1),l8(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{t(0,e)})})}),{initialScrollTop:r}},lJ(u8,uT,cb),{singleton:!0}),cE=uc(([{scrollVelocity:e}])=>{let t=uo(!1),n=ua(),r=uo(!1);return l2(ue(e,ui(r,t,n),l8(([e,t])=>!1!==t&&void 0!==t),l9(([e,t,n,r])=>{let{enter:i,exit:o}=t;if(n){if(o(e,r))return!1}else if(i(e,r))return!0;return n}),l6()),t),ue(ud(t,e,n),ui(r))(1,([[e,t,n],r])=>{e&&!1!==r&&void 0!==r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},lJ(cl),{singleton:!0}),cO=uc(([{scrollContainerState:e,scrollTo:t}])=>{let n=ua(),r=ua(),i=ua(),o=uo(!1),s=uo(void 0);return l2(ue(ud(n,r),l9(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),l2(ue(t,ui(r),l9(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:s,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},lJ(uT)),cR=uc(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:s,windowScrollContainerState:a,windowViewportRect:l}])=>{let u=ua(),c=uo(void 0),h=uo(null),d=uo(null);return l2(a,h),l2(l,d),ue(u,ui(t,r,s,h,d,n))(1,([e,t,n,r,i,o,s])=>{let a=uL(t.sizeTree).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:void 0===i?1/0:i.k-1,size:t,startIndex:e}});r&&null!==i&&null!==o&&(n=i.scrollTop-o.offsetTop),e({ranges:a,scrollTop:n-=s})}),l2(ue(c,l8(lZ),l9(cI)),i),l2(ue(o,ui(c),l8(([,e])=>void 0!==e),l6(),l9(([,e])=>e.ranges)),e),{getState:u,restoreStateFrom:c}},lJ(u4,uT,ci,u8,cO));function cI(e){return{align:"start",index:0,offset:e.scrollTop}}let cP=uc(([{topItemsIndexes:e}])=>{let t=uo(0);return l2(ue(t,l8(e=>e>=0),l9(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},lJ(cb));function cN(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}let cL=cN(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),cj=uc(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:o,lastJumpDueToItemResize:s,scrollDirection:a},{listState:l},{beforeUnshiftWith:u,gap:c,shiftWithOffset:h,sizes:d},{log:f},{recalcInProgress:p}])=>{let m=ul(ue(l,ui(s),ut(([,e,t,n],[{bottom:r,items:i,offsetBottom:o,totalCount:s},a])=>{let l=r+o,u=0;return t===s&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||0!=(u=l-n)&&(u+=a)),[u,i,s,l]},[0,[],0,0]),l8(([e])=>0!==e),ui(r,a,n,i,f,p),l8(([,e,t,n,,,r])=>!r&&!n&&0!==e&&"up"===t),l9(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},0),e))));function g(n){n>0?(t(0,{behavior:"auto",top:-n}),e(0,0)):(e(0,0),t(0,{behavior:"auto",top:-n}))}return ue(m,ui(e,o))(1,([t,n,r])=>{r&&cL()?e(0,n-t):g(-t)}),ue(ud(us(o,!1),e,p),l8(([e,t,n])=>!e&&!n&&0!==t),l9(([e,t])=>t),ur(1))(1,g),l2(ue(h,l9(e=>({top:-e}))),t),ue(u,ui(d,c),l9(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{if(0===t.length)return e*(n+i);let o=0,s=uR(r,0),a=0,l=0;for(;a<e;){a++,o+=s;let r=t.length===l+1?1/0:t[l+1]-t[l]-1;a+r>e&&(o-=s,r=e-a+1),a+=r,o+=r*(n+i),l++}return o}))(1,n=>{e(0,n),requestAnimationFrame(()=>{t(0,{top:n}),requestAnimationFrame(()=>{e(0,0),p(0,!1)})})}),{deviation:e}},lJ(uT,cl,cb,u4,uv,uW)),cF=uc(([e,t,n,r,i,o,s,a,l,u,c])=>({...e,...t,...n,...r,...i,...o,...s,...a,...l,...u,...c}),lJ(cf,cT,u8,cE,cx,cD,cw,cO,cA,uv,cS)),cB=uc(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:o,groupIndices:s,heightEstimates:a,itemSize:l,sizeRanges:u,sizes:c,statefulTotalCount:h,totalCount:d,trackItemSizes:f},{initialItemFinalLocationReached:p,initialTopMostItemIndex:m,scrolledToInitialItem:g},v,y,b,x,{scrollToIndex:w},S,{topItemCount:C},{groupCounts:A},k])=>{let{listState:M,minOverscanItemCount:T,topItemsIndexes:D,rangeChanged:E,...O}=x;return l2(E,k.scrollSeekRangeChanged),l2(ue(k.windowViewportRect,l9(e=>e.visibleHeight)),v.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:o,groupCounts:A,heightEstimates:a,initialItemFinalLocationReached:p,initialTopMostItemIndex:m,scrolledToInitialItem:g,sizeRanges:u,topItemCount:C,topItemsIndexes:D,totalCount:d,...b,groupIndices:s,itemSize:l,listState:M,minOverscanItemCount:T,scrollToIndex:w,statefulTotalCount:h,trackItemSizes:f,rangeChanged:E,...O,...k,...v,sizes:c,...y}},lJ(u4,ci,uT,cR,cM,cb,ce,cj,cP,u6,cF)),c_=typeof document>"u"?S().useEffect:S().useLayoutEffect;function cz(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),s=Object.keys(t.events||{}),a=S().createContext({});function l(e,n){for(let i of(void 0!==e.propsReady&&(0,e.propsReady)(0,!1),r))(0,e[t.required[i]])(0,n[i]);for(let r of i)r in n&&(0,e[t.optional[r]])(0,n[r]);void 0!==e.propsReady&&(0,e.propsReady)(0,!0)}function u(e){return s.reduce((n,r)=>{var i;let o,s,a;return n[r]=(i=e[t.events[r]],a=()=>o?.(),function(e,t){switch(e){case 1:return t?s===t?void 0:(a(),s=t,o=i(1,t)):(a(),lX);case 2:a(),s=null;return}}),n},{})}return{Component:S().forwardRef(function(c,h){var d;let{children:f,...p}=c,[m]=S().useState(()=>{var t;let n,r;return n=new Map,l(t=(r=({constructor:e,dependencies:t,id:i,singleton:o})=>{if(o&&n.has(i))return n.get(i);let s=e(t.map(e=>r(e)));return o&&n.set(i,s),s})(e),p),t}),[g]=S().useState(()=>u(m));return c_(()=>{for(let e of s)e in p&&(0,g[e])(1,p[e]);return()=>{Object.values(g).map(l0)}},[p,g,m]),c_(()=>{l(m,p)}),S().useImperativeHandle(h,(d=o.reduce((e,n)=>(e[n]=e=>{(0,m[t.methods[n]])(0,e)},e),{}),()=>d)),(0,x.jsx)(a.Provider,{value:m,children:void 0===n?f:(0,x.jsx)(n,{...function(e,t){let n={},r={},i=0,o=e.length;for(;i<o;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}([...r,...i,...s],p),children:f})})}),useEmitter:(e,t)=>{let n=S().useContext(a)[e];c_(()=>n(1,t),[t,n])},useEmitterValue:parseInt(S().version,10)>=18?e=>{let t=S().useContext(a)[e],n=S().useCallback(e=>t(1,e),[t]);return S().useSyncExternalStore(n,()=>l1(t),()=>l1(t))}:e=>{let t=S().useContext(a)[e],[n,r]=S().useState(()=>l1(t));return c_(()=>t(1,e=>{e!==n&&r(()=>e)}),[t,n]),n},usePublisher:e=>{let t=S().useContext(a);return S().useCallback(n=>{(0,t[e])(0,n)},[t,e])}}}let cV=S().createContext(void 0),cH=S().createContext(void 0),c$="-webkit-sticky",cW="sticky",cU=cN(()=>{if(typeof document>"u")return cW;let e=document.createElement("div");return e.style.position=c$,e.style.position===c$?c$:cW}),cq=typeof document>"u"?S().useEffect:S().useLayoutEffect;function cG(e){return"self"in e}function cY(e,t,n,r=lX,i,o){let s=S().useRef(null),a=S().useRef(null),l=S().useRef(null),u=S().useCallback(n=>{let r,i,s,u=n.target;if("body"in u||cG(u)){let e=cG(u)?u:u.defaultView;s=!0===o?uw(e,e.scrollX):e.scrollY,r=!0===o?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=!0===o?e.innerWidth:e.innerHeight}else s=!0===o?uw(u,u.scrollLeft):u.scrollTop,r=!0===o?u.scrollWidth:u.scrollHeight,i=!0===o?u.offsetWidth:u.offsetHeight;let c=()=>{e({scrollHeight:r,scrollTop:Math.max(s,0),viewportHeight:i})};!0===n.suppressFlushSync?c():eV().flushSync(c),null!==a.current&&(s===a.current||s<=0||s===r-i)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,o]);return S().useEffect(()=>{let e=i??s.current;return ux(e),r(i??s.current),u({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",u,{passive:!0}),()=>{ux(e),r(null),e.removeEventListener("scroll",u)}},[s,u,n,r,i]),{scrollByCallback:function(e){!0===o&&(e={...void 0===e.behavior?{}:{behavior:e.behavior},...void 0===e.top?{}:{left:uw(s.current,e.top)}}),s.current.scrollBy(e)},scrollerRef:s,scrollToCallback:function(n){let r,i,u,c=s.current;if(!c||(!0===o?"offsetWidth"in c&&0===c.offsetWidth:"offsetHeight"in c&&0===c.offsetHeight))return;let h="smooth"===n.behavior;cG(c)?(i=Math.max(uq(c.document.documentElement,!0===o?"width":"height"),!0===o?c.document.documentElement.scrollWidth:c.document.documentElement.scrollHeight),r=!0===o?c.innerWidth:c.innerHeight,u=!0===o?uw(c,c.scrollX):c.scrollY):(i=c[!0===o?"scrollWidth":"scrollHeight"],r=uq(c,!0===o?"width":"height"),u=!0===o?uw(c,c.scrollLeft):c.scrollTop);let d=i-r;if(void 0===n.top)return void c.scrollTo(n);let f=Math.ceil(Math.max(Math.min(d,n.top),0));if(n.top=f,co(r,i)||f===u){e({scrollHeight:i,scrollTop:u,viewportHeight:r}),h&&t(!0);return}h?(a.current=f,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,!0===o&&(n={...void 0===n.behavior?{}:{behavior:n.behavior},left:uw(c,f)}),c.scrollTo(n)}}}function cK(e){return e}let cZ=uc(()=>{let e=uo(e=>`Item ${e}`),t=uo(e=>`Group ${e}`),n=uo({}),r=uo(cK),i=uo("div"),o=uo(lX),s=(e,t=null)=>us(ue(n,l9(t=>t[e]),l6()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:s("EmptyPlaceholder"),FooterComponent:s("Footer"),GroupComponent:s("Group","div"),groupContent:t,HeaderComponent:s("Header"),HeaderFooterTag:i,ItemComponent:s("Item","div"),itemContent:e,ListComponent:s("List","div"),ScrollerComponent:s("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),TopItemListComponent:s("TopItemList")}}),cX=uc(([e,t])=>({...e,...t}),lJ(cB,cZ)),cQ=({height:e})=>(0,x.jsx)("div",{style:{height:e}}),cJ={overflowAnchor:"none",position:cU(),zIndex:1},c0={overflowAnchor:"none"},c1={...c0,display:"inline-block",height:"100%"},c2=S().memo(function({showTopList:e=!1}){let t=hu("listState"),n=hc("sizeRanges"),r=hu("useWindowScroll"),i=hu("customScrollParent"),o=hc("windowScrollContainerState"),s=hc("scrollContainerState"),a=hu("itemContent"),l=hu("context"),u=hu("groupContent"),c=hu("trackItemSizes"),h=hu("itemSize"),d=hu("log"),f=hc("gap"),p=hu("horizontalDirection"),{callbackRef:m}=uA(n,h,c,e?lX:i||r?o:s,d,f,i,p,hu("skipAnimationFrameInResizeObserver")),[g,v]=S().useState(0);hl("deviation",e=>{g!==e&&v(e)});let y=hu("EmptyPlaceholder"),b=hu("ScrollSeekPlaceholder")??cQ,C=hu("ListComponent"),A=hu("ItemComponent"),k=hu("GroupComponent"),M=hu("computeItemKey"),T=hu("isSeeking"),D=hu("groupIndices").length>0,E=hu("alignToBottom"),O=hu("initialItemFinalLocationReached"),R=e?{}:{boxSizing:"border-box",...p?{display:"inline-block",height:"100%",marginInlineStart:0===g?E?"auto":0:g,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:0===g?E?"auto":0:g,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...O?{}:{visibility:"hidden"}};return e||0!==t.totalCount||null==y?(0,x.jsx)(C,{...c9(C,l),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:m,style:R,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=M(n+t.firstItemIndex,e.data,l);return T?(0,w.createElement)(b,{...c9(b,l),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?(0,w.createElement)(k,{...c9(k,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:cJ},u(e.index,l)):(0,w.createElement)(A,{...c9(A,l),...c7(A,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:p?c1:c0},D?a(e.index,e.groupIndex,e.data,l):a(e.index,e.data,l))})}):(0,x.jsx)(y,{...c9(y,l)})}),c5={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},c4={outline:"none",overflowX:"auto",position:"relative"},c3=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),c6=(e,t,n=0)=>({...c3(e),position:t?"relative":"absolute",top:t?-n:0}),c8={position:cU(),top:0,width:"100%",zIndex:1};function c9(e,t){if("string"!=typeof e)return{context:t}}function c7(e,t){return{item:"string"==typeof e?void 0:t}}let he=S().memo(function(){let e=hu("HeaderComponent"),t=hc("headerHeight"),n=hu("HeaderFooterTag"),r=uS(S().useMemo(()=>e=>{t(uq(e,"height"))},[t]),!0,hu("skipAnimationFrameInResizeObserver")),i=hu("context");return null!=e?(0,x.jsx)(n,{ref:r,children:(0,x.jsx)(e,{...c9(e,i)})}):null}),ht=S().memo(function(){let e=hu("FooterComponent"),t=hc("footerHeight"),n=hu("HeaderFooterTag"),r=uS(S().useMemo(()=>e=>{t(uq(e,"height"))},[t]),!0,hu("skipAnimationFrameInResizeObserver")),i=hu("context");return null!=e?(0,x.jsx)(n,{ref:r,children:(0,x.jsx)(e,{...c9(e,i)})}):null});function hn({useEmitter:e,useEmitterValue:t,usePublisher:n}){return S().memo(function({children:r,style:i,context:o,...s}){let a=n("scrollContainerState"),l=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),c=t("scrollerRef"),h=t("horizontalDirection")||!1,{scrollByCallback:d,scrollerRef:f,scrollToCallback:p}=cY(a,u,l,c,void 0,h);return e("scrollTo",p),e("scrollBy",d),(0,x.jsx)(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:f,style:{...h?c4:c5,...i},tabIndex:0,...s,...c9(l,o),children:r})})}function hr({useEmitter:e,useEmitterValue:t,usePublisher:n}){return S().memo(function({children:r,style:i,context:o,...s}){let a=n("windowScrollContainerState"),l=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),c=t("totalListHeight"),h=t("deviation"),d=t("customScrollParent"),f=S().useRef(null),{scrollByCallback:p,scrollerRef:m,scrollToCallback:g}=cY(a,u,l,t("scrollerRef"),d);return cq(()=>(m.current=d??f.current?.ownerDocument.defaultView,()=>{m.current=null}),[m,d]),e("windowScrollTo",g),e("scrollBy",p),(0,x.jsx)(l,{ref:f,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...0===c?void 0:{height:c+h}},...s,...c9(l,o),children:r})})}let hi=({children:e})=>{let t=S().useContext(cV),n=hc("viewportHeight"),r=hc("fixedItemHeight"),i=hu("alignToBottom"),o=hu("horizontalDirection"),s=uS(S().useMemo(()=>lK(n,e=>uq(e,o?"width":"height")),[n,o]),!0,hu("skipAnimationFrameInResizeObserver"));return S().useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,x.jsx)("div",{"data-viewport-type":"element",ref:s,style:c3(i),children:e})},ho=({children:e})=>{let t=S().useContext(cV),n=hc("windowViewportRect"),r=hc("fixedItemHeight"),i=hu("customScrollParent"),o=hu("useWindowScroll"),s=hu("topListHeight"),a=uM(n,i,hu("skipAnimationFrameInResizeObserver")),l=hu("alignToBottom");return S().useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,x.jsx)("div",{"data-viewport-type":"window",ref:a,style:c6(l,o,s),children:e})},hs=({children:e})=>{let t=hu("TopItemListComponent")??"div",n=hu("headerHeight"),r={...c8,marginTop:`${n}px`},i=hu("context");return(0,x.jsx)(t,{style:r,...c9(t,i),children:e})},{Component:ha,useEmitter:hl,useEmitterValue:hu,usePublisher:hc}=cz(cX,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},S().memo(function(e){let t=hu("useWindowScroll"),n=hu("topItemsIndexes").length>0,r=hu("customScrollParent"),i=hu("context");return(0,x.jsxs)(r||t?hd:hh,{...e,context:i,children:[n&&(0,x.jsx)(hs,{children:(0,x.jsx)(c2,{showTopList:!0})}),(0,x.jsxs)(r||t?ho:hi,{children:[(0,x.jsx)(he,{}),(0,x.jsx)(c2,{}),(0,x.jsx)(ht,{})]})]})})),hh=hn({useEmitter:hl,useEmitterValue:hu,usePublisher:hc}),hd=hr({useEmitter:hl,useEmitterValue:hu,usePublisher:hc}),hf=uc(()=>{let e=uo(e=>(0,x.jsxs)("td",{children:["Item $",e]})),t=uo(null),n=uo(e=>(0,x.jsxs)("td",{colSpan:1e3,children:["Group ",e]})),r=uo(null),i=uo(null),o=uo({}),s=uo(cK),a=uo(lX),l=(e,t=null)=>us(ue(o,l9(t=>t[e]),l6()),t);return{components:o,computeItemKey:s,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}}),hp=uc(([e,t])=>({...e,...t}),lJ(cB,hf)),hm=({height:e})=>(0,x.jsx)("tr",{children:(0,x.jsx)("td",{style:{height:e}})}),hg=({height:e})=>(0,x.jsx)("tr",{children:(0,x.jsx)("td",{style:{border:0,height:e,padding:0}})}),hv={overflowAnchor:"none"},hy={position:cU(),zIndex:2,overflowAnchor:"none"},hb=S().memo(function({showTopList:e=!1}){let t=hk("listState"),n=hk("computeItemKey"),r=hk("firstItemIndex"),i=hk("context"),o=hk("isSeeking"),s=hk("fixedHeaderHeight"),a=hk("groupIndices").length>0,l=hk("itemContent"),u=hk("groupContent"),c=hk("ScrollSeekPlaceholder")??hm,h=hk("GroupComponent"),d=hk("TableRowComponent"),f=(e?t.topItems:[]).reduce((e,t,n)=>(0===n?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let p=t.originalIndex,m=n(p+r,t.data,i),g=e?0===p?0:f[p-1]:0;return o?(0,w.createElement)(c,{...c9(c,i),height:t.size,index:t.index,key:m,type:t.type||"item"}):"group"===t.type?(0,w.createElement)(h,{...c9(h,i),"data-index":p,"data-item-index":t.index,"data-known-size":t.size,key:m,style:{...hy,top:s}},u(t.index,i)):(0,w.createElement)(d,{...c9(d,i),...c7(d,t.data),"data-index":p,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:m,style:e?{...hy,top:s+g}:hv},a?l(t.index,t.groupIndex,t.data,i):l(t.index,t.data,i))})}),hx=S().memo(function(){let e=hk("listState"),t=hk("topItemsIndexes").length>0,n=hM("sizeRanges"),r=hk("useWindowScroll"),i=hk("customScrollParent"),o=hM("windowScrollContainerState"),s=hM("scrollContainerState"),a=hk("trackItemSizes"),{callbackRef:l,ref:u}=uA(n,hk("itemSize"),a,i||r?o:s,hk("log"),void 0,i,!1,hk("skipAnimationFrameInResizeObserver")),[c,h]=S().useState(0);hA("deviation",e=>{c!==e&&(u.current.style.marginTop=`${e}px`,h(e))});let d=hk("EmptyPlaceholder"),f=hk("FillerRow")??hg,p=hk("TableBodyComponent"),m=hk("paddingTopAddition"),g=hk("statefulTotalCount"),v=hk("context");if(0===g&&null!=d)return(0,x.jsx)(d,{...c9(d,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+m+c-y,w=e.offsetBottom,C=b>0?(0,x.jsx)(f,{context:v,height:b},"padding-top"):null,A=w>0?(0,x.jsx)(f,{context:v,height:w},"padding-bottom"):null;return(0,x.jsxs)(p,{"data-testid":"virtuoso-item-list",ref:l,...c9(p,v),children:[C,t&&(0,x.jsx)(hb,{showTopList:!0}),(0,x.jsx)(hb,{}),A]})}),hw=({children:e})=>{let t=S().useContext(cV),n=hM("viewportHeight"),r=hM("fixedItemHeight"),i=uS(S().useMemo(()=>lK(n,e=>uq(e,"height")),[n]),!0,hk("skipAnimationFrameInResizeObserver"));return S().useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,x.jsx)("div",{"data-viewport-type":"element",ref:i,style:c3(!1),children:e})},hS=({children:e})=>{let t=S().useContext(cV),n=hM("windowViewportRect"),r=hM("fixedItemHeight"),i=hk("customScrollParent"),o=hk("useWindowScroll"),s=uM(n,i,hk("skipAnimationFrameInResizeObserver"));return S().useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,x.jsx)("div",{"data-viewport-type":"window",ref:s,style:c6(!1,o),children:e})},{Component:hC,useEmitter:hA,useEmitterValue:hk,usePublisher:hM}=cz(hp,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},S().memo(function(e){let t=hk("useWindowScroll"),n=hk("customScrollParent"),r=hM("fixedHeaderHeight"),i=hM("fixedFooterHeight"),o=hk("fixedHeaderContent"),s=hk("fixedFooterContent"),a=hk("context"),l=uS(S().useMemo(()=>lK(r,e=>uq(e,"height")),[r]),!0,hk("skipAnimationFrameInResizeObserver")),u=uS(S().useMemo(()=>lK(i,e=>uq(e,"height")),[i]),!0,hk("skipAnimationFrameInResizeObserver")),c=n||t?hD:hT,h=n||t?hS:hw,d=hk("TableComponent"),f=hk("TableHeadComponent"),p=hk("TableFooterComponent"),m=o?(0,x.jsx)(f,{ref:l,style:{position:"sticky",top:0,zIndex:2},...c9(f,a),children:o()},"TableHead"):null,g=s?(0,x.jsx)(p,{ref:u,style:{bottom:0,position:"sticky",zIndex:1},...c9(p,a),children:s()},"TableFoot"):null;return(0,x.jsx)(c,{...e,...c9(c,a),children:(0,x.jsx)(h,{children:(0,x.jsxs)(d,{style:{borderSpacing:0,overflowAnchor:"none"},...c9(d,a),children:[m,(0,x.jsx)(hx,{},"TableBody"),g]})})})})),hT=hn({useEmitter:hA,useEmitterValue:hk,usePublisher:hM}),hD=hr({useEmitter:hA,useEmitterValue:hk,usePublisher:hM}),hE={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},hO={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:hR,floor:hI,max:hP,min:hN,round:hL}=Math;function hj(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function hF(e,t){return void 0!==e&&e.width===t.width&&e.height===t.height}function hB(e,t){return void 0!==e&&e.column===t.column&&e.row===t.row}let h_=uc(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:s,scrollContainerState:a,scrollTo:l,scrollTop:u,smoothScrollTargetReached:c,viewportHeight:h},d,f,{didMount:p,propsReady:m},{customScrollParent:g,useWindowScroll:v,windowScrollContainerState:y,windowScrollTo:b,windowViewportRect:x},w])=>{let S=uo(0),C=uo(0),A=uo(hE),k=uo({height:0,width:0}),M=uo({height:0,width:0}),T=ua(),D=ua(),E=uo(0),O=uo(null),R=uo({column:0,row:0}),I=ua(),P=ua(),N=uo(!1),L=uo(0),j=uo(!0),F=uo(!1),B=uo(!1);ue(p,ui(L),l8(([e,t])=>!cr(t)))(1,()=>{j(0,!1)}),ue(ud(p,j,M,k,L,F),l8(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i))(1,([,,,,e])=>{void 0===e?j(0,!0):(F(0,!0),ct(1,()=>{T(0,e)}),l5(ue(u),()=>{t(0,[0,0]),j(0,!0)}))}),l2(ue(P,l8(e=>null!=e&&e.scrollTop>0),l7(0)),C),ue(p,ui(P),l8(([,e])=>null!=e))(1,([,e])=>{e&&(k(0,e.viewport),M(0,e.item),R(0,e.gap),e.scrollTop>0&&(N(0,!0),l5(ue(u,un(1)),e=>{N(0,!1)}),l(0,{top:e.scrollTop})))}),l2(ue(k,l9(({height:e})=>e)),h),l2(ue(ud(uf(k,hF),uf(M,hF),uf(R,(e,t)=>void 0!==e&&e.column===t.column&&e.row===t.row),uf(u)),l9(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),I),l2(ue(ud(uf(S),r,uf(R,hB),uf(M,hF),uf(k,hF),uf(O),uf(C),uf(N),uf(j),uf(L)),l8(([,,,,,,,e])=>!e),l9(([e,[t,n],r,i,o,s,a,,l,u])=>{let c,h,{column:d,row:f}=r,{height:p,width:m}=i,{width:g}=o;if(0===a&&(0===e||0===g))return hE;if(0===m){var v;let t=cn(u,e),n=t+Math.max(a-1,0);return v=hj(t,n,s),{...hO,items:v}}let y=hz(g,m,d);l?0===t&&0===n&&a>0?(c=0,h=a-1):(c=y*hI((t+f)/(p+f)),h=hN(e-1,hP(h=y*hR((n+f)/(p+f))-1,y-1)),c=hN(h,hP(0,c))):(c=0,h=-1);let b=hj(c,h,s),{bottom:x,top:w}=hV(o,r,i,b),S=hR(e/y);return{bottom:x,itemHeight:p,items:b,itemWidth:m,offsetBottom:S*p+(S-1)*f-x,offsetTop:w,top:w}})),A),l2(ue(O,l8(e=>null!==e),l9(e=>e.length)),S),l2(ue(ud(k,M,A,R),l8(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),l9(([e,t,{items:n},r])=>{let{bottom:i,top:o}=hV(e,r,t,n);return[o,i]}),l6(u$)),t);let _=uo(!1);l2(ue(u,ui(_),l9(([e,t])=>t||0!==e)),_);let z=ul(ue(ud(A,S),l8(([{items:e}])=>e.length>0),ui(_),l8(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&0===e.offsetBottom&&e.items.length===t)&&r}),l9(([[,e]])=>e-1),l6())),V=ul(ue(uf(A),l8(({items:e})=>e.length>0&&0===e[0].index),l7(0),l6())),H=ul(ue(uf(A),ui(N),l8(([{items:e},t])=>e.length>0&&!t),l9(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),l6(uH),ur(0)));l2(H,f.scrollSeekRangeChanged),l2(ue(T,ui(k,M,S,R),l9(([e,t,n,r,i])=>{let o=u7(e),{align:s,behavior:a,offset:l}=o,u=o.index;"LAST"===u&&(u=r-1);let c=hH(t,i,n,u=hP(0,u,hN(r-1,u)));return"end"===s?c=hL(c-t.height+n.height):"center"===s&&(c=hL(c-t.height/2+n.height/2)),void 0!==l&&0!==l&&(c+=l),{behavior:a,top:c}})),l);let $=us(ue(A,l9(e=>e.offsetBottom+e.bottom)),0);return l2(ue(x,l9(e=>({height:e.visibleHeight,width:e.visibleWidth}))),k),{customScrollParent:g,data:O,deviation:E,footerHeight:i,gap:R,headerHeight:o,increaseViewportBy:e,initialItemCount:C,itemDimensions:M,overscan:n,restoreStateFrom:P,scrollBy:s,scrollContainerState:a,scrollHeight:D,scrollTo:l,scrollToIndex:T,scrollTop:u,smoothScrollTargetReached:c,totalCount:S,useWindowScroll:v,viewportDimensions:k,windowScrollContainerState:y,windowScrollTo:b,windowViewportRect:x,...f,gridState:A,horizontalDirection:B,initialTopMostItemIndex:L,totalListHeight:$,...d,endReached:z,propsReady:m,rangeChanged:H,startReached:V,stateChanged:I,stateRestoreInProgress:N,...w}},lJ(cf,uT,cl,cE,u8,cO,uv));function hz(e,t,n){return hP(1,hI((e+n)/(hI(t)+n)))}function hV(e,t,n,r){let{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};let o=hH(e,t,n,r[0].index);return{bottom:hH(e,t,n,r[r.length-1].index)+i,top:o}}function hH(e,t,n,r){let i=hI(r/hz(e.width,n.width,t.column)),o=i*n.height+hP(0,i-1)*t.row;return o>0?o+t.row:o}let h$=uc(()=>{let e=uo(e=>`Item ${e}`),t=uo({}),n=uo(null),r=uo("virtuoso-grid-item"),i=uo("virtuoso-grid-list"),o=uo(cK),s=uo("div"),a=uo(lX),l=(e,n=null)=>us(ue(t,l9(t=>t[e]),l6()),n),u=uo(!1),c=uo(!1);return l2(uf(c),u),{components:t,computeItemKey:o,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:s,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:i,ListComponent:l("List","div"),readyStateChanged:u,reportReadyState:c,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),hW=uc(([e,t])=>({...e,...t}),lJ(h_,h$)),hU=S().memo(function(){let e=hX("gridState"),t=hX("listClassName"),n=hX("itemClassName"),r=hX("itemContent"),i=hX("computeItemKey"),o=hX("isSeeking"),s=hQ("scrollHeight"),a=hX("ItemComponent"),l=hX("ListComponent"),u=hX("ScrollSeekPlaceholder"),c=hX("context"),h=hQ("itemDimensions"),d=hQ("gap"),f=hX("log"),p=hX("stateRestoreInProgress"),m=hQ("reportReadyState"),g=uS(S().useMemo(()=>e=>{s(e.parentElement.parentElement.scrollHeight);let t=e.firstChild;if(null!==t){let{height:e,width:n}=t.getBoundingClientRect();h({height:e,width:n})}d({column:h1("column-gap",getComputedStyle(e).columnGap,f),row:h1("row-gap",getComputedStyle(e).rowGap,f)})},[s,h,d,f]),!0,!1);return cq(()=>{e.itemHeight>0&&e.itemWidth>0&&m(!0)},[e]),p?null:(0,x.jsx)(l,{className:t,ref:g,...c9(l,c),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let s=i(t.index,t.data,c);return o?(0,x.jsx)(u,{...c9(u,c),height:e.itemHeight,index:t.index,width:e.itemWidth},s):(0,w.createElement)(a,{...c9(a,c),className:n,"data-index":t.index,key:s},r(t.index,t.data,c))})})}),hq=S().memo(function(){let e=hX("HeaderComponent"),t=hQ("headerHeight"),n=hX("headerFooterTag"),r=uS(S().useMemo(()=>e=>{t(uq(e,"height"))},[t]),!0,!1),i=hX("context");return null!=e?(0,x.jsx)(n,{ref:r,children:(0,x.jsx)(e,{...c9(e,i)})}):null}),hG=S().memo(function(){let e=hX("FooterComponent"),t=hQ("footerHeight"),n=hX("headerFooterTag"),r=uS(S().useMemo(()=>e=>{t(uq(e,"height"))},[t]),!0,!1),i=hX("context");return null!=e?(0,x.jsx)(n,{ref:r,children:(0,x.jsx)(e,{...c9(e,i)})}):null}),hY=({children:e})=>{let t=S().useContext(cH),n=hQ("itemDimensions"),r=hQ("viewportDimensions"),i=uS(S().useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return S().useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,x.jsx)("div",{ref:i,style:c3(!1),children:e})},hK=({children:e})=>{let t=S().useContext(cH),n=hQ("windowViewportRect"),r=hQ("itemDimensions"),i=hX("customScrollParent"),o=hX("useWindowScroll"),s=uM(n,i,!1);return S().useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,x.jsx)("div",{ref:s,style:c6(!1,o),children:e})},{useEmitter:hZ,useEmitterValue:hX,usePublisher:hQ}=cz(hW,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},S().memo(function({...e}){let t=hX("useWindowScroll"),n=hX("customScrollParent"),r=n||t?h0:hJ,i=n||t?hK:hY,o=hX("context");return(0,x.jsx)(r,{...e,...c9(r,o),children:(0,x.jsxs)(i,{children:[(0,x.jsx)(hq,{}),(0,x.jsx)(hU,{}),(0,x.jsx)(hG,{})]})})})),hJ=hn({useEmitter:hZ,useEmitterValue:hX,usePublisher:hQ}),h0=hr({useEmitter:hZ,useEmitterValue:hX,usePublisher:hQ});function h1(e,t,n){return"normal"!==t&&t?.endsWith("px")!==!0&&n(`${e} was not resolved to pixel value correctly`,t,2),"normal"===t?0:parseInt(t??"0",10)}function h2({items:e,height:t,width:n,selectedItems:r,onLegendItemClick:i,onItemMouseOver:o,onItemMouseOut:s}){let a=e.length>5;return(0,x.jsx)(ha,{style:{height:t,width:n},data:e,itemContent:(e,t)=>(0,x.jsx)(lq,{item:t,index:e,truncateLabel:a,isVisuallySelected:lP(t,r),onClick:i,onMouseOver:o,onMouseOut:s,sx:{width:"100%",wordBreak:"break-word",overflow:"hidden"}},t.id),role:"list"})}function h5(e,t){return"function"==typeof e?e(t):e}function h4(e,t){return n=>{t.setState(t=>({...t,[e]:h5(n,t[e])}))}}function h3(e){return e instanceof Function}function h6(e,t,n){let r,i=[];return o=>{let s,a;n.key&&n.debug&&(s=Date.now());let l=e(o);if(!(l.length!==i.length||l.some((e,t)=>i[t]!==e)))return r;if(i=l,n.key&&n.debug&&(a=Date.now()),r=t(...l),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){let e=Math.round((Date.now()-s)*100)/100,t=Math.round((Date.now()-a)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
3
+ font-size: .6rem;
4
+ font-weight: bold;
5
+ color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return r}}function h8(e,t,n,r){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:r}}let h9="debugHeaders";function h7(e,t,n){var r;let i={id:null!=(r=n.id)?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(i),e},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(t=>{null==t.createHeader||t.createHeader(i,e)}),i}function de(e,t,n,r){var i,o;let s=0,a=function(e,t){void 0===t&&(t=1),s=Math.max(s,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&a(e.columns,t+1)},0)};a(e);let l=[],u=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},o=[];e.forEach(e=>{let s,a=[...o].reverse()[0],l=e.column.depth===i.depth,u=!1;if(l&&e.column.parent?s=e.column.parent:(s=e.column,u=!0),a&&(null==a?void 0:a.column)===s)a.subHeaders.push(e);else{let i=h7(n,s,{id:[r,t,s.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:u,placeholderId:u?`${o.filter(e=>e.column===s).length}`:void 0,depth:t,index:o.length});i.subHeaders.push(e),o.push(i)}i.headers.push(e),e.headerGroup=i}),l.push(i),t>0&&u(o,t-1)};u(t.map((e,t)=>h7(n,e,{depth:s,index:t})),s-1),l.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1,n+=Math.min(...r),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(null!=(i=null==(o=l[0])?void 0:o.headers)?i:[]),l}let dt=(e,t,n,r,i,o,s)=>{let a={id:t,index:r,original:n,depth:i,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(a._valuesCache.hasOwnProperty(t))return a._valuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return a._valuesCache[t]=n.accessorFn(a.original,r),a._valuesCache[t]},getUniqueValues:t=>{if(a._uniqueValuesCache.hasOwnProperty(t))return a._uniqueValuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return n.columnDef.getUniqueValues?a._uniqueValuesCache[t]=n.columnDef.getUniqueValues(a.original,r):a._uniqueValuesCache[t]=[a.getValue(t)],a._uniqueValuesCache[t]},renderValue:t=>{var n;return null!=(n=a.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=o?o:[],getLeafRows:()=>{var e,t;let n,r;return e=a.subRows,t=e=>e.subRows,n=[],(r=e=>{e.forEach(e=>{n.push(e);let i=t(e);null!=i&&i.length&&r(i)})})(e),n},getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let e=[],t=a;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:h6(()=>[e.getAllLeafColumns()],t=>t.map(t=>{var n;let r;return n=t.id,r={id:`${a.id}_${t.id}`,row:a,column:t,getValue:()=>a.getValue(n),renderValue:()=>{var t;return null!=(t=r.getValue())?t:e.options.renderFallbackValue},getContext:h6(()=>[e,t,a,r],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),h8(e.options,"debugCells","cell.getContext"))},e._features.forEach(n=>{null==n.createCell||n.createCell(r,t,a,e)},{}),r}),h8(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:h6(()=>[a.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),h8(e.options,"debugRows","getAllCellsByColumnId"))};for(let t=0;t<e._features.length;t++){let n=e._features[t];null==n||null==n.createRow||n.createRow(a,e)}return a},dn=(e,t,n)=>{var r,i;let o=null==n||null==(r=n.toString())?void 0:r.toLowerCase();return!!(null==(i=e.getValue(t))||null==(i=i.toString())||null==(i=i.toLowerCase())?void 0:i.includes(o))};dn.autoRemove=e=>df(e);let dr=(e,t,n)=>{var r;return!!(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};dr.autoRemove=e=>df(e);let di=(e,t,n)=>{var r;return(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.toLowerCase())===(null==n?void 0:n.toLowerCase())};di.autoRemove=e=>df(e);let ds=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};ds.autoRemove=e=>df(e);let da=(e,t,n)=>!n.some(n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))});da.autoRemove=e=>df(e)||!(null!=e&&e.length);let dl=(e,t,n)=>n.some(n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)});dl.autoRemove=e=>df(e)||!(null!=e&&e.length);let du=(e,t,n)=>e.getValue(t)===n;du.autoRemove=e=>df(e);let dc=(e,t,n)=>e.getValue(t)==n;dc.autoRemove=e=>df(e);let dh=(e,t,n)=>{let[r,i]=n,o=e.getValue(t);return o>=r&&o<=i};dh.resolveFilterValue=e=>{let[t,n]=e,r="number"!=typeof t?parseFloat(t):t,i="number"!=typeof n?parseFloat(n):n,o=null===t||Number.isNaN(r)?-1/0:r,s=null===n||Number.isNaN(i)?1/0:i;if(o>s){let e=o;o=s,s=e}return[o,s]},dh.autoRemove=e=>df(e)||df(e[0])&&df(e[1]);let dd={includesString:dn,includesStringSensitive:dr,equalsString:di,arrIncludes:ds,arrIncludesAll:da,arrIncludesSome:dl,equals:du,weakEquals:dc,inNumberRange:dh};function df(e){return null==e||""===e}function dp(e,t,n){return!!e&&!!e.autoRemove&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}let dm={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+("number"==typeof r?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r>n||void 0===r&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r<n||void 0===r&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(void 0===r?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);null!=i&&(i*=1)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!(Array.isArray(n)&&n.every(e=>"number"==typeof e)))return;if(1===n.length)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2!=0?i[r]:(i[r-1]+i[r])/2},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},dg=()=>({left:[],right:[]}),dv={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},dy=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),db=null;function dx(e){return"touchstart"===e.type}function dw(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}let dS=()=>({pageIndex:0,pageSize:10}),dC=()=>({top:[],bottom:[]}),dA=(e,t,n,r,i)=>{var o;let s=i.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&null!=(o=s.subRows)&&o.length&&s.getCanSelectSubRows()&&s.subRows.forEach(t=>dA(e,t.id,n,r,i))};function dk(e,t){let n=e.getState().rowSelection,r=[],i={},o=function(e,t){return e.map(e=>{var t;let s=dM(e,n);if(s&&(r.push(e),i[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:o(e.subRows)}),s)return e}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function dM(e,t){var n;return null!=(n=t[e.id])&&n}function dT(e,t,n){var r;if(!(null!=(r=e.subRows)&&r.length))return!1;let i=!0,o=!1;return e.subRows.forEach(e=>{if((!o||i)&&(e.getCanSelect()&&(dM(e,t)?o=!0:i=!1),e.subRows&&e.subRows.length)){let n=dT(e,t);"all"===n?o=!0:("some"===n&&(o=!0),i=!1)}}),i?"all":!!o&&"some"}let dD=/([0-9]+)/gm;function dE(e,t){return e===t?0:e>t?1:-1}function dO(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function dR(e,t){let n=e.split(dD).filter(Boolean),r=t.split(dD).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),o=parseInt(t,10),s=[i,o].sort();if(isNaN(s[0])){if(e>t)return 1;if(t>e)return -1;continue}if(isNaN(s[1]))return isNaN(i)?-1:1;if(i>o)return 1;if(o>i)return -1}return n.length-r.length}let dI={alphanumeric:(e,t,n)=>dR(dO(e.getValue(n)).toLowerCase(),dO(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>dR(dO(e.getValue(n)),dO(t.getValue(n))),text:(e,t,n)=>dE(dO(e.getValue(n)).toLowerCase(),dO(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>dE(dO(e.getValue(n)),dO(t.getValue(n))),datetime:(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},basic:(e,t,n)=>dE(e.getValue(n),t.getValue(n))},dP=[{createTable:e=>{e.getHeaderGroups=h6(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,s;let a=null!=(o=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[],l=null!=(s=null==i?void 0:i.map(e=>n.find(t=>t.id===e)).filter(Boolean))?s:[];return de(t,[...a,...n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),...l],e)},h8(e.options,h9,"getHeaderGroups")),e.getCenterHeaderGroups=h6(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>de(t,n=n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),e,"center"),h8(e.options,h9,"getCenterHeaderGroups")),e.getLeftHeaderGroups=h6(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;return de(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"left")},h8(e.options,h9,"getLeftHeaderGroups")),e.getRightHeaderGroups=h6(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;return de(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"right")},h8(e.options,h9,"getRightHeaderGroups")),e.getFooterGroups=h6(()=>[e.getHeaderGroups()],e=>[...e].reverse(),h8(e.options,h9,"getFooterGroups")),e.getLeftFooterGroups=h6(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),h8(e.options,h9,"getLeftFooterGroups")),e.getCenterFooterGroups=h6(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),h8(e.options,h9,"getCenterFooterGroups")),e.getRightFooterGroups=h6(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),h8(e.options,h9,"getRightFooterGroups")),e.getFlatHeaders=h6(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),h8(e.options,h9,"getFlatHeaders")),e.getLeftFlatHeaders=h6(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),h8(e.options,h9,"getLeftFlatHeaders")),e.getCenterFlatHeaders=h6(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),h8(e.options,h9,"getCenterFlatHeaders")),e.getRightFlatHeaders=h6(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),h8(e.options,h9,"getRightFlatHeaders")),e.getCenterLeafHeaders=h6(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),h8(e.options,h9,"getCenterLeafHeaders")),e.getLeftLeafHeaders=h6(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),h8(e.options,h9,"getLeftLeafHeaders")),e.getRightLeafHeaders=h6(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),h8(e.options,h9,"getRightLeafHeaders")),e.getLeafHeaders=h6(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var r,i,o,s,a,l;return[...null!=(r=null==(i=e[0])?void 0:i.headers)?r:[],...null!=(o=null==(s=t[0])?void 0:s.headers)?o:[],...null!=(a=null==(l=n[0])?void 0:l.headers)?a:[]].map(e=>e.getLeafHeaders()).flat()},h8(e.options,h9,"getLeafHeaders"))}},{getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:h4("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;let i=e.columns;return null==(n=i.length?i.some(e=>e.getIsVisible()):null==(r=t.getState().columnVisibility)?void 0:r[e.id])||n},e.getCanHide=()=>{var n,r;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(r=t.options.enableHiding)||r)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=h6(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),h8(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=h6(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],h8(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(t,n)=>h6(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),h8(e.options,"debugColumns",t));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}},{getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:h4("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=h6(e=>[dw(t,e)],t=>t.findIndex(t=>t.id===e.id),h8(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=n=>{var r;return(null==(r=dw(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;let i=dw(t,n);return(null==(r=i[i.length-1])?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=h6(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(null!=e&&e.length){let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}else i=r;var o=i;if(!(null!=t&&t.length)||!n)return o;let s=o.filter(e=>!t.includes(e.id));return"remove"===n?s:[...t.map(e=>o.find(t=>t.id===e)).filter(Boolean),...s]},h8(e.options,"debugTable","_getOrderColumnsFn"))}},{getInitialState:e=>({columnPinning:dg(),...e}),getDefaultOptions:e=>({onColumnPinningChange:h4("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,i,o,s,a,l;return"right"===n?{left:(null!=(o=null==e?void 0:e.left)?o:[]).filter(e=>!(null!=r&&r.includes(e))),right:[...(null!=(s=null==e?void 0:e.right)?s:[]).filter(e=>!(null!=r&&r.includes(e))),...r]}:"left"===n?{left:[...(null!=(a=null==e?void 0:e.left)?a:[]).filter(e=>!(null!=r&&r.includes(e))),...r],right:(null!=(l=null==e?void 0:e.right)?l:[]).filter(e=>!(null!=r&&r.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=r&&r.includes(e))),right:(null!=(i=null==e?void 0:e.right)?i:[]).filter(e=>!(null!=r&&r.includes(e)))}})},e.getCanPin=()=>e.getLeafColumns().some(e=>{var n,r,i;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(r=null!=(i=t.options.enableColumnPinning)?i:t.options.enablePinning)||r)}),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(e=>null==r?void 0:r.includes(e)),s=n.some(e=>null==i?void 0:i.includes(e));return o?"left":!!s&&"right"},e.getPinnedIndex=()=>{var n,r;let i=e.getIsPinned();return i?null!=(n=null==(r=t.getState().columnPinning)||null==(r=r[i])?void 0:r.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=h6(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.column.id))},h8(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=h6(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"})),h8(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=h6(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"})),h8(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?dg():null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:dg())},e.getIsSomeColumnsPinned=t=>{var n,r,i;let o=e.getState().columnPinning;return t?!!(null==(n=o[t])?void 0:n.length):!!((null==(r=o.left)?void 0:r.length)||(null==(i=o.right)?void 0:i.length))},e.getLeftLeafColumns=h6(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),h8(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=h6(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),h8(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=h6(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.id))},h8(e.options,"debugColumns","getCenterLeafColumns"))}},{createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},{getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:h4("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"string"==typeof r?dd.includesString:"number"==typeof r?dd.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?dd.equals:Array.isArray(r)?dd.arrIncludes:dd.weakEquals},e.getFilterFn=()=>{var n,r;return h3(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(r=t.options.filterFns)?void 0:r[e.columnDef.filterFn])?n:dd[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(r=t.options.enableColumnFilters)||r)&&(null==(i=t.options.enableFilters)||i)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find(t=>t.id===e.id))?void 0:n.value},e.getFilterIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().columnFilters)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.setFilterValue=n=>{t.setColumnFilters(t=>{var r,i;let o=e.getFilterFn(),s=null==t?void 0:t.find(t=>t.id===e.id),a=h5(n,s?s.value:void 0);if(dp(o,a,e))return null!=(r=null==t?void 0:t.filter(t=>t.id!==e.id))?r:[];let l={id:e.id,value:a};return s?null!=(i=null==t?void 0:t.map(t=>t.id===e.id?l:t))?i:[]:null!=t&&t.length?[...t,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(e=>{var r;return null==(r=h5(t,e))?void 0:r.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&dp(t.getFilterFn(),e.value,t))&&!0})})},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel)?e.getPreFilteredRowModel():e._getFilteredRowModel()}},{createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},{getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:h4("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;let r=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof r||"number"==typeof r}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,o;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(r=t.options.enableGlobalFilter)||r)&&(null==(i=t.options.enableFilters)||i)&&(null==(o=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||o)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>dd.includesString,e.getGlobalFilterFn=()=>{var t,n;let{globalFilterFn:r}=e.options;return h3(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:dd[r]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:h4("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return dI.datetime;if("string"==typeof n&&(r=!0,n.split(dD).length>1))return dI.alphanumeric}return r?dI.text:dI.basic},e.getAutoSortDir=()=>{let n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw Error();return h3(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(r=t.options.sortingFns)?void 0:r[e.columnDef.sortingFn])?n:dI[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),o=null!=n;t.setSorting(s=>{let a,l=null==s?void 0:s.find(t=>t.id===e.id),u=null==s?void 0:s.findIndex(t=>t.id===e.id),c=[],h=o?n:"desc"===i;if("toggle"!=(a=null!=s&&s.length&&e.getCanMultiSort()&&r?l?"toggle":"add":null!=s&&s.length&&u!==s.length-1?"replace":l?"toggle":"replace")||o||i||(a="remove"),"add"===a){var d;(c=[...s,{id:e.id,desc:h}]).splice(0,c.length-(null!=(d=t.options.maxMultiSortColCount)?d:Number.MAX_SAFE_INTEGER))}else c="toggle"===a?s.map(t=>t.id===e.id?{...t,desc:h}:t):"remove"===a?s.filter(t=>t.id!==e.id):[{id:e.id,desc:h}];return c})},e.getFirstSortDir=()=>{var n,r;return(null!=(n=null!=(r=e.columnDef.sortDescFirst)?r:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;let o=e.getFirstSortDir(),s=e.getIsSorted();return s?(s===o||null!=(r=t.options.enableSortingRemoval)&&!r||!!n&&null!=(i=t.options.enableMultiRemove)&&!i)&&("desc"===s?"asc":"desc"):o},e.getCanSort=()=>{var n,r;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(r=t.options.enableSorting)||r)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return null!=(n=null!=(r=e.columnDef.enableMultiSort)?r:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;let r=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!r&&(r.desc?"desc":"asc")},e.getSortIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().sorting)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.clearSorting=()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(null==r.persist||r.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(r))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel)?e.getPreSortedRowModel():e._getSortedRowModel()}},{getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:h4("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},e.getCanGroup=()=>{var n,r;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(r=t.options.enableGrouping)||r)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"number"==typeof r?dm.sum:"[object Date]"===Object.prototype.toString.call(r)?dm.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw Error();return h3(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(r=t.options.aggregationFns)?void 0:r[e.columnDef.aggregationFn])?n:dm[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel)?e.getPreGroupedRowModel():e._getGroupedRowModel()},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return null!=r&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!(null!=(t=n.subRows)&&t.length)}}},{getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:h4("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(i=e.options.autoResetAll)?i:e.options.autoResetExpanded)?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,r;e.setExpanded(t?{}:null!=(n=null==(r=e.initialState)?void 0:r.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return"boolean"==typeof t?!0===t:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(".");t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel)?e.getPreExpandedRowModel():e._getExpandedRowModel()},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;let o=!0===r||!!(null!=r&&r[e.id]),s={};if(!0===r?Object.keys(t.getRowModel().rowsById).forEach(e=>{s[e]=!0}):s=r,n=null!=(i=n)?i:!o,!o&&n)return{...s,[e.id]:!0};if(o&&!n){let{[e.id]:t,...n}=s;return n}return r})},e.getIsExpanded=()=>{var n;let r=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===r||(null==r?void 0:r[e.id]))},e.getCanExpand=()=>{var n,r,i;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(r=t.options.enableExpanding)||r)&&!!(null!=(i=e.subRows)&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)n=(r=t.getRow(r.parentId,!0)).getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},{getInitialState:e=>({...e,pagination:{...dS(),...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:h4("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(i=e.options.autoResetAll)?i:e.options.autoResetPageIndex)?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(e=>h5(t,e)),e.resetPagination=t=>{var n;e.setPagination(t?dS():null!=(n=e.initialState.pagination)?n:dS())},e.setPageIndex=t=>{e.setPagination(n=>{let r=h5(t,n.pageIndex);return r=Math.max(0,Math.min(r,void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n,r;e.setPageIndex(t?0:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageIndex)?n:0)},e.resetPageSize=t=>{var n,r;e.setPageSize(t?10:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,h5(t,e.pageSize)),r=Math.floor(e.pageSize*e.pageIndex/n);return{...e,pageIndex:r,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{var r;let i=h5(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...n,pageCount:i}}),e.getPageOptions=h6(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},h8(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return -1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel)?e.getPrePaginationRowModel():e._getPaginationRowModel(),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},{getInitialState:e=>({rowPinning:dC(),...e}),getDefaultOptions:e=>({onRowPinningChange:h4("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let o=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],e.id,...o]);t.setRowPinning(e=>{var t,r,i,o,a,l;return"bottom"===n?{top:(null!=(i=null==e?void 0:e.top)?i:[]).filter(e=>!(null!=s&&s.has(e))),bottom:[...(null!=(o=null==e?void 0:e.bottom)?o:[]).filter(e=>!(null!=s&&s.has(e))),...Array.from(s)]}:"top"===n?{top:[...(null!=(a=null==e?void 0:e.top)?a:[]).filter(e=>!(null!=s&&s.has(e))),...Array.from(s)],bottom:(null!=(l=null==e?void 0:e.bottom)?l:[]).filter(e=>!(null!=s&&s.has(e)))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter(e=>!(null!=s&&s.has(e))),bottom:(null!=(r=null==e?void 0:e.bottom)?r:[]).filter(e=>!(null!=s&&s.has(e)))}})},e.getCanPin=()=>{var n;let{enableRowPinning:r,enablePinning:i}=t.options;return"function"==typeof r?r(e):null==(n=null!=r?r:i)||n},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,o=n.some(e=>null==r?void 0:r.includes(e)),s=n.some(e=>null==i?void 0:i.includes(e));return o?"top":!!s&&"bottom"},e.getPinnedIndex=()=>{var n,r;let i=e.getIsPinned();if(!i)return -1;let o=null==(n="top"===i?t.getTopRows():t.getBottomRows())?void 0:n.map(e=>{let{id:t}=e;return t});return null!=(r=null==o?void 0:o.indexOf(e.id))?r:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?dC():null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:dC())},e.getIsSomeRowsPinned=t=>{var n,r,i;let o=e.getState().rowPinning;return t?!!(null==(n=o[t])?void 0:n.length):!!((null==(r=o.top)?void 0:r.length)||(null==(i=o.bottom)?void 0:i.length))},e._getPinnedRows=(t,n,r)=>{var i;return(null==(i=e.options.keepPinnedRows)||i?(null!=n?n:[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(null!=n?n:[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r}))},e.getTopRows=h6(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),h8(e.options,"debugRows","getTopRows")),e.getBottomRows=h6(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),h8(e.options,"debugRows","getBottomRows")),e.getCenterRows=h6(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter(e=>!r.has(e.id))},h8(e.options,"debugRows","getCenterRows"))}},{getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:h4("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=void 0!==t?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(t=>{dA(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=h6(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?dk(e,n):{rows:[],flatRows:[],rowsById:{}},h8(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=h6(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?dk(e,n):{rows:[],flatRows:[],rowsById:{}},h8(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=h6(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?dk(e,n):{rows:[],flatRows:[],rowsById:{}},h8(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;let n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(o=>{var s;if(n=void 0!==n?n:!i,e.getCanSelect()&&i===n)return o;let a={...o};return dA(a,e.id,n,null==(s=null==r?void 0:r.selectChildren)||s,t),a})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return dM(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return"some"===dT(e,n)},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return"all"===dT(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected(null==(r=n.target)?void 0:r.checked)}}}},{getDefaultColumnDef:()=>dv,getInitialState:e=>({columnSizing:{},columnSizingInfo:dy(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:h4("columnSizing",e),onColumnSizingInfoChange:h4("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;let o=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:dv.minSize,null!=(r=null!=o?o:e.columnDef.size)?r:dv.size),null!=(i=e.columnDef.maxSize)?i:dv.maxSize)},e.getStart=h6(e=>[e,dw(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),h8(t.options,"debugColumns","getStart")),e.getAfter=h6(e=>[e,dw(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),h8(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var n,r;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(r=t.options.enableColumnResizing)||r)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{if(e.subHeaders.length)e.subHeaders.forEach(n);else{var r;t+=null!=(r=e.column.getSize())?r:0}};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=null==r?void 0:r.getCanResize();return o=>{if(!r||!i||(null==o.persist||o.persist(),dx(o)&&o.touches&&o.touches.length>1))return;let s=e.getSize(),a=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],l=dx(o)?Math.round(o.touches[0].clientX):o.clientX,u={},c=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var r,i;let o="rtl"===t.options.columnResizeDirection?-1:1,s=(n-(null!=(r=null==e?void 0:e.startOffset)?r:0))*o,a=Math.max(s/(null!=(i=null==e?void 0:e.startSize)?i:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;u[t]=Math.round(100*Math.max(n+n*a,0))/100}),{...e,deltaOffset:s,deltaPercentage:a}}),("onChange"===t.options.columnResizeMode||"end"===e)&&t.setColumnSizing(e=>({...e,...u})))},h=e=>{c("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},d=n||("u">typeof document?document:null),f={moveHandler:e=>c("move",e.clientX),upHandler:e=>{null==d||d.removeEventListener("mousemove",f.moveHandler),null==d||d.removeEventListener("mouseup",f.upHandler),h(e.clientX)}},p={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),c("move",e.touches[0].clientX),!1),upHandler:e=>{var t;null==d||d.removeEventListener("touchmove",p.moveHandler),null==d||d.removeEventListener("touchend",p.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),h(null==(t=e.touches[0])?void 0:t.clientX)}},m=!!function(){if("boolean"==typeof db)return db;let e=!1;try{let t=()=>{};window.addEventListener("test",t,{get passive(){return e=!0,!1}}),window.removeEventListener("test",t)}catch(t){e=!1}return db=e}()&&{passive:!1};dx(o)?(null==d||d.addEventListener("touchmove",p.moveHandler,m),null==d||d.addEventListener("touchend",p.upHandler,m)):(null==d||d.addEventListener("mousemove",f.moveHandler,m),null==d||d.addEventListener("mouseup",f.upHandler,m)),t.setColumnSizingInfo(e=>({...e,startOffset:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?dy():null!=(n=e.initialState.columnSizingInfo)?n:dy())},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}}}];function dN(e){let t=[],n=e=>{var r;t.push(e),null!=(r=e.subRows)&&r.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}let dL={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ù:"u",ú:"u",û:"u",ü:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z"},dj=RegExp(Object.keys(dL).join("|"),"g"),dF={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function dB(e,t,n){let r;return(e=d_(e,n),(t=d_(t,n)).length>e.length)?dF.NO_MATCH:e===t?dF.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase())===(t=t.toLowerCase())?dF.EQUAL:e.startsWith(t)?dF.STARTS_WITH:e.includes(` ${t}`)?dF.WORD_STARTS_WITH:e.includes(t)?dF.CONTAINS:1===t.length?dF.NO_MATCH:(r="",e.split(" ").forEach(e=>{e.split("-").forEach(e=>{r+=e.substr(0,1)})}),r).includes(t)?dF.ACRONYM:function(e,t){var n;let r,i=0,o=0;function s(e,t,n){for(let r=n,o=t.length;r<o;r++)if(t[r]===e)return i+=1,r+1;return -1}let a=s(t[0],e,0);if(a<0)return dF.NO_MATCH;o=a;for(let n=1,r=t.length;n<r;n++)if(!((o=s(t[n],e,o))>-1))return dF.NO_MATCH;return n=o-a,r=i/t.length,dF.MATCHES+1/n*r}(e,t)}function d_(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(dj,e=>dL[e])),e}let dz={maxRanking:1/0,minRanking:-1/0};function dV(e,t,{isHeader:n,isLastColumn:r,isFirstColumn:i,defaultColumnHeight:o}={}){var s,a;let l=e.spacing(1),u=e.spacing(1.25),c=e.spacing(2),h=i?c:u,d=r?c:u,f=e.typography.body1.lineHeight,p=e.typography.body1.fontSize;"compact"===t&&(l=e.spacing(.5),u=e.spacing(.5),c=e.spacing(1),h=i?c:u,d=r?c:u,f=e.typography.body2.lineHeight,p=e.typography.body2.fontSize),"comfortable"===t&&(l=e.spacing(2),u=e.spacing(1.5),c=e.spacing(2),h=i?c:u,d=r?c:u,f=e.typography.body1.lineHeight,p=e.typography.body1.fontSize);let m=n||!o||"auto"===o?(s=f,a=l,("string"==typeof s?parseInt(s,10):s??0)+2*("string"==typeof a?parseInt(a,10):a)):o;return{padding:`${l} ${d} ${l} ${h}`,height:m,fontSize:p,lineHeight:f}}function dH(e,t){return e.map(({width:e,align:n,headerDescription:r,cellDescription:i,enableSorting:o,dataLink:s,enableResizing:a,...l})=>{var u,c,h,d,f,p,m;let g=a??t?.enableResizing??!1,v="auto"===e||void 0===e?(u=g,c=t?.minWidth,h=t?.maxWidth,u?{size:150,minSize:c??60,maxSize:h??1e3}:{size:0,minSize:0,maxSize:0}):(d=g,f=e,p=t?.minWidth,m=t?.maxWidth,d?{size:f,minSize:p??60,maxSize:m??1e3}:{size:f});return{...l,...v,enableSorting:!!o,enableResizing:g,meta:{align:n,headerDescription:r,cellDescription:i,dataLink:s}}})}var d$=n(32560),dW=n(22402);let dU=(0,dW.A)((0,x.jsx)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),dq=(0,dW.A)((0,x.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),dG=(0,dW.A)((0,x.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function dY(e){return(0,P.Ay)("MuiCheckbox",e)}let dK=(0,I.A)("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]);var dZ=n(64606),dX=n(73397);let dQ=(0,D.A)(d$.A,{shouldForwardProp:e=>(0,lN.A)(e)||"classes"===e,name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${(0,T.A)(n.size)}`],"default"!==n.color&&t[`color${(0,T.A)(n.color)}`]]}})((0,E.A)(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,k.X4)(e.palette.action.active,e.palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter((0,O.A)()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,k.X4)(e.palette[t].main,e.palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter((0,O.A)()).map(([t])=>({props:{color:t},style:{[`&.${dK.checked}, &.${dK.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${dK.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),dJ=(0,x.jsx)(dq,{}),d0=(0,x.jsx)(dU,{}),d1=(0,x.jsx)(dG,{}),d2=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiCheckbox"}),{checkedIcon:r=dJ,color:i="primary",icon:o=d0,indeterminate:s=!1,indeterminateIcon:a=d1,inputProps:l,size:u="medium",disableRipple:c=!1,className:h,slots:d={},slotProps:f={},...p}=n,m=s?a:o,g=s?a:r,v={...n,disableRipple:c,color:i,indeterminate:s,size:u},y=(e=>{let{classes:t,indeterminate:n,color:r,size:i}=e,o={root:["root",n&&"indeterminate",`color${(0,T.A)(r)}`,`size${(0,T.A)(i)}`]},s=(0,A.A)(o,dY,t);return{...t,...s}})(v),b=f.input??l,[S,k]=(0,dX.A)("root",{ref:t,elementType:dQ,className:(0,C.A)(y.root,h),shouldForwardComponentProp:!0,externalForwardedProps:{slots:d,slotProps:f,...p},ownerState:v,additionalProps:{type:"checkbox",icon:w.cloneElement(m,{fontSize:m.props.fontSize??u}),checkedIcon:w.cloneElement(g,{fontSize:g.props.fontSize??u}),disableRipple:c,slots:d,slotProps:{input:(0,dZ.A)("function"==typeof b?b(v):b,{"data-indeterminate":s})}}});return(0,x.jsx)(S,{...k,classes:y})});function d5({color:e,density:t,...n}){let r="compact"===t;return(0,x.jsx)(d2,{size:r?"small":"medium",...n,focusRipple:!1,tabIndex:-1,sx:{color:e,padding:e=>e.spacing(r?.25:.5),position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)","&.Mui-checked":{color:e},"&.Mui-focusVisible":{background:e?(0,k.X4)(e,.5):void 0},"& .MuiSvgIcon-root":{fontSize:r?16:18}}})}var d4=n(3399),d3=n(76746),d6=n(97653),d8=n(76795),d9=n(45271);function d7(e){return(0,P.Ay)("MuiToolbar",e)}(0,I.A)("MuiToolbar",["root","gutters","regular","dense"]);let fe=(0,D.A)("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})((0,E.A)(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:e.mixins.toolbar}]}))),ft=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiToolbar"}),{className:r,component:i="div",disableGutters:o=!1,variant:s="regular",...a}=n,l={...n,component:i,disableGutters:o,variant:s},u=(e=>{let{classes:t,disableGutters:n,variant:r}=e;return(0,A.A)({root:["root",!n&&"gutters",r]},d7,t)})(l);return(0,x.jsx)(fe,{as:i,className:(0,C.A)(u.root,r),ref:t,ownerState:l,...a})});var fn=n(35216),fr=n(96913),fi=n(70776);let fo=(0,dW.A)((0,x.jsx)("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"}),"LastPage"),fs=(0,dW.A)((0,x.jsx)("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"}),"FirstPage"),fa=w.forwardRef(function(e,t){let{backIconButtonProps:n,count:r,disabled:i=!1,getItemAriaLabel:o,nextIconButtonProps:s,onPageChange:a,page:l,rowsPerPage:u,showFirstButton:c,showLastButton:h,slots:d={},slotProps:f={},...p}=e,m=(0,fn.I)(),g=d.firstButton??$.A,v=d.lastButton??$.A,y=d.nextButton??$.A,b=d.previousButton??$.A,w=d.firstButtonIcon??fs,S=d.lastButtonIcon??fo,C=d.nextButtonIcon??fi.A,A=d.previousButtonIcon??fr.A,k=m?v:g,M=m?y:b,T=m?b:y,D=m?g:v,E=m?f.lastButton:f.firstButton,O=m?f.nextButton:f.previousButton,R=m?f.previousButton:f.nextButton,I=m?f.firstButton:f.lastButton;return(0,x.jsxs)("div",{ref:t,...p,children:[c&&(0,x.jsx)(k,{onClick:e=>{a(e,0)},disabled:i||0===l,"aria-label":o("first",l),title:o("first",l),...E,children:m?(0,x.jsx)(S,{...f.lastButtonIcon}):(0,x.jsx)(w,{...f.firstButtonIcon})}),(0,x.jsx)(M,{onClick:e=>{a(e,l-1)},disabled:i||0===l,color:"inherit","aria-label":o("previous",l),title:o("previous",l),...O??n,children:m?(0,x.jsx)(C,{...f.nextButtonIcon}):(0,x.jsx)(A,{...f.previousButtonIcon})}),(0,x.jsx)(T,{onClick:e=>{a(e,l+1)},disabled:i||-1!==r&&l>=Math.ceil(r/u)-1,color:"inherit","aria-label":o("next",l),title:o("next",l),...R??s,children:m?(0,x.jsx)(A,{...f.previousButtonIcon}):(0,x.jsx)(C,{...f.nextButtonIcon})}),h&&(0,x.jsx)(D,{onClick:e=>{a(e,Math.max(0,Math.ceil(r/u)-1))},disabled:i||l>=Math.ceil(r/u)-1,"aria-label":o("last",l),title:o("last",l),...I,children:m?(0,x.jsx)(w,{...f.firstButtonIcon}):(0,x.jsx)(S,{...f.lastButtonIcon})})]})});var fl=n(63392);function fu(e){return(0,P.Ay)("MuiTablePagination",e)}let fc=(0,I.A)("MuiTablePagination",["root","toolbar","spacer","selectLabel","selectRoot","select","selectIcon","input","menuItem","displayedRows","actions"]),fh=(0,D.A)(d9.A,{name:"MuiTablePagination",slot:"Root",overridesResolver:(e,t)=>t.root})((0,E.A)(({theme:e})=>({overflow:"auto",color:(e.vars||e).palette.text.primary,fontSize:e.typography.pxToRem(14),"&:last-child":{padding:0}}))),fd=(0,D.A)(ft,{name:"MuiTablePagination",slot:"Toolbar",overridesResolver:(e,t)=>({[`& .${fc.actions}`]:t.actions,...t.toolbar})})((0,E.A)(({theme:e})=>({minHeight:52,paddingRight:2,[`${e.breakpoints.up("xs")} and (orientation: landscape)`]:{minHeight:52},[e.breakpoints.up("sm")]:{minHeight:52,paddingRight:2},[`& .${fc.actions}`]:{flexShrink:0,marginLeft:20}}))),ff=(0,D.A)("div",{name:"MuiTablePagination",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})({flex:"1 1 100%"}),fp=(0,D.A)("p",{name:"MuiTablePagination",slot:"SelectLabel",overridesResolver:(e,t)=>t.selectLabel})((0,E.A)(({theme:e})=>({...e.typography.body2,flexShrink:0}))),fm=(0,D.A)(d8.A,{name:"MuiTablePagination",slot:"Select",overridesResolver:(e,t)=>({[`& .${fc.selectIcon}`]:t.selectIcon,[`& .${fc.select}`]:t.select,...t.input,...t.selectRoot})})({color:"inherit",fontSize:"inherit",flexShrink:0,marginRight:32,marginLeft:8,[`& .${fc.select}`]:{paddingLeft:8,paddingRight:24,textAlign:"right",textAlignLast:"right"}}),fg=(0,D.A)(d6.A,{name:"MuiTablePagination",slot:"MenuItem",overridesResolver:(e,t)=>t.menuItem})({}),fv=(0,D.A)("p",{name:"MuiTablePagination",slot:"DisplayedRows",overridesResolver:(e,t)=>t.displayedRows})((0,E.A)(({theme:e})=>({...e.typography.body2,flexShrink:0})));function fy({from:e,to:t,count:n}){return`${e}–${t} of ${-1!==n?n:`more than ${t}`}`}function fb(e){return`Go to ${e} page`}let fx=w.forwardRef(function(e,t){let n,r=(0,R.b)({props:e,name:"MuiTablePagination"}),{ActionsComponent:i=fa,backIconButtonProps:o,colSpan:s,component:a=d9.A,count:l,disabled:u=!1,getItemAriaLabel:c=fb,labelDisplayedRows:h=fy,labelRowsPerPage:d="Rows per page:",nextIconButtonProps:f,onPageChange:p,onRowsPerPageChange:m,page:g,rowsPerPage:y,rowsPerPageOptions:b=[10,25,50,100],SelectProps:S={},showFirstButton:k=!1,showLastButton:M=!1,slotProps:T={},slots:D={},...E}=r,O=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],toolbar:["toolbar"],spacer:["spacer"],selectLabel:["selectLabel"],select:["select"],input:["input"],selectIcon:["selectIcon"],menuItem:["menuItem"],displayedRows:["displayedRows"],actions:["actions"]},fu,t)})(r),I=T?.select??S,P=I.native?"option":fg;(a===d9.A||"td"===a)&&(n=s||1e3);let N=(0,fl.A)(I.id),L=(0,fl.A)(I.labelId),j={slots:D,slotProps:T},[F,B]=(0,dX.A)("root",{ref:t,className:O.root,elementType:fh,externalForwardedProps:{...j,component:a,...E},ownerState:r,additionalProps:{colSpan:n}}),[_,z]=(0,dX.A)("toolbar",{className:O.toolbar,elementType:fd,externalForwardedProps:j,ownerState:r}),[V,H]=(0,dX.A)("spacer",{className:O.spacer,elementType:ff,externalForwardedProps:j,ownerState:r}),[$,W]=(0,dX.A)("selectLabel",{className:O.selectLabel,elementType:fp,externalForwardedProps:j,ownerState:r,additionalProps:{id:L}}),[U,q]=(0,dX.A)("select",{className:O.select,elementType:fm,externalForwardedProps:j,ownerState:r}),[G,Y]=(0,dX.A)("menuItem",{className:O.menuItem,elementType:P,externalForwardedProps:j,ownerState:r}),[K,Z]=(0,dX.A)("displayedRows",{className:O.displayedRows,elementType:fv,externalForwardedProps:j,ownerState:r});return(0,x.jsx)(F,{...B,children:(0,x.jsxs)(_,{...z,children:[(0,x.jsx)(V,{...H}),b.length>1&&(0,x.jsx)($,{...W,children:d}),b.length>1&&(0,x.jsx)(U,{variant:"standard",...!I.variant&&{input:v||(v=(0,x.jsx)(d3.Ay,{}))},value:y,onChange:m,id:N,labelId:L,...I,classes:{...I.classes,root:(0,C.A)(O.input,O.selectRoot,(I.classes||{}).root),select:(0,C.A)(O.select,(I.classes||{}).select),icon:(0,C.A)(O.selectIcon,(I.classes||{}).icon)},disabled:u,...q,children:b.map(e=>(0,w.createElement)(G,{...Y,key:e.label?e.label:e,value:e.value?e.value:e},e.label?e.label:e))}),(0,x.jsx)(K,{...Z,children:h({from:0===l?0:g*y+1,to:-1===l?(g+1)*y:-1===y?l:Math.min(l,(g+1)*y),count:-1===l?-1:l,page:g})}),(0,x.jsx)(i,{className:O.actions,backIconButtonProps:o,count:l,nextIconButtonProps:f,onPageChange:p,page:g,rowsPerPage:y,showFirstButton:k,showLastButton:M,slotProps:T.actions,slots:D.actions,getItemAriaLabel:c,disabled:u})]})})}),fw={row:0,column:0},fS=new Set(["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"]);var fC=n(91394);let fA=(0,D.A)(fC.A)(({theme:e})=>({tableLayout:"fixed",borderCollapse:"separate",backgroundColor:e.palette.background.default})),fk={compact:"small",standard:"medium",comfortable:"medium"},fM=(0,w.forwardRef)(function({density:e,...t},n){return(0,x.jsx)(fA,{...t,tabIndex:-1,size:fk[e],ref:n,sx:{width:"100%"}})});var fT=n(5139);let fD=(0,w.forwardRef)(function(e,t){return(0,x.jsx)(fT.A,{...e,ref:t})});var fE=n(93399),fO=n(88091);function fR(e){return(0,P.Ay)("MuiLink",e)}let fI=(0,I.A)("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]);var fP=n(95279);let fN={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},fL=(0,D.A)(fO.A,{name:"MuiLink",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`underline${(0,T.A)(n.underline)}`],"button"===n.component&&t.button]}})((0,E.A)(({theme:e})=>({variants:[{props:{underline:"none"},style:{textDecoration:"none"}},{props:{underline:"hover"},style:{textDecoration:"none","&:hover":{textDecoration:"underline"}}},{props:{underline:"always"},style:{textDecoration:"underline","&:hover":{textDecorationColor:"inherit"}}},{props:({underline:e,ownerState:t})=>"always"===e&&"inherit"!==t.color,style:{textDecorationColor:"var(--Link-underlineColor)"}},...Object.entries(e.palette).filter((0,O.A)()).map(([t])=>({props:{underline:"always",color:t},style:{"--Link-underlineColor":e.vars?`rgba(${e.vars.palette[t].mainChannel} / 0.4)`:(0,k.X4)(e.palette[t].main,.4)}})),{props:{underline:"always",color:"textPrimary"},style:{"--Link-underlineColor":e.vars?`rgba(${e.vars.palette.text.primaryChannel} / 0.4)`:(0,k.X4)(e.palette.text.primary,.4)}},{props:{underline:"always",color:"textSecondary"},style:{"--Link-underlineColor":e.vars?`rgba(${e.vars.palette.text.secondaryChannel} / 0.4)`:(0,k.X4)(e.palette.text.secondary,.4)}},{props:{underline:"always",color:"textDisabled"},style:{"--Link-underlineColor":(e.vars||e).palette.text.disabled}},{props:{component:"button"},style:{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},[`&.${fI.focusVisible}`]:{outline:"auto"}}}]}))),fj=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiLink"}),r=(0,lO.A)(),{className:i,color:o="primary",component:s="a",onBlur:a,onFocus:l,TypographyClasses:u,underline:c="always",variant:h="inherit",sx:d,...f}=n,[p,m]=w.useState(!1),g={...n,color:o,component:s,focusVisible:p,underline:c,variant:h},v=(e=>{let{classes:t,component:n,focusVisible:r,underline:i}=e,o={root:["root",`underline${(0,T.A)(i)}`,"button"===n&&"button",r&&"focusVisible"]};return(0,A.A)(o,fR,t)})(g);return(0,x.jsx)(fL,{color:o,className:(0,C.A)(v.root,i),classes:u,component:s,onBlur:e=>{(0,fE.A)(e.target)||m(!1),a&&a(e)},onFocus:e=>{(0,fE.A)(e.target)&&m(!0),l&&l(e)},ref:t,ownerState:g,variant:h,...f,sx:[...void 0===fN[o]?[{color:o}]:[],...Array.isArray(d)?d:[d]],style:{...f.style,..."always"===c&&"inherit"!==o&&!fN[o]&&{"--Link-underlineColor":(({theme:e,ownerState:t})=>{let n=t.color,r=(0,fP.Yn)(e,`palette.${n}.main`,!1)||(0,fP.Yn)(e,`palette.${n}`,!1)||t.color,i=(0,fP.Yn)(e,`palette.${n}.mainChannel`)||(0,fP.Yn)(e,`palette.${n}Channel`);return"vars"in e&&i?`rgba(${i} / 0.4)`:(0,k.X4)(r,.4)})({theme:r,ownerState:g})}}})}),fF=(0,D.A)(d9.A)(({theme:e})=>({padding:0,backgroundColor:"inherit","&.MuiTableCell-head":{backgroundColor:e.palette.background.default},"&:focus-visible":{outline:`solid 1px ${e.palette.primary.main}`,outlineOffset:"-1px",borderRadius:0}}));function fB({children:e,density:t,variant:n,width:r,defaultColumnHeight:i,focusState:o="none",onFocusTrigger:s,isFirstColumn:a,isLastColumn:l,description:u,align:c,color:h,backgroundColor:d,dataLink:f,adjacentCellsValuesMap:p,...m}){let g=(0,lO.A)(),v=(0,w.useRef)(),y="head"===n;(0,w.useEffect)(()=>{"trigger-focus"===o&&v.current&&v.current.focus()},[o]);let b=e=>{s?.(e)},S=(0,w.useMemo)(()=>{if(f){if(p&&r7(f.url)){let{text:e}=r3(f.url,p,{urlEncode:!0});return{...f,url:e}}return f}},[f,p]);return(0,x.jsx)(fF,{...m,tabIndex:"none"!==o?0:-1,onFocus:e=>{let t=e.currentTarget?.querySelector('a[href], button, input, textarea, select, details,[role="button"]');t&&t.focus()},onClick:b,onKeyUp:b,style:{width:r},sx:{position:"relative",borderBottom:y?`solid 1px ${g.palette.grey[100]}`:`solid 1px ${g.palette.grey[50]}`,"&:hover #original-cell":{position:"absolute",top:0,left:0,zIndex:10,width:"fit-content",minWidth:"100%",whiteSpace:"nowrap",overflow:"visible",backgroundColor:`${d??g.palette.background.default} !important`,outline:`solid 1px ${g.palette.info.main}`,outlineOffset:"-1px"}},ref:v,children:(0,x.jsx)(lR.A,{id:"original-cell",sx:{...dV(g,t,{isHeader:y,isLastColumn:l,isFirstColumn:a,defaultColumnHeight:i}),position:"relative",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexDirection:"inherit"},style:{backgroundColor:d??"inherit",color:h??"inherit"},title:u,"aria-label":u,textAlign:c,children:S?(0,x.jsx)(fj,{href:S.url,target:S.targetBlank?"_blank":"_self",rel:S.targetBlank?"noopener noreferrer":void 0,children:e}):e})})}var f_=n(91644);function fz(e){return(0,P.Ay)("MuiTableFooter",e)}(0,I.A)("MuiTableFooter",["root"]);let fV=(0,D.A)("tfoot",{name:"MuiTableFooter",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"table-footer-group"}),fH={variant:"footer"},f$="tfoot",fW=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiTableFooter"}),{className:r,component:i=f$,...o}=n,s={...n,component:i},a=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"]},fz,t)})(s);return(0,x.jsx)(f_.A.Provider,{value:fH,children:(0,x.jsx)(fV,{as:i,className:(0,C.A)(a.root,r),ref:t,role:i===f$?null:"rowgroup",ownerState:s,...o})})}),fU=(0,w.forwardRef)(function(e,t){return(0,x.jsx)(fW,{...e,ref:t})});var fq=n(70561);let fG=(0,w.forwardRef)(function(e,t){return(0,x.jsx)(fq.A,{...e,ref:t})}),fY=(0,dW.A)((0,x.jsx)("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function fK(e){return(0,P.Ay)("MuiTableSortLabel",e)}let fZ=(0,I.A)("MuiTableSortLabel",["root","active","icon","iconDirectionDesc","iconDirectionAsc","directionDesc","directionAsc"]),fX=(0,D.A)(lL.A,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.active&&t.active]}})((0,E.A)(({theme:e})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(e.vars||e).palette.text.secondary},"&:hover":{color:(e.vars||e).palette.text.secondary,[`& .${fZ.icon}`]:{opacity:.5}},[`&.${fZ.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${fZ.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),fQ=(0,D.A)("span",{name:"MuiTableSortLabel",slot:"Icon",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,t[`iconDirection${(0,T.A)(n.direction)}`]]}})((0,E.A)(({theme:e})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:e.transitions.create(["opacity","transform"],{duration:e.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),fJ=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiTableSortLabel"}),{active:r=!1,children:i,className:o,direction:s="asc",hideSortIcon:a=!1,IconComponent:l=fY,slots:u={},slotProps:c={},...h}=n,d={...n,active:r,direction:s,hideSortIcon:a,IconComponent:l},f=(e=>{let{classes:t,direction:n,active:r}=e,i={root:["root",r&&"active",`direction${(0,T.A)(n)}`],icon:["icon",`iconDirection${(0,T.A)(n)}`]};return(0,A.A)(i,fK,t)})(d),p={slots:u,slotProps:c},[m,g]=(0,dX.A)("root",{elementType:fX,externalForwardedProps:p,ownerState:d,className:(0,C.A)(f.root,o),ref:t}),[v,y]=(0,dX.A)("icon",{elementType:fQ,externalForwardedProps:p,ownerState:d,className:f.icon});return(0,x.jsxs)(m,{disableRipple:!0,component:"span",...g,...h,children:[i,a&&!r?null:(0,x.jsx)(v,{as:l,...y})]})});var f0=n(6227);function f1({onSort:e,sortDirection:t,nextSortDirection:n,children:r,resizeConfig:i,...o}){let s=!!e,a=(0,x.jsx)(fO.A,{noWrap:!0,variant:"inherit",component:"div",color:"inherit",children:r}),l=!!t;return(0,x.jsxs)(fB,{...o,children:[s?(0,x.jsx)(fJ,{onClick:e,direction:l?t:n,active:l,sx:{verticalAlign:"unset",maxWidth:"100%","&:focus-visible":{[`& .${fZ.icon}`]:{opacity:l?1:.5}}},children:a}):a,i&&(0,x.jsx)(lR.A,{onMouseDown:e=>{2===e.detail?i.resetSizeHandler():i.resizeHandler(e)},onTouchStart:i.resizeHandler,sx:{position:"absolute",height:"100%",top:0,right:"4px",cursor:"col-resize"},children:(0,x.jsx)(f0.A,{flexItem:!0,orientation:"vertical",sx:e=>({backgroundColor:i.isResizing?e.palette.action.active:e.palette.divider,borderRadius:"2px",borderWidth:"2px",height:"100%",touchAction:"none",transform:"translateX(4px)",userSelect:"none"})})})]})}let f2=(0,w.forwardRef)(function(e,t){return(0,x.jsx)(d4.A,{...e,ref:t,sx:{backgroundColor:e=>e.palette.background.default,"&:hover":{backgroundColor:e=>(0,k.X4)(e.palette.primary.main,e.palette.action.hoverOpacity)}}})});var f5=n(2582),f4=n(3725),f3=n(30443),f6=n(46823),f8=n(48865),f9=n(32398),f7=n(2203);function pe(e){return(0,P.Ay)("MuiTooltip",e)}let pt=(0,I.A)("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]),pn=(0,D.A)(f8.A,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.popper,!n.disableInteractive&&t.popperInteractive,n.arrow&&t.popperArrow,!n.open&&t.popperClose]}})((0,E.A)(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:e})=>!e.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:e})=>!e,style:{pointerEvents:"none"}},{props:({ownerState:e})=>e.arrow,style:{[`&[data-popper-placement*="bottom"] .${pt.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${pt.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${pt.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${pt.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:e})=>e.arrow&&!e.isRtl,style:{[`&[data-popper-placement*="right"] .${pt.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!!e.isRtl,style:{[`&[data-popper-placement*="right"] .${pt.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!e.isRtl,style:{[`&[data-popper-placement*="left"] .${pt.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!!e.isRtl,style:{[`&[data-popper-placement*="left"] .${pt.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),pr=(0,D.A)("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.tooltip,n.touch&&t.touch,n.arrow&&t.tooltipArrow,t[`tooltipPlacement${(0,T.A)(n.placement.split("-")[0])}`]]}})((0,E.A)(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:(0,k.X4)(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${pt.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${pt.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${pt.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${pt.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:e})=>e.arrow,style:{position:"relative",margin:0}},{props:({ownerState:e})=>e.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${Math.round(16/14*1e5)/1e5}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:e})=>!e.isRtl,style:{[`.${pt.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${pt.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:e})=>!e.isRtl&&e.touch,style:{[`.${pt.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${pt.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:e})=>!!e.isRtl,style:{[`.${pt.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${pt.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:e})=>!!e.isRtl&&e.touch,style:{[`.${pt.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${pt.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:e})=>e.touch,style:{[`.${pt.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:e})=>e.touch,style:{[`.${pt.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),pi=(0,D.A)("span",{name:"MuiTooltip",slot:"Arrow",overridesResolver:(e,t)=>t.arrow})((0,E.A)(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:(0,k.X4)(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}}))),po=!1,ps=new f4.E,pa={x:0,y:0};function pl(e,t){return(n,...r)=>{t&&t(n,...r),e(n,...r)}}let pu=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiTooltip"}),{arrow:r=!1,children:i,classes:o,components:s={},componentsProps:a={},describeChild:l=!1,disableFocusListener:u=!1,disableHoverListener:c=!1,disableInteractive:h=!1,disableTouchListener:d=!1,enterDelay:f=100,enterNextDelay:p=0,enterTouchDelay:m=700,followCursor:g=!1,id:v,leaveDelay:y=0,leaveTouchDelay:b=1500,onClose:S,onOpen:k,open:M,placement:D="bottom",PopperComponent:E,PopperProps:O={},slotProps:I={},slots:P={},title:N,TransitionComponent:L,TransitionProps:j,...F}=n,B=w.isValidElement(i)?i:(0,x.jsx)("span",{children:i}),_=(0,lO.A)(),z=(0,fn.I)(),[V,H]=w.useState(),[$,W]=w.useState(null),U=w.useRef(!1),q=h||g,G=(0,f4.A)(),Y=(0,f4.A)(),K=(0,f4.A)(),Z=(0,f4.A)(),[X,Q]=(0,f7.A)({controlled:M,default:!1,name:"Tooltip",state:"open"}),J=X,ee=(0,fl.A)(v),et=w.useRef(),en=(0,f9.A)(()=>{void 0!==et.current&&(document.body.style.WebkitUserSelect=et.current,et.current=void 0),Z.clear()});w.useEffect(()=>en,[en]);let er=e=>{ps.clear(),po=!0,Q(!0),k&&!J&&k(e)},ei=(0,f9.A)(e=>{ps.start(800+y,()=>{po=!1}),Q(!1),S&&J&&S(e),G.start(_.transitions.duration.shortest,()=>{U.current=!1})}),eo=e=>{U.current&&"touchstart"!==e.type||(V&&V.removeAttribute("title"),Y.clear(),K.clear(),f||po&&p?Y.start(po?p:f,()=>{er(e)}):er(e))},es=e=>{Y.clear(),K.start(y,()=>{ei(e)})},[,ea]=w.useState(!1),el=e=>{(0,fE.A)(e.target)||(ea(!1),es(e))},eu=e=>{V||H(e.currentTarget),(0,fE.A)(e.target)&&(ea(!0),eo(e))},ec=e=>{U.current=!0;let t=B.props;t.onTouchStart&&t.onTouchStart(e)};w.useEffect(()=>{if(J)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){"Escape"===e.key&&ei(e)}},[ei,J]);let eh=(0,lF.A)((0,f3.A)(B),H,t);N||0===N||(J=!1);let ed=w.useRef(),ef={},ep="string"==typeof N;l?(ef.title=J||!ep||c?null:N,ef["aria-describedby"]=J?ee:null):(ef["aria-label"]=ep?N:null,ef["aria-labelledby"]=J&&!ep?ee:null);let em={...ef,...F,...B.props,className:(0,C.A)(F.className,B.props.className),onTouchStart:ec,ref:eh,...g?{onMouseMove:e=>{let t=B.props;t.onMouseMove&&t.onMouseMove(e),pa={x:e.clientX,y:e.clientY},ed.current&&ed.current.update()}}:{}},eg={};d||(em.onTouchStart=e=>{ec(e),K.clear(),G.clear(),en(),et.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",Z.start(m,()=>{document.body.style.WebkitUserSelect=et.current,eo(e)})},em.onTouchEnd=e=>{B.props.onTouchEnd&&B.props.onTouchEnd(e),en(),K.start(b,()=>{ei(e)})}),!c&&(em.onMouseOver=pl(eo,em.onMouseOver),em.onMouseLeave=pl(es,em.onMouseLeave),q||(eg.onMouseOver=eo,eg.onMouseLeave=es)),!u&&(em.onFocus=pl(eu,em.onFocus),em.onBlur=pl(el,em.onBlur),q||(eg.onFocus=eu,eg.onBlur=el));let ev={...n,isRtl:z,arrow:r,disableInteractive:q,placement:D,PopperComponentProp:E,touch:U.current},ey="function"==typeof I.popper?I.popper(ev):I.popper,eb=w.useMemo(()=>{let e=[{name:"arrow",enabled:!!$,options:{element:$,padding:4}}];return O.popperOptions?.modifiers&&(e=e.concat(O.popperOptions.modifiers)),ey?.popperOptions?.modifiers&&(e=e.concat(ey.popperOptions.modifiers)),{...O.popperOptions,...ey?.popperOptions,modifiers:e}},[$,O.popperOptions,ey?.popperOptions]),ex=(e=>{let{classes:t,disableInteractive:n,arrow:r,touch:i,placement:o}=e,s={popper:["popper",!n&&"popperInteractive",r&&"popperArrow"],tooltip:["tooltip",r&&"tooltipArrow",i&&"touch",`tooltipPlacement${(0,T.A)(o.split("-")[0])}`],arrow:["arrow"]};return(0,A.A)(s,pe,t)})(ev),ew="function"==typeof I.transition?I.transition(ev):I.transition,eS={slots:{popper:s.Popper,transition:s.Transition??L,tooltip:s.Tooltip,arrow:s.Arrow,...P},slotProps:{arrow:I.arrow??a.arrow,popper:{...O,...ey??a.popper},tooltip:I.tooltip??a.tooltip,transition:{...j,...ew??a.transition}}},[eC,eA]=(0,dX.A)("popper",{elementType:pn,externalForwardedProps:eS,ownerState:ev,className:(0,C.A)(ex.popper,O?.className)}),[ek,eM]=(0,dX.A)("transition",{elementType:f6.A,externalForwardedProps:eS,ownerState:ev}),[eT,eD]=(0,dX.A)("tooltip",{elementType:pr,className:ex.tooltip,externalForwardedProps:eS,ownerState:ev}),[eE,eO]=(0,dX.A)("arrow",{elementType:pi,className:ex.arrow,externalForwardedProps:eS,ownerState:ev,ref:W});return(0,x.jsxs)(w.Fragment,{children:[w.cloneElement(B,em),(0,x.jsx)(eC,{as:E??f8.A,placement:D,anchorEl:g?{getBoundingClientRect:()=>({top:pa.y,left:pa.x,right:pa.x,bottom:pa.y,width:0,height:0})}:V,popperRef:ed,open:!!V&&J,id:ee,transition:!0,...eg,...eA,popperOptions:eb,children:({TransitionProps:e})=>(0,x.jsx)(ek,{timeout:_.transitions.duration.shorter,...e,...eM,children:(0,x.jsxs)(eT,{...eD,children:[N,r?(0,x.jsx)(eE,{...eO}):null]})})})]})});var pc=n(58597),ph=n(7800),pd=n(98599),pf=n(16979),pp=n(9323),pm=n(12933),pg=n(46177);let pv=(0,w.forwardRef)(function({debounceMs:e=250,value:t,onChange:n,...r},i){let[o,s]=(0,w.useState)(t),a=(0,w.useCallback)(e=>{n?.(e)},[n]),l=(0,w.useMemo)(()=>pg(a,e),[e,a]);return(0,x.jsx)(W.A,{ref:i,value:o,onChange:function(e){s(e.target.value),l(e.target.value)},...r})});function py({isSearchEnabled:e,globalFilter:t,onGlobalFilterChange:n,isColumnFilterEnabled:r,columns:i,width:o,columnFilterMenuMaxHeight:s=400,isExpandAllEnabled:a,isAllExpanded:l,onExpandAllChange:u}){let[c,h]=(0,w.useState)(null),d=!!c,[f,p]=(0,w.useState)(0),m=(0,w.useCallback)(()=>{n(""),p(e=>e+1)},[n]);return e||r||a?(0,x.jsxs)(H.A,{direction:"row",gap:1,alignItems:"center",justifyContent:"flex-end",width:o,padding:"0.5rem",sx:{backgroundColor:e=>e.palette.background.default},children:[e&&(0,x.jsx)(pv,{placeholder:"Search...",value:t,onChange:n,variant:"standard",slotProps:{htmlInput:{"aria-label":"search table"},input:{startAdornment:(0,x.jsx)(f5.A,{position:"start",children:(0,x.jsx)(pd,{fontSize:"small"})}),endAdornment:""!==t&&(0,x.jsx)(f5.A,{position:"end",children:(0,x.jsx)($.A,{onClick:m,children:(0,x.jsx)(ph,{fontSize:"small"})})})}},sx:{flexGrow:1}},f),a&&(0,x.jsx)(pu,{title:l?"Collapse all":"Expand all",children:(0,x.jsx)($.A,{onClick:u,color:"info","aria-label":l?"collapse all rows":"expand all rows",children:l?(0,x.jsx)(pf,{}):(0,x.jsx)(pp,{})})}),r&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)($.A,{onClick:e=>h(e.currentTarget),"aria-haspopup":"listbox","aria-expanded":d,color:"info",children:(0,x.jsx)(pm,{})}),(0,x.jsx)(pc.A,{anchorEl:c,open:d,onClose:()=>h(null),slotProps:{list:{dense:!0}},sx:{maxHeight:s},children:i.map(e=>{let t=e.columnDef.header,n="string"==typeof t?t:e.id;return(0,x.jsxs)(d6.A,{disabled:!e.getCanHide(),onClick:e.getCanHide()?e.getToggleVisibilityHandler():void 0,dense:!0,children:[(0,x.jsx)(d2,{checked:e.getIsVisible(),disabled:!e.getCanHide(),size:"small",disableRipple:!0,sx:{p:0,mr:1}}),(0,x.jsx)(l$.A,{primary:n})]},e.id)})})]})]}):null}pv.displayName="TextField";var pb=n(347);let px=(0,w.forwardRef)(function(e,t){return(0,x.jsx)(pb.A,{...e,tabIndex:-1,ref:t,sx:rV({flexGrow:1},e.sx)})});function pw({width:e,height:t,density:n,defaultColumnWidth:r,defaultColumnHeight:i,onRowClick:o,onRowMouseOver:s,onRowMouseOut:a,rows:l,columns:u,headers:c,columnSizing:h,columnSizingInfo:d,cellConfigs:f,pagination:p,onPaginationChange:m,rowCount:g,toolbarConfig:v}){let y=(0,w.useRef)(null),b=(0,w.useRef)({startIndex:0,endIndex:0}),S=function({visibleRange:e,virtualTable:t,maxRows:n,maxColumns:r}){return function({maxRows:e,maxColumns:t,onActiveCellChange:n}){let[r,i]=(0,w.useState)(fw),[o,s]=(0,w.useState)(!1);return{activeCell:r,isActive:o,onTableKeyDown:(0,w.useCallback)(r=>{let o=r.key;(fS.has(o)||"Home"===o||"End"===o||"PageDown"===o||"PageUp"===o)&&i(i=>{let s=i.row,a=i.column;"ArrowRight"===o&&a<t-1?(r.preventDefault(),a+=1):"ArrowLeft"===o&&a>0?(r.preventDefault(),a-=1):"ArrowDown"===o&&s<e-1?(r.preventDefault(),s+=1):"ArrowUp"===o&&s>0?(r.preventDefault(),s-=1):"Home"===o?(r.preventDefault(),s=0,a=0):"End"===o&&(r.preventDefault(),s=e-1,a=t-1);let l={column:a,row:s},u=n?.(r,i,l)||l;return u.row===i.row&&u.column===i.column?i:u})},[t,e,n]),onCellFocus:e=>{e.column===r.column&&e.row===r.row&&o||(s(!0),i(e))},onTableBlur:(0,w.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||(s(!1),i(fw))},[])}}({maxRows:n,maxColumns:r,onActiveCellChange:(r,i,o)=>{let s=r.key,a=o&&(i.column!==o.column||i.row!==o.row),l=o?.row??i.row;if("ArrowDown"===s&&a)(l-1<e.current.startIndex||l-1>e.current.endIndex)&&t.current?.scrollToIndex({index:l-1,align:"end"});else if("ArrowUp"===s&&a)(l-1<e.current.startIndex||l-1>e.current.endIndex)&&t.current?.scrollToIndex({index:l-1,align:"start"});else if(a&&("Home"===s||"End"===s))t.current?.scrollToIndex({index:Math.max(l-1,0),align:"start"});else if("PageDown"===s){r.preventDefault();let o=i.row;return o=Math.min(n-1,e.current.endIndex+1),t.current?.scrollToIndex({index:o-1,align:"start"}),{row:o,column:i.column}}else if("PageUp"===s){let n=i.row;return n=Math.max(0,e.current.startIndex-1),t.current?.scrollToIndex({index:n-1,align:"end"}),{row:n,column:i.column}}return o}})}({visibleRange:b,virtualTable:y,maxRows:l.length+1,maxColumns:u.length}),C=e=>e.row===S.activeCell.row&&e.column===S.activeCell.column?S.isActive?"trigger-focus":"focus-next":"none",A=(0,w.useMemo)(()=>({Scroller:px,Table:t=>(0,x.jsx)(fM,{...t,width:e,density:n,onKeyDown:S.onTableKeyDown,onBlur:S.onTableBlur}),TableHead:fG,TableFoot:fU,TableRow:({item:e,...t})=>{let r=l[t["data-index"]];if(!r)return null;let i={id:r.id,index:r.index};return(0,x.jsx)(f2,{...t,onClick:e=>o(e,r.id),density:n,onMouseOver:e=>{s?.(e,i)},onMouseOut:e=>{a?.(e,i)}})},TableBody:fD}),[n,S.onTableKeyDown,S.onTableBlur,o,a,s,l,e]),k=(e,t)=>{p&&m&&m({...p,pageIndex:t})},M=e=>{p&&m&&m({pageIndex:0,pageSize:parseInt(e.target.value,10)})},T=(0,w.useMemo)(()=>{let e={};return c.forEach(t=>{t.headers.filter(e=>e.column.getCanResize()).forEach(t=>{e[`--header-${t.id}-size`]=t.getSize(),e[`--col-${t.column.id}-size`]=t.column.getSize()})}),e},[d,h,c]);return(0,x.jsxs)(lR.A,{style:{width:e,height:t,...T},children:[(0,x.jsx)(py,{...v,width:e}),(0,x.jsx)(hC,{ref:y,totalCount:l.length,components:A,rangeChanged:e=>{b.current=e},fixedHeaderContent:()=>(0,x.jsx)(x.Fragment,{children:c.map(e=>(0,x.jsx)(f2,{density:n,children:e.headers.map((e,t,o)=>{var s,a,l,u,c;let h,d=e.column,f={row:0,column:t},p=d.getIsSorted(),m=d.getNextSortingOrder();return(0,x.jsx)(f1,{onSort:d.getCanSort()?d.getToggleSortingHandler():void 0,sortDirection:"string"==typeof p?p:void 0,nextSortDirection:"string"==typeof m?m:void 0,width:e.column.getCanResize()?`calc(var(--header-${e?.id}-size) * 1px)`:d.getSize()||r,defaultColumnHeight:i,align:d.columnDef.meta?.align,variant:"head",density:n,description:d.columnDef.meta?.headerDescription,focusState:C(f),onFocusTrigger:()=>S.onCellFocus(f),isFirstColumn:0===t,isLastColumn:t===o.length-1,resizeConfig:e.column.getCanResize()?{resizeHandler:e.getResizeHandler(),resetSizeHandler:e.column.resetSize,isResizing:e.column.getIsResizing()}:void 0,children:(s=d.columnDef.header,a=e.getContext(),s?"function"==typeof(u=l=s)&&(h=Object.getPrototypeOf(u)).prototype&&h.prototype.isReactComponent||"function"==typeof l||"object"==typeof(c=l)&&"symbol"==typeof c.$$typeof&&["react.memo","react.forward_ref"].includes(c.$$typeof.description)?w.createElement(s,a):s:null)},e.id)})},e.id))}),fixedFooterContent:p?()=>(0,x.jsx)(d4.A,{sx:{backgroundColor:e=>e.palette.background.default},children:(0,x.jsx)(fx,{colSpan:u.length,count:g,page:p.pageIndex,rowsPerPage:p.pageSize,onPageChange:k,onRowsPerPageChange:M})}):void 0,itemContent:e=>{let t=l[e];return t?(0,x.jsx)(x.Fragment,{children:t.getVisibleCells().map((o,s,a)=>{let l,u={row:e+1,column:s},c=o.getContext(),h=f?.[c.cell.id],d=o.column.columnDef.cell,p="function"==typeof d?d(c):null,m=o.column.columnDef.meta?.cellDescription;"function"==typeof m?l=m(c):m&&"string"==typeof p&&(l=p);let g=Object.entries(t.original)?.filter(([e,t])=>["string","number"].includes(typeof t)).reduce((e,[t,n])=>({...e,[t]:String(n)}),{});return(0,x.jsx)(fB,{"data-testid":o.id,title:l||h?.text||p,width:o.column.getCanResize()?`calc(var(--col-${o.column.id}-size) * 1px)`:o.column.getSize()||r,defaultColumnHeight:i,align:o.column.columnDef.meta?.align,density:n,focusState:C(u),onFocusTrigger:()=>S.onCellFocus(u),isFirstColumn:0===s,isLastColumn:s===a.length-1,description:l,color:h?.textColor??void 0,backgroundColor:h?.backgroundColor??void 0,dataLink:o.column.columnDef.meta?.dataLink,adjacentCellsValuesMap:g,children:h?.text||p},o.id)})}):null}})]})}let pS=(e,t)=>`${t}`,pC={},pA=[];function pk({data:e,columns:t,cellConfigs:n,density:r="standard",defaultColumnWidth:i=150,defaultColumnHeight:o="auto",checkboxSelection:s,onRowSelectionChange:a,onSortingChange:l,getCheckboxColor:u,getRowId:c=pS,rowSelection:h=pC,sorting:d=pA,getItemActions:f,hasItemActions:p,pagination:m,onPaginationChange:g,rowSelectionVariant:v="standard",getSubRows:y,hiddenColumns:b,tableToolbarConfig:S,columnResizeMode:C="onChange",defaultColumnConfig:A,...k}){let M=(0,lO.A)(),T=!!y,[D,E]=(0,w.useState)({}),{globalFilter:O,setGlobalFilter:R,fuzzySearchOptions:I}=function(e,t,n,r){let[i,o]=(0,w.useState)(""),[s,a]=(0,w.useState)(n),l=(0,w.useCallback)(e=>{o(t=>(t?t&&!e&&r(s):(a(n),r(!0)),e))},[n,s,r]);return{globalFilter:i,setGlobalFilter:l,fuzzySearchOptions:{filterFns:{fuzzy:(e,n,r,i)=>{let o=function(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:dF.MATCHES,!n.accessors){let r=dB(e,t,n);return{rankedValue:e,rank:r,accessorIndex:-1,accessorThreshold:n.threshold,passed:r>=n.threshold}}let i=function(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r],o="function"==typeof i?dz:{...dz,...i},s=function(e,t){let n=t;"object"==typeof t&&(n=t.accessor);let r=n(e);return null==r?[]:Array.isArray(r)?r:[String(r)]}(e,i);for(let e=0,t=s.length;e<t;e++)n.push({itemValue:s[e],attributes:o})}return n}(e,n.accessors),o={rankedValue:e,rank:dF.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let e=0;e<i.length;e++){let r=i[e],s=dB(r.itemValue,t,n),{minRanking:a,maxRanking:l,threshold:u=n.threshold}=r.attributes;s<a&&s>=dF.MATCHES?s=a:s>l&&(s=l),(s=Math.min(s,l))>=u&&s>o.rank&&(o.rank=s,o.passed=!0,o.accessorIndex=e,o.accessorThreshold=u,o.rankedValue=r.itemValue)}return o}(e.getValue(n),r,{threshold:dF[t]});return i({itemRank:o}),o.passed}},globalFilterFn:e?"fuzzy":void 0,getFilteredRowModel:e?e=>h6(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{var i,o,s,a,l,u,c,h,d,f;let p,m,g,v,y,b,x,w,S,C;if(!t.rows.length||!(null!=n&&n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}let A=[],k=[];(null!=n?n:[]).forEach(t=>{var n;let r=e.getColumn(t.id);if(!r)return;let i=r.getFilterFn();i&&A.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value})});let M=(null!=n?n:[]).map(e=>e.id),T=e.getGlobalFilterFn(),D=e.getAllLeafColumns().filter(e=>e.getCanGlobalFilter());r&&T&&D.length&&(M.push("__global__"),D.forEach(e=>{var t;k.push({id:e.id,filterFn:T,resolvedValue:null!=(t=null==T.resolveFilterValue?void 0:T.resolveFilterValue(r))?t:r})}));for(let e=0;e<t.flatRows.length;e++){let n=t.flatRows[e];if(n.columnFilters={},A.length)for(let e=0;e<A.length;e++){let t=(p=A[e]).id;n.columnFilters[t]=p.filterFn(n,t,p.resolvedValue,e=>{n.columnFiltersMeta[t]=e})}if(k.length){for(let e=0;e<k.length;e++){let t=(m=k[e]).id;if(m.filterFn(n,t,m.resolvedValue,e=>{n.columnFiltersMeta[t]=e})){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return i=t.rows,o=e=>{for(let t=0;t<M.length;t++)if(!1===e.columnFilters[M[t]])return!1;return!0},e.options.filterFromLeafRows?(s=i,a=o,g=[],v={},y=null!=(u=(l=e).options.maxLeafRowFilterDepth)?u:100,{rows:(b=function(e,t){void 0===t&&(t=0);let n=[];for(let i=0;i<e.length;i++){var r;let o=e[i],s=dt(l,o.id,o.original,o.index,o.depth,void 0,o.parentId);if(s.columnFilters=o.columnFilters,null!=(r=o.subRows)&&r.length&&t<y){if(s.subRows=b(o.subRows,t+1),a(o=s)&&!s.subRows.length||a(o)||s.subRows.length){n.push(o),v[o.id]=o,g.push(o);continue}}else a(o=s)&&(n.push(o),v[o.id]=o,g.push(o))}return n})(s),flatRows:g,rowsById:v}):(c=i,h=o,x=[],w={},S=null!=(f=(d=e).options.maxLeafRowFilterDepth)?f:100,{rows:(C=function(e,t){void 0===t&&(t=0);let n=[];for(let i=0;i<e.length;i++){let o=e[i];if(h(o)){var r;if(null!=(r=o.subRows)&&r.length&&t<S){let e=dt(d,o.id,o.original,o.index,o.depth,void 0,o.parentId);e.subRows=C(o.subRows,t+1),o=e}n.push(o),x.push(o),w[o.id]=o}}return n})(c),flatRows:x,rowsById:w})},h8(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex())):void 0,filterFromLeafRows:e,onGlobalFilterChange:l}}}(S?.isSearchEnabled,S?.fuzzyMatchThreshold??"CONTAINS",D,E),[P,N]=(0,w.useState)(b?.reduce((e,t)=>({...e,[t]:!1}),{})??{}),L=(0,w.useCallback)((e,t,n)=>{"standard"===v||n?t.toggleSelected():t.getIsSelected()&&!e.getIsAllRowsSelected()?e.toggleAllRowsSelected():a?.({[t.id]:!0})},[a,v]),j=(0,w.useCallback)((e,t,n)=>{let r=e.nativeEvent&&(e.nativeEvent instanceof MouseEvent||e.nativeEvent instanceof KeyboardEvent)?e.nativeEvent:void 0;L(t,n,!!r?.metaKey||!!r?.shiftKey)},[L]),F=(0,w.useMemo)(()=>({id:"itemActions",header:"Actions",cell:({row:e})=>(0,x.jsx)(H.A,{direction:"row",alignItems:"center",children:f?.({id:e.id,data:e.original})}),enableSorting:!1,enableResizing:!1}),[f]),B=(0,w.useMemo)(()=>({id:"checkboxRowSelect",size:28,header:({table:e})=>(0,x.jsx)(d5,{checked:e.getIsAllRowsSelected(),indeterminate:e.getIsSomeRowsSelected(),onChange:e.getToggleAllRowsSelectedHandler(),color:M.palette.text.primary,density:r}),cell:({row:e,table:t})=>(0,x.jsx)(d5,{checked:e.getIsSelected(),indeterminate:e.getIsSomeSelected(),onChange:n=>{j(n,t,e)},color:u?.(e.original),density:r}),enableSorting:!1,enableResizing:!1}),[M.palette.text.primary,r,u,j]),_=function(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=w.useState(()=>({current:function(e){var t,n;let r=[...dP,...null!=(t=e._features)?t:[]],i={_features:r},o=i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(i)),{}),s={...null!=(n=e.initialState)?n:{}};i._features.forEach(e=>{var t;s=null!=(t=null==e.getInitialState?void 0:e.getInitialState(s))?t:s});let a=[],l=!1,u={_features:r,options:{...o,...e},initialState:s,_queue:e=>{a.push(e),l||(l=!0,Promise.resolve().then(()=>{for(;a.length;)a.shift()();l=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{i.setState(i.initialState)},setOptions:e=>{var t;t=h5(e,i.options),i.options=i.options.mergeOptions?i.options.mergeOptions(o,t):{...o,...t}},getState:()=>i.options.state,setState:e=>{null==i.options.onStateChange||i.options.onStateChange(e)},_getRowId:(e,t,n)=>{var r;return null!=(r=null==i.options.getRowId?void 0:i.options.getRowId(e,t,n))?r:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?i.getPrePaginationRowModel():i.getRowModel()).rowsById[e];if(!n&&!(n=i.getCoreRowModel().rowsById[e]))throw Error();return n},_getDefaultColumnDef:h6(()=>[i.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},h8(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:h6(()=>[i._getColumnDefs()],e=>{let t=function(e,n,r){return void 0===r&&(r=0),e.map(e=>{let o=function(e,t,n,r){var i,o;let s,a={...e._getDefaultColumnDef(),...t},l=a.accessorKey,u=null!=(i=null!=(o=a.id)?o:l?"function"==typeof String.prototype.replaceAll?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)?i:"string"==typeof a.header?a.header:void 0;if(a.accessorFn?s=a.accessorFn:l&&(s=l.includes(".")?e=>{let t=e;for(let e of l.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[a.accessorKey]),!u)throw Error();let c={id:`${String(u)}`,accessorFn:s,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:h6(()=>[!0],()=>{var e;return[c,...null==(e=c.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},h8(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:h6(()=>[e._getOrderColumnsFn()],e=>{var t;return null!=(t=c.columns)&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},h8(e.options,"debugColumns","column.getLeafColumns"))};for(let t of e._features)null==t.createColumn||t.createColumn(c,e);return c}(i,e,r,n);return o.columns=e.columns?t(e.columns,o,r+1):[],o})};return t(e)},h8(e,"debugColumns","getAllColumns")),getAllFlatColumns:h6(()=>[i.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),h8(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:h6(()=>[i.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),h8(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:h6(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),h8(e,"debugColumns","getAllLeafColumns")),getColumn:e=>i._getAllFlatColumnsById()[e]};Object.assign(i,u);for(let e=0;e<i._features.length;e++){let t=i._features[e];null==t||null==t.createTable||t.createTable(i)}return i}(t)})),[r,i]=w.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),null==e.onStateChange||e.onStateChange(t)}})),n.current}({data:e,columns:(0,w.useMemo)(()=>{let e=dH(t,A);return p&&e.unshift(F),s&&e.unshift(B),e},[t,A,p,s,F,B]),getRowId:c,getCoreRowModel:e=>h6(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,o){void 0===i&&(i=0);let s=[];for(let l=0;l<t.length;l++){let u=dt(e,e._getRowId(t[l],l,o),t[l],l,i,void 0,null==o?void 0:o.id);if(n.flatRows.push(u),n.rowsById[u.id]=u,s.push(u),e.options.getSubRows){var a;u.originalSubRows=e.options.getSubRows(t[l],l),null!=(a=u.originalSubRows)&&a.length&&(u.subRows=r(u.originalSubRows,i+1,u))}}return s};return n.rows=r(t),n},h8(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex())),getSortedRowModel:e=>h6(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(null!=t&&t.length))return n;let r=e.getState().sorting,i=[],o=r.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),s={};o.forEach(t=>{let n=e.getColumn(t.id);n&&(s[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});let a=e=>{let t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let r=0;r<o.length;r+=1){var n;let i=o[r],a=s[i.id],l=a.sortUndefined,u=null!=(n=null==i?void 0:i.desc)&&n,c=0;if(l){let n=e.getValue(i.id),r=t.getValue(i.id),o=void 0===n,s=void 0===r;if(o||s){if("first"===l)return o?-1:1;if("last"===l)return o?1:-1;c=o&&s?0:o?l:-l}}if(0===c&&(c=a.sortingFn(e,t,i.id)),0!==c)return u&&(c*=-1),a.invertSorting&&(c*=-1),c}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=a(e.subRows))}),t};return{rows:a(n.rows),flatRows:i,rowsById:n.rowsById}},h8(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex())),getPaginationRowModel:m?e=>h6(()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded],(t,n)=>{let r;if(!n.rows.length)return n;let{pageSize:i,pageIndex:o}=t,{rows:s,flatRows:a,rowsById:l}=n,u=i*o;s=s.slice(u,u+i),(r=e.options.paginateExpandedRows?{rows:s,flatRows:a,rowsById:l}:dN({rows:s,flatRows:a,rowsById:l})).flatRows=[];let c=e=>{r.flatRows.push(e),e.subRows.length&&e.subRows.forEach(c)};return r.rows.forEach(c),r},h8(e.options,"debugTable","getPaginationRowModel")):void 0,manualPagination:!m,enableRowSelection:!!s,onRowSelectionChange:e=>{let t="function"==typeof e?e(h):e;a?.(t)},onSortingChange:e=>{let t="function"==typeof e?e(d):e;l?.(t)},onColumnVisibilityChange:N,getSubRows:y,getExpandedRowModel:T?e=>h6(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(e,t,n)=>t.rows.length&&(!0===e||Object.keys(null!=e?e:{}).length)&&n?dN(t):t,h8(e.options,"debugTable","getExpandedRowModel")):void 0,...I,sortDescFirst:!0,columnResizeMode:C,onExpandedChange:E,state:{rowSelection:h,sorting:d,globalFilter:S?.isSearchEnabled?O:void 0,columnVisibility:P,...m?{pagination:m}:{},expanded:D}}),z=(0,w.useCallback)((e,t)=>{let n=_.getRow(t);L(_,n,e.metaKey||e.shiftKey)},[L,_]);return(0,x.jsx)(pw,{...k,density:r,defaultColumnWidth:i,defaultColumnHeight:o,onRowClick:z,rows:_.getRowModel().rows,columns:_.getVisibleFlatColumns(),columnSizing:_.getState().columnSizing,columnSizingInfo:_.getState().columnSizingInfo,headers:_.getHeaderGroups(),cellConfigs:n,pagination:m,onPaginationChange:g,rowCount:_.getRowCount(),toolbarConfig:{isSearchEnabled:S?.isSearchEnabled,globalFilter:O,onGlobalFilterChange:R,isColumnFilterEnabled:S?.isColumnFilterEnabled,columns:_.getAllColumns(),columnFilterMenuMaxHeight:S?.columnFilterMenuMaxHeight,isExpandAllEnabled:T,isAllExpanded:_.getIsAllRowsExpanded(),onExpandAllChange:_.getToggleAllRowsExpandedHandler()}})}let pM=[{accessorKey:"label",header:"Name",enableSorting:!0,enableResizing:!0,cell:({getValue:e})=>(0,x.jsx)("span",{title:e(),children:e()})}],pT=e=>e.id,pD=e=>e.color;function pE({items:e,selectedItems:t,onSelectedItemsChange:n,onItemMouseOver:r,onItemMouseOut:i,height:o,width:s,columns:a=[],sorting:l,onSortingChange:u}){let c=(0,w.useMemo)(()=>"string"!=typeof t?t:e.reduce((e,t,n)=>(e[pT(t,n)]=!0,e),{}),[t,e]),h=(0,w.useMemo)(()=>{let e=Math.max(s-(a?.reduce((e,t)=>e+("number"==typeof t.width?t.width:150),0)??0)-45,60*pM.length)/pM.length;return[...pM.map(t=>({...t,width:e})),...a]},[a,s]);return(0,x.jsx)(pk,{height:o,width:s,rowSelection:c,onRowSelectionChange:n,onRowMouseOver:r,onRowMouseOut:i,sorting:l,onSortingChange:u,data:e,columns:h,density:"compact",defaultColumnWidth:"auto",getRowId:pT,getCheckboxColor:pD,checkboxSelection:!0,rowSelectionVariant:"legend"})}function pO({width:e,height:t,options:n,data:r,selectedItems:i,onSelectedItemsChange:o,onItemMouseOver:s,onItemMouseOut:a,tableProps:l}){let u,c=(e,t)=>{let n=e.metaKey||e.shiftKey;o((0,lI.produce)(i,e=>{if("ALL"===e)return{[t]:!0};let r=!!e[t];return n?(r?delete e[t]:e[t]=!0,e):r?"ALL":{[t]:!0}}))},h=nr(n.mode),d=r.length>=500,f={height:t,items:r,selectedItems:i,onLegendItemClick:c,onItemMouseOver:s,onItemMouseOut:a};return(u="table"===h?(0,x.jsx)(pE,{...f,onSelectedItemsChange:o,width:e,...l}):"right"===n.position||d?(0,x.jsx)(h2,{...f,width:e,onLegendItemClick:c}):(0,x.jsx)(lG,{...f,onLegendItemClick:c}),"right"===n.position)?(0,x.jsx)(lR.A,{style:{width:e,height:t},sx:{position:"absolute",top:0,right:0,backgroundColor:e=>`${e.palette.background.default}`},children:u}):(0,x.jsx)(lR.A,{style:{width:e,height:t},sx:{position:"absolute",bottom:0,backgroundColor:e=>`${e.palette.background.default}`},children:u})}let pR={medium:{bottom:6,right:250},small:{bottom:4,right:150}};function pI({children:e,legendProps:t,width:n,height:r,spacing:i=0,legendSize:o,minChildrenWidth:s=100,minChildrenHeight:a=100}){let{content:l,legend:u,margin:c}=function({width:e,height:t,legendProps:n,legendSize:r,minChildrenHeight:i,minChildrenWidth:o,spacing:s,theme:a}){let l,u,c=n?.options,h={legend:{show:!1,width:0,height:0},content:{width:e,height:t},margin:{right:0,bottom:0}};if(!c)return h;let{position:d}=c;if("list"===nr(c.mode))l="right"===d?200:e,u=40,"right"===d?u=t:t>=300&&(u=100);else{let i=dV(a,"compact"),o=(n?.tableProps?.columns||[]).reduce((e,t)=>("number"==typeof t.width&&(e+=t.width),e),0);l="right"===d?pR[r].right+o:e;let s=Math.min(pR[r].bottom,n.data.length+1);u="bottom"===d?s*i.height:t}let f="right"===d?e-l-s:e,p="bottom"===d?t-u-s:t;return"right"===d&&f<o||"bottom"===d&&p<i?h:{legend:{width:l,height:u,show:!0},content:{width:f,height:p},margin:{right:"right"===d?s:0,bottom:"bottom"===d?s:0}}}({width:n,height:r,legendProps:t,minChildrenHeight:a,minChildrenWidth:s,spacing:i,theme:(0,lO.A)(),legendSize:ni(o)});return(0,x.jsxs)(lR.A,{style:{width:n,height:r},sx:{position:"relative",overflow:"hidden"},children:[(0,x.jsx)(lR.A,{style:{width:l.width,height:l.height},sx:{marginRight:`${c.right}px`,marginBottom:`${c.bottom}px`},children:"function"==typeof e?e({width:l.width,height:l.height}):e}),t&&u.show&&(0,x.jsx)(pO,{...t,height:u.height,width:u.width})]})}var pP=n(91467),pN=n(66834),pL=n(92890),pj=n(39750);let pF=(0,D.A)("form")({overflowY:"auto",display:"flex",flexDirection:"column"}),pB=e=>({position:"absolute",top:e.spacing(.5),right:e.spacing(.5)}),p_=({children:e,...t})=>(0,x.jsx)(pL.A,{...t,children:e});p_.Header=({children:e,onClose:t,...n})=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(pP.A,{style:{textOverflow:"ellipsis",overflow:"hidden"},...n,children:e}),t&&(0,x.jsx)($.A,{"aria-label":"Close",onClick:t,sx:pB,children:(0,x.jsx)(ph,{})})]}),p_.Form=pF,p_.Content=({children:e,sx:t,...n})=>(0,x.jsx)(pN.A,{dividers:!0,...n,sx:rV({minWidth:"500px",textWrap:"balance"},t),children:e}),p_.PrimaryButton=({children:e,...t})=>(0,x.jsx)(z.A,{variant:"contained",type:"submit",...t,children:e}),p_.SecondaryButton=({children:e,...t})=>(0,x.jsx)(z.A,{variant:"outlined",color:"secondary",...t,children:e}),p_.Actions=pj.A;let pz=e=>{let{description:t,isOpen:n,onCancel:r,onDiscardChanges:i}=e;return(0,x.jsxs)(p_,{open:n,"aria-labelledby":"discard-dialog",children:[(0,x.jsx)(p_.Header,{children:"Discard Changes"}),(0,x.jsx)(p_.Content,{children:t}),(0,x.jsxs)(p_.Actions,{children:[(0,x.jsx)(z.A,{variant:"contained",onClick:i,children:"Discard Changes"}),(0,x.jsx)(z.A,{variant:"outlined",color:"secondary",onClick:r,children:"Cancel"})]})]})};var pV=n(66395);let pH=({children:e})=>(0,x.jsx)(pV.Ay,{item:!0,xs:4,children:(0,x.jsx)(H.A,{spacing:3,children:e})});var p$=n(67987),pW=n(9799),pU=n(17366);let pq=({id:e,title:t,description:n,placement:r,children:i,enterDelay:o,enterNextDelay:s})=>{let a=(0,x.jsx)("span",{children:i});return(0,x.jsx)(pY,{arrow:!0,id:e,placement:r??"top",title:(0,x.jsx)(pG,{title:t,description:n}),enterDelay:o??500,enterNextDelay:s??500,children:a})},pG=({title:e,description:t})=>(0,x.jsxs)(x.Fragment,{children:[e&&(0,x.jsx)(fO.A,{variant:"body2",sx:e=>({color:e.palette.text.primary,fontWeight:e.typography.fontWeightMedium}),children:e}),(0,x.jsx)(fO.A,{variant:"caption",sx:e=>({color:e.palette.text.primary,whiteSpace:"pre-line"}),children:t})]}),pY=(0,D.A)(({className:e,...t})=>(0,x.jsx)(pu,{...t,classes:{popper:e}}))(({theme:e})=>({[`& .${pt.tooltip}`]:{backgroundColor:e.palette.background.tooltip,color:e.palette.text.primary,maxWidth:"300px",padding:e.spacing(1),boxShadow:e.shadows[1]},[`& .${pt.arrow}`]:{color:e.palette.background.tooltip}})),pK=({label:e,control:t,description:n})=>{let r=rH("EditorSectionControl"),i=`${r}-control`,o=`${r}-label`;return(0,x.jsx)(p$.A,{children:(0,x.jsxs)(H.A,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[(0,x.jsxs)(H.A,{direction:"row",alignItems:"center",justifyContent:"center",children:[(0,x.jsx)(pW.A,{id:o,htmlFor:i,children:e}),n&&(0,x.jsx)(pq,{description:n,enterDelay:100,children:(0,x.jsx)($.A,{size:"small",sx:e=>({borderRadius:e.shape.borderRadius,padding:"4x",margin:"0 2px"}),children:(0,x.jsx)(pU,{"aria-describedby":"info-tooltip","aria-hidden":!1,fontSize:"inherit",sx:{color:e=>e.palette.grey[700]}})})})]}),(0,x.jsxs)(lR.A,{sx:{width:"180px",textAlign:"right"},children:[" ",S().cloneElement(t,{id:i,"aria-labelledby":o})]})]})})},pZ=({children:e})=>(0,x.jsx)(pV.Ay,{container:!0,spacing:8,children:e}),pX=({title:e,children:t,icon:n})=>(0,x.jsxs)(lR.A,{children:[(0,x.jsxs)(lR.A,{display:"flex",borderBottom:1,borderColor:"grey.300",marginBottom:e=>e.spacing(1),children:[(0,x.jsx)(fO.A,{variant:"overline",component:"h4",children:e}),n&&(0,x.jsx)(lR.A,{sx:{marginLeft:"auto"},children:n})]}),(0,x.jsx)(H.A,{spacing:1,children:t})]});var pQ=n(31271),pJ=n(81227);function p0({options:e,renderInput:t=e=>(0,x.jsx)(W.A,{...e}),id:n,"aria-labelledby":r,...i}){let o=e=>e.label??e.id;return(0,x.jsx)(pQ.A,{isOptionEqualToValue:(e,t)=>e.id===t.id,getOptionDisabled:e=>!!e.disabled,getOptionLabel:o,options:e,renderInput:e=>t({...e,inputProps:{...e.inputProps,id:n,"aria-labelledby":r}}),renderOption:({key:e,...t},n)=>(0,x.jsx)("li",{...t,children:(0,x.jsxs)("div",{children:[(0,x.jsx)(fO.A,{variant:"body1",component:"div",children:o(n)}),n.description&&(0,x.jsx)(fO.A,{variant:"body2",component:"div",sx:{color:e=>e.palette.text.secondary},children:n.description})]})},e),filterOptions:(0,pJ.Z)({stringify:e=>`${o(e)} ${e.description||""}`}),...i})}let p1=[{id:"compact",label:"Compact"},{id:"standard",label:"Standard"},{id:"comfortable",label:"Comfortable"}];function p2({onChange:e,value:t="standard"}){return(0,x.jsx)(pK,{label:"Density",control:(0,x.jsx)(p0,{value:p1.find(e=>e.id===t),options:p1,getOptionLabel:e=>e.label,onChange:(t,{id:n})=>{e(n)},disableClearable:!0})})}function p5(){return(0,x.jsxs)(H.A,{direction:"row",alignItems:"center",children:[(0,x.jsx)(lR.A,{sx:{content:'""',width:8,height:8,boxSizing:"border-box",position:"absolute",backgroundColor:e=>e.palette.background.default,border:e=>`2px solid ${e.palette.info.main}`,borderRadius:"50%"}}),(0,x.jsx)(lR.A,{sx:{content:'""',height:2,background:e=>e.palette.info.main,width:"100%"}})]})}function p4(e){return(p4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p3(e,t,n){var r;return(r=function(e,t){if("object"!=p4(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=p4(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==p4(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p8(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p6(Object(n),!0).forEach(function(t){p3(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p6(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var p9={top:function(e,t){return Math.abs(t.y-e.top)},right:function(e,t){return Math.abs(e.right-t.x)},bottom:function(e,t){return Math.abs(e.bottom-t.y)},left:function(e,t){return Math.abs(t.x-e.left)}},p7=Symbol("closestEdge");function me(e){var t;return null!=(t=e[p7])?t:null}function mt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mn(e,t){if(e){if("string"==typeof e)return mt(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mt(e,t):void 0}}function mr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||mn(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mi(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){t.forEach(function(e){return e()})}}var mo=n(96907),ms="data-pdnd-honey-pot";function ma(e){return e instanceof Element&&e.hasAttribute(ms)}function ml(e){var t=mr(document.elementsFromPoint(e.x,e.y),2),n=t[0],r=t[1];return n?ma(n)?null!=r?r:null:n:null}var mu={inset:"unset",border:"none",padding:0,margin:0,overflow:"visible",color:"inherit",background:"transparent"};function mc(e){var t=null;return function(){if(!t){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];t={result:e.apply(this,r)}}return t.result}}var mh=mc(function(){return"u">typeof HTMLElement&&"function"==typeof HTMLElement.prototype.showPopover});function md(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?md(Object(n),!0).forEach(function(t){p3(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):md(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mp(e){var t,n,r,i,o={x:Math.min((i={x:Math.max((r={x:(n={x:Math.floor((t=e.client).x),y:Math.floor(t.y)}).x-1,y:n.y-1}).x,0),y:Math.max(r.y,0)}).x,window.innerWidth-2),y:Math.min(i.y,window.innerHeight-2)};return DOMRect.fromRect({x:o.x,y:o.y,width:2,height:2})}function mm(e){var t=e.clientRect;return{left:"".concat(t.left,"px"),top:"".concat(t.top,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}}function mg(e){return function(e){if(Array.isArray(e))return mt(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||mn(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var mv=mc(function(){return navigator.userAgent.includes("Firefox")}),my=mc(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),mb={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if(!("u"<typeof window)&&my()){var mx=mw();(0,mo.bindAll)(window,[{type:"dragstart",listener:function(){mx.enterCount=0,mx.isOverWindow=!0}},{type:"drop",listener:mS},{type:"dragend",listener:mS},{type:"dragenter",listener:function(e){mx.isOverWindow||0!==mx.enterCount||(e[mb.isEnteringWindow]=!0),mx.isOverWindow=!0,mx.enterCount++}},{type:"dragleave",listener:function(e){mx.enterCount--,mx.isOverWindow&&0===mx.enterCount&&(e[mb.isLeavingWindow]=!0,mx.isOverWindow=!1)}}],{capture:!0})}function mw(){return{enterCount:0,isOverWindow:!1}}function mS(){mx=mw()}function mC(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var mA=(o=function(e){return e()},s=[],a=null,(l=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];s=t,a||(a=requestAnimationFrame(function(){a=null,o.apply(void 0,s)}))}).cancel=function(){a&&(cancelAnimationFrame(a),a=null)},l),mk=(u=null,{schedule:function(e){u={frameId:requestAnimationFrame(function(){u=null,e()}),fn:e}},flush:function(){u&&(cancelAnimationFrame(u.frameId),u.fn(),u=null)}}),mM={isActive:!1};function mT(){return!mM.isActive}function mD(e){var t,n=e.event,r=null==(t=e.current[0])?void 0:t.dropEffect;null!=r&&n.dataTransfer&&(n.dataTransfer.dropEffect=r)}var mE=function(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=e.dispatchEvent;if(mT()){var o,s,a=function(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=mC(t);if("external"===n.startedFrom)return{input:i,dropTargets:[]};var o=r({input:i,source:n.payload,target:t.target,current:[]});return{input:i,dropTargets:o}}({event:t,dragType:n,getDropTargetsOver:r});mM.isActive=!0;var l={current:a};mD({event:t,current:a.dropTargets});var u=function(e){var t=e.source,n=e.initial,r=e.dispatchEvent,i={dropTargets:[]};function o(e){r(e),i={dropTargets:e.payload.location.current.dropTargets}}return{start:function(e){var r=e.nativeSetDragImage,s={current:n,previous:i,initial:n};o({eventName:"onGenerateDragPreview",payload:{source:t,location:s,nativeSetDragImage:r}}),mk.schedule(function(){o({eventName:"onDragStart",payload:{source:t,location:s}})})},dragUpdate:function(e){var r=e.current;mk.flush(),mA.cancel(),o({eventName:"onDropTargetChange",payload:{source:t,location:{initial:n,previous:i,current:r}}})},drag:function(e){var r=e.current;mA(function(){mk.flush(),o({eventName:"onDrag",payload:{source:t,location:{initial:n,previous:i,current:r}}})})},drop:function(e){var r=e.current,s=e.updatedSourcePayload;mk.flush(),mA.cancel(),o({eventName:"onDrop",payload:{source:null!=s?s:t,location:{current:r,previous:i,initial:n}}})}}}({source:n.payload,dispatchEvent:i,initial:a}),c=(0,mo.bindAll)(window,[{type:"dragover",listener:function(e){d(e),u.drag({current:l.current})}},{type:"dragenter",listener:d},{type:"dragleave",listener:function(e){(function(e){var t=e.dragLeave,n=t.type,r=t.relatedTarget;return"dragleave"===n&&(my()?!!my()&&t.hasOwnProperty(mb.isLeavingWindow):null==r||(mv()?"nodeName"in r&&r.ownerDocument!==document:r instanceof HTMLIFrameElement))})({dragLeave:e})&&(h({input:l.current.input,dropTargets:[]}),"external"===n.startedFrom&&f())}},{type:"drop",listener:function(e){(l.current={dropTargets:l.current.dropTargets,input:mC(e)},l.current.dropTargets.length)?(e.preventDefault(),mD({event:e,current:l.current.dropTargets}),u.drop({current:l.current,updatedSourcePayload:"external"===n.type?n.getDropPayload(e):null}),p()):f()}},{type:"dragend",listener:function(e){l.current={dropTargets:l.current.dropTargets,input:mC(e)},f()}}].concat(mg([{type:"pointermove",listener:(s=0,function(){s<20?s++:o()})},{type:"pointerdown",listener:o=f}])),{capture:!0});u.start({nativeSetDragImage:t.dataTransfer?t.dataTransfer.setDragImage.bind(t.dataTransfer):null})}function h(e){var t=function(e){var t=e.current,n=e.next;if(t.length!==n.length)return!0;for(var r=0;r<t.length;r++)if(t[r].element!==n[r].element)return!0;return!1}({current:l.current.dropTargets,next:e.dropTargets});l.current=e,t&&u.dragUpdate({current:l.current})}function d(e){var t=mC(e),i=r({target:ma(e.target)?ml({x:t.clientX,y:t.clientY}):e.target,input:t,source:n.payload,current:l.current.dropTargets});i.length&&(e.preventDefault(),mD({event:e,current:i})),h({dropTargets:i,input:t})}function f(){l.current.dropTargets.length&&h({dropTargets:[],input:l.current.input}),u.drop({current:l.current,updatedSourcePayload:null}),p()}function p(){mM.isActive=!1,c()}},mO=new Map;function mR(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function mI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mI(Object(n),!0).forEach(function(t){p3(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mN(e,t){var n="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return mL(e,void 0);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?mL(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function mL(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mj(e){return e.slice(0).reverse()}function mF(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var m_=mc(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),mz="text/plain",mV=new WeakMap,mH=(c=null,{bindEvents:function(){return c=null,(0,mo.bind)(window,{type:"pointermove",listener:function(e){c={x:e.clientX,y:e.clientY}},options:{capture:!0}})},getOnPostDispatch:function(){var e=null;return function(t){var n=t.eventName,r=t.payload;if("onDragStart"===n){var i,o,s,a=r.location.initial.input,l=null!=c?c:{x:a.clientX,y:a.clientY};(i=document.createElement("div")).setAttribute(ms,"true"),mh()&&i.setAttribute("popover","manual"),o=mp({client:l}),Object.assign(i.style,mf(mf({position:"fixed"},mh()?mu:{zIndex:0x7fffffff}),{},{backgroundColor:"transparent",padding:0,margin:0,boxSizing:"border-box",pointerEvents:"auto"},mm({clientRect:o}))),document.body.appendChild(i),mh()&&i.showPopover(),s=(0,mo.bind)(window,{type:"pointermove",listener:function(e){o=mp({client:{x:e.clientX,y:e.clientY}}),Object.assign(i.style,mm({clientRect:o}))},options:{capture:!0}}),e=function(e){var t,n,r,a=e.current;if(s(),n=(t={client:a,clientRect:o}).client,r=t.clientRect,n.x>=r.x&&n.x<=r.x+r.width&&n.y>=r.y&&n.y<=r.y+r.height)return void i.remove();function l(){u(),i.remove()}var u=(0,mo.bindAll)(window,[{type:"pointerdown",listener:l},{type:"pointermove",listener:l},{type:"focusin",listener:l},{type:"focusout",listener:l},{type:"dragstart",listener:l},{type:"dragenter",listener:l},{type:"dragover",listener:l}],{capture:!0})}}if("onDrop"===n){var u,h=r.location.current.input;null==(u=e)||u({current:{x:h.clientX,y:h.clientY}}),e=null,c=null}}}}),m$=function(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,o=e.defaultDropEffect,s=function(){var e=new Set,t=null;function n(e){t&&(!e.canMonitor||e.canMonitor(t.canMonitorArgs))&&t.active.add(e)}return{dispatchEvent:function(r){var i=r.eventName,o=r.payload;if("onGenerateDragPreview"===i){t={canMonitorArgs:{initial:o.location.initial,source:o.source},active:new Set};var s,a=function(e){var t="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return mF(e,void 0);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?mF(e,void 0):void 0}}(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw i}}}}(e);try{for(a.s();!(s=a.n()).done;){var l=s.value;n(l)}}catch(e){a.e(e)}finally{a.f()}}if(t){for(var u=Array.from(t.active),c=0;c<u.length;c++){var h,d=u[c];t.active.has(d)&&(null==(h=d[i])||h.call(d,o))}"onDrop"===i&&(t.active.clear(),t=null)}},monitorForConsumers:function(r){var i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mB(Object(n),!0).forEach(function(t){p3(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mB(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},r);return e.add(i),n(i),mc(function(){e.delete(i),t&&t.active.delete(i)})}}}(),a=function(e){var t=e.typeKey,n=e.defaultDropEffect,r=new WeakMap,i="data-drop-target-for-".concat(t),o="[".concat(i,"]");function s(e){var t,n=e.eventName,i=e.payload,o=mN(i.location.current.dropTargets);try{for(o.s();!(t=o.n()).done;){var s,a=t.value,l=r.get(a.element),u=mP(mP({},i),{},{self:a});null==l||null==(s=l[n])||s.call(l,u)}}catch(e){o.e(e)}finally{o.f()}}var a={onGenerateDragPreview:s,onDrag:s,onDragStart:s,onDrop:s,onDropTargetChange:function(e){var t,n=e.payload,i=new Set(n.location.current.dropTargets.map(function(e){return e.element})),o=new Set,s=mN(n.location.previous.dropTargets);try{for(s.s();!(t=s.n()).done;){var a,l,u=t.value;o.add(u.element);var c=r.get(u.element),h=i.has(u.element),d=mP(mP({},n),{},{self:u});null==c||null==(a=c.onDropTargetChange)||a.call(c,d),h||null==c||null==(l=c.onDragLeave)||l.call(c,d)}}catch(e){s.e(e)}finally{s.f()}var f,p=mN(n.location.current.dropTargets);try{for(p.s();!(f=p.n()).done;){var m,g,v=f.value;if(!o.has(v.element)){var y=mP(mP({},n),{},{self:v}),b=r.get(v.element);null==b||null==(m=b.onDropTargetChange)||m.call(b,y),null==b||null==(g=b.onDragEnter)||g.call(b,y)}}}catch(e){p.e(e)}finally{p.f()}}};return{dropTargetForConsumers:function(e){return mc(mi(mR(e.element,{attribute:i,value:"true"}),(r.set(e.element,e),function(){return r.delete(e.element)})))},getIsOver:function(e){var t=e.source,i=e.target,s=e.input,a=e.current,l=function e(t){var i,s,a,l,u=t.source,c=t.target,h=t.input,d=t.result,f=void 0===d?[]:d;if(null==c)return f;if(!(c instanceof Element))return c instanceof Node?e({source:u,target:c.parentElement,input:h,result:f}):f;var p=c.closest(o);if(null==p)return f;var m=r.get(p);if(null==m)return f;var g={input:h,source:u,element:m.element};if(m.canDrop&&!m.canDrop(g))return e({source:u,target:m.element.parentElement,input:h,result:f});var v=null!=(i=null==(s=m.getData)?void 0:s.call(m,g))?i:{},y=null!=(a=null==(l=m.getDropEffect)?void 0:l.call(m,g))?a:n,b={data:v,element:m.element,dropEffect:y,isActiveDueToStickiness:!1};return e({source:u,target:m.element.parentElement,input:h,result:[].concat(mg(f),[b])})}({source:t,target:i,input:s});if(l.length>=a.length)return l;for(var u=mj(a),c=mj(l),h=[],d=0;d<u.length;d++){var f,p=u[d],m=c[d];if(null!=m){h.push(m);continue}var g=h[d-1],v=u[d-1];if((null==g?void 0:g.element)!==(null==v?void 0:v.element))break;var y=r.get(p.element);if(!y)break;var b={input:s,source:t,element:y.element};if(y.canDrop&&!y.canDrop(b)||!(null!=(f=y.getIsSticky)&&f.call(y,b)))break;h.push(mP(mP({},p),{},{isActiveDueToStickiness:!0}))}return mj(h)},dispatchEvent:function(e){a[e.eventName](e)}}}({typeKey:t,defaultDropEffect:o});function l(e){null==r||r(e),a.dispatchEvent(e),s.dispatchEvent(e),null==i||i(e)}function u(e){mE({event:e.event,dragType:e.dragType,getDropTargetsOver:a.getIsOver,dispatchEvent:l})}return{registerUsage:function(){var e,r;return r=function(e){var t=e.typeKey,n=e.mount,r=mO.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return mO.set(t,i),i}(e={typeKey:t,mount:function(){return n({canStart:mT,start:u})}}),function(){r.usageCount--,r.usageCount>0||(r.unmount(),mO.delete(e.typeKey))}},dropTarget:a.dropTargetForConsumers,monitor:s.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return mi(mH.bindEvents(),(0,mo.bind)(document,{type:"dragstart",listener:function(t){if(e.canStart(t)&&!t.defaultPrevented&&t.dataTransfer){var n,r,i,o,s,a,l=t.target;if(l instanceof HTMLElement){var u=mV.get(l);if(u){var c=mC(t),h={element:u.element,dragHandle:null!=(n=u.dragHandle)?n:null,input:c};if(u.canDrag&&!u.canDrag(h))return void t.preventDefault();if(u.dragHandle){var d=ml({x:c.clientX,y:c.clientY});if(!u.dragHandle.contains(d))return void t.preventDefault()}var f=null!=(r=null==(i=u.getInitialDataForExternal)?void 0:i.call(u,h))?r:null;if(f)for(var p=0,m=Object.entries(f);p<m.length;p++){var g=mr(m[p],2),v=g[0],y=g[1];t.dataTransfer.setData(v,null!=y?y:"")}!m_()||t.dataTransfer.types.includes(mz)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(mz,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var b={element:u.element,dragHandle:null!=(o=u.dragHandle)?o:null,data:null!=(s=null==(a=u.getInitialData)?void 0:a.call(u,h))?s:{}};e.start({event:t,dragType:{type:"element",payload:b,startedFrom:"internal"}})}}}}}))},dispatchEventToSource:function(e){var t,n,r=e.eventName,i=e.payload;null==(t=mV.get(i.source.element))||null==(n=t[r])||n.call(t,i)},onPostDispatch:mH.getOnPostDispatch()}),mW=m$.dropTarget,mU=m$.monitor;let mq={type:"idle"};function mG({elements:e,accessKey:t,axis:n="vertical",onChange:r}){return(0,w.useEffect)(()=>mU({onDrop({location:i,source:o}){var s,a;let l=i.current.dropTargets[0];if(!l)return;let u=o.data,c=l.data,h=e.findIndex(e=>e[t]===u[t]),d=e.findIndex(e=>e[t]===c[t]);d<0||h<0||r(function(e){var t=e.list,n=e.startIndex,r=e.finishIndex;if(-1===n||-1===r)return Array.from(t);var i=Array.from(t),o=mr(i.splice(n,1),1)[0];return i.splice(r,0,o),i}({list:(s={list:e,startIndex:h,indexOfTarget:d,closestEdgeOfTarget:me(c),axis:n}).list,startIndex:a=s.startIndex,finishIndex:function(e){var t=e.startIndex,n=e.closestEdgeOfTarget,r=e.indexOfTarget,i=e.axis;if(-1===t||-1===r||t===r)return t;if(null==n)return r;var o="vertical"===i&&"bottom"===n||"horizontal"===i&&"right"===n;return t<r?o?r:r-1:o?r+1:r}({closestEdgeOfTarget:s.closestEdgeOfTarget,startIndex:a,indexOfTarget:s.indexOfTarget,axis:s.axis})}))}}),[t,n,e,r])}function mY({children:e,data:t}){let n=(0,w.useRef)(null),[r,i]=(0,w.useState)(mq);return(0,w.useEffect)(()=>{let e=n.current;if(e){var r;return mi((r={element:e,getInitialData:()=>t,onDragStart(){i({type:"is-dragging"})},onDrop(){i(mq)}},mc(mi(m$.registerUsage(),(mV.set(r.element,r),function(){mV.delete(r.element)}),mR(r.element,{attribute:"draggable",value:"true"})))),mW({element:e,canDrop:({source:t})=>t.element!==e,getData:({input:n})=>{var r,i,o,s,a,l,u,c,h;return s=(r={element:e,input:n,allowedEdges:["top","bottom"]}).element,a=r.input,l=r.allowedEdges,u={x:a.clientX,y:a.clientY},c=s.getBoundingClientRect(),h=null!=(i=null==(o=l.map(function(e){return{edge:e,value:p9[e](c,u)}}).sort(function(e,t){return e.value-t.value})[0])?void 0:o.edge)?i:null,p8(p8({},t),{},p3({},p7,h))},getIsSticky:()=>!0,onDragEnter({self:e}){i({type:"is-dragging-over",closestEdge:me(e.data)})},onDrag({self:e}){let t=me(e.data);i(e=>"is-dragging-over"===e.type&&e.closestEdge===t?e:{type:"is-dragging-over",closestEdge:t})},onDragLeave(){i(mq)},onDrop(){i(mq)}}))}},[t]),(0,x.jsxs)(H.A,{ref:n,spacing:1,style:{opacity:"is-dragging"===r.type?.5:"unset"},children:["is-dragging-over"===r.type&&"top"===r.closestEdge?(0,x.jsx)(p5,{}):null,e,"is-dragging-over"===r.type&&"bottom"===r.closestEdge?(0,x.jsx)(p5,{}):null]})}var mK=n(53064);function mZ(e,t){let n=t.indexOf(e);if(0===n)return t;let r=[...t];return r.splice(n,1),r.splice(n-1,0,e),r}function mX(e,t){let n=t.indexOf(e);if(n===t.length-1)return t;let r=[...t];return r.splice(n,1),r.splice(n+1,0,e),r}let mQ=(0,w.forwardRef)(function({onMoveUp:e,onMoveDown:t,onMoveLeft:n,onMoveRight:r,menuSx:i,...o},s){let[a,l]=(0,w.useState)(null),u=!!a;function c(e){l(null),e?.()}return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)($.A,{...o,ref:s,"aria-label":"move","aria-haspopup":!0,"aria-expanded":u,size:"small",onClick:function(e){l(e.currentTarget)},children:(0,x.jsx)(mK,{})}),(e||t||n||r)&&(0,x.jsxs)(pc.A,{id:"drag-button-menu",MenuListProps:{"aria-labelledby":"drag-button-menu"},anchorEl:a,open:u,onClose:()=>c(void 0),sx:i,children:[e&&(0,x.jsx)(d6.A,{onClick:()=>c(e),children:"Move Up"}),t&&(0,x.jsx)(d6.A,{onClick:()=>c(t),children:"Move Down"}),n&&(0,x.jsx)(d6.A,{onClick:()=>c(n),children:"Move Left"}),r&&(0,x.jsx)(d6.A,{onClick:()=>c(r),children:"Move Right"}),r&&(0,x.jsx)(d6.A,{onClick:()=>c(r),children:"Move Right"})]})]})});var mJ=n(31789),m0=n(70320),m1=n(45827);let m2={...w}.useSyncExternalStore;function m5(e={}){let{themeId:t}=e;return function(e,n={}){let r=(0,m1.A)();r&&t&&(r=r[t]||r);let i="u">typeof window&&void 0!==window.matchMedia,{defaultMatches:o=!1,matchMedia:s=i?window.matchMedia:null,ssrMatchMedia:a=null,noSsr:l=!1}=(0,m0.A)({name:"MuiUseMediaQuery",props:n,theme:r}),u="function"==typeof e?e(r):e;return(u=u.replace(/^@media( ?)/m,"")).includes("print")&&console.warn("MUI: You have provided a `print` query to the `useMediaQuery` hook.\nUsing the print media query to modify print styles can lead to unexpected results.\nConsider using the `displayPrint` field in the `sx` prop instead.\nMore information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."),(void 0!==m2?function(e,t,n,r,i){let o=w.useCallback(()=>t,[t]),s=w.useMemo(()=>{if(i&&n)return()=>n(e).matches;if(null!==r){let{matches:t}=r(e);return()=>t}return o},[o,e,r,i,n]),[a,l]=w.useMemo(()=>{if(null===n)return[o,()=>()=>{}];let t=n(e);return[()=>t.matches,e=>(t.addEventListener("change",e),()=>{t.removeEventListener("change",e)})]},[o,n,e]);return m2(l,a,s)}:function(e,t,n,r,i){let[o,s]=w.useState(()=>i&&n?n(e).matches:r?r(e).matches:t);return(0,mJ.A)(()=>{if(!n)return;let t=n(e),r=()=>{s(t.matches)};return r(),t.addEventListener("change",r),()=>{t.removeEventListener("change",r)}},[e,n]),o})(u,o,s,a,l)}}m5();var m4=n(93724);let m3=m5({themeId:m4.A});var m6=n(10972),m8=n(46477),m9=n(55403),m7=n(32494),ge=n(63025);function gt(e,t,n){let r=function(e,t,n){let r,i=t.getBoundingClientRect(),o=n&&n.getBoundingClientRect(),s=(0,ge.A)(t);if(t.fakeTransform)r=t.fakeTransform;else{let e=s.getComputedStyle(t);r=e.getPropertyValue("-webkit-transform")||e.getPropertyValue("transform")}let a=0,l=0;if(r&&"none"!==r&&"string"==typeof r){let e=r.split("(")[1].split(")")[0].split(",");a=parseInt(e[4],10),l=parseInt(e[5],10)}return"left"===e?o?`translateX(${o.right+a-i.left}px)`:`translateX(${s.innerWidth+a-i.left}px)`:"right"===e?o?`translateX(-${i.right-o.left-a}px)`:`translateX(-${i.left+i.width-a}px)`:"up"===e?o?`translateY(${o.bottom+l-i.top}px)`:`translateY(${s.innerHeight+l-i.top}px)`:o?`translateY(-${i.top-o.top+i.height-l}px)`:`translateY(-${i.top+i.height-l}px)`}(e,t,"function"==typeof n?n():n);r&&(t.style.webkitTransform=r,t.style.transform=r)}let gn=w.forwardRef(function(e,t){let n=(0,lO.A)(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:o,appear:s=!0,children:a,container:l,direction:u="down",easing:c=r,in:h,onEnter:d,onEntered:f,onEntering:p,onExit:m,onExited:g,onExiting:v,style:y,timeout:b=i,TransitionComponent:S=m8.Ay,...C}=e,A=w.useRef(null),k=(0,lF.A)((0,f3.A)(a),A,t),M=e=>t=>{e&&(void 0===t?e(A.current):e(A.current,t))},T=M((e,t)=>{gt(u,e,l),(0,m7.q)(e),d&&d(e,t)}),D=M((e,t)=>{let r=(0,m7.c)({timeout:b,style:y,easing:c},{mode:"enter"});e.style.webkitTransition=n.transitions.create("-webkit-transform",{...r}),e.style.transition=n.transitions.create("transform",{...r}),e.style.webkitTransform="none",e.style.transform="none",p&&p(e,t)}),E=M(f),O=M(v),R=M(e=>{let t=(0,m7.c)({timeout:b,style:y,easing:c},{mode:"exit"});e.style.webkitTransition=n.transitions.create("-webkit-transform",t),e.style.transition=n.transitions.create("transform",t),gt(u,e,l),m&&m(e)}),I=M(e=>{e.style.webkitTransition="",e.style.transition="",g&&g(e)}),P=w.useCallback(()=>{A.current&&gt(u,A.current,l)},[u,l]);return w.useEffect(()=>{if(h||"down"===u||"right"===u)return;let e=(0,m9.A)(()=>{A.current&&gt(u,A.current,l)}),t=(0,ge.A)(A.current);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[u,h,l]),w.useEffect(()=>{h||P()},[h,P]),(0,x.jsx)(S,{nodeRef:A,onEnter:T,onEntered:E,onEntering:D,onExit:R,onExited:I,onExiting:O,addEndListener:e=>{o&&o(A.current,e)},appear:s,in:h,timeout:b,...C,children:(e,{ownerState:t,...n})=>w.cloneElement(a,{ref:k,style:{visibility:"exited"!==e||h?void 0:"hidden",...y,...a.props.style},...n})})});var gr=n(11502);function gi(e){return(0,P.Ay)("MuiDrawer",e)}(0,I.A)("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);let go=(e,t)=>{let{ownerState:n}=e;return[t.root,("permanent"===n.variant||"persistent"===n.variant)&&t.docked,t.modal]},gs=(0,D.A)(m6.A,{name:"MuiDrawer",slot:"Root",overridesResolver:go})((0,E.A)(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),ga=(0,D.A)("div",{shouldForwardProp:lN.A,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:go})({flex:"0 0 auto"}),gl=(0,D.A)(gr.A,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${(0,T.A)(n.anchor)}`],"temporary"!==n.variant&&t[`paperAnchorDocked${(0,T.A)(n.anchor)}`]]}})((0,E.A)(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:e})=>"left"===e.anchor&&"temporary"!==e.variant,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"top"===e.anchor&&"temporary"!==e.variant,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"right"===e.anchor&&"temporary"!==e.variant,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"bottom"===e.anchor&&"temporary"!==e.variant,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),gu={left:"right",right:"left",top:"down",bottom:"up"},gc=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiDrawer"}),r=(0,lO.A)(),i=(0,fn.I)(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:s="left",BackdropProps:a,children:l,className:u,elevation:c=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:d,...f}={},onClose:p,open:m=!1,PaperProps:g={},SlideProps:v,TransitionComponent:y,transitionDuration:b=o,variant:S="temporary",slots:k={},slotProps:M={},...D}=n,E=w.useRef(!1);w.useEffect(()=>{E.current=!0},[]);let O=function({direction:e},t){return"rtl"===e&&["left","right"].includes(t)?gu[t]:t}({direction:i?"rtl":"ltr"},s),I={...n,anchor:s,elevation:c,open:m,variant:S,...D},P=(e=>{let{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${(0,T.A)(n)}`],docked:[("permanent"===r||"persistent"===r)&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${(0,T.A)(n)}`,"temporary"!==r&&`paperAnchorDocked${(0,T.A)(n)}`]};return(0,A.A)(i,gi,t)})(I),N={slots:{transition:y,...k},slotProps:{paper:g,transition:v,...M,backdrop:(0,dZ.A)(M.backdrop||{...a,...d},{transitionDuration:b})}},[L,j]=(0,dX.A)("root",{ref:t,elementType:gs,className:(0,C.A)(P.root,P.modal,u),shouldForwardComponentProp:!0,ownerState:I,externalForwardedProps:{...N,...D,...f},additionalProps:{open:m,onClose:p,hideBackdrop:h,slots:{backdrop:N.slots.backdrop},slotProps:{backdrop:N.slotProps.backdrop}}}),[F,B]=(0,dX.A)("paper",{elementType:gl,shouldForwardComponentProp:!0,className:(0,C.A)(P.paper,g.className),ownerState:I,externalForwardedProps:N,additionalProps:{elevation:"temporary"===S?c:0,square:!0}}),[_,z]=(0,dX.A)("docked",{elementType:ga,ref:t,className:(0,C.A)(P.root,P.docked,u),ownerState:I,externalForwardedProps:N,additionalProps:D}),[V,H]=(0,dX.A)("transition",{elementType:gn,ownerState:I,externalForwardedProps:N,additionalProps:{in:m,direction:gu[O],timeout:b,appear:E.current}}),$=(0,x.jsx)(F,{...B,children:l});if("permanent"===S)return(0,x.jsx)(_,{...z,children:$});let W=(0,x.jsx)(V,{...H,children:$});return"persistent"===S?(0,x.jsx)(_,{...z,children:W}):(0,x.jsx)(L,{...j,children:W})}),gh=({anchor:e="right",isOpen:t,onClose:n,PaperProps:r,children:i,...o})=>{let s=m3("(max-width:1080px)");return(0,x.jsx)(gc,{...o,open:t,onClose:n,anchor:e,PaperProps:{...r,sx:rV({width:s?"100%":"1080px",overflow:"hidden"},r?.sx)},"aria-hidden":!t,children:i})};var gd=n(31373),gf=n(62707),gp=n(49828),gm=n(76545),gg=n(32741),gv=n(23670),gy=n(9356),gb=n(90652),gx=n(61305),gw=n(50944),gS=n(59738),gC=n(72106),gA=n(40988),gk=n(55875),gM=n(46182),gT=n(64404),gD=n(28502),gE=n(48683),gO=n(74653),gR=n(31950),gI=n(37573);(0,gO.Y)([gb.a,gx.a,gw.a,gd.a,gf.a,gp.a,gm.a,gg.a,gv.a,gy.a,gS.a,gC.a,gA.a,gk.a,gI.a,gM.a,gT.a,gD.a,gE.a]);let gP=["click","dblclick","mousedown","mousemove","mouseup","mouseover","mouseout","globalout","contextmenu"],gN=["datazoom","downplay","highlight"],gL=(0,w.memo)(function({option:e,theme:t,renderer:n,sx:r,style:i,onEvents:o,_instance:s,syncGroup:a,onChartInitialized:l}){let u=(0,w.useRef)(e),c=(0,w.useRef)(e),h=(0,w.useRef)(null),d=(0,w.useRef)(null);return(0,w.useLayoutEffect)(()=>{if(null!==h.current&&null===d.current&&(d.current=(0,gR.Ts)(h.current,t,{renderer:n??"canvas"}),void 0!==d.current))return d.current.setOption(u.current,!0),l?.(d.current),void 0!==s&&(s.current=d.current),()=>{null!==d.current&&(d.current.dispose(),d.current=null)}},[s,l,t,n]),(0,w.useEffect)(()=>{d.current&&a&&(d.current.group=a,(0,gR.Ng)([d.current]))},[a,d]),(0,w.useEffect)(()=>{void 0===c.current||ib(c.current,e)||d.current&&(d.current.setOption(e,!0),c.current=e)},[e]),(0,w.useLayoutEffect)(()=>{let e=pg(()=>{d.current&&d.current.resize()},200);return window.addEventListener("resize",e),e(),()=>{window.removeEventListener("resize",e)}},[]),(0,w.useEffect)(()=>{let e=d.current;if(e&&void 0!==o)return function(e,t){if(void 0!==t){for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=t[n]??null;r&&function(t,n){var r,i;"function"==typeof n&&((r=t,gP.includes(r))?e.on(t,t=>n(t,e)):(i=t,gN.includes(i))?e.on(t,e=>n(e)):e.on(t,()=>n(null,e)))}(n,r)}}}(e,o),()=>{if(void 0!==e&&!0!==e.isDisposed())for(let t in o)e.off(t)}},[o]),(0,w.useEffect)(()=>{pg(()=>{d.current&&d.current.resize()},200,{leading:!0})()},[r,i]),(0,x.jsx)(lR.A,{ref:h,sx:r,style:i})});var gj=n(17157);function gF(e,t){return function(n){let r=new Date(Number(n));return e>15768e7?(0,gj.formatWithTimeZone)(r,"yyyy",t):e>15552e6?(0,gj.formatWithTimeZone)(r,"MMM yyyy",t):e>864e6?(0,gj.formatWithTimeZone)(r,"dd.MM",t):e>1728e5?(0,gj.formatWithTimeZone)(r,"dd.MM HH:mm",t):(0,gj.formatWithTimeZone)(r,"HH:mm",t)}}var gB=n(34007);function g_(e){let{error:t}=e;return(0,x.jsx)(gB.A,{severity:"error",children:t.message})}var gz=n(77440);let gV=[{id:"default",label:"Default",value:void 0},{id:"12",label:"12",value:12},{id:"14",label:"14",value:14},{id:"16",label:"16",value:16},{id:"20",label:"20",value:20},{id:"24",label:"24",value:24},{id:"28",label:"28",value:28},{id:"32",label:"32",value:32},{id:"36",label:"36",value:36},{id:"40",label:"40",value:40},{id:"48",label:"48",value:48},{id:"56",label:"56",value:56},{id:"64",label:"64",value:64},{id:"72",label:"72",value:72},{id:"96",label:"96",value:96},{id:"128",label:"128",value:128},{id:"160",label:"160",value:160},{id:"192",label:"192",value:192}];function gH({value:e,onChange:t}){return(0,x.jsx)(pK,{label:"Font Size",control:(0,x.jsx)(p0,{value:gV.find(t=>t.value===e),options:gV,getOptionLabel:e=>e.label,onChange:(e,{value:n})=>{t(n)},disableClearable:!0})})}function g$({action:e,submitText:t="Save",cancelText:n="Cancel",isReadonly:r,isValid:i,onActionChange:o,onSubmit:s,onDelete:a,onCancel:l,...u}){return(0,x.jsx)(H.A,{direction:"row",gap:1,sx:{marginLeft:"auto"},...u,children:"read"===e?(0,x.jsxs)(x.Fragment,{children:[o&&(0,x.jsx)(z.A,{disabled:r,variant:"contained",onClick:()=>o("update"),children:"Edit"}),a&&(0,x.jsx)(z.A,{color:"error",disabled:r,variant:"outlined",onClick:a,children:"Delete"}),l&&(s||a)&&(0,x.jsx)(f0.A,{orientation:"vertical",flexItem:!0,sx:{borderColor:e=>e.palette.grey["500"],"&.MuiDivider-root":{marginLeft:2,marginRight:1}}}),l&&(0,x.jsx)(z.A,{color:"secondary",variant:"outlined",onClick:l,children:n})]}):(0,x.jsxs)(x.Fragment,{children:[s&&(0,x.jsx)(z.A,{variant:"contained",disabled:!i,onClick:s,children:t}),l&&(0,x.jsx)(z.A,{color:"secondary",variant:"outlined",onClick:l,children:n})]})})}let gW=0;class gU{constructor(e,t){this.from=e,this.to=t}}class gq{constructor(e={}){this.id=gW++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=gK.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}gq.closedBy=new gq({deserialize:e=>e.split(" ")}),gq.openedBy=new gq({deserialize:e=>e.split(" ")}),gq.group=new gq({deserialize:e=>e.split(" ")}),gq.isolate=new gq({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw RangeError("Invalid value for isolate: "+e);return e||"auto"}}),gq.contextHash=new gq({perNode:!0}),gq.lookAhead=new gq({perNode:!0}),gq.mounted=new gq({perNode:!0});class gG{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[gq.mounted.id]}}let gY=Object.create(null);class gK{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):gY,n=!!e.top|2*!!e.skipped|4*!!e.error|8*(null==e.name),r=new gK(e.name||"",t,e.id,n);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(gq.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(gq.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}gK.none=new gK("",Object.create(null),0,8);class gZ{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let t of e){let e=t(n);if(e){r||(r=Object.assign({},n.props));let t=e[1],i=e[0];i.combine&&i.id in r&&(t=i.combine(r[i.id],t)),r[i.id]=t}}t.push(r?new gK(n.name,r,n.id,n.flags):n)}return new gZ(t)}}let gX=new WeakMap,gQ=new WeakMap;(h=y||(y={}))[h.ExcludeBuffers=1]="ExcludeBuffers",h[h.IncludeAnonymous=2]="IncludeAnonymous",h[h.IgnoreMounts=4]="IgnoreMounts",h[h.IgnoreOverlays=8]="IgnoreOverlays",h[h.EnterBracketed=16]="EnterBracketed";class gJ{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length)for(let[e,t]of(this.props=Object.create(null),i))this.props["number"==typeof e?e:e.id]=t}toString(){let e=gG.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new vn(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new vn(gX.get(this)||this.topNode);return r.moveTo(e,t),gX.set(this,r._tree),r}get topNode(){return new g3(this,0,0,null)}resolve(e,t=0){let n=g5(gX.get(this)||this.topNode,e,t,!1);return gX.set(this,n),n}resolveInner(e,t=0){let n=g5(gQ.get(this)||this.topNode,e,t,!0);return gQ.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof g3?r:r.context.parent;e;e=e.parent)if(e.index<0){let o=e.parent;(i||(i=[r])).push(o.resolve(t,n)),e=o}else{let o=gG.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new g3(o.tree,o.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(g5(s,t,n,!1))}}return i?ve(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&y.IncludeAnonymous)>0;for(let e=this.cursor(o|y.IncludeAnonymous);;){let o=!1;if(e.from<=i&&e.to>=r&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:vs(gK.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new gJ(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new gJ(gK.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=1024,reused:o=[],minRepeatType:s=r.types.length}=e,a=Array.isArray(n)?new g0(n,n.length):n,l=r.types,u=0,c=0;function h(e,t,n,i,o,s,a,l,u){let c=[],h=[];for(;e.length>i;)c.push(e.pop()),h.push(t.pop()+n-o);e.push(d(r.types[a],c,h,s-o,l-s,u)),t.push(o-n)}function d(e,t,n,r,i,o,s){if(o){let e=[gq.contextHash,o];s=s?[e].concat(s):[e]}if(i>25){let e=[gq.lookAhead,i];s=s?[e].concat(s):[e]}return new gJ(e,t,n,r,s)}let f=[],p=[];for(;a.pos>0;)!function e(t,n,f,p,m,g){let{id:v,start:y,end:b,size:x}=a,w=c,S=u;if(x<0){if(a.next(),-1==x){let e=o[v];f.push(e),p.push(y-t);return}if(-3==x){u=v;return}if(-4==x){c=v;return}else throw RangeError(`Unrecognized record size: ${x}`)}let C=l[v],A,k,M=y-t;if(b-y<=i&&(k=function(e,t){let n=a.fork(),r=0,o=0,l=0,u=n.end-i,c={size:0,start:0,skip:0};t:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){c.size=r,c.start=o,c.skip=l,l+=4,r+=4,n.next();continue}let a=n.pos-e;if(e<0||a<i||n.start<u)break;let h=4*(n.id>=s),d=n.start;for(n.next();n.pos>a;){if(n.size<0)if(-3==n.size||-4==n.size)h+=4;else break t;else n.id>=s&&(h+=4);n.next()}o=d,r+=e,l+=h}return(t<0||r==e)&&(c.size=r,c.start=o,c.skip=l),c.size>4?c:void 0}(a.pos-n,m))){let e=new Uint16Array(k.size-k.skip),n=a.pos-k.size,i=e.length;for(;a.pos>n;)i=function e(t,n,r){let{id:i,start:o,end:l,size:h}=a;if(a.next(),h>=0&&i<s){let s=r;if(h>4){let i=a.pos-(h-4);for(;a.pos>i;)r=e(t,n,r)}n[--r]=s,n[--r]=l-t,n[--r]=o-t,n[--r]=i}else -3==h?u=i:-4==h&&(c=i);return r}(k.start,e,i);A=new g1(e,b-k.start,r),M=k.start-t}else{let t=a.pos-x;a.next();let n=[],o=[],l=v>=s?v:-1,u=0,c=b;for(;a.pos>t;)l>=0&&a.id==l&&a.size>=0?(a.end<=c-i&&(h(n,o,y,u,a.end,c,l,w,S),u=n.length,c=a.end),a.next()):g>2500?function(e,t,n,o){let s=[],l=0,u=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:r}=a;if(r>4)a.next();else if(u>-1&&t<u)break;else u<0&&(u=n-i),s.push(e,t,n),l++,a.next()}if(l){let t=new Uint16Array(4*l),i=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-i,t[n++]=s[e+2]-i,t[n++]=n;n.push(new g1(t,s[2]-i,r)),o.push(i-e)}}(y,t,n,o):e(y,t,n,o,l,g+1);if(l>=0&&u>0&&u<n.length&&h(n,o,y,u,y,c,l,w,S),n.reverse(),o.reverse(),l>-1&&u>0){let e=function(e,t){return(n,r,i)=>{let o=0,s=n.length-1,a,l;if(s>=0&&(a=n[s])instanceof gJ){if(!s&&a.type==e&&a.length==i)return a;(l=a.prop(gq.lookAhead))&&(o=r[s]+a.length+l)}return d(e,n,r,i,o,t)}}(C,S);A=vs(C,n,o,0,n.length,0,b-y,e,e)}else A=d(C,n,o,b-y,w-b,S)}f.push(A),p.push(M)}(e.start||0,e.bufferStart||0,f,p,-1,0);let m=null!=(t=e.length)?t:f.length?p[0]+f[0].length:0;return new gJ(l[e.topID],f.reverse(),p.reverse(),m)}(e)}}gJ.empty=new gJ(gK.none,[],[],0);class g0{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new g0(this.buffer,this.index)}}class g1{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return gK.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),n==(e+=4))return i;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,t,n,r,i){let{buffer:o}=this,s=-1;for(let a=e;a!=t&&(!g2(i,r,o[a+1],o[a+2])||(s=a,!(n>0)));a=o[a+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),o=0;for(let s=e,a=0;s<t;){i[a++]=r[s++],i[a++]=r[s++]-n;let t=i[a++]=r[s++]-n;i[a++]=r[s++]-e,o=Math.max(o,t)}return new g1(i,o,this.set)}}function g2(e,t,n,r){switch(e){case -2:return n<t;case -1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function g5(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof g3&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=r?0:y.IgnoreOverlays;if(r)for(let r=e,s=r.parent;s;s=(r=s).parent)r instanceof g3&&r.index<0&&(null==(i=s.enter(t,n,o))?void 0:i.from)!=r.from&&(e=s);for(;;){let r=e.enter(t,n,o);if(!r)return e;e=r}}class g4{cursor(e=0){return new vn(this,e)}getChild(e,t=null,n=null){let r=g6(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return g6(this,e,t,n)}resolve(e,t=0){return g5(this,e,t,!1)}resolveInner(e,t=0){return g5(this,e,t,!0)}matchContext(e){return g8(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class g3 extends g4{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,i=0){for(let o=this;;){for(let{children:s,positions:a}=o._tree,l=t>0?s.length:-1;e!=l;e+=t){let l=s[e],u=a[e]+o.from,c;if(i&y.EnterBracketed&&l instanceof gJ&&(c=gG.get(l))&&!c.overlay&&c.bracketed&&n>=u&&n<=u+l.length||g2(r,n,u,u+l.length)){if(l instanceof g1){if(i&y.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-u,r);if(s>-1)return new g7(new g9(o,l,e,u),null,s)}else if(i&y.IncludeAnonymous||!l.type.isAnonymous||vr(l)){let s;if(!(i&y.IgnoreMounts)&&(s=gG.get(l))&&!s.overlay)return new g3(s.tree,u,e,o);let a=new g3(l,u,e,o);return i&y.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,r,i)}}}if(i&y.IncludeAnonymous||!o.type.isAnonymous||(e=o.index>=0?o.index+t:t<0?-1:o._parent._tree.children.length,!(o=o._parent)))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&y.IgnoreOverlays)&&(r=gG.get(this._tree))&&r.overlay){let i=e-this.from,o=n&y.EnterBracketed&&r.bracketed;for(let{from:e,to:n}of r.overlay)if((t>0||o?e<=i:e<i)&&(t<0||o?n>=i:n>i))return new g3(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function g6(e,t,n,r){let i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return o}for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function g8(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class g9{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class g7 extends g4{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new g7(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&y.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new g7(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new g7(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new g7(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new gJ(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ve(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof g3&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new vt(i,n)}class vt{constructor(e,t){this.heads=e,this.node=t}get next(){return ve(this.heads)}}class vn{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~y.EnterBracketed,e instanceof g3)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return!!e&&(e instanceof g3?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&y.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&y.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&y.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&y.IncludeAnonymous||e instanceof g1||!e.type.isAnonymous||vr(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)t:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break t}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new g7(this.buffer,t,this.stack[e]);return this.bufferNode=new g7(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return g8(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return g8(this._tree,e,r);let o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function vr(e){return e.children.some(e=>e instanceof g1||!e.type.isAnonymous||vr(e))}let vi=new WeakMap;function vo(e,t){if(!e.isAnonymous||t instanceof g1||t.type!=e)return 1;let n=vi.get(t);if(null==n){for(let r of(n=1,t.children)){if(r.type!=e||!(r instanceof gJ)){n=1;break}n+=vo(e,r)}vi.set(t,n)}return n}function vs(e,t,n,r,i,o,s,a,l){let u=0;for(let n=r;n<i;n++)u+=vo(e,t[n]);let c=Math.ceil(1.5*u/8),h=[],d=[];return!function t(n,r,i,s,a){for(let u=i;u<s;){let i=u,f=r[u],p=vo(e,n[u]);for(u++;u<s;u++){let t=vo(e,n[u]);if(p+t>=c)break;p+=t}if(u==i+1){if(p>c){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+a);continue}h.push(n[i])}else{let t=r[u-1]+n[u-1].length-f;h.push(vs(e,n,r,i,u,f,t,null,l))}d.push(f+a-o)}}(t,n,r,i,0),(a||l)(h,d,s)}class va{constructor(e,t,n,r,i=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|2*!!o}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new va(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,o=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let u=s<t.length?t[s]:null,c=u?u.fromA:1e9;if(c-a>=n)for(;o&&o.from<c;){let t=o;if(a>=t.from||c<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,c)-l;t=e>=n?null:new va(e,n,t.tree,t.offset+l,s>0,!!u)}if(t&&r.push(t),o.to>c)break;o=i<e.length?e[i++]:null}if(!u)break;a=u.toA,l=u.toA-u.toB}return r}}class vl{startParse(e,t,n){return"string"==typeof e&&(e=new vu(e)),n=n?n.length?n.map(e=>new gU(e.from,e.to)):[new gU(0,0)]:[new gU(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class vu{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new gq({perNode:!0});class vc{constructor(e,t,n,r,i,o,s,a,l,u=0,c){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=o,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=u,this.parent=c}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new vc(e,[],t,n,n,0,[],0,r?new vh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=65535&e,{parser:i}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),s=i.dynamicPrecedence(r);if(s&&(this.score+=s),0==n){r<i.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(i.getGoto(this.state,r,!0),this.reducePos),r<i.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let a=this.stack.length-(n-1)*3-(262144&e?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from;r<i.minRepeatTerm&&l==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-l;u>=2e3&&!(null==(t=this.p.parser.nodeSet.types[r])?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=u));let c=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-c;if(r<i.minRepeatTerm||131072&e){let e=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,l,e,h+4,!0)}if(262144&e)this.state=this.stack[a];else{let e=this.stack[a-3];this.state=i.getGoto(e,r,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,t,n,r=4,i=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&0==this.buffer[e-4]&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(i&&this.pos!=n){let i=this.buffer.length;if(i>0&&(0!=this.buffer[i-4]||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}else this.buffer.push(e,t,n,r)}shift(e,t,n,r){if(131072&e)this.pushState(65535&e,this.pos);else if((262144&e)==0){let{parser:i}=this.p;this.pos=r;let o=i.stateFlag(e,1);!o&&(r>n||t<=i.maxNode)&&(this.reducePos=r),this.pushState(e,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=i.maxNode&&this.buffer.push(t,n,r,4)}else this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4)}apply(e,t,n,r){65536&e?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&0==e.buffer[t-4]&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new vc(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new vd(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if((65536&n)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>1&t&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((65536&t)==0)return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=65535&t,i=this.stack.length-3*n;if(i<0||0>e.getGoto(this.stack[i],r,!1)){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(393216&t);else if(65536&t){let n=(t>>19)-i;if(n>1){let r=65535&t,i=this.stack.length-3*n;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(null!=e)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new vh(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead)&&(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class vh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class vd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e>>19;0==t?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(t-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],65535&e,!0);this.state=n}}class vf{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new vf(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new vf(this.stack,this.pos,this.index)}}function vp(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let r=0,i=0;r<e.length;){let o=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(126==t){o=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),o+=i,n)break;o*=46}n?n[i++]=o:n=new t(o)}return n}class vm{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}let vg=new vm;class vv{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=vg,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(null==t)return -1;if((n=t)>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=vg,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class vy{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;vb(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}function vb(e,t,n,r,i,o){let s=0,a=1<<r,{dialect:l}=n.p.parser;t:for(;(a&e[s])!=0;){let n=e[s+1];for(let r=s+3;r<n;r+=2)if((e[r+1]&a)>0){let n=e[r];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||function(e,t,n,r){let i=vx(n,r,t);return i<0||vx(n,r,e)<i}(n,t.token.value,i,o))){t.acceptToken(n);break}}let r=t.next,u=0,c=e[s+2];if(t.next<0&&c>u&&65535==e[n+3*c-3]){s=e[n+3*c-1];continue}for(;u<c;){let i=u+c>>1,o=n+i+(i<<1),a=e[o],l=e[o+1]||65536;if(r<a)c=i;else if(r>=l)u=i+1;else{s=e[o+2],t.advance();continue t}}break}}function vx(e,t,n){for(let r=t,i;65535!=(i=e[r]);r++)if(i==n)return r-t;return -1}vy.prototype.contextual=vy.prototype.fallback=vy.prototype.extend=!1,(class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?vp(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(vb(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(!n&&r++,null==i)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}).prototype.contextual=vy.prototype.fallback=vy.prototype.extend=!1;let vw="u">typeof process&&process.env&&/\bparse\b/.test(process.env.LOG),vS=null;function vC(e,t,n){let r=e.cursor(y.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}class vA{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?vC(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?vC(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],o=this.start[t]+n.positions[r];if(o>e)return this.nextStart=o,null;if(i instanceof gJ){if(o==e){if(o<this.safeFrom)return null;let e=o+i.length;if(e<=this.safeTo){let t=i.prop(gq.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+i.length}}}class vk{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new vm)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,o=r.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let r=0;r<i.length;r++){if((1<<r&o)==0)continue;let l=i[r],u=this.tokens[r];if((!n||l.fallback)&&((l.contextual||u.start!=e.pos||u.mask!=o||u.context!=s)&&(this.updateCachedToken(u,l,e),u.mask=o,u.context=s),u.lookAhead>u.end+25&&(a=Math.max(u.lookAhead,a)),0!=u.value)){let r=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!l.extend&&(n=u,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||((n=new vm).value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new vm,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){(1&i)==0?e.value=i>>1:e.extended=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:o}=e.p,{data:s}=o;for(let e=0;e<2;e++)for(let a=o.stateSlot(i,e?2:1);;a+=3){if(65535==s[a])if(1==s[a+1])a=vO(s,a+2);else{0==r&&2==s[a+1]&&(r=this.putAction(vO(s,a+2),t,n,r));break}s[a]==t&&(r=this.putAction(vO(s,a+1),t,n,r))}return r}}class vM{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new vv(t,r),this.tokens=new vk(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[vc.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>4*e.bufferLength?new vA(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,r=this.minStackPos,i=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<n.length;o++){let s=n[o];for(;;){if(this.tokens.mainToken=null,s.pos>r)i.push(s);else{if(this.advanceStack(s,i,n))continue;e||(e=[],t=[]),e.push(s);let r=this.tokens.getMainToken(s);t.push(r.value,r.end)}break}}if(!i.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return vw&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw vw&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,i);if(n)return vw&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(i.length>e)for(i.sort((e,t)=>t.score-e.score);i.length>e;)i.pop();i.some(e=>e.reducePos>r)&&this.recovering--}else if(i.length>1){n:for(let e=0;e<i.length-1;e++){let t=i[e];for(let n=e+1;n<i.length;n++){let r=i[n];if(t.sameState(r)||t.buffer.length>500&&r.buffer.length>500)if((t.score-r.score||t.buffer.length-r.buffer.length)>0)i.splice(n--,1);else{i.splice(e--,1);continue n}}}i.length>12&&(i.sort((e,t)=>t.score-e.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let e=1;e<i.length;e++)i[e].pos<this.minStackPos&&(this.minStackPos=i[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,o=vw?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(r);s;){let r=this.parser.nodeSet.types[s.type.id]==s.type?i.getGoto(e.state,s.type.id):-1;if(r>-1&&s.length&&(!t||(s.prop(gq.contextHash)||0)==n))return e.useNode(s,r),vw&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(s.type.id)})`),!0;if(!(s instanceof gJ)||0==s.children.length||s.positions[0]>0)break;let a=s.children[0];if(a instanceof gJ&&0==s.positions[0])s=a;else break}}let s=i.stateSlot(e.state,4);if(s>0)return e.reduce(s),vw&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let s=0;s<a.length;){let l=a[s++],u=a[s++],c=a[s++],h=s==a.length||!n,d=h?e:e.split(),f=this.tokens.mainToken;if(d.apply(l,u,f?f.start:d.pos,c),vw&&console.log(o+this.stackID(d)+` (via ${(65536&l)==0?"shift":`reduce of ${i.getName(65535&l)}`} for ${i.getName(u)} @ ${r}${d==e?"":", split"})`),h)return!0;d.pos>r?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return vT(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=t[o<<1],l=t[(o<<1)+1],u=vw?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),vw&&console.log(u+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let c=s.split(),h=u;for(let e=0;e<10&&c.forceReduce()&&(vw&&console.log(h+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,n));e++)vw&&(h=this.stackID(c)+" -> ");for(let e of s.recoverByInsert(a))vw&&console.log(u+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),vw&&console.log(u+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),vT(s,n)):(!r||r.score<c.score)&&(r=c)}return r}stackToTree(e){return e.close(),gJ.build({buffer:vf.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(vS||(vS=new WeakMap)).get(e);return t||vS.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function vT(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}class vD{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class vE extends vl{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=gq[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let o=t[n+-r];for(let s=-r;s>0;s--)i(t[n++],e,o);n++}}}this.nodeSet=new gZ(t.map((t,i)=>gK.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:0==i,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=vp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(vR),this.states=vp(e.states,Uint32Array),this.data=vp(e.stateData),this.goto=vp(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new vy(o,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new vM(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return -1;for(let i=r[t+1];;){let t=r[i++],o=1&t,s=r[i++];if(o&&n)return s;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return s;if(o)return -1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),o;;i+=3){if(65535==(o=n[i]))if(1==n[i+1])o=n[i=vO(n,i+2)];else if(2==n[i+1])return vO(n,i+2);else break;if(o==t||0==o)return vO(n,i+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==r;n+=3){if(65535==this.data[n])if(1==this.data[n+1])n=vO(this.data,n+2);else break;r=t(vO(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n])if(1==this.data[n+1])n=vO(this.data,n+2);else break;if((1&this.data[n+2])==0){let e=this.data[n+1];t.some((t,n)=>1&n&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(vE.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let i=e.specializers.find(e=>e.from==n.external);if(!i)return n;let o=Object.assign(Object.assign({},n),{external:i.to});return t.specializers[r]=vR(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(" ")){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;65535!=(i=this.data[n++]);)(r||(r=new Uint8Array(this.maxTerm+1)))[i]=1;return new vD(e,n,r)}static deserialize(e){return new vE(e)}}function vO(e,t){return e[t]|e[t+1]<<16}function vR(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}let vI=0;class vP{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=vI++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){if(e instanceof vP&&(t=e),null==t?void 0:t.base)throw Error("Can not derive from a modified tag");let n=new vP("string"==typeof e?e:"?",[],null,[]);if(n.set.push(n),t)for(let e of t.set)n.set.push(e);return n}static defineModifier(e){let t=new vL(e);return e=>e.modified.indexOf(t)>-1?e:vL.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let vN=0;class vL{constructor(e){this.name=e,this.instances=[],this.id=vN++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{var r,i;return n.base==e&&(r=t,i=n.modified,r.length==i.length&&r.every((e,t)=>e==i[t]))});if(n)return n;let r=[],i=new vP(e.name,r,e,t);for(let e of t)e.instances.push(i);let o=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)r.push(vL.get(t,e));return i}}function vj(e){let t=Object.create(null);for(let n in e){let r=e[n];for(let e of(Array.isArray(r)||(r=[r]),n.split(" ")))if(e){let n=[],i=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!r)throw RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),(t+=r[0].length)==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){i=0;break}if("/"!=s)throw RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw RangeError("Invalid path: "+e);let l=new vB(r,i,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return vF.add(t)}let vF=new gq({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let o=new vB(i.tags,i.mode,i.context);n?n.next=o:r=o,n=o}return r}});class vB{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function v_(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}vB.empty=new vB([],2,null);class vz{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:o,from:s,to:a}=e;if(s>=n||a<=t)return;o.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(o)));let l=r,u=function(e){let t=e.type.prop(vF);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||vB.empty,c=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(i,u.tags);if(c&&(l&&(l+=" "),l+=c,1==u.mode&&(r+=(r?" ":"")+c)),this.startSpan(Math.max(t,s),l),u.opaque)return;let h=e.tree&&e.tree.prop(gq.mounted);if(h&&h.overlay){let o=e.node.enter(h.overlay[0].from+s,1),u=this.highlighters.filter(e=>!e.scope||e.scope(h.tree.type)),c=e.firstChild();for(let d=0,f=s;;d++){let p=d<h.overlay.length?h.overlay[d]:null,m=p?p.from+s:a,g=Math.max(t,f),v=Math.min(n,m);if(g<v&&c)for(;e.from<v&&(this.highlightRange(e,g,v,r,i),this.startSpan(Math.min(v,e.to),l),!(e.to>=m)&&e.nextSibling()););if(!p||m>n)break;(f=p.to+s)>t&&(this.highlightRange(o.cursor(),Math.max(t,p.from+s),Math.min(n,f),"",u),this.startSpan(Math.min(n,f),l))}c&&e.parent()}else if(e.firstChild()){h&&(r="");do{if(e.to<=t)continue;if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),l)}while(e.nextSibling());e.parent()}}}let vV=vP.define,vH=vV(),v$=vV(),vW=vV(v$),vU=vV(v$),vq=vV(),vG=vV(vq),vY=vV(vq),vK=vV(),vZ=vV(vK),vX=vV(),vQ=vV(),vJ=vV(),v0=vV(vJ),v1=vV(),v2={comment:vH,lineComment:vV(vH),blockComment:vV(vH),docComment:vV(vH),name:v$,variableName:vV(v$),typeName:vW,tagName:vV(vW),propertyName:vU,attributeName:vV(vU),className:vV(v$),labelName:vV(v$),namespace:vV(v$),macroName:vV(v$),literal:vq,string:vG,docString:vV(vG),character:vV(vG),attributeValue:vV(vG),number:vY,integer:vV(vY),float:vV(vY),bool:vV(vq),regexp:vV(vq),escape:vV(vq),color:vV(vq),url:vV(vq),keyword:vX,self:vV(vX),null:vV(vX),atom:vV(vX),unit:vV(vX),modifier:vV(vX),operatorKeyword:vV(vX),controlKeyword:vV(vX),definitionKeyword:vV(vX),moduleKeyword:vV(vX),operator:vQ,derefOperator:vV(vQ),arithmeticOperator:vV(vQ),logicOperator:vV(vQ),bitwiseOperator:vV(vQ),compareOperator:vV(vQ),updateOperator:vV(vQ),definitionOperator:vV(vQ),typeOperator:vV(vQ),controlOperator:vV(vQ),punctuation:vJ,separator:vV(vJ),bracket:v0,angleBracket:vV(v0),squareBracket:vV(v0),paren:vV(v0),brace:vV(v0),content:vK,heading:vZ,heading1:vV(vZ),heading2:vV(vZ),heading3:vV(vZ),heading4:vV(vZ),heading5:vV(vZ),heading6:vV(vZ),contentSeparator:vV(vK),list:vV(vK),quote:vV(vK),emphasis:vV(vK),strong:vV(vK),link:vV(vK),monospace:vV(vK),strikethrough:vV(vK),inserted:vV(),deleted:vV(),changed:vV(),invalid:vV(),meta:v1,documentMeta:vV(v1),annotation:vV(v1),processingInstruction:vV(v1),definition:vP.defineModifier("definition"),constant:vP.defineModifier("constant"),function:vP.defineModifier("function"),standard:vP.defineModifier("standard"),local:vP.defineModifier("local"),special:vP.defineModifier("special")};for(let e in v2){let t=v2[e];t instanceof vP&&(t.name=e)}v_([{tag:v2.link,class:"tok-link"},{tag:v2.heading,class:"tok-heading"},{tag:v2.emphasis,class:"tok-emphasis"},{tag:v2.strong,class:"tok-strong"},{tag:v2.keyword,class:"tok-keyword"},{tag:v2.atom,class:"tok-atom"},{tag:v2.bool,class:"tok-bool"},{tag:v2.url,class:"tok-url"},{tag:v2.labelName,class:"tok-labelName"},{tag:v2.inserted,class:"tok-inserted"},{tag:v2.deleted,class:"tok-deleted"},{tag:v2.literal,class:"tok-literal"},{tag:v2.string,class:"tok-string"},{tag:v2.number,class:"tok-number"},{tag:[v2.regexp,v2.escape,v2.special(v2.string)],class:"tok-string2"},{tag:v2.variableName,class:"tok-variableName"},{tag:v2.local(v2.variableName),class:"tok-variableName tok-local"},{tag:v2.definition(v2.variableName),class:"tok-variableName tok-definition"},{tag:v2.special(v2.variableName),class:"tok-variableName2"},{tag:v2.definition(v2.propertyName),class:"tok-propertyName tok-definition"},{tag:v2.typeName,class:"tok-typeName"},{tag:v2.namespace,class:"tok-namespace"},{tag:v2.className,class:"tok-className"},{tag:v2.macroName,class:"tok-macroName"},{tag:v2.propertyName,class:"tok-propertyName"},{tag:v2.operator,class:"tok-operator"},{tag:v2.comment,class:"tok-comment"},{tag:v2.meta,class:"tok-meta"},{tag:v2.invalid,class:"tok-invalid"},{tag:v2.punctuation,class:"tok-punctuation"}]);let v5=vj({String:v2.string,Number:v2.number,"True False":v2.bool,PropertyName:v2.propertyName,Null:v2.null,", :":v2.separator,"[ ]":v2.squareBracket,"{ }":v2.brace}),v4=vE.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[v5],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),v3=[],v6=[],v8="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<v8.length;e++)(e%2?v6:v3).push(t+=v8[e]);function v9(e){return e>=127462&&e<=127487}function v7(e,t,n){if(t==e.length)return t;t&&yt(e.charCodeAt(t))&&yn(e.charCodeAt(t-1))&&t--;let r=ye(e,t);for(t+=yr(r);t<e.length;){let i=ye(e,t);if(8205==r||8205==i||n&&function(e){if(e<768)return!1;for(let t=0,n=v3.length;;){let r=t+n>>1;if(e<v3[r])n=r;else{if(!(e>=v6[r]))return!0;t=r+1}if(t==n)return!1}}(i))t+=yr(i),r=i;else if(v9(i)){let n=0,r=t-2;for(;r>=0&&v9(ye(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function ye(e,t){let n=e.charCodeAt(t);if(!yn(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return yt(r)?(n-55296<<10)+(r-56320)+65536:n}function yt(e){return e>=56320&&e<57344}function yn(e){return e>=55296&&e<56320}function yr(e){return e<65536?1:2}class yi{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=yd(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),ys.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=yd(this,e,t);let n=[];return this.decompose(e,t,n,0),ys.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new yl(this),i=new yl(e);for(let e=t,o=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(o+=r.value.length,r.done||o>=n)return!0}}iter(e=1){return new yl(this,e)}iterRange(e,t=this.length){return new yu(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new yc(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(0==e.length)throw RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new yo(e):ys.from(yo.split(e,[])):yi.empty}}class yo extends yi{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.text[i],s=r+o.length;if((t?n:s)>=e)return new yh(r,s,n,o);r=s+1,n++}}decompose(e,t,n,r){var i;let o=e<=0&&t>=this.length?this:new yo((i=this.text,ya(i,[""],e,t)),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=ya(o.text,e.text.slice(),0,o.length);if(t.length<=32)n.push(new yo(t,e.length+o.length));else{let e=t.length>>1;n.push(new yo(t.slice(0,e)),new yo(t.slice(e)))}}else n.push(o)}replace(e,t,n){var r;if(!(n instanceof yo))return super.replace(e,t,n);[e,t]=yd(this,e,t);let i=ya(this.text,ya(n.text,(r=this.text,ya(r,[""],0,e))),t),o=this.length+n.length-(t-e);return i.length<=32?new yo(i,o):ys.from(yo.split(i,[]),o)}sliceString(e,t=this.length,n="\n"){[e,t]=yd(this,e,t);let r="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let s=this.text[o],a=i+s.length;i>e&&o&&(r+=n),e<a&&t>i&&(r+=s.slice(Math.max(0,e-i),t-i)),i=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let i of e)n.push(i),r+=i.length+1,32==n.length&&(t.push(new yo(n,r)),n=[],r=-1);return r>-1&&t.push(new yo(n,r)),t}}class ys extends yi{constructor(e,t){for(let n of(super(),this.children=e,this.length=t,this.lines=0,e))this.lines+=n.lines}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.children[i],s=r+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,r);r=s+1,n=a+1}}decompose(e,t,n,r){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e<=a&&t>=o){let i=r&(o<=e|2*(a>=t));o>=e&&a<=t&&!i?n.push(s):s.decompose(e-o,t-o,n,i)}o=a+1}}replace(e,t,n){if([e,t]=yd(this,e,t),n.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],s=i+o.length;if(e>=i&&t<=s){let a=o.replace(e-i,t-i,n),l=this.lines-o.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let i=this.children.slice();return i[r]=a,new ys(i,this.length-(t-e)+n.length)}return super.replace(i,s,a)}i=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=yd(this,e,t);let r="";for(let i=0,o=0;i<this.children.length&&o<=t;i++){let s=this.children[i],a=o+s.length;o>e&&i&&(r+=n),e<a&&t>o&&(r+=s.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ys))return 0;let n=0,[r,i,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,i+=t){if(r==o||i==s)return n;let a=this.children[r],l=e.children[i];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new yo(n,t)}let r=Math.max(32,n>>5),i=r<<1,o=r>>1,s=[],a=0,l=-1,u=[];function c(){0!=a&&(s.push(1==u.length?u[0]:ys.from(u,l)),l=-1,a=u.length=0)}for(let t of e)!function e(t){let n;if(t.lines>i&&t instanceof ys)for(let n of t.children)e(n);else t.lines>o&&(a>o||!a)?(c(),s.push(t)):t instanceof yo&&a&&(n=u[u.length-1])instanceof yo&&t.lines+n.lines<=32?(a+=t.lines,l+=t.length+1,u[u.length-1]=new yo(n.text.concat(t.text),n.length+1+t.length)):(a+t.lines>r&&c(),a+=t.lines,l+=t.length+1,u.push(t))}(t);return c(),1==s.length?s[0]:new ys(s,t)}}function ya(e,t,n=0,r=1e9){for(let i=0,o=0,s=!0;o<e.length&&i<=r;o++){let a=e[o],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(t[t.length-1]+=a,s=!1):t.push(a)),i=l+1}return t}yi.empty=new yo([""],0);class yl{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof yo?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,s=r instanceof yo?r.text.length:r.children.length;if(o==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof yo){let i=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[o+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof yo?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class yu{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new yl(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class yc{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"u">typeof Symbol&&(yi.prototype[Symbol.iterator]=function(){return this.iter()},yl.prototype[Symbol.iterator]=yu.prototype[Symbol.iterator]=yc.prototype[Symbol.iterator]=function(){return this});class yh{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function yd(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function yf(e,t,n=!0,r=!0){return function(e,t,n=!0,r=!0){return(n?v7:function(e,t,n){for(;t>1;){let r=v7(e,t-2,n);if(r<t)return r;t--}return 0})(e,t,r)}(e,t,n,r)}function yp(e,t){let n=e.charCodeAt(t);if(!(n>=55296&&n<56320)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return r>=56320&&r<57344?(n-55296<<10)+(r-56320)+65536:n}function ym(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(((e-=65536)>>10)+55296,(1023&e)+56320)}function yg(e){return e<65536?1:2}let yv=/\r\n?|\n/;var yy=((d=yy||(yy={}))[d.Simple=0]="Simple",d[d.TrackDel=1]="TrackDel",d[d.TrackBefore=2]="TrackBefore",d[d.TrackAfter=3]="TrackAfter",d);class yb{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,i),r+=i):r+=o,n+=i}}iterChangedRanges(e,t=!1){yC(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new yb(e)}composeDesc(e){return this.empty?e:e.empty?this:yk(this,e)}mapDesc(e,t=!1){return e.empty?this:yA(this,e,t)}mapPos(e,t=-1,n=yy.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=r+s;if(a<0){if(l>e)return i+(e-r);i+=s}else{if(n!=yy.Simple&&l>=e&&(n==yy.TrackDel&&r<e&&l>e||n==yy.TrackBefore&&r<e||n==yy.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==r||t<0?i:i+a;i+=a}r=l}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],o=this.sections[n++],s=r+i;if(o>=0&&r<=t&&s>=e)return!(r<e)||!(s>t)||"cover";r=s}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw RangeError("Invalid JSON representation of ChangeDesc");return new yb(e)}static create(e){return new yb(e)}}class yx extends yb{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return yC(this,(t,n,r,i,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return yA(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,i=0;r<t.length;r+=2){let o=t[r],s=t[r+1];if(s>=0){t[r]=s,t[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(yi.empty);n.push(o?e.slice(i,i+o):yi.empty)}i+=o}return new yx(t,n)}compose(e){return this.empty?e:e.empty?this:yk(this,e,!0)}map(e,t=!1){return e.empty?this:yA(this,e,t,!0)}iterChanges(e,t=!1){yC(this,e,t)}get desc(){return yb.create(this.sections)}filter(e){let t=[],n=[],r=[],i=new yM(this);r:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==i.len;){if(i.done)break r;let e=Math.min(i.len,a-s);yw(r,e,-1);let o=-1==i.ins?-1:0==i.off?i.ins:0;yw(t,e,o),o>0&&yS(n,t,i.text),i.forward(e),s+=e}let l=e[o++];for(;s<l;){if(i.done)break r;let e=Math.min(i.len,l-s);yw(t,e,-1),yw(r,e,-1==i.ins?-1:0==i.off?i.ins:0),i.forward(e),s+=e}}return{changes:new yx(t,n),filtered:yb.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):0==r?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],i=[],o=0,s=null;function a(e=!1){if(!e&&!r.length)return;o<t&&yw(r,t-o,-1);let n=new yx(r,i);s=s?s.compose(n.map(s)):n,r=[],i=[],o=0}return!function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof yx){if(l.length!=t)throw RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),s=s?s.compose(l.map(s)):l}else{let{from:e,to:s=e,insert:u}=l;if(e>s||e<0||s>t)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let c=u?"string"==typeof u?yi.of(u.split(n||yv)):u:yi.empty,h=c.length;if(e==s&&0==h)return;e<o&&a(),e>o&&yw(r,e-o,-1),yw(r,s-e,h),yS(i,r,c),o=s}}(e),a(!s),s}static empty(e){return new yx(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if("number"==typeof i)t.push(i,-1);else if(!Array.isArray(i)||"number"!=typeof i[0]||i.some((e,t)=>t&&"string"!=typeof e))throw RangeError("Invalid JSON representation of ChangeSet");else if(1==i.length)t.push(i[0],0);else{for(;n.length<r;)n.push(yi.empty);n[r]=yi.of(i.slice(1)),t.push(i[0],n[r].length)}}return new yx(t,n)}static createSet(e,t){return new yx(e,t)}}function yw(e,t,n,r=!1){if(0==t&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function yS(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(yi.empty);e.push(n)}}function yC(e,t,n){let r=e.inserted;for(let i=0,o=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)i+=a,o+=a;else{let u=i,c=o,h=yi.empty;for(;u+=a,c+=l,l&&r&&(h=h.append(r[s-2>>1])),!n&&s!=e.sections.length&&!(e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(i,u,o,c,h),i=u,o=c}}}function yA(e,t,n,r=!1){let i=[],o=r?[]:null,s=new yM(e),a=new yM(t);for(let e=-1;;)if(s.done&&a.len||a.done&&s.len)throw Error("Mismatched change set lengths");else if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);yw(i,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(yw(i,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(yw(i,0,s.ins),o&&yS(o,i,s.text),e=s.i),s.forward(n),t-=n}a.next()}else if(s.ins>=0){let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else if(0==a.ins&&a.len<n)n-=a.len,a.next();else break;yw(i,t,e<s.i?s.ins:0),o&&e<s.i&&yS(o,i,s.text),e=s.i,s.forward(s.len-n)}else if(s.done&&a.done)return o?yx.createSet(i,o):yb.create(i);else throw Error("Mismatched change set lengths")}function yk(e,t,n=!1){let r=[],i=n?[]:null,o=new yM(e),s=new yM(t);for(let e=!1;;)if(o.done&&s.done)return i?yx.createSet(r,i):yb.create(r);else if(0==o.ins)yw(r,o.len,0,e),o.next();else if(0!=s.len||s.done)if(o.done||s.done)throw Error("Mismatched change set lengths");else{let t=Math.min(o.len2,s.len),n=r.length;if(-1==o.ins){let n=-1==s.ins?-1:s.off?0:s.ins;yw(r,t,n,e),i&&n&&yS(i,r,s.text)}else -1==s.ins?(yw(r,o.off?0:o.len,t,e),i&&yS(i,r,o.textBit(t))):(yw(r,o.off?0:o.len,s.off?0:s.ins,e),i&&!s.off&&yS(i,r,s.text));e=(o.ins>t||s.ins>=0&&s.len>t)&&(e||r.length>n),o.forward2(t),s.forward(t)}else yw(r,0,s.ins,e),i&&yS(i,r,s.text),s.next()}class yM{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return -2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?yi.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?yi.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class yT{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get undirectional(){return(64&this.flags)>0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new yT(n,r,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return yD.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return yD.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw RangeError("Invalid JSON representation for SelectionRange");return yD.range(e.anchor,e.head)}static create(e,t,n,r){return new yT(e,t,n,r)}}class yD{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:yD.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new yD([this.main],0)}addRange(e,t=!0){return yD.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,yD.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new yD(e.ranges.map(e=>yT.fromJSON(e)),e.main)}static single(e,t=e){return new yD([yD.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let i=e[r];if(i.empty?i.from<=n:i.from<n)return yD.normalized(e.slice(),t);n=i.to}return new yD(e,t)}static cursor(e,t=0,n,r){return yT.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let o=null==r?7:Math.min(6,r);return i||e==t||(i=t<e?1:-1),i&&(o|=i<0?8:16),t<e?yT.create(t,e,32|o,n):yT.create(e,t,o,n)}static undirectionalRange(e,t){return yT.create(e,t,64,void 0)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let r=e[n],i=e[n-1];if(r.empty?r.from<=i.to:r.from<i.to){let o=i.from,s=Math.max(r.to,i.to);n<=t&&t--,e.splice(--n,2,r.anchor>r.head?yD.range(s,o):yD.range(o,s))}}return new yD(e,t)}}function yE(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError("Selection points outside of document")}let yO=0;class yR{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=yO++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new yR(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(!e.combine?yI:(e,t)=>e===t),!!e.static,e.enables)}of(e){return new yP([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new yP(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new yP(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function yI(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class yP{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=yO++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,o=e[i]>>1,s=2==this.type,a=!1,l=!1,u=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:((null!=(t=e[n.id])?t:1)&1)==0&&u.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||yL(e,u)){let t=n(e);if(s?!yN(t,e.values[o],r):!r(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[i];if(null!=l){let i=yU(t,l);if(this.dependencies.every(n=>n instanceof yR?t.facet(n)===e.facet(n):!(n instanceof yF)||t.field(n,!1)==e.field(n,!1))||(s?yN(a=n(e),i,r):r(a=n(e),i)))return e.values[o]=i,0}else a=n(e);return e.values[o]=a,1}}}}function yN(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function yL(e,t){let n=!1;for(let r of t)1&yW(e,r)&&(n=!0);return n}let yj=yR.define({static:!0});class yF{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(e){let t=new yF(yO++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(yj).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(yj),i=n.facet(yj),o;return(o=r.find(e=>e.field==this))&&o!=i.find(e=>e.field==this)?(e.values[t]=o.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,yj.of({field:this,create:e})]}get extension(){return this}}function yB(e){return t=>new yz(t,e)}let y_={highest:yB(0),high:yB(1),default:yB(2),low:yB(3),lowest:yB(4)};class yz{constructor(e,t){this.inner=e,this.prec=t}}class yV{of(e){return new yH(this,e)}reconfigure(e){return yV.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class yH{constructor(e,t){this.compartment=e,this.inner=t}}class y${constructor(e,t,n,r,i,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){var r,i,o;let s,a,l=[],u=Object.create(null),c=new Map;for(let n of(r=e,i=t,o=c,s=[[],[],[],[],[]],a=new Map,!function e(t,n){let r=a.get(t);if(null!=r){if(r<=n)return;let e=s[r].indexOf(t);e>-1&&s[r].splice(e,1),t instanceof yH&&o.delete(t.compartment)}if(a.set(t,n),Array.isArray(t))for(let r of t)e(r,n);else if(t instanceof yH){if(o.has(t.compartment))throw RangeError("Duplicate use of compartment in extensions");let r=i.get(t.compartment)||t.inner;o.set(t.compartment,r),e(r,n)}else if(t instanceof yz)e(t.inner,t.prec);else if(t instanceof yF)s[n].push(t),t.provides&&e(t.provides,n);else if(t instanceof yP)s[n].push(t),t.facet.extensions&&e(t.facet.extensions,2);else{let r=t.extension;if(!r)throw Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(r,n)}}(r,2),s.reduce((e,t)=>e.concat(t))))n instanceof yF?l.push(n):(u[n.facet.id]||(u[n.facet.id]=[])).push(n);let h=Object.create(null),d=[],f=[];for(let e of l)h[e.id]=f.length<<1,f.push(t=>e.slot(t));let p=null==n?void 0:n.config.facets;for(let e in u){let t=u[e],r=t[0].facet,i=p&&p[e]||[];if(t.every(e=>0==e.type))if(h[r.id]=d.length<<1|1,yI(i,t))d.push(n.facet(r));else{let e=r.combine(t.map(e=>e.value));d.push(n&&r.compare(e,n.facet(r))?n.facet(r):e)}else{for(let e of t)0==e.type?(h[e.id]=d.length<<1|1,d.push(e.value)):(h[e.id]=f.length<<1,f.push(t=>e.dynamicSlot(t)));h[r.id]=f.length<<1,f.push(e=>(function(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),o=r.filter(e=>!(1&e)),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<r.length;t++){let o=yU(e,r[t]);if(2==i[t])for(let e of o)n.push(e);else n.push(o)}return t.combine(n)}return{create(e){for(let t of r)yW(e,t);return e.values[s]=a(e),1},update(e,n){if(!yL(e,o))return 0;let r=a(e);return t.compare(r,e.values[s])?0:(e.values[s]=r,1)},reconfigure(e,i){let o=yL(e,r),l=i.config.facets[t.id],u=i.facet(t);if(l&&!o&&yI(n,l))return e.values[s]=u,0;let c=a(e);return t.compare(c,u)?(e.values[s]=u,0):(e.values[s]=c,1)}}})(e,r,t))}}return new y$(e,c,f.map(e=>e(h)),h,d,u)}}function yW(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function yU(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}let yq=yR.define(),yG=yR.define({combine:e=>e.some(e=>e),static:!0}),yY=yR.define({combine:e=>e.length?e[0]:void 0,static:!0}),yK=yR.define(),yZ=yR.define(),yX=yR.define(),yQ=yR.define({combine:e=>!!e.length&&e[0]});class yJ{constructor(e,t){this.type=e,this.value=t}static define(){return new y0}}class y0{of(e){return new yJ(this,e)}}class y1{constructor(e){this.map=e}of(e){return new y2(this,e)}}class y2{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new y2(this.type,t)}is(e){return this.type==e}static define(e={}){return new y1(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}y2.reconfigure=y2.define(),y2.appendConfig=y2.define();class y5{constructor(e,t,n,r,i,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,n&&yE(n,t.newLength),i.some(e=>e.type==y5.time)||(this.annotations=i.concat(y5.time.of(Date.now())))}static create(e,t,n,r,i,o){return new y5(e,t,n,r,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(y5.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function y4(e,t,n){var r;let i,o,s;return n?(i=t.changes,o=yx.empty(t.changes.length),s=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(i)),{changes:s,selection:t.selection?t.selection.map(o):null==(r=e.selection)?void 0:r.map(i),effects:y2.mapEffects(e.effects,i).concat(y2.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function y3(e,t,n){let r=t.selection,i=y8(t.annotations);return t.userEvent&&(i=i.concat(y5.userEvent.of(t.userEvent))),{changes:t.changes instanceof yx?t.changes:yx.of(t.changes||[],n,e.facet(yY)),selection:r&&(r instanceof yD?r:yD.single(r.anchor,r.head)),effects:y8(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}y5.time=yJ.define(),y5.userEvent=yJ.define(),y5.addToHistory=yJ.define(),y5.remote=yJ.define();let y6=[];function y8(e){return null==e?y6:Array.isArray(e)?e:[e]}var y9=((f=y9||(y9={}))[f.Word=0]="Word",f[f.Space=1]="Space",f[f.Other=2]="Other",f);let y7=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{r=RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class be{constructor(e,t,n,r,i,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)yW(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null==n){if(t)throw RangeError("Field is not present in this state");return}return yW(this,n),yU(this,n)}update(...e){return function e(t,n,r){let i=y3(t,n.length?n[0]:{},t.doc.length);n.length&&!1===n[0].filter&&(r=!1);for(let e=1;e<n.length;e++){!1===n[e].filter&&(r=!1);let o=!!n[e].sequential;i=y4(i,y3(t,n[e],o?i.changes.newLength:t.doc.length),o)}let o=y5.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(yX),r=e;for(let i=n.length-1;i>=0;i--){let o=n[i](e);o&&Object.keys(o).length&&(r=y4(r,y3(t,o,e.changes.newLength),!0))}return r==e?e:y5.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(r?function(t){let n=t.startState,r=!0;for(let e of n.facet(yK)){let n=e(t);if(!1===n){r=!1;break}Array.isArray(n)&&(r=!0===r?n:function(e,t){let n=[];for(let r=0,i=0;;){let o,s;if(r<e.length&&(i==t.length||t[i]>=e[r]))o=e[r++],s=e[r++];else{if(!(i<t.length))return n;o=t[i++],s=t[i++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}(r,n))}if(!0!==r){let e,i;if(!1===r)i=t.changes.invertedDesc,e=yx.empty(n.doc.length);else{let n=t.changes.filter(r);e=n.changes,i=n.filtered.mapDesc(n.changes).invertedDesc}t=y5.create(n,e,t.selection&&t.selection.map(i),y2.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let i=n.facet(yZ);for(let r=i.length-1;r>=0;r--){let o=i[r](t);t=o instanceof y5?o:Array.isArray(o)&&1==o.length&&o[0]instanceof y5?o[0]:e(n,y8(o),!1)}return t}(o):o)}(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:r,compartments:i}=n;for(let t of e.effects)t.is(yV.reconfigure)?(n&&(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),n=null),i.set(t.value.compartment,t.value.extension)):t.is(y2.reconfigure)?(n=null,r=t.value):t.is(y2.appendConfig)&&(n=null,r=y8(r).concat(t.value));t=n?e.startState.values.slice():new be(n=y$.resolve(r,i,this),this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values;let o=e.startState.facet(yG)?e.newSelection:e.newSelection.asSingle();new be(n,e.newDoc,o,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:yD.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],o=y8(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(l);let u=r.mapDesc(a,!0);i.push(s.range.map(u)),r=r.compose(l),o=y2.mapEffects(o,l).concat(y2.mapEffects(y8(s.effects),u))}return{changes:r,selection:yD.create(i,t.mainIndex),effects:o}}changes(e=[]){return e instanceof yx?e:yx.of(e,this.doc.length,this.facet(be.lineSeparator))}toText(e){return yi.of(e.split(this.facet(be.lineSeparator)||yv))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(yW(this,t),yU(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof yF&&null!=this.config.address[r.id]&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let i=n[t],o=e[t];r.push(i.init(e=>i.spec.fromJSON(o,e)))}}return be.create({doc:e.doc,selection:yD.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=y$.resolve(e.extensions||[],new Map),n=e.doc instanceof yi?e.doc:yi.of((e.doc||"").split(t.staticFacet(be.lineSeparator)||yv)),r=e.selection?e.selection instanceof yD?e.selection:yD.single(e.selection.anchor,e.selection.head):yD.single(0);return yE(r,n.length),t.staticFacet(yG)||(r=r.asSingle()),new be(t,n,r,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(be.tabSize)}get lineBreak(){return this.facet(be.lineSeparator)||"\n"}get readOnly(){return this.facet(yQ)}phrase(e,...t){for(let t of this.facet(be.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let r=+(n||1);return!r||r>t.length?e:t[r-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(yq))for(let o of i(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){var t;let n=this.languageDataAt("wordChars",e);return t=n.length?n[0]:"",e=>{if(!/\S/.test(e))return y9.Space;if(function(e){if(r)return r.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||y7.test(n)))return!0}return!1}(e))return y9.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return y9.Word;return y9.Other}}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=yf(t,o,!1);if(i(t.slice(e,o))!=y9.Word)break;o=e}for(;s<r;){let e=yf(t,s);if(i(t.slice(s,e))!=y9.Word)break;s=e}return o==s?null:yD.range(o+n,s+n)}}function bt(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],o=r[e];if(void 0===o)r[e]=i;else if(o===i||void 0===i);else if(Object.hasOwnProperty.call(n,e))r[e]=n[e](o,i);else throw Error("Config merge conflict for field "+e)}for(let e in t)void 0===r[e]&&(r[e]=t[e]);return r}be.allowMultipleSelections=yG,be.tabSize=yR.define({combine:e=>e.length?e[0]:4}),be.lineSeparator=yY,be.readOnly=yQ,be.phrases=yR.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),be.languageData=yq,be.changeFilter=yK,be.transactionFilter=yZ,be.transactionExtender=yX,yV.reconfigure=y2.define();class bn{eq(e){return this==e}range(e,t=e){return bi.create(e,t,this)}}function br(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}bn.prototype.startSide=bn.prototype.endSide=0,bn.prototype.point=!1,bn.prototype.mapMode=yy.TrackDel;class bi{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new bi(e,t,n)}}function bo(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class bs{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let o=r,s=i.length;;){if(o==s)return o;let r=o+s>>1,a=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==o)return a>=0?o:s;a>=0?s=r:o=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);i<o;i++)if(!1===r(this.from[i]+e,this.to[i]+e,this.value[i]))return!1}map(e,t){let n=[],r=[],i=[],o=-1,s=-1;for(let a=0;a<this.value.length;a++){let l=this.value[a],u=this.from[a]+e,c=this.to[a]+e,h,d;if(u==c){let e=t.mapPos(u,l.startSide,l.mapMode);if(null==e||(h=d=e,l.startSide!=l.endSide&&(d=t.mapPos(u,l.endSide))<h))continue}else if((h=t.mapPos(u,l.startSide))>(d=t.mapPos(c,l.endSide))||h==d&&l.startSide>0&&l.endSide<=0)continue;0>(d-h||l.endSide-l.startSide)||(o<0&&(o=h),l.point&&(s=Math.max(s,d-h)),n.push(l),r.push(h-o),i.push(d-o))}return{mapped:n.length?new bs(r,i,n,s):null,pos:o}}}class ba{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new ba(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:i=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(bo)),this.isEmpty)return t.length?ba.of(t):this;let s=new bc(this,null,-1).goto(0),a=0,l=[],u=new bl;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];u.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(s.chunkIndex)||i<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||r>s.to||i<s.from||o(s.from,s.to,s.value))&&!u.addInner(s.from,s.to,s.value)&&l.push(bi.create(s.from,s.to,s.value)),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?ba.empty:this.nextLayer.update({add:l,filter:o,filterFrom:r,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],s=this.chunk[i],a=e.touchesRange(o,o+s.length);if(!1===a)r=Math.max(r,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===a){let{mapped:i,pos:a}=s.map(o,e);i&&(r=Math.max(r,i.maxPoint),t.push(i),n.push(a))}}let i=this.nextLayer.map(e);return 0==t.length?i:new ba(n,t,i||ba.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(t>=i&&e<=i+o.length&&!1===o.between(i,e-i,t-i,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return bh.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return bh.from(e).goto(t)}static compare(e,t,n,r,i=-1){let o=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),a=bu(o,s,n),l=new bf(o,a,i),u=new bf(s,a,i);n.iterGaps((e,t,n)=>bp(l,e,u,t,n,r)),n.empty&&0==n.length&&bp(l,0,u,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=0x3b9ac9ff);let i=e.filter(e=>!e.isEmpty&&0>t.indexOf(e)),o=t.filter(t=>!t.isEmpty&&0>e.indexOf(t));if(i.length!=o.length)return!1;if(!i.length)return!0;let s=bu(i,o),a=new bf(i,s,0).goto(n),l=new bf(o,s,0).goto(n);for(;;){if(a.to!=l.to||!bm(a.active,l.active)||a.point&&(!l.point||!br(a.point,l.point)))return!1;if(a.to>r)return!0;a.next(),l.next()}}static spans(e,t,n,r,i=-1){let o=new bf(e,null,i).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),i=o.pointFrom<t?n.length+1:o.point.startSide<0?n.length:Math.min(n.length,a);r.point(s,e,o.point,n,i,o.pointRank),a=Math.min(o.openEnd(e),n.length)}else e>s&&(r.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new bl;for(let r of e instanceof bi?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(bo(t,r)>0)return e.slice().sort(bo);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return ba.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=ba.empty;r=r.nextLayer)t=new ba(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}ba.empty=new ba([],[],null,-1),ba.empty.nextLayer=ba.empty;class bl{finishChunk(e){this.chunks.push(new bs(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new bl)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&0>(e-this.lastFrom||n.startSide-this.last.startSide))throw Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if(0>(e-this.lastTo||t.value[0].startSide-this.last.endSide))return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(ba.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=ba.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function bu(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let o=r.get(e.chunk[t]);null==o||(n?n.mapPos(o):o)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(o,o+e.chunk[t].length))||i.add(e.chunk[t])}return i}class bc{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){0>(this.to-e||this.endSide-t)&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class bh{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new bc(o,t,n,i));return 1==r.length?r[0]:new bh(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)bd(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)bd(this.heap,e);0>(this.to-e||this.value.endSide-t)&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),bd(this.heap,0)}}}function bd(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),0>n.compare(i))break;e[r]=n,e[t]=i,t=r}}class bf{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=bh.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&0>(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t);)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){bg(this.active,e),bg(this.activeTo,e),bg(this.activeRank,e),this.minActive=by(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;bv(this.active,t,n),bv(this.activeTo,t,r),bv(this.activeRank,t,i),e&&bv(e,t,this.cursor.from),this.minActive=by(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&0>(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&bg(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(e.point)if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}else this.addActive(n),this.cursor.next()}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function bp(e,t,n,r,i,o){e.goto(t),n.goto(r);let s=r+i,a=r,l=r-t,u=!!o.boundChange;for(let t=!1;;){let r=e.to+l-n.to,i=r||e.endSide-n.endSide,c=i<0?e.to+l:n.to,h=Math.min(c,s);if(e.point||n.point?(e.point&&n.point&&br(e.point,n.point)&&bm(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,h,e.point,n.point),t=!1):(t&&o.boundChange(a),h>a&&!bm(e.active,n.active)&&o.compareRange(a,h,e.active,n.active),u&&h<s&&(r||e.openEnd(c)!=n.openEnd(c))&&(t=!0)),c>s)break;a=c,i<=0&&e.next(),i>=0&&n.next()}}function bm(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!br(e[n],t[n]))return!1;return!0}function bg(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function bv(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function by(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)0>(t[i]-r||e[i].endSide-e[n].endSide)&&(n=i,r=t[i]);return n}function bb(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)9==e.charCodeAt(i)?(r+=t-r%t,i++):(r++,i=yf(e,i));return r}function bx(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=9==e.charCodeAt(r)?n-i%n:1,r=yf(e,r)}return!0===r?-1:e.length}let bw="u"<typeof Symbol?"__ͼ":Symbol.for("ͼ"),bS="u"<typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),bC="u">typeof globalThis?globalThis:"u">typeof window?window:{};class bA{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}for(let t in e)!function e(t,i,o,s){let a=[],l=/^@(\w+)\b/.exec(t[0]),u=l&&"keyframes"==l[1];if(l&&null==i)return o.push(t[0]+";");for(let n in i){let s=i[n];if(/&/.test(n))e(n.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((e,t)=>e.concat(t)),s,o);else if(s&&"object"==typeof s){if(!l)throw RangeError("The value of a property ("+n+") should be a primitive value.");e(r(n),s,a,u)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(a.length||u)&&o.push((n&&!l&&!s?t.map(n):t).join(", ")+" {"+a.join(" ")+"}")}(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=bC[bw]||1;return bC[bw]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[bS],i=n&&n.nonce;r?i&&r.setNonce(i):r=new bM(e,i),r.mount(Array.isArray(t)?t:[t],e)}}let bk=new Map;class bM{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=bk.get(n);if(t)return e[bS]=t;this.sheet=new r.CSSStyleSheet,bk.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[bS]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)0>t.adoptedStyleSheets.indexOf(this.sheet)&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var bT={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},bD={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},bE="u">typeof navigator&&/Mac/.test(navigator.platform),bO="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),bR=0;bR<10;bR++)bT[48+bR]=bT[96+bR]=String(bR);for(var bR=1;bR<=24;bR++)bT[bR+111]="F"+bR;for(var bR=65;bR<=90;bR++)bT[bR]=String.fromCharCode(bR+32),bD[bR]=String.fromCharCode(bR);for(var bI in bT)bD.hasOwnProperty(bI)||(bD[bI]=bT[bI]);function bP(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];"string"==typeof i?e.setAttribute(r,i):null!=i&&(e[r]=i)}t++}for(;t<arguments.length;t++)!function e(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null==n);else if(null!=n.nodeType)t.appendChild(n);else if(Array.isArray(n))for(var r=0;r<n.length;r++)e(t,n[r]);else throw RangeError("Unsupported child node: "+n)}(e,arguments[t]);return e}let bN="u">typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},bL="u">typeof document?document:{documentElement:{style:{}}},bj=/Edge\/(\d+)/.exec(bN.userAgent),bF=/MSIE \d/.test(bN.userAgent),bB=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bN.userAgent),b_=!!(bF||bB||bj),bz=!b_&&/gecko\/(\d+)/i.test(bN.userAgent),bV=!b_&&/Chrome\/(\d+)/.exec(bN.userAgent),bH="webkitFontSmoothing"in bL.documentElement.style,b$=!b_&&/Apple Computer/.test(bN.vendor),bW=b$&&(/Mobile\/\w+/.test(bN.userAgent)||bN.maxTouchPoints>2);var bU={mac:bW||/Mac/.test(bN.platform),windows:/Win/.test(bN.platform),linux:/Linux|X11/.test(bN.platform),ie:b_,ie_version:bF?bL.documentMode||6:bB?+bB[1]:bj?+bj[1]:0,gecko:bz,gecko_version:bz?+(/Firefox\/(\d+)/.exec(bN.userAgent)||[0,0])[1]:0,chrome:!!bV,chrome_version:bV?+bV[1]:0,ios:bW,android:/Android\b/.test(bN.userAgent),webkit:bH,webkit_version:bH?+(/\bAppleWebKit\/(\d+)/.exec(bN.userAgent)||[0,0])[1]:0,safari:b$,safari_version:b$?+(/\bVersion\/(\d+(\.\d+)?)/.exec(bN.userAgent)||[0,0])[1]:0,tabSize:null!=bL.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function bq(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}let bG=Object.create(null);function bY(e,t,n){if(e==t)return!0;e||(e=bG),t||(t=bG);let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let o of r)if(o!=n&&(-1==i.indexOf(o)||e[o]!==t[o]))return!1;return!0}function bK(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,"style"==i?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,"style"==i?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}class bZ{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return -1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var bX=((p=bX||(bX={}))[p.Text=0]="Text",p[p.WidgetBefore=1]="WidgetBefore",p[p.WidgetAfter=2]="WidgetAfter",p[p.WidgetRange=3]="WidgetRange",p);class bQ extends bn{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new bJ(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new b1(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:o}=b2(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new b1(e,n,r,t,e.widget||null,!0)}static line(e){return new b0(e)}static set(e,t=!1){return ba.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}bQ.none=ba.empty;class bJ extends bQ{constructor(e){let{start:t,end:n}=b2(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?bq(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||bG}eq(e){return this==e||e instanceof bJ&&this.tagName==e.tagName&&bY(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw RangeError("Mark decorations may not be empty");return super.range(e,t)}}bJ.prototype.point=!1;class b0 extends bQ{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof b0&&this.spec.class==e.spec.class&&bY(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}b0.prototype.mapMode=yy.TrackBefore,b0.prototype.point=!0;class b1 extends bQ{constructor(e,t,n,r,i,o){super(t,n,i,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?yy.TrackBefore:yy.TrackAfter:yy.TrackDel}get type(){return this.startSide!=this.endSide?bX.WidgetRange:this.startSide<=0?bX.WidgetBefore:bX.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){var t,n;return e instanceof b1&&(t=this.widget,t==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function b2(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function b5(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}b1.prototype.point=!0;class b4 extends bn{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(e){return e==this||e instanceof b4&&this.tagName==e.tagName&&bY(this.attributes,e.attributes)}static create(e){return new b4(e.tagName,e.attributes||bG,null==e.rank?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return ba.of(e,t)}}function b3(e){return(11==e.nodeType?e.getSelection?e:e.ownerDocument:e).getSelection()}function b6(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function b8(e,t){if(!t.anchorNode)return!1;try{return b6(e,t.anchorNode)}catch(e){return!1}}function b9(e){return 3==e.nodeType?xc(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function b7(e,t,n,r){return!!n&&(xn(e,t,n,r,-1)||xn(e,t,n,r,1))}function xe(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function xt(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function xn(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:xr(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=xe(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType||1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?xr(e):0}}}function xr(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function xi(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function xo(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||1>Math.abs(t.width-e.offsetWidth))&&(n=1),(r>.995&&r<1.005||!isFinite(r)||1>Math.abs(t.height-e.offsetHeight))&&(r=1),{scaleX:n,scaleY:r}}function xs(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let o=e.parentNode;o;)if(o==n.body||(!t||r)&&i)break;else if(1==o.nodeType)!i&&o.scrollHeight>o.clientHeight&&(i=o),t&&!r&&o.scrollWidth>o.clientWidth&&(r=o),o=o.assignedSlot||o.parentNode;else if(11==o.nodeType)o=o.host;else break;return{x:r,y:i}}b4.prototype.startSide=b4.prototype.endSide=-1;class xa{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?xr(t):0),n,Math.min(e.focusOffset,n?xr(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let xl=null;function xu(e){if(e.setActive)return e.setActive();if(xl)return e.focus(xl);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==xl?{get preventScroll(){return xl={preventScroll:!0},!0}}:void 0),!xl){xl=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],i=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}}}function xc(e,t,n=t){let r=i||(i=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function xh(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let o=new KeyboardEvent("keydown",i);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",i);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function xd(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function xf(e,t){for(let n=e,r=t;;)if(3==n.nodeType&&r>0)return{node:n,offset:r};else if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;r=xr(n=n.childNodes[r-1])}else{if(!n.parentNode||xt(n))return null;r=xe(n),n=n.parentNode}}function xp(e,t){for(let n=e,r=t;;)if(3==n.nodeType&&r<n.nodeValue.length)return{node:n,offset:r};else if(1==n.nodeType&&r<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[r],r=0}else{if(!n.parentNode||xt(n))return null;r=xe(n)+1,n=n.parentNode}}bU.safari&&bU.safari_version>=26&&(xl=!1);class xm{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new xm(e.parentNode,xe(e),t)}static after(e,t){return new xm(e.parentNode,xe(e)+1,t)}}var xg=((m=xg||(xg={}))[m.LTR=0]="LTR",m[m.RTL=1]="RTL",m);let xv=xg.LTR,xy=xg.RTL;function xb(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}let xx=xb("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),xw=xb("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),xS=Object.create(null),xC=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);xS[t]=n,xS[n]=-t}function xA(e){return e<=247?xx[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?xw[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}let xk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class xM{get dir(){return this.level%2?xy:xv}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;(i<0||(0!=r?r<0?s.from<t:s.to>t:e[i].level>s.level))&&(i=o)}}if(i<0)throw RangeError("Index out of range");return i}}let xT=[];function xD(e){return[new xM(0,e,0)]}let xE="",xO=yR.define(),xR=yR.define(),xI=yR.define(),xP=yR.define(),xN=yR.define(),xL=yR.define(),xj=yR.define(),xF=yR.define(),xB=yR.define(),x_=yR.define({combine:e=>e.some(e=>e)}),xz=yR.define({combine:e=>e.some(e=>e)}),xV=yR.define();class xH{constructor(e,t,n,r,i,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new xH(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new xH(yD.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}let x$=y2.define({map:(e,t)=>e.map(t)}),xW=y2.define();function xU(e,t,n){let r=e.facet(xP);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}let xq=yR.define({combine:e=>!e.length||e[0]}),xG=0,xY=yR.define({combine:e=>e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})});class xK{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(xY.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(xY.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:n,eventObservers:r,provide:i,decorations:o}=t||{};return new xK(xG++,e,n,r,e=>{let t=[];return o&&t.push(xJ.of(t=>{let n=t.plugin(e);return n?o(n):bQ.none})),i&&t.push(i(e)),t})}static fromClass(e,t){return xK.define((t,n)=>new e(t,n),t)}}class xZ{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(xU(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){xU(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null==(t=this.value)?void 0:t.destroy)try{this.value.destroy()}catch(t){xU(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}let xX=yR.define(),xQ=yR.define(),xJ=yR.define(),x0=yR.define(),x1=yR.define(),x2=yR.define(),x5=yR.define();function x4(e,t){let n=e.state.facet(x5);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return ba.spans(r,t.from,t.to,{point(){},span(e,n,r,o){let s=e-t.from,a=n-t.from,l=i;for(let e=r.length-1;e>=0;e--,o--){let n=r[e].spec.bidiIsolate,i;if(null==n&&(n=function(e,t,n){for(let r=t;r<n;r++){let t=xA(e.charCodeAt(r));if(1==t)break;if(2==t||4==t)return xy}return xv}(t.text,s,a)),o>0&&l.length&&(i=l[l.length-1]).to==s&&i.direction==n)i.to=a,l=i.inner;else{let e={from:s,to:a,direction:n,inner:[]};l.push(e),l=e.inner}}}}),i}let x3=yR.define();function x6(e){let t=0,n=0,r=0,i=0;for(let o of e.state.facet(x3)){let s=o(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(r=Math.max(r,s.top)),null!=s.bottom&&(i=Math.max(i,s.bottom)))}return{left:t,right:n,top:r,bottom:i}}let x8=yR.define();class x9{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new x9(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let r=0,i=0,o=0;;){let s=Math.min(r<e.length?e[r].fromB:1e9,i<t.length?t[i]:1e9);if(1e9==s)break;let a=s+o,l=s,u=a;for(;;)if(i<t.length&&t[i]<=l){let n=t[i+1];i+=2,l=Math.max(l,n);for(let t=r;t<e.length&&e[t].fromB<=l;t++)o=e[t].toA-e[t].toB;u=Math.max(u,n+o)}else if(r<e.length&&e[r].fromB<=l){let t=e[r++];l=Math.max(l,t.toB),u=Math.max(u,t.toA),o=t.toA-t.toB}else break;n.push(new x9(a,u,s,l))}return n}}class x7{constructor(e,t,n){for(let r of(this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=yx.empty(this.startState.doc.length),n))this.changes=this.changes.compose(r.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new x9(e,t,n,i))),this.changedRanges=r}static create(e,t,n){return new x7(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}let we=[];class wt{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return we}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;null==t[r]&&e.removeAttribute(r)}for(let n in t){let r=t[n];"style"==n?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=xe(this.dom),r=this.length?e>0:t>0;return new xm(this.parent.dom,n+ +!!r,0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof wi)return e;return null}static get(e){return e.cmTile}}class wn extends wt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t=this.dom,n=null,r,i=(null==e?void 0:e.node)==t?e:null,o=0;for(let s of this.children){if(s.sync(e),o+=s.length+s.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=s.dom&&(i.written=!0),s.dom.parentNode==t)for(;r&&r!=s.dom;)r=wr(r);else t.insertBefore(s.dom,r);n=s.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=wr(r);this.length=o}}function wr(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class wi extends wn{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=wt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;(n=n.parent).breakAfter&&i++,r=t.pop()}else{let o=n.children[r++];if(o instanceof wo)t.push(r),n=o,r=0;else{let t=i+o.length,n=e(o,i);if(void 0!==n)return n;i=t+o.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,o=-1;if(this.blockTiles((s,a)=>{let l=a+s.length;if(e>=a&&e<=l){if(s.isWidget()&&t>=-1&&t<=1){if(32&s.flags)return!0;16&s.flags&&(n=void 0)}(a<e||e==l&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget())&&(n=s,r=e-a),(l>e||e==a&&(t>1?s.length:s.covers(-1)))&&(!i||!s.isWidget()&&i.isWidget())&&(i=s,o=e-a)}}),!n&&!i)throw Error("No tile at position "+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:o}}}class wo extends wn{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new wo(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class ws extends wn{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let r=new ws(t||document.createElement("div"),e);return t&&n||(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,i=-1,o=null,s=-1;!function e(a,l){for(let u=0,c=0;u<a.children.length&&c<=l;u++){let h=a.children[u],d=c+h.length;d>=l&&(h.isComposite()?e(h,l-c):(!o||o.isHidden&&(t>0||n&&function(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}(o,h)))&&(d>l||32&h.flags)?(o=h,s=l-c):(c<l||16&h.flags&&!h.isHidden)&&(r=h,i=l-c)),c=d}}(this,e);let a=(t<0?r:o)||r||o;return a?{tile:a,offset:a==r?i:s}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=b9(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new xm(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,16&e.flags?1:32&e.flags?-1:t);let i=n.tile.parent,o=!1;for(let e of i.children){if(o)return new xm(e.dom,0);e==n.tile&&(o=!0)}}return new xm(this.dom,0)}}class wa extends wn{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new wa(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class wl extends wt{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,i=e,o=0;0==e&&t<0||e==n&&t>=0?!(bU.chrome||bU.gecko)&&(e?(r--,o=1):i<n&&(i++,o=-1)):t<0?r--:i<n&&i++;let s=xc(this.dom,r,i).getClientRects();if(!s.length)return null;let a=s[(o?o<0:t>=0)?0:s.length-1];return bU.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(s,e=>e.width)||a),o?xi(a,o<0):a||null}static of(e,t){let n=new wl(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class wu extends wt{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return xi(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let i=r?t.length-1:0;n=t[i],e>0?0!=i:i!=t.length-1&&!(n.top<n.bottom);i+=r?-1:1);return xi(n,!r)}}get overrideDOMText(){if(!this.length)return yi.empty;let{root:e}=this;if(!e)return yi.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,r,i){return!i&&(i=e.toDOM(t),e.editable||(i.contentEditable="false")),new wu(i,n,e,r)}}class wc extends wt{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return yi.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class wh{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:o,parents:s}=this;for(;e||t>0;)if(r.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(i==r.children.length){if(!e&&!s.length)break;n&&n.leave(r),o=!!r.breakAfter,({tile:r,index:i}=s.pop()),i++}else{let a=r.children[i],l=a.breakAfter;(t>0?a.length<=e:a.length<e)&&(!n||!1!==n.skip(a,0,a.length)||!a.isComposite)?(o=!!l,i++,e-=a.length):(s.push({tile:r,index:i}),r=a,i=0,n&&a.isComposite()&&n.enter(a))}else if(i==r.length)o=!!r.breakAfter,({tile:r,index:i}=s.pop()),i++;else if(e){let t=Math.min(e,r.length-i);n&&n.skip(r,i,i+t),e-=t,i+=t}else break;return this.tile=r,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class wd{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}}class wf{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){var i;this.flushBuffer();let o=this.ensureMarks(t,n),s=o.lastChild;s&&s.isText()&&!(8&s.flags)&&s.length+e.length<512?(this.cache.reused.set(s,2),(o.children[o.children.length-1]=new wl(s.dom,s.text+e)).parent=o):o.append(r||wl.of(e,null==(i=this.cache.find(wl))?void 0:i.dom)),this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?wx(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof wa&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(wx(n.dom)),r=i;else{if(this.cache.reused.get(n)){let e=wt.get(n.dom);e&&e.setDOM(wx(n.dom))}let e=wa.of(n.mark,n.dom);r.append(e),r=e}this.cache.reused.set(n,2)}let i=wt.get(e.text);i&&this.cache.reused.set(i,2);let o=new wl(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,r.append(o)}addInlineWidget(e,t,n){let r=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);r||this.flushBuffer();let i=this.ensureMarks(t,n);r||16&e.flags||i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=wb);let r=ws.start(e,t||(null==(n=this.cache.find(ws))?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let i=e.length-1;i>=0;i--){let o=e[i],s;if(t>0&&(s=r.lastChild)&&s instanceof wa&&s.mark.eq(o))r=s,t--;else{let e=wa.of(o,null==(n=this.cache.find(wa,e=>e.mark.eq(o)))?void 0:n.dom);r.append(e),r=e,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!wy(this.curLine,!1)||"BR"!=e.dom.nodeName&&e.isWidget()&&!(bU.ios&&wy(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(wS,0,32)||new wu(wS.toDOM(),0,wS,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=102*e.rank+e.value.rank,n=new wd(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&0>(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to);)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.from<this.pos&&r instanceof wo&&r.wrapper.eq(n.wrapper))t=r;else{let r=wo.of(n.wrapper,null==(e=this.cache.find(wo,e=>e.wrapper.eq(n.wrapper)))?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(wc,void 0,1);return n&&(n.flags=t),n||new wc(t)}flushBuffer(){this.afterWidget&&!(32&this.afterWidget.flags)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class wp{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error("Ran out of text content when drawing inline views");this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}let wm=[wu,ws,wl,wa,wc,wo,wi];for(let e=0;e<wm.length;e++)wm[e].bucket=e;class wg{constructor(e){this.view=e,this.buckets=wm.map(()=>[]),this.index=wm.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],o=this.index[r];for(let e=i.length-1;e>=0;e--){let s=(e+o)%i.length,a=i[s];if((!t||t(a))&&!this.reused.has(a))return i.splice(s,1),s<o&&this.index[r]--,this.reused.set(a,n),a}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,o=0;;i++){if(i==r.length){if(o)return null;o=1,i=0}let s=r[i];if(!this.reused.has(s)&&(0==o?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view,s.widget))){if(r.splice(i,1),i<this.index[0]&&this.index[0]--,s.widget==e&&s.length==t&&(497&s.flags)==n)return this.reused.set(s,1),s;return this.reused.set(s,2),new wu(s.dom,t,e,-498&s.flags|n)}}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class wv{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new wg(e),this.text=new wp(e.state.doc),this.builder=new wf(this.cache,new wi(e,e.contentDOM),ba.iter(n)),this.cache.reused.set(t,2),this.old=new wh(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,o=0;;){let s=o<e.length?e[o++]:null,a=s?s.fromA:this.old.root.length;if(a>r){let e=a-r;this.preserve(e,!o,!s),r=a,i+=e}if(!s)break;t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA?(this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB)):(this.forward(s.fromA,s.toA),this.emit(i,s.toB)),i=s.toB,r=s.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof wa&&t.push(r.mark)}return t}(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let o=n>0||t<e.length?wu.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&o.flags?(o.flags&=-2,this.builder.addBlockWidget(o)):(this.builder.ensureLine(null),this.builder.addInlineWidget(o,r,i),i=r.length)}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length||this.cache.reused.has(e)?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)):this.builder.addText(e.text,r,i,this.cache.reuse(e)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof wc)this.cache.add(e);else{if(!(e instanceof wa))return!1;this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof wa&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&(r.length=i=0):e instanceof wa&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=0,o=ba.spans(this.decorations,e,t,{point:(e,t,o,s,a,l)=>{var u,c,h;if(o instanceof b1){if(this.disallowBlockEffectsFor[l]){if(o.block)throw RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=s.length,a>s.length)r.continueWidget(t-e);else{let i,l=o.widget||(o.block?ww.block:ww.inline),c=(i=(u=o).isReplace?64*(u.startSide<0)|128*(u.endSide>0):u.startSide>0?32:16,u.block&&(i|=256),i),h=this.cache.findWidget(l,t-e,c)||wu.of(l,this.view,t-e,c);o.block?(o.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(h)):(r.ensureLine(n),r.addInlineWidget(h,s,a))}n=null}else{let e,t;c=n,e=(h=o).spec.attributes,t=h.spec.class,(e||t)&&(c||(c={class:"cm-line"}),e&&bq(e,c),t&&(c.class+=" "+t)),n=c}t>e&&this.text.skip(t-e)},span:(e,t,o,s)=>{for(let i=e;i<t;){let a=this.text.next(Math.min(512,t-i));null==a?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(a,o,i==e?s:o.length),i+=a.length),n=null}i=o.length}});this.openWidget=o>i,this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=o}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=wt.get(r);if(r==this.view.contentDOM)break;e instanceof wa?t.push(e):(null==e?void 0:e.isLine())?n=e:e instanceof wo||("DIV"!=r.nodeName||n||r==this.view.contentDOM?n||t.push(wa.of(new bJ({tagName:r.nodeName.toLowerCase(),attributes:function(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}(r)}),r)):n=new ws(r,wb))}return{line:n,marks:t}}}function wy(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}let wb={class:"cm-line"};function wx(e){let t=wt.get(e);return t&&t.setDOM(e.cloneNode()),e}class ww extends bZ{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ww.inline=new ww("span"),ww.block=new ww("div");let wS=new class extends bZ{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class wC{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=bQ.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new wi(e,e.contentDOM),this.updateInner([new x9(0,0,0,e.state.doc.length)],null)}update(e){var t,n,r,i,o,s,a,l,u;let c,h,d,f=e.changedRanges;this.minWidth>0&&f.length&&(f.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let p=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null==(t=this.domChanged)?void 0:t.newSel)?p=this.domChanged.newSel.head:(n=e.changes,r=this.hasComposition,c=!1,r&&n.iterChangedRanges((e,t)=>{e<r.to&&t>r.from&&(c=!0)}),c||e.selectionSet||(p=e.state.selection.main.head)));let m=p>-1?function(e,t,n){let r=wk(e,n);if(!r)return null;let{node:i,from:o,to:s}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc;return{range:new x9(l.mapPos(o),l.mapPos(s),o,s),text:i}}(this.view,e.changes,p):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:n}=this.hasComposition;f=new x9(t,n,e.changes.mapPos(t,-1),e.changes.mapPos(n,1)).addToSet(f.slice())}this.hasComposition=m?{from:m.range.fromB,to:m.range.toB}:null,(bU.ie||bU.chrome)&&!m&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let g=this.decorations,v=this.blockWrappers;this.updateDeco();let y=(i=g,o=this.decorations,s=e.changes,h=new wM,ba.compare(i,o,s,h),h.changes);y.length&&(f=x9.extendWithRanges(f,y));let b=(a=v,l=this.blockWrappers,u=e.changes,d=new wT,ba.compare(a,l,u,d),d.changes);return b.length&&(f=x9.extendWithRanges(f,b)),m&&!f.some(e=>e.fromA<=m.range.fromA&&e.toA>=m.range.toA)&&(f=m.range.addToSet(f.slice())),(!(2&this.tile.flags)||0!=f.length)&&(this.updateInner(f,m),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new wv(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&wt.get(t.text)&&r.cache.reused.set(wt.get(t.text),2),this.tile=r.run(e,t),wA(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=bU.chrome||bU.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof wD&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){for(let t of(this.editContextFormatting=this.editContextFormatting.map(e.changes),e.transactions))for(let e of t.effects)e.is(xW)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){var n;(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,o=i==r,s=!o&&!(this.view.state.facet(xq)||r.tabIndex>-1)&&b8(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(o||t||s))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,u,c;if(l.empty?c=u=this.inlineDOMNearPos(l.anchor,l.assoc||1):(c=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),u=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),bU.gecko&&l.empty&&!this.hasComposition&&1==(n=u).node.nodeType&&n.node.firstChild&&(0==n.offset||"false"==n.node.childNodes[n.offset-1].contentEditable)&&(n.offset==n.node.childNodes.length||"false"==n.node.childNodes[n.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(e,u.node.childNodes[u.offset]||null)),u=c=new xm(e,0),a=!0}let h=this.view.observer.selectionRange;!a&&h.focusNode&&(b7(u.node,u.offset,h.anchorNode,h.anchorOffset)&&b7(c.node,c.offset,h.focusNode,h.focusOffset)||this.suppressWidgetCursorChange(h,l))||(this.view.observer.ignore(()=>{bU.android&&bU.chrome&&r.contains(h.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(h.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let e=b3(this.view.root);if(e)if(l.empty){if(bU.gecko){var t,n;let e=(t=u.node,n=u.offset,1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|2*(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable));if(e&&3!=e){let t=(1==e?xf:xp)(u.node,u.offset);t&&(u=new xm(t.node,t.offset))}}e.collapse(u.node,u.offset),null!=l.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=l.bidiLevel)}else if(e.extend){e.collapse(u.node,u.offset);try{e.extend(c.node,c.offset)}catch(e){}}else{let t=document.createRange();l.anchor>l.head&&([u,c]=[c,u]),t.setEnd(c.node,c.offset),t.setStart(u.node,u.offset),e.removeAllRanges(),e.addRange(t)}s&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,c)),this.impreciseAnchor=u.precise?null:new xm(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new xm(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&b7(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=b3(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=0==xr(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==r&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!wt.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,o,s=-1,a=!1;return(this.tile.blockTiles((t,l)=>{if(t.isWidget()){if(32&t.flags&&l>=e)return!0;16&t.flags&&(i=!0)}else{let u=l+t.length;if(l<=e&&(n=t,r=e-l,i=u<e),u>=e&&!o&&(o=t,s=e-l,a=l>e),l>e&&o)return!0}}),n||o)?(i&&o?n=null:a&&n&&(o=null),n&&t<0||!o?n.domIn(r,t):o.domIn(s,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof wD?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);return t.isLine()?function e(t,n){if(t.isComposite())for(let r of t.children){if(r.length>=n){let t=e(r,n);if(t)return t}if((n-=r.length)<0)break}else if(t.isText()&&n<t.length){let e=yf(t.text,n);if(e==n)return null;let r=xc(t.dom,n,e).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n):null}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==xg.LTR,l=0,u=(e,c,h)=>{for(let d=0;d<e.children.length&&!(c>r);d++){let r=e.children[d],f=c+r.length,p=r.dom.getBoundingClientRect(),{height:m}=p;if(h&&!d&&(l+=p.top-h.top),r instanceof wo)f>n&&u(r,c,p);else if(c>=n&&(l>0&&t.push(-l),t.push(m+l),l=0,o)){let e=r.dom.lastChild,t=e?b9(e):[];if(t.length){let e=t[t.length-1],n=a?e.right-p.left:p.right-e.left;n>s&&(s=n,this.minWidth=i,this.minWidthFrom=c,this.minWidthTo=f)}}h&&d==e.children.length-1&&(l+=h.bottom-p.bottom),c=f+r.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?xg.RTL:xg.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=b9(r.dom);if(1!=e.length)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement("div"),n,r,i;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=b9(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],o=i?i.from-1:this.view.state.doc.length;if(o>n){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(bQ.replace({widget:new wD(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return bQ.set(e)}updateDeco(){let e=1,t=this.view.state.facet(xJ).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet(x1).map((e,t)=>{let r="function"==typeof e;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(ba.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(x0).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){var t;if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(xV))try{if(t(this.view,e.range,e))return!0}catch(e){xU(this.view.state,e,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,null!=(t=n.assoc)?t:n.empty?0:n.head>n.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let o=x6(this.view),s={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(!function(e,t,n,r,i,o,s,a){let l=e.ownerDocument,u=l.defaultView||window;for(let c=e,h=!1;c&&!h;)if(1==c.nodeType){let e,d=c==l.body,f=1,p=1;if(d)e=function(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(h=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let t=c.getBoundingClientRect();({scaleX:f,scaleY:p}=xo(c,t)),e={left:t.left,right:t.left+c.clientWidth*f,top:t.top,bottom:t.top+c.clientHeight*p}}let m=0,g=0;if("nearest"==i)t.top<e.top+s?(g=t.top-(e.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+s)):t.bottom>e.bottom-s&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=t.top-(e.top+s)));else{let r=t.bottom-t.top,o=e.bottom-e.top;g=("center"==i&&r<=o?t.top+r/2-o/2:"start"==i||"center"==i&&n<0?t.top-s:t.bottom-o+s)-e.top}if("nearest"==r?t.left<e.left+o?(m=t.left-(e.left+o),n>0&&t.right>e.right+m&&(m=t.right-e.right+o)):t.right>e.right-o&&(m=t.right-e.right+o,n<0&&t.left<e.left+m&&(m=t.left-(e.left+o))):m=("center"==r?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==r==a?t.left-o:t.right-(e.right-e.left)+o)-e.left,m||g)if(d)u.scrollBy(m,g);else{let e=0,n=0;if(g){let e=c.scrollTop;c.scrollTop+=g/p,n=(c.scrollTop-e)*p}if(m){let t=c.scrollLeft;c.scrollLeft+=m/f,e=(c.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&1>Math.abs(e-m)&&(r="nearest"),n&&1>Math.abs(n-g)&&(i="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),c=c.assignedSlot||c.parentNode}else if(11==c.nodeType)c=c.host;else break}(this.view.scrollDOM,s,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==xg.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(n.head,1);e&&e.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){wA(this.tile)}}function wA(e,t){let n=null==t?void 0:t.get(e);if(1!=n)for(let r of(null==n&&e.destroy(),e.children))wA(r,t)}function wk(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=xf(n.focusNode,n.focusOffset),i=xp(n.focusNode,n.focusOffset),o=r||i;if(i&&r&&i.node!=r.node){let t=wt.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)o=i;else if(e.docView.lastCompositionAfterCursor){let e=wt.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(o=i)}}if(e.docView.lastCompositionAfterCursor=o!=r,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let wM=class{constructor(){this.changes=[]}compareRange(e,t){b5(e,t,this.changes)}comparePoint(e,t){b5(e,t,this.changes)}boundChange(e){b5(e,e,this.changes)}};class wT{constructor(){this.changes=[]}compareRange(e,t){b5(e,t,this.changes)}comparePoint(){}boundChange(e){b5(e,e,this.changes)}}class wD extends bZ{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function wE(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==bX.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function wO(e,t,n,r){let i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),s=e.textDirectionAt(i.from);for(let a=t,l=null;;){let t=function(e,t,n,r,i){var o;let s=r.head-e.from,a=xM.find(t,s,null!=(o=r.bidiLevel)?o:-1,r.assoc),l=t[a],u=l.side(i,n);if(s==u){let e=a+=i?1:-1;if(e<0||e>=t.length)return null;s=(l=t[a=e]).side(!i,n),u=l.side(i,n)}let c=yf(e.text,s,l.forward(i,n));(c<l.from||c>l.to)&&(c=u),xE=e.text.slice(Math.min(s,c),Math.max(s,c));let h=a==(i?t.length-1:0)?null:t[a+(i?1:-1)];return h&&c==u&&h.level+ +!i<l.level?yD.cursor(h.side(!i,n)+e.from,h.forward(i,n)?1:-1,h.level):yD.cursor(c+e.from,l.forward(i,n)?-1:1,l.level)}(i,o,s,a,n),u=xE;if(!t){if(i.number==(n?e.state.doc.lines:1))return a;u="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(l){if(!l(u))return a}else{if(!r)return t;l=r(u)}a=t}}function wR(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,o)=>{if(t>e&&t<i){let o=r||n||(t-e<i-t?-1:1);t=o<0?e:i,r=o}});if(!r)return t}}function wI(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],o=null;if(i.empty){let t=wR(e,i.from,0);t!=i.from&&(o=yD.cursor(t,-1))}else{let t=wR(e,i.from,-1),n=wR(e,i.to,1);(t!=i.from||n!=i.to)&&(o=i.undirectional?yD.undirectionalRange(i.from,i.to):yD.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}o&&(n||(n=t.ranges.slice()),n[r]=o)}return n?yD.create(n,t.mainIndex):t}function wP(e,t,n){let r=wR(e.state.facet(x2).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:yD.cursor(r,r<n.from?1:-1)}class wN{constructor(e,t){this.pos=e,this.assoc=t}}function wL(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),o=i.top+e.viewState.paddingTop,{x:s,y:a}=t,l=a-o,u;for(;;){if(l<0)return new wN(0,1);if(l>e.viewState.docHeight)return new wN(e.state.doc.length,-1);if(u=e.elementAtHeight(l),null==r)break;if(u.type==bX.Text){if(r<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(t&&(r<0?t.top<=l+o:t.bottom>=l+o))break}let t=e.viewState.heightOracle.textHeight/2;l=r>0?u.bottom+t:u.top-t}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==bX.Text){let t=function(e,t,n,r,i){let o=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+bx(s,o,e.state.tabSize)}(e,i,u,s,a);return new wN(t,t==u.from?1:-1)}}if(u.type!=bX.Text)return l<(u.top+u.bottom)/2?new wN(u.from,1):new wN(u.to,-1);let c=e.docView.lineAt(u.from,2);return c&&c.length==u.length||(c=e.docView.lineAt(u.from,-2)),new wj(e,s,a,e.textDirectionAt(u.from)).scanTile(c,u.from)}class wj{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[xM.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[xM.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r,i,o=0,s=e.length-1,a=new Set,l=this.bidiIn(e[0],e[s]),u=-1,c=1e9,h;for(;o<s;){let n=s-o,d=o+s>>1;i:if(a.has(d)){let e=o+Math.floor(Math.random()*n);for(let t=0;t<n;t++){if(!a.has(e)){d=e;break i}++e==s&&(e=o)}break}a.add(d);let f=t(d);if(f)for(let t=0;t<f.length;t++){let n=f[t],a=0;if(0!=n.width||!(f.length>1)){if(n.bottom<this.y)(!r||r.bottom<n.bottom)&&(r=n),a=1;else if(n.top>this.y)(!i||i.top>n.top)&&(i=n),a=-1;else{let e=n.left>this.x?this.x-n.left:n.right<this.x?this.x-n.right:0,t=Math.abs(e);t<c&&(u=d,c=t,h=n),e&&(a=e<0==(this.baseDir==xg.LTR)?-1:1)}-1==a&&(!l||this.baseDirAt(e[d],1))?s=d:1==a&&(!l||this.baseDirAt(e[d+1],-1))&&(o=d+1)}}}if(!h){if(!i&&!r)return{i:e[0],after:!1};let n=r&&(!i||this.y-r.bottom<i.top-this.y)?r:i;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(c&&!n){let{top:n,bottom:o}=h;if(r&&r.bottom>(n+n+o)/3)return this.y=r.bottom-1,this.scan(e,t,!0);if(i&&i.top<(n+o+o)/3)return this.y=i.top+1,this.scan(e,t,!0)}let d=(l?this.dirAt(e[u],1):this.baseDir)==xg.LTR;return{i:u,after:this.x>(h.left+h.right)/2==d}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=yf(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,r=>{let i=n[r]-t,o=n[r+1]-t;return xc(e.dom,i,o).getClientRects()});return r.after?new wN(n[r.i+1],-1):new wN(n[r.i],1)}scanTile(e,t){if(!e.length)return new wN(t,1);if(1==e.children.length){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return 48&n.flags?null:(1==n.dom.nodeType?n.dom:xc(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],o=n[r.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):r.after?new wN(n[r.i+1],-1):new wN(o,1)}}class wF{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(be.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+="￿"}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=wt.get(r),o=r.nextSibling;if(o==t){(null==i?void 0:i.breakAfter)&&!o&&n!=this.view.contentDOM&&this.lineBreak();break}let s=wt.get(o);(i&&s?i.breakAfter:(i?i.breakAfter:xt(r))||xt(o)&&("BR"!=r.nodeName||(null==i?void 0:i.isWidget()))&&this.text.length>e)&&!function(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=wt.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}(o,t)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,s;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(s=r.exec(t))&&(i=s.index,o=s[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=i+o}}readNode(e){let t=wt.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(!function(e,t,n){for(;;){if(!t||n<xr(t))return!1;if(t==e)return!0;n=xe(t)+1,t=t.parentNode}}(e,n.node,n.offset)?0:t))}}class wB{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class w_{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView,s=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=function e(t,n,r,i){if(t.isComposite()){let o=-1,s=-1,a=-1,l=-1;for(let u=0,c=i,h=i;u<t.children.length;u++){let i=t.children[u],d=c+i.length;if(c<n&&d>r)return e(i,n,r,c);if(d>=n&&-1==o&&(o=u,s=c),c>r&&i.dom.parentNode==t.dom){a=u,l=h;break}h=d,c=d+i.breakAfter}return{from:s,to:l<0?i+t.length:l,startDOM:(o?t.children[o-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:a<t.children.length&&a>=0?t.children[a].dom:null}}return t.isText()?{from:i,to:i+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}(e.docView.tile,t,n,0))){let t=i||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=e.observer.selectionRange;return n&&(t.push(new wB(n,r)),(i!=n||o!=r)&&t.push(new wB(i,o))),t}(e),n=new wF(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?yD.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!b6(e.contentDOM,t.focusNode)?s.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!b6(e.contentDOM,t.anchorNode)?s.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),a=e.viewport;if((bU.ios||bU.chrome)&&n!=r&&Math.min(n,r)<=s.main.from&&Math.max(n,r)>=s.main.to&&(a.from>0||a.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),o=a.from-t,s=a.to-i;(0==o||1==o||0==t)&&(0==s||-1==s||i==e.state.doc.length)&&(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&s.ranges.length>1)this.newSel=s.replaceRange(yD.range(r,n));else if(e.lineWrapping&&r==n&&!(s.main.empty&&s.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=yD.create([yD.cursor(n,r)])}else this.newSel=yD.single(r,n)}}}function wz(e,t){let n,{newSel:r}=t,{state:i}=e,o=i.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,a=o.from,l=null;(8===s||bU.android&&t.text.length<r-e)&&(a=o.to,l="end");let u=i.doc.sliceString(e,r,"￿"),c,h;!o.empty&&o.from>=e&&o.to<=r&&(t.typeOver||u!=t.text)&&u.slice(0,o.from-e)==t.text.slice(0,o.from-e)&&u.slice(o.to-e)==t.text.slice(c=t.text.length-(u.length-(o.to-e)))?n={from:o.from,to:o.to,insert:yi.of(t.text.slice(o.from-e,c).split("￿"))}:(h=wH(u,t.text,a-e,l))&&(bU.chrome&&13==s&&h.toB==h.from+2&&"￿￿"==t.text.slice(h.from,h.toB)&&h.toB--,n={from:e+h.from,to:e+h.toA,insert:yi.of(t.text.slice(h.from,h.toB).split("￿"))})}else r&&(!e.hasFocus&&i.facet(xq)||w$(r,o))&&(r=null);if(!n&&!r)return!1;if((bU.mac||bU.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=yD.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:yi.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(o.from).to<o.to&&e.docView.lineHasWidget(o.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:o.from,to:o.to,insert:i.toText(e.inputState.insertingText)}:bU.chrome&&n&&n.from==n.to&&n.from==o.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=yD.single(r.main.anchor-1,r.main.head-1)),n={from:o.from,to:o.to,insert:yi.of([" "])}),n)return wV(e,n,r,s);if(!r||w$(r,o))return!1;{let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),"select.pointer"==(n=e.inputState.lastSelectionOrigin)&&(r=wI(i.facet(x2).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}}function wV(e,t,n,r=-1){let i;if(bU.ios&&e.inputState.flushIOSKey(t))return!0;let o=e.state.selection.main;if(bU.android&&(t.to==o.to&&(t.from==o.from||t.from==o.from-1&&" "==e.state.sliceDoc(t.from,o.from))&&1==t.insert.length&&2==t.insert.lines&&xh(e.contentDOM,"Enter",13)||(t.from==o.from-1&&t.to==o.to&&0==t.insert.length||8==r&&t.insert.length<t.to-t.from&&t.to>o.head)&&xh(e.contentDOM,"Backspace",8)||t.from==o.from&&t.to==o.to+1&&0==t.insert.length&&xh(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>i||(i=function(e,t,n){let r,i=e.state,o=i.selection.main,s=-1;if(t.from==t.to&&t.from<o.from||t.from>o.to){let n=t.from<o.from?-1:1,r=n<0?o.from:o.to,a=wR(i.facet(x2).map(t=>t(e)),r,n);t.from==a&&(s=a)}if(s>-1)r={changes:t,selection:yD.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.from<t.from?i.sliceDoc(o.from,t.from):"",s=o.to>t.to?i.sliceDoc(t.to,o.to):"";r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=i.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let l=e.state.sliceDoc(t.from,t.to),u,c=n&&wk(e,n.main.head);if(c){let e=t.insert.length-(t.to-t.from);u={from:c.from,to:c.to-e}}else u=e.state.doc.lineAt(o.head);let h=o.to-t.to;r=i.changeByRange(n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:a||n.map(s)};let r=n.to-h,c=r-l.length;if(e.state.sliceDoc(c,r)!=l||r>=u.from&&c<=u.to)return{range:n};let d=i.changes({from:c,to:r,insert:t.insert}),f=n.to-o.to;return{changes:d,range:a?yD.range(Math.max(0,a.anchor+f),Math.max(0,a.head+f)):n.map(d)}})}else r={changes:s,selection:a&&i.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(xL).some(n=>n(e,t.from,t.to,s,a))||e.dispatch(a()),!0}function wH(e,t,n,r){let i=Math.min(e.length,t.length),o=0;for(;o<i&&e.charCodeAt(o)==t.charCodeAt(o);)o++;if(o==i&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==r){let e=Math.max(0,o-Math.min(s,a));n-=s+e-o}if(s<o&&e.length<t.length){let e=n<=o&&n>=s?o-n:0;o-=e,a=o+(a-s),s=o}else if(a<o){let e=n<=o&&n>=a?o-n:0;o-=e,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function w$(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class wW{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,bU.safari&&e.contentDOM.addEventListener("input",()=>null),bU.gecko&&function(e){Sr.has(e)||(Sr.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(r=wt.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}(this.view,e)||this.ignoreDuringComposition(e)||"keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=function(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(wU(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(wU(t.value,r))}}for(let e in wX)n(e).handlers.push(wX[e]);for(let e in wQ)n(e).observers.push(wQ[e]);return t}(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if("scroll"!=e){let i=!t[e].handlers.length,o=n[e];o&&!o.handlers.length!=i&&(r.removeEventListener(e,this.handleEvent),o=null),o||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)"scroll"==e||t[e]||r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&0>wY.indexOf(e.keyCode)&&(this.tabFocusMode=-1),bU.android&&bU.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(bU.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(wq.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||wG.indexOf(e.key)>-1&&e.ctrlKey)){var t;let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&bU.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&(t=this.view.win).visualViewport&&t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return 229!=e.keyCode&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!(!t||"Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,xh(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&!e.synthetic&&(this.composing>0||!!(bU.safari&&!bU.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wU(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){xU(n.state,e)}}}let wq=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],wG="dthko",wY=[16,17,18,20,91,92,224,225];function wK(e){return .7*Math.max(0,e)+8}class wZ{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=xs(e.contentDOM),this.atoms=e.state.facet(x2).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(be.allowMultipleSelections)&&function(e,t){let n=e.state.facet(xO);return n.length?n[0](t):bU.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=b3(e.root);if(!r||0==r.rangeCount)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)&&1==w8(t)&&null}start(e){!1===this.dragging&&this.select(e)}move(e){var t;if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&10>(t=this.startEvent,Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))))return;this.select(this.lastEvent=e);let n=0,r=0,i=0,o=0,s=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=x6(this.view);e.clientX-l.left<=i+6?n=-wK(i-e.clientX):e.clientX+l.right>=s-6&&(n=wK(e.clientX-s)),e.clientY-l.top<=o+6?r=-wK(o-e.clientY):e.clientY+l.bottom>=a-6&&(r=wK(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=wI(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,!1===this.dragging))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}let wX=Object.create(null),wQ=Object.create(null),wJ=bU.ie&&bU.ie_version<15||bU.ios&&bU.webkit_version<604;function w0(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function w1(e,t){t=w0(e.state,xF,t);let{state:n}=e,r,i=1,o=n.toText(t),s=o.lines==n.selection.ranges.length;if(null!=w7&&n.selection.ranges.every(e=>e.empty)&&w7==o.toString()){let e=-1;r=n.changeByRange(r=>{let a=n.doc.lineAt(r.from);if(a.from==e)return{range:r};e=a.from;let l=n.toText((s?o.line(i++).text:t)+n.lineBreak);return{changes:{from:a.from,insert:l},range:yD.cursor(r.from+l.length)}})}else r=s?n.changeByRange(e=>{let t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:yD.cursor(e.from+t.length)}}):n.replaceSelection(o);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}function w2(e,t,n,r){if(1==r)return yD.cursor(t,n);{if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),o=t-i.from;if(0==i.length)return yD.cursor(t);0==o?n=1:o==i.length&&(n=-1);let s=o,a=o;n<0?s=yf(i.text,o,!1):a=yf(i.text,o);let l=r(i.text.slice(s,a));for(;s>0;){let e=yf(i.text,s,!1);if(r(i.text.slice(e,s))!=l)break;s=e}for(;a<i.length;){let e=yf(i.text,a);if(r(i.text.slice(a,e))!=l)break;a=e}return yD.undirectionalRange(s+i.from,a+i.from)}(e.state,t,n);let i=e.docView.lineAt(t,n),o=e.state.doc.lineAt(i?i.posAtEnd:t),s=i?i.posAtStart:o.from,a=i?i.posAtEnd:o.to;return a<e.state.doc.length&&a==o.to&&a++,yD.undirectionalRange(s,a)}}wQ.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},wQ.wheel=wQ.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},wX.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),wQ.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")},wQ.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},wX.mousedown=(e,t)=>{var n,r;let i,o,s;if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let a=null;for(let n of e.state.facet(xI))if(a=n(e,t))break;if(a||0!=t.button||(n=e,r=t,i=n.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),o=w8(r),s=n.state.selection,a={update(e){e.docChanged&&(i.pos=e.changes.mapPos(i.pos),s=s.map(e.changes))},get(e,t,r){let a=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),l,u=w2(n,a.pos,a.assoc,o);if(i.pos!=a.pos&&!t){let e=w2(n,i.pos,i.assoc,o),t=Math.min(e.from,u.from),r=Math.max(e.to,u.to);u=t<u.from?yD.range(t,r,u.assoc):yD.range(r,t,u.assoc)}return t?s.replaceRange(s.main.extend(u.from,u.to,u.assoc)):r&&1==o&&s.ranges.length>1&&(l=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return yD.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n))}return null}(s,a.pos))?l:r?s.addRange(u):yD.create([u])}}),a){let n=!e.hasFocus;e.inputState.startMouseSelection(new wZ(e,t,a,n)),n&&e.observer.ignore(()=>{xu(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};let w5=bU.ie&&bU.ie_version<=11,w4=null,w3=0,w6=0;function w8(e){if(!w5)return e.detail;let t=w4,n=w6;return w4=e,w6=Date.now(),w3=!t||n>Date.now()-400&&2>Math.abs(t.clientX-e.clientX)&&2>Math.abs(t.clientY-e.clientY)?(w3+1)%3:1}function w9(e,t,n,r){let i;if(!(n=w0(e.state,xF,n)))return;let o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,a=r&&s&&((i=e.state.facet(xR)).length?i[0](t):bU.mac?!t.altKey:!t.ctrlKey)?{from:s.from,to:s.to}:null,l={from:o,insert:n},u=e.state.changes(a?[a,l]:l);e.focus(),e.dispatch({changes:u,selection:{anchor:u.mapPos(o,-1),head:u.mapPos(o,1)},userEvent:a?"move.drop":"input.drop"}),e.inputState.draggedContent=null}wX.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=yD.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",w0(e.state,xB,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},wX.dragend=e=>(e.inputState.draggedContent=null,!1),wX.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,o=()=>{++i==n.length&&w9(e,t,r.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=o,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return w9(e,t,n,!0),!0}return!1},wX.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=wJ?null:t.clipboardData;return n?(w1(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(!function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),w1(e,n.value)},50)}(e),!1)};let w7=null;wX.copy=wX.cut=(e,t)=>{if(!b8(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=function(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let o=e.doc.lineAt(r);o.number>i&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),i=o.number}r=!0}return{text:w0(e,xB,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!n&&!i)return!1;w7=i?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let o=wJ?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(!function(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}(e,n),!1)};let Se=yJ.define();function St(e,t){let n=[];for(let r of e.facet(xj)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Se.of(!0)}):null}function Sn(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=St(e.state,t);n?e.dispatch(n):e.update([])}},10)}wQ.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Sn(e)},wQ.blur=e=>{e.observer.clearSelectionRange(),Sn(e)},wQ.compositionstart=wQ.compositionupdate=e=>{!e.observer.editContext&&(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},wQ.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,bU.chrome&&bU.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},wQ.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},wX.beforeinput=(e,t)=>{var n,r;let i;if(("insertText"==t.inputType||"insertCompositionText"==t.inputType)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let r=null==(n=t.dataTransfer)?void 0:n.getData("text/plain"),i=t.getTargetRanges();if(r&&i.length){let t=i[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return wV(e,{from:n,to:o,insert:e.state.toText(r)},null),!0}}if(bU.chrome&&bU.android&&(i=wq.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null==(r=window.visualViewport)?void 0:r.height)||0;setTimeout(()=>{var n;((null==(n=window.visualViewport)?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return bU.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),bU.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>wQ.compositionend(e,t),20),!1};let Sr=new Set,Si=["pre-wrap","normal","pre-line","break-spaces"],So=!1;class Ss{constructor(e){this.lineWrapping=e,this.doc=yi.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Si.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(10*r)]||(t=!0,this.heightSamples[Math.floor(10*r)]=!0)}return t}refresh(e,t,n,r,i,o){let s=Si.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,a){this.heightSamples={};for(let e=0;e<o.length;e++){let t=o[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class Sa{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Sl{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return"number"==typeof this._content?bX.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof b1?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Sl(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Su=((g=Su||(Su={}))[g.ByPos=0]="ByPos",g[g.ByHeight=1]="ByHeight",g[g.ByPosNoHeight=2]="ByPosNoHeight",g);class Sc{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=2*!!e|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>.001&&(So=!0),this.height=e)}replace(e,t,n){return Sc.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,o=n.doc;for(let s=r.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:u,toB:c}=r[s],h=i.lineAt(a,Su.ByPosNoHeight,n.setDoc(t),0,0),d=h.to>=l?h:i.lineAt(l,Su.ByPosNoHeight,n,0,0);for(c+=d.to-l,l=d.to;s>0&&h.from<=r[s-1].toA;)a=r[s-1].fromA,u=r[s-1].fromB,s--,a<h.from&&(h=i.lineAt(a,Su.ByPosNoHeight,n,0,0));u+=h.from-a,a=h.from;let f=Sy.build(n.setDoc(o),e,u,c);i=Sh(i,i.replace(a,l,f))}return i.updateHeight(n,0)}static empty(){return new Sp(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,r=0,i=0;for(;;)if(t==n)if(r>2*i){let i=e[t-1];i.break?e.splice(--t,1,i.left,null,i.right):e.splice(--t,1,i.left,i.right),n+=1+i.break,r-=i.size}else if(i>2*r){let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,i-=t.size}else break;else if(r<i){let n=e[t++];n&&(r+=n.size)}else{let t=e[--n];t&&(i+=t.size)}let o=0;return null==e[t-1]?(o=1,t--):null==e[t]&&(o=1,n++),new Sg(Sc.of(e.slice(0,t)),o,Sc.of(e.slice(n)))}}function Sh(e,t){return e==t?e:(e.constructor!=t.constructor&&(So=!0),t)}Sc.prototype.size=1;let Sd=bQ.replace({});class Sf extends Sc{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Sl(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Sl(r,0,n,this.spaceAbove,Sd):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let o=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(o):o}forEachLine(e,t,n,r,i,o){e<=i+this.length&&t>=i&&o(this.lineAt(0,Su.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Sp extends Sf{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new Sl(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof Sp||r instanceof Sm&&4&r.flags)&&10>Math.abs(this.length-r.length)?(r instanceof Sm?r=new Sp(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Sc.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Sm extends Sc{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,o,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);o=t/i,this.length>i+1&&(s=(this.height-t)/(this.length-i-1))}else o=this.height/i;return{firstLine:n,lastLine:r,perLine:o,perChar:s}}blockAt(e,t,n,r){let{firstLine:i,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),o=t.doc.lineAt(i),l=s+o.length*a,u=Math.max(n,e-l/2);return new Sl(o.from,o.length,u,l,0)}{let r=Math.max(0,Math.min(o-i,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(i+r);return new Sl(a,l,n+s*r,s,0)}}lineAt(e,t,n,r,i){if(t==Su.ByHeight)return this.blockAt(e,n,r,i);if(t==Su.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Sl(t,r-t,0,0,0)}let{firstLine:o,perLine:s,perChar:a}=this.heightMetrics(n,i),l=n.doc.lineAt(e),u=s+l.length*a,c=l.number-o,h=r+s*c+a*(l.from-i-c);return new Sl(l.from,l.length,Math.max(r,Math.min(h,r+this.height-u)),u,0)}forEachLine(e,t,n,r,i,o){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,i);for(let u=e,c=r;u<=t;){let t=n.doc.lineAt(u);if(u==e){let n=t.number-s;c+=a*n+l*(e-i-n)}let r=a+l*t.length;o(new Sl(t.from,t.length,c,r,0)),c+=r,u=t.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let e=n[n.length-1];e instanceof Sm?n[n.length-1]=new Sm(e.length+r):n.push(null,new Sm(r-1))}if(e>0){let t=n[0];t instanceof Sm?n[0]=new Sm(e+t.length):n.unshift(new Sm(e-1),null)}return Sc.of(n)}decomposeLeft(e,t){t.push(new Sm(e-1),null)}decomposeRight(e,t){t.push(null,new Sm(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let i=t+this.length;if(r&&r.from<=t+this.length&&r.more){let n=[],o=Math.max(t,r.from),s=-1;for(r.from>t&&n.push(new Sm(r.from-t-1).updateHeight(e,t));o<=i&&r.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let i=r.heights[r.index++],a=0;i<0&&(a=-i,i=r.heights[r.index++]),-1==s?s=i:Math.abs(i-s)>=.001&&(s=-2);let l=new Sp(t,i,a);l.outdated=!1,n.push(l),o+=t+1}o<=i&&n.push(null,new Sm(i-o).updateHeight(e,o));let a=Sc.of(n);return(s<0||Math.abs(a.height-this.height)>=.001||Math.abs(s-this.heightMetrics(e,t).perLine)>=.001)&&(So=!0),Sh(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Sg extends Sc{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let o=r+this.left.height,s=i+this.left.length+this.break,a=t==Su.ByHeight?e<o:e<s,l=a?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,o,s);if(this.break||(a?l.to<s:l.from>s))return l;let u=t==Su.ByPosNoHeight?Su.ByPosNoHeight:Su.ByPos;return a?l.join(this.right.lineAt(s,u,n,o,s)):this.left.lineAt(s,u,n,r,i).join(l)}forEachLine(e,t,n,r,i,o){let s=r+this.left.height,a=i+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,r,i,o),t>=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,Su.ByPos,n,r,i);e<l.from&&this.left.forEachLine(e,l.from-1,n,r,i,o),l.to>=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,o)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let e of n)i.push(e);if(e>0&&Sv(i,o-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Sv(i,e)}return Sc.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&e>=++n&&t.push(null),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Sc.of(this.break?[e,null,t]:[e,t]):(this.left=Sh(this.left,e),this.right=Sh(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:o}=this,s=t+i.length+this.break,a=null;return(r&&r.from<=t+i.length&&r.more?a=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=s+o.length&&r.more?a=o=o.updateHeight(e,s,n,r):o.updateHeight(e,s,n),a)?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Sv(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof Sm&&(r=e[t+1])instanceof Sm&&e.splice(t-1,3,new Sm(n.length+1+r.length))}class Sy{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Sp?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Sp(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new Sf(o,r,n)):(o||i||r>=5)&&this.addLineDeco(r,i,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Sp(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Sm(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Sp)return e;let t=new Sp(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Sp||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Sp(0,-1,0));let n=e;for(let e of this.nodes)e instanceof Sp&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let i=new Sy(n,e);return ba.spans(t,n,r,i,0),i.finish(n)}}class Sb{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&b5(e,t,this.changes,5)}}class Sx{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return bQ.replace({widget:new Sw(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Sw extends bZ{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class SS{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=SM,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=xg.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(xQ).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new Ss(n),this.stateDeco=ST(t),this.heightMap=Sc.empty().applyChanges(this.stateDeco,yi.empty,this.heightOracle.setDoc(t.doc),[new x9(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=bQ.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new SC(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?SM:new SD(this.heightOracle,this.heightMap,this.viewports),2*!e.eq(this.scaler)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(SE(e,this.scaler))})}update(e,t=null){var n,r;let i;this.state=e.state;let o=this.stateDeco;this.stateDeco=ST(this.state);let s=e.changedRanges,a=x9.extendWithRanges(s,(n=this.stateDeco,r=e?e.changes:yx.empty(this.state.doc.length),i=new Sb,ba.compare(o,n,r,i,0),i.changes)),l=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);So=!1,this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=l||So)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let c=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(xz)&&(this.mustEnforceCursorAssoc=!0)}measure(){var e;let t,n,{view:r}=this,i=r.contentDOM,o=window.getComputedStyle(i),s=this.heightOracle,a=o.whiteSpace;this.defaultTextDirection="rtl"==o.direction?xg.RTL:xg.LTR;let l=this.heightOracle.mustRefreshForWrapping(a)||"refresh"===this.mustMeasureContent,u=i.getBoundingClientRect(),c=l||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let h=0,d=0;if(u.width&&u.height){let{scaleX:e,scaleY:t}=xo(i,u);(e>.005&&Math.abs(this.scaleX-e)>.005||t>.005&&Math.abs(this.scaleY-t)>.005)&&(this.scaleX=e,this.scaleY=t,h|=16,l=c=!0)}let f=(parseInt(o.paddingTop)||0)*this.scaleY,p=(parseInt(o.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=p)&&(this.paddingTop=f,this.paddingBottom=p,h|=18),this.editorWidth!=r.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=r.scrollDOM.clientWidth,h|=16);let m=xs(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=xd(this.scrollParent||r.win);let v=(this.printing?function(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}:function(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,o=Math.max(0,n.left),s=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(1==t.nodeType){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=r.overflow){let r=n.getBoundingClientRect();o=Math.max(o,r.left),s=Math.min(s,r.right),a=Math.max(a,r.top),l=Math.min(t==e.parentNode?i.innerHeight:l,r.bottom)}t="absolute"==r.position||"fixed"==r.position?n.offsetParent:n.parentNode}else if(11==t.nodeType)t=t.host;else break;return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}})(i,this.paddingTop),y=v.top-this.pixelViewport.top,b=v.bottom-this.pixelViewport.bottom;this.pixelViewport=v;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(c=!0)),!this.inView&&!this.scrollTarget&&(t=(e=r.dom).getBoundingClientRect(),n=e.ownerDocument.defaultView||window,!(t.left<n.innerWidth)||!(t.right>0)||!(t.top<n.innerHeight)||!(t.bottom>0)))return 0;let w=u.width;if((this.contentDOMWidth!=w||this.editorHeight!=r.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=r.scrollDOM.clientHeight,h|=16),c){let e=r.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(e)&&(l=!0),l||s.lineWrapping&&Math.abs(w-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:i}=r.docView.measureTextSize();(l=t>0&&s.refresh(a,t,n,i,Math.max(5,w/n),e))&&(r.docView.minWidth=0,h|=16)}for(let t of(y>0&&b>0?d=Math.max(y,b):y<0&&b<0&&(d=Math.min(y,b)),So=!1,this.viewports)){let n=t.from==this.viewport.from?e:r.docView.measureVisibleLineHeights(t);this.heightMap=(l?Sc.empty().applyChanges(this.stateDeco,yi.empty,this.heightOracle,[new x9(0,0,0,r.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new Sa(t.from,n))}So&&(h|=2)}let S=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return S&&(2&h&&(h|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),h|=this.updateForViewport()),(2&h||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,r)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,r.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new SC(r.lineAt(o-1e3*n,Su.ByHeight,i,0,0).from,r.lineAt(s+(1-n)*1e3,Su.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=r.lineAt(e,Su.ByPos,i,0,0),s;s="center"==t.y?(o.top+o.bottom)/2-n/2:"start"==t.y||"nearest"==t.y&&e<a.from?o.top:o.bottom-n,a=new SC(r.lineAt(s-500,Su.ByHeight,i,0,0).from,r.lineAt(s+n+500,Su.ByHeight,i,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new SC(this.heightMap.lineAt(n,Su.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Su.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Su.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,Su.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(0==e||r<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=s+Math.max(10,Math.min(n,250)))&&r>o-2e3&&i<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Sx(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=xg.LTR&&!n)return[];let s=[],a=(r,o,l,u)=>{if(o-r<i)return;let c=this.state.selection.main,h=[c.from];for(let e of(c.empty||h.push(c.to),h))if(e>r&&e<o){a(r,e-10,l,u),a(e+10,o,l,u);return}let d=function(e,t){for(let n of e)if(t(n))return n}(e,e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-o)<i&&!h.some(t=>e.from<t&&e.to>t));if(!d){if(o<l.to&&t&&n&&t.visibleRanges.some(e=>e.from<=o&&e.to>=o)){let e=t.moveToLineBoundary(yD.cursor(o),!1,!0).head;e>r&&(o=e)}let e=this.gapSize(l,r,o,u),i=n||e<2e6?e:2e6;d=new Sx(r,o,e,i)}s.push(d)},l=t=>{var i,s,l;let u,c,h,d,f;if(t.length<o||t.type!=bX.Text)return;let p=(i=t.from,s=t.to,l=this.stateDeco,h=[],d=i,f=0,ba.spans(l,i,s,{span(){},point(e,t){e>d&&(h.push({from:d,to:e}),f+=e-d),d=t}},20),d<s&&(h.push({from:d,to:s}),f+=s-d),{total:f,ranges:h});if(p.total<o)return;let m=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,i=r/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=m){let r=Sk(p,m),o=((this.visibleBottom-this.visibleTop)/2+i)/t.height;e=r-o,n=r+o}else e=(this.visibleTop-t.top-i)/t.height,n=(this.visibleBottom-t.top+i)/t.height;u=SA(p,e),c=SA(p,n)}else{let n,i,o=p.total*this.heightOracle.charWidth,s=r*this.heightOracle.charWidth,a=0;if(o>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let l=this.pixelViewport.left+a,h=this.pixelViewport.right+a;if(null!=m){let e=Sk(p,m),t=((h-l)/2+s)/o;n=e-t,i=e+t}else n=(l-s)/o,i=(h+s)/o;u=SA(p,n),c=SA(p,i)}u>t.from&&a(t.from,u,t,p),c<t.to&&a(c,t.to,t,p)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,r){let i=Sk(r,n)-Sk(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){Sx.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=bQ.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];ba.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(8&r);t++){let i=this.visibleRanges[t],o=n[t];(i.from!=o.from||i.to!=o.to)&&(r|=4,e&&e.mapPos(i.from,-1)==o.from&&e.mapPos(i.to,1)==o.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||SE(this.heightMap.lineAt(e,Su.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||SE(this.heightMap.lineAt(this.scaler.fromDOM(e),Su.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return SE(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class SC{constructor(e,t){this.from=e,this.to=t}}function SA({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],o=i-n;if(r<=o)return n+r;r-=o}}function Sk(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}let SM={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function ST(e){let t=e.facet(xJ).filter(e=>"function"!=typeof e),n=e.facet(x1).filter(e=>"function"!=typeof e);return n.length&&t.push(ba.join(n)),t}class SD{constructor(e,t,n){let r=0,i=0,o=0;for(let s of(this.viewports=n.map(({from:n,to:i})=>{let o=t.lineAt(n,Su.ByPos,e,0,0).top,s=t.lineAt(i,Su.ByPos,e,0,0).bottom;return r+=s-o,{from:n,to:i,top:o,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r),this.viewports))s.domTop=o+(s.top-i)*this.scale,o=s.domBottom=s.domTop+(s.bottom-s.top),i=s.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(e){return e instanceof SD&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function SE(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Sl(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>SE(e,t)):e._content)}let SO=yR.define({combine:e=>e.join(" ")}),SR=yR.define({combine:e=>e.indexOf(!0)>-1}),SI=bA.newName(),SP=bA.newName(),SN=bA.newName(),SL={"&light":"."+SP,"&dark":"."+SN};function Sj(e,t,n){return new bA(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}let SF=Sj("."+SI,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},SL),SB={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},S_=bU.ie&&bU.ie_version<=11;class Sz{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new xa,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(bU.ie&&bU.ie_version<=11||bU.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&bU.android&&!1!==e.constructor.EDIT_CONTEXT&&!(bU.chrome&&bU.chrome_version<126)&&(this.editContext=new S$(e),e.state.facet(xq)&&(e.contentDOM.editContext=this.editContext.editContext)),S_&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null==(e=this.view.docView)?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){for(let t of(this.gapIntersection.disconnect(),e))this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(xq)?n.root.activeElement!=this.dom:!b8(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(bU.ie&&bU.ie_version<=11||bU.android&&bU.chrome)&&!n.state.selection.main.empty&&r.focusNode&&b7(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=b3(e.root);if(!t)return!1;let n=bU.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return SH(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?SH(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=b8(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,xr(n));;)if(r){if(1!=n.nodeType)return!1;let e=n.childNodes[r-1];"false"==e.contentEditable?r--:r=xr(n=e)}else{if(n==e)return!0;r=xe(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(11==n.nodeType)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,SB),S_&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),S_&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&xh(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null==(n=this.delayedAndroidKey)?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),-1==t?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&b8(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new w_(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=wz(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!w$(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=SV(t,e.previousSibling||e.target.previousSibling,-1),r=SV(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(xq)!=e.state.facet(xq)&&(e.view.contentDOM.editContext=e.state.facet(xq)?this.editContext.editContext:null))}destroy(){var e,t,n;for(let r of(this.stop(),null==(e=this.intersection)||e.disconnect(),null==(t=this.gapIntersection)||t.disconnect(),null==(n=this.resizeScroll)||n.disconnect(),this.scrollTargets))r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function SV(e,t,n){for(;t;){let r=wt.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function SH(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor,1);return b7(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}class S${constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});for(let n in this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:o}=r,s=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1});let l=a-s>n.text.length;s==this.from&&i<this.from?s=i:a==this.to&&i>this.to&&(a=i);let u=wH(e.state.sliceDoc(s,a),n.text,(l?r.from:r.to)-s,l?"end":null);if(!u){let t=yD.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));w$(t,r)||e.dispatch({selection:t,userEvent:"select"});return}let c={from:u.from+s,to:u.toA+s,insert:yi.of(n.text.slice(u.from,u.toB).split("\n"))};if((bU.mac||bU.android)&&c.from==o-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(c={from:s,to:a,insert:yi.of([n.text.replace("."," ")])}),this.pendingContextChange=c,!e.state.readOnly){let t=this.to-this.from+(c.to-c.from+c.insert.length);wV(e,c,yD.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),c.from<c.to&&!c.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t<o;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(i<o){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(r)?1:2}px`;n.push(bQ.mark({attributes:{style:e}}).range(i,o))}}}e.dispatch({effects:xW.of(bQ.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}},this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:e=>{let t=b3(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,o,s,a,l)=>{if(n)return;let u=l.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(l)){r=this.pendingContextChange=null,t+=u,this.to+=u;return}else r=null,this.revertPending(e.state);if(i+=t,(o+=t)<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+l.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),l.toString()),this.to+=u}t+=u}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class SW{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;for(let t of(this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new SS(this,e.state||be.create(e)),e.scrollTo&&e.scrollTo.is(x$)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(xY).map(e=>new xZ(e)),this.plugins))t.update(this);this.observer=new Sz(this),this.inputState=new wW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new wC(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null==(t=document.fonts)?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof y5?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,r,i=this.state;for(let t of e){if(t.startState!=i)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=t.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,s=0,a=null;e.some(e=>e.annotation(Se))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,(a=St(i,o))||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),((u=this.observer.readChange())&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(be.phrases)!=this.state.facet(be.phrases))return this.setState(i);r=x7.create(this,i,e),r.flags|=s;let c=this.viewState.scrollTarget;try{for(let t of(this.updateState=2,e)){if(c&&(c=c.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection,{x:n,y:r}=this.state.facet(SW.cursorScrollMargin);c=new xH(e.empty?e:yD.cursor(e.head,e.head>e.anchor?-1:1),"nearest","nearest",r,n)}for(let e of t.effects)e.is(x$)&&(c=e.value.clip(this.state))}this.viewState.update(r,c),this.bidiCache=SG.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(x8)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(SO)!=r.state.facet(SO)&&(this.viewState.mustMeasureContent=!0),(t||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let e of this.state.facet(xN))try{e(r)}catch(e){xU(this.state,e,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!wz(this,u)&&l.force&&xh(this.contentDOM,l.key,l.keyCode)})}setState(e){if(0!=this.updateState)throw Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);for(let t of(this.viewState=new SS(this,e),this.plugins=e.facet(xY).map(e=>new xZ(e)),this.pluginMap.clear(),this.plugins))t.update(this);this.docView.destroy(),this.docView=new wC(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(xY),n=e.state.facet(xY);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new xZ(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){xU(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(xd(n||this.win))i=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,o=e.top}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(e=>{try{return e.read(this)}catch(e){return xU(this.state,e),Sq}}),u=x7.create(this,this.state,[]),c=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,!u.empty&&(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),(c=this.docView.update(u))&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=Sq)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){xU(this.state,e)}if(c&&this.docView.updateSelection(!0),!u.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let e=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o)/this.scaleY;if((e>1||e<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?n.scrollTop+=e:this.win.scrollBy(0,e),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(xN))e(t)}get themeClasses(){return SI+" "+(this.state.facet(SR)?SN:SP)+" "+this.state.facet(SO)}updateAttrs(){let e=SY(this,xX,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(xq)?"true":"false",class:"cm-content",style:`${bU.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),SY(this,xQ,t);let n=this.observer.ignore(()=>{let n=bK(this.contentDOM,this.contentAttrs,t),r=bK(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(SW.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(x8);let e=this.state.facet(SW.cspNonce);bA.mount(this.root,this.styleModules.concat(SF).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if((this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e)&&!(this.measureRequests.indexOf(e)>-1)){if(null!=e.key){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return wP(this,e,wO(this,e,t,n))}moveByGroup(e,t){return wP(this,e,wO(this,e,t,t=>{var n;let r,i;return n=e.head,i=(r=this.state.charCategorizer(n))(t),e=>{let t=r(e);return i==y9.Space&&(i=t),i==t}}))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return yD.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let i=wE(e,t.head,t.assoc||-1),o=r&&i.type==bX.Text&&(e.lineWrapping||i.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),s=e.posAtCoords({x:n==(r==xg.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return yD.cursor(s,n?-1:1)}return yD.cursor(n?i.to:i.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return wP(this,e,function(e,t,n,r){let i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return yD.cursor(i,t.assoc);let s=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),c=e.documentTop;if(u)null==s&&(s=u.left-l.left),a=o<0?u.top:u.bottom;else{let t=e.viewState.lineBlockAt(i);null==s&&(s=Math.min(l.right-l.left,e.defaultCharacterWidth*(i-t.from))),a=(o<0?t.top:t.bottom)+c}let h=l.left+s,d=e.viewState.heightOracle.textHeight>>1,f=null!=r?r:d;for(let t=0;;t+=d){let r=a+(f+t)*o,i=wL(e,{x:h,y:r},!1,o);if(n?r>l.bottom:r<l.top)return yD.cursor(i.pos,i.assoc);let u=e.coordsAtPos(i.pos,i.assoc),c=u?(u.top+u.bottom)/2:0;if(!u||(n?c>a:c<a))return yD.cursor(i.pos,i.assoc,void 0,s)}}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=wL(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),wL(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r);return xi(n,i[xM.find(i,e-r.from,-1,t)].dir==xg.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(x_)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>SU)return xD(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||function e(t,n){if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++){let i=t[r],o=n[r];if(i.from!=o.from||i.to!=o.to||i.direction!=o.direction||!e(i.inner,o.inner))return!1}return!0}(r.isolates,n=x4(this,e))))return r.order;n||(n=x4(this,e));let r=function(e,t,n){if(!e)return[new xM(0,0,+(t==xy))];if(t==xv&&!n.length&&!xk.test(e))return xD(e.length);if(n.length)for(;e.length>xT.length;)xT[xT.length]=256;let r=[],i=+(t!=xv);return function e(t,n,r,i,o,s,a){let l=n%2?2:1;!function(e,t,n,r,i){for(let o=0;o<=r.length;o++){let s=o?r[o-1].to:t,a=o<r.length?r[o].from:n,l=o?256:i;for(let t=s,n=l,r=l;t<a;t++){let i=xA(e.charCodeAt(t));512==i?i=n:8==i&&4==r&&(i=16),xT[t]=4==i?2:i,7&i&&(r=i),n=i}for(let e=s,t=l,r=l;e<a;e++){let i=xT[e];if(128==i)e<a-1&&t==xT[e+1]&&24&t?i=xT[e]=t:xT[e]=256;else if(64==i){let i=e+1;for(;i<a&&64==xT[i];)i++;let o=e&&8==t||i<n&&8==xT[i]?1==r?1:8:256;for(let t=e;t<i;t++)xT[t]=o;e=i-1}else 8==i&&1==r&&(xT[e]=1);t=i,7&i&&(r=i)}}}(t,o,s,i,l),function(e,t,n,r,i){let o=1==i?2:1;for(let s=0,a=0,l=0;s<=r.length;s++){let u=s?r[s-1].to:t,c=s<r.length?r[s].from:n;for(let t=u,n,r,s;t<c;t++)if(r=xS[n=e.charCodeAt(t)])if(r<0){for(let e=a-3;e>=0;e-=3)if(xC[e+1]==-r){let n=xC[e+2],r=2&n?i:4&n?1&n?o:i:0;r&&(xT[t]=xT[xC[e]]=r),a=e;break}}else if(189==xC.length)break;else xC[a++]=t,xC[a++]=n,xC[a++]=l;else if(2==(s=xT[t])||1==s){let e=s==i;l=+!e;for(let t=a-3;t>=0;t-=3){let n=xC[t+2];if(2&n)break;if(e)xC[t+2]|=2;else{if(4&n)break;xC[t+2]|=4}}}}}(t,o,s,i,l),function(e,t,n,r){for(let i=0,o=r;i<=n.length;i++){let s=i?n[i-1].to:e,a=i<n.length?n[i].from:t;for(let l=s;l<a;){let s=xT[l];if(256==s){let s=l+1;for(;;)if(s==a){if(i==n.length)break;s=n[i++].to,a=i<n.length?n[i].from:t}else if(256==xT[s])s++;else break;let u=1==o,c=u==((s<t?xT[s]:r)==1)?u?1:2:r;for(let t=s,r=i,o=r?n[r-1].to:e;t>l;)t==o&&(t=n[--r].from,o=r?n[r-1].to:e),xT[--t]=c;l=s}else o=s,l++}}}(o,s,i,l),function t(n,r,i,o,s,a,l){let u=o%2?2:1;if(o%2==s%2)for(let c=r,h=0;c<i;){let r=!0,d=!1;if(h==a.length||c<a[h].from){let e=xT[c];e!=u&&(r=!1,d=16==e)}let f=r||1!=u?null:[],p=r?o:o+1,m=c;o:for(;;)if(h<a.length&&m==a[h].from){if(d)break;let t=a[h];if(!r)for(let e=t.to,n=h+1;;){if(e==i)break o;if(n<a.length&&a[n].from==e)e=a[n++].to;else if(xT[e]==u)break o;else break}h++,f?f.push(t):(t.from>c&&l.push(new xM(c,t.from,p)),e(n,t.direction==xv!=!(p%2)?o+1:o,s,t.inner,t.from,t.to,l),c=t.to),m=t.to}else if(m==i||(r?xT[m]!=u:xT[m]==u))break;else m++;f?t(n,c,m,o+1,s,f,l):c<m&&l.push(new xM(c,m,p)),c=m}else for(let c=i,h=a.length;c>r;){let i=!0,d=!1;if(!h||c>a[h-1].to){let e=xT[c-1];e!=u&&(i=!1,d=16==e)}let f=i||1!=u?null:[],p=i?o:o+1,m=c;o:for(;;)if(h&&m==a[h-1].to){if(d)break;let t=a[--h];if(!i)for(let e=t.from,n=h;;){if(e==r)break o;if(n&&a[n-1].to==e)e=a[--n].from;else if(xT[e-1]==u)break o;else break}f?f.push(t):(t.to<c&&l.push(new xM(t.to,c,p)),e(n,t.direction==xv!=!(p%2)?o+1:o,s,t.inner,t.from,t.to,l),c=t.from),m=t.from}else if(m==r||(i?xT[m-1]!=u:xT[m-1]==u))break;else m--;f?t(n,m,c,o+1,s,f,l):m<c&&l.push(new xM(m,c,p)),c=m}}(t,o,s,n,r,i,a)}(e,i,i,n,0,e.length,r),r}(e.text,t,n);return this.bidiCache.push(new SG(e.from,e.to,t,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||bU.safari&&(null==(e=this.inputState)?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{xu(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of(this.root.activeElement==this.contentDOM&&this.contentDOM.blur(),this.plugins))e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var n,r,i,o;return x$.of(new xH("number"==typeof e?yD.cursor(e):e,null!=(n=t.y)?n:"nearest",null!=(r=t.x)?r:"nearest",null!=(i=t.yMargin)?i:5,null!=(o=t.xMargin)?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return x$.of(new xH(yD.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return xK.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return xK.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=bA.newName(),r=[SO.of(n),x8.of(Sj(`.${n}`,e))];return t&&t.dark&&r.push(SR.of(!0)),r}static baseTheme(e){return y_.lowest(x8.of(Sj("."+SI,e,SL)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&wt.get(n)||wt.get(e);return(null==(t=null==r?void 0:r.root)?void 0:t.view)||null}}SW.styleModule=x8,SW.inputHandler=xL,SW.clipboardInputFilter=xF,SW.clipboardOutputFilter=xB,SW.scrollHandler=xV,SW.focusChangeEffect=xj,SW.perLineTextDirection=x_,SW.exceptionSink=xP,SW.updateListener=xN,SW.editable=xq,SW.mouseSelectionStyle=xI,SW.dragMovesSelection=xR,SW.clickAddsSelectionRange=xO,SW.decorations=xJ,SW.blockWrappers=x0,SW.outerDecorations=x1,SW.atomicRanges=x2,SW.bidiIsolatedRanges=x5,SW.cursorScrollMargin=yR.define({combine:e=>{let t=5,n=5;for(let r of e)"number"==typeof r?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),SW.scrollMargins=x3,SW.darkTheme=SR,SW.cspNonce=yR.define({combine:e=>e.length?e[0]:""}),SW.contentAttributes=xQ,SW.editorAttributes=xX,SW.lineWrapping=SW.contentAttributes.of({class:"cm-lineWrapping"}),SW.announce=y2.define();let SU=4096,Sq={};class SG{constructor(e,t,n,r,i,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=o}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:xg.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir!=r||t.touchesRange(o.from,o.to)||n.push(new SG(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function SY(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],o="function"==typeof t?t(e):t;o&&bq(o,n)}return n}let SK=bU.mac?"mac":bU.windows?"win":bU.linux?"linux":"key";function SZ(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}let SX=y_.default(SW.domEventHandlers({keydown:(e,t)=>S5(S0(t.state),e,t,"editor")})),SQ=yR.define({enables:SX}),SJ=new WeakMap;function S0(e){let t=e.facet(SQ),n=SJ.get(t);return n||SJ.set(t,n=function(e,t=SK){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(null==n)r[e]=t;else if(n!=t)throw Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},o=(e,r,o,s,a)=>{var l,u;let c=n[e]||(n[e]=Object.create(null)),h=r.split(/ (?!$)/).map(e=>(function(e,t){let n,r,i,o,s=e.split(/-(?!$)/),a=s[s.length-1];"Space"==a&&(a=" ");for(let e=0;e<s.length-1;++e){let a=s[e];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))"mac"==t?o=!0:r=!0;else throw Error("Unrecognized modifier name: "+a)}return n&&(a="Alt-"+a),r&&(a="Ctrl-"+a),o&&(a="Meta-"+a),i&&(a="Shift-"+a),a})(e,t));for(let t=1;t<h.length;t++){let n=h.slice(0,t).join(" ");i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=S1={view:t,prefix:n,scope:e};return setTimeout(()=>{S1==r&&(S1=null)},4e3),!0}]})}let d=h.join(" ");i(d,!1);let f=c[d]||(c[d]={preventDefault:!1,stopPropagation:!1,run:(null==(u=null==(l=c._any)?void 0:l.run)?void 0:u.slice())||[]});o&&f.run.push(o),s&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,S2))}let i=r[t]||r.key;if(i)for(let t of e)o(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&o(t,"Shift-"+i,r.shift,r.preventDefault,r.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}let S1=null,S2=null;function S5(e,t,n,r){var i;S2=t;let o=("Esc"==(i=!(bE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||bO&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?bD:bT)[t.keyCode]||t.key||"Unidentified")&&(i="Escape"),"Del"==i&&(i="Delete"),"Left"==i&&(i="ArrowLeft"),"Up"==i&&(i="ArrowUp"),"Right"==i&&(i="ArrowRight"),"Down"==i&&(i="ArrowDown"),i),s=yg(yp(o,0))==o.length&&" "!=o,a="",l=!1,u=!1,c=!1;S1&&S1.view==n&&S1.scope==r&&(a=S1.prefix+" ",0>wY.indexOf(t.keyCode)&&(u=!0,S1=null));let h=new Set,d=e=>{if(e){for(let t of e.run)if(!h.has(t)&&(h.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),u=!0)}return!1},f=e[r],p,m;return f&&(d(f[a+SZ(o,t,!s)])?l=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(bU.windows&&t.ctrlKey&&t.altKey)&&!(bU.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=bT[t.keyCode])&&p!=o?d(f[a+SZ(p,t,!0)])?l=!0:t.shiftKey&&(m=bD[t.keyCode])!=o&&m!=p&&d(f[a+SZ(m,t,!1)])&&(l=!0):s&&t.shiftKey&&d(f[a+SZ(o,t,!0)])&&(l=!0),!l&&d(f._any)&&(l=!0)),u&&(l=!0),l&&c&&t.stopPropagation(),S2=null,l}class S4{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(!n.empty)return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),o=e.textDirection==xg.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=S3(e),u=s.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),h=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=wE(e,r,1),p=wE(e,i,-1),m=f.type==bX.Text?f:null,g=p.type==bX.Text?p:null;if(m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=S6(e,r,1,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=S6(e,i,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return y(b(n.from,n.to,m));{let t=m?b(n.from,null,m):x(f,!1),r=g?b(null,n.to,g):x(p,!0),i=[];return(m||f).to<(g||p).from-(m&&g?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(v(h,t.bottom,d,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==bX.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),y(t).concat(i).concat(y(r))}function v(e,n,r,i){return new S4(t,e-l.left,n-l.top,Math.max(0,r-e),i-n)}function y({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(v(n[i],e,n[i+1],t));return r}function b(t,n,r){let i=1e9,s=-1e9,a=[];function l(t,n,l,u,c){let f=e.coordsAtPos(t,t==r.to?-2:2),p=e.coordsAtPos(l,l==r.from?2:-2);f&&p&&(i=Math.min(f.top,p.top,i),s=Math.max(f.bottom,p.bottom,s),c==xg.LTR?a.push(o&&n?h:f.left,o&&u?d:p.right):a.push(!o&&u?h:p.left,!o&&n?d:f.right))}let u=null!=t?t:r.from,c=null!=n?n:r.to;for(let r of e.visibleRanges)if(r.to>u&&r.from<c)for(let i=Math.max(r.from,u),o=Math.min(r.to,c);;){let r=e.state.doc.lineAt(i);for(let s of e.bidiSpans(r)){let e=s.from+r.from,a=s.to+r.from;if(e>=o)break;a>i&&l(Math.max(e,i),null==t&&e<=u,Math.min(a,o),null==n&&a>=c,s.dir)}if((i=r.to+1)>=o)break}return 0==a.length&&l(u,null==t,c,null==n,e.textDirection),{top:i,bottom:s,horizontal:a}}function x(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n);{let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let i=S3(e);return[new S4(t,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}}}function S3(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==xg.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function S6(e,t,n,r){let i=e.coordsAtPos(t,2*n);if(!i)return r;let o=e.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,a=e.posAtCoords({x:o.left+1,y:s}),l=e.posAtCoords({x:o.right-1,y:s});return null==a||null==l?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}class S8{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(S9)!=e.state.facet(S9)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(S9);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>{var n;return n=this.drawn[t],!(e.constructor==n.constructor&&e.eq(n))})){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,bU.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}let S9=yR.define();function S7(e){return[xK.define(t=>new S8(t,e)),S9.of(e)]}let Ce=yR.define({combine:e=>bt(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Ct(e){return e.startState.facet(Ce)!=e.state.facet(Ce)}let Cn=S7({above:!0,markers(e){let{state:t}=e,n=t.facet(Ce),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(o&&bU.ios&&n.iosSelectionHandles)){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=i.empty?i:yD.cursor(i.head,i.assoc);for(let i of S4.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=Ct(e);return n&&Cr(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Cr(t.state,e)},class:"cm-cursorLayer"});function Cr(e,t){t.style.animationDuration=e.facet(Ce).cursorBlinkRate+"ms"}let Ci=S7({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let n of r)if(!n.empty)for(let r of S4.forRange(e,"cm-selectionBackground",n))t.push(r);if(bU.ios&&!n.empty&&e.state.facet(Ce).iosSelectionHandles){for(let r of S4.forRange(e,"cm-selectionHandle cm-selectionHandle-start",yD.cursor(n.from,1)))t.push(r);for(let r of S4.forRange(e,"cm-selectionHandle cm-selectionHandle-end",yD.cursor(n.to,1)))t.push(r)}return t},update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||Ct(e),class:"cm-selectionLayer"}),Co=y_.highest(SW.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Cs=y2.define({map:(e,t)=>null==e?null:t.mapPos(e)}),Ca=yF.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(Cs)?t.value:e,e))}),Cl=xK.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(Ca);null==n?null!=this.cursor&&(null==(t=this.cursor)||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(Ca)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(Ca),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(Ca)!=e&&this.view.dispatch({effects:Cs.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Cu(e,t,n,r,i){t.lastIndex=0;for(let o=e.iterRange(n,r),s=n,a;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;a=t.exec(o.value);)i(s+a.index,a)}class Cc{constructor(e){const{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:o=1e3}=e;if(!t.global)throw RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,r,i)=>{let o=n(e,t,r);o&&i(r,r+e[0].length,o)};else if(n)this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n);else throw RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(e){let t=new bl,n=t.add.bind(t);for(let{from:t,to:r}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),o=Math.min(e.state.doc.lineAt(o).to,o+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}(e,this.maxLength))Cu(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return(e.docChanged&&e.changes.iterChanges((t,i,o,s)=>{s>=e.view.viewport.from&&o<=e.view.viewport.to&&(n=Math.min(o,n),r=Math.max(s,r))}),e.viewportMoved||r-n>1e3)?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let o=Math.max(i.from,n),s=Math.min(i.to,r);if(s>=o){let n=e.state.doc.lineAt(o),r=n.to<s?e.state.doc.lineAt(s):n,a=Math.max(i.from,n.from),l=Math.min(i.to,r.to);if(this.boundary){for(;o>n.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;s<r.to;s++)if(this.boundary.test(r.text[s-r.from])){l=s;break}}let u=[],c,h=(e,t,n)=>u.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.index<l-n.from;)this.addMatch(c,e,c.index+n.from,h);else Cu(e.state.doc,this.regexp,a,l,(t,n)=>this.addMatch(n,e,t,h));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:u})}}return t}}let Ch=null!=/x/.unicode?"gu":"g",Cd=RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]",Ch),Cf={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Cp=null,Cm=yR.define({combine(e){let t=bt(e,{render:null,specialChars:Cd,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Cp&&"u">typeof document&&document.body){let t=document.body.style;Cp=(null!=(e=t.tabSize)?e:t.MozTabSize)!=null}return Cp||!1}())&&(t.specialChars=RegExp(" |"+t.specialChars.source,Ch)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Ch)),t}}),Cg=null;class Cv extends bZ{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){var t;let n=(t=this.code)>=32?"•":10==t?"␤":String.fromCharCode(9216+t),r=e.state.phrase("Control character")+" "+(Cf[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let o=document.createElement("span");return o.textContent=n,o.title=r,o.setAttribute("aria-label",r),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class Cy extends bZ{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}let Cb=bQ.line({class:"cm-activeLine"}),Cx=xK.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(Cb.range(i.from)),t=i.from)}return bQ.set(n)}},{decorations:e=>e.decorations});class Cw extends bZ{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?b9(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=xi(t[0],"rtl"!=n.direction),i=parseInt(n.lineHeight);return r.bottom-r.top>1.5*i?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}function CS(e,t){var n;let r,i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),o=e.state.doc.lineAt(i),s=i-o.from,a=s>2e3?-1:s==o.length?(n=t.clientX,(r=e.coordsAtPos(e.viewport.from))?Math.round(Math.abs((r.left-n)/e.defaultCharacterWidth)):-1):bb(o.text,e.state.tabSize,i-o.from);return{line:o.number,col:a,off:s}}let CC={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},CA={style:"cursor: crosshair"},Ck="-10000px";class CM{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let o=[],s=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],a=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(a=e)}if(a<0)o[n]=this.createTooltipView(r,n?o[n-1]:null),s&&(s[n]=!!r.above);else{let r=o[n]=this.tooltipViews[a];s&&(s[n]=t[a]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)0>o.indexOf(e)&&(this.removeTooltipView(e),null==(n=e.destroy)||n.call(e));return t&&(s.forEach((e,n)=>t[n]=e),t.length=s.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function CT(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}let CD=yR.define({combine:e=>{var t,n,r;return{position:bU.ios?"absolute":(null==(t=e.find(e=>e.position))?void 0:t.position)||"fixed",parent:(null==(n=e.find(e=>e.parent))?void 0:n.parent)||null,tooltipSpace:(null==(r=e.find(e=>e.tooltipSpace))?void 0:r.tooltipSpace)||CT}}}),CE=new WeakMap,CO=xK.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(CD);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new CM(e,CN,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver)for(let e of(this.intersectionObserver.disconnect(),this.manager.tooltipViews))this.intersectionObserver.observe(e.dom)}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(CD);if(r.position!=this.position&&!this.madeAbsolute){for(let e of(this.position=r.position,this.manager.tooltipViews))e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){for(let e of(this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer(),this.manager.tooltipViews))this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=Ck,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;for(let t of(this.view.win.removeEventListener("resize",this.measureSoon),this.manager.tooltipViews))t.dom.remove(),null==(e=t.destroy)||e.call(t);this.parent&&this.container.remove(),null==(t=this.resizeObserver)||t.disconnect(),null==(n=this.intersectionObserver)||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(bU.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=x6(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(CD).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute)for(let e of(this.madeAbsolute=!0,this.position="absolute",this.manager.tooltipViews))e.dom.style.position="absolute";let{visible:n,space:r,scaleX:i,scaleY:o}=e,s=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],u=this.manager.tooltipViews[a],{dom:c}=u,h=e.pos[a],d=e.size[a];if(!h||!1!==l.clip&&(h.bottom<=Math.max(n.top,r.top)||h.top>=Math.min(n.bottom,r.bottom)||h.right<Math.max(n.left,r.left)-.1||h.left>Math.min(n.right,r.right)+.1)){c.style.top=Ck;continue}let f=l.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=7*!!f,m=d.right-d.left,g=null!=(t=CE.get(u))?t:d.bottom-d.top,v=u.offset||CP,y=this.view.textDirection==xg.LTR,b=d.width>r.right-r.left?y?r.left:r.right-d.width:y?Math.max(r.left,Math.min(h.left-14*!!f+v.x,r.right-m)):Math.min(Math.max(r.left,h.left-m+14*!!f-v.x),r.right-m),x=this.above[a];!l.strictSide&&(x?h.top-g-p-v.y<r.top:h.bottom+g+p+v.y>r.bottom)&&x==r.bottom-h.bottom>h.top-r.top&&(x=this.above[a]=!x);let w=(x?h.top-r.top:r.bottom-h.bottom)-p;if(w<g&&!1!==u.resize){if(w<this.view.defaultLineHeight){c.style.top=Ck;continue}CE.set(u,g),c.style.height=(g=w)/o+"px"}else c.style.height&&(c.style.height="");let S=x?h.top-g-p-v.y:h.bottom+p+v.y,C=b+m;if(!0!==u.overlap)for(let e of s)e.left<C&&e.right>b&&e.top<S+g&&e.bottom>S&&(S=x?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(c.style.top=(S-e.parent.top)/o+"px",CR(c,(b-e.parent.left)/i)):(c.style.top=S/o+"px",CR(c,b/i)),f){let e=h.left+(y?v.x:-v.x)-(b+14-7);f.style.left=e/i+"px"}!0!==u.overlap&&s.push({left:b,top:S,right:C,bottom:S+g}),c.classList.toggle("cm-tooltip-above",x),c.classList.toggle("cm-tooltip-below",!x),u.positioned&&u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView)&&(this.inView=this.view.inView,!this.inView))for(let e of this.manager.tooltipViews)e.dom.style.top=Ck}},{eventObservers:{scroll(){this.maybeMeasure()}}});function CR(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}let CI=SW.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),CP={x:0,y:0},CN=yR.define({enables:[CO,CI]}),CL=yR.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class Cj{static create(e){return new Cj(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new CM(e,CL,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null==(e=t.destroy)||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(void 0!==r){if(void 0===t)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}let CF=CN.compute([CL],e=>{let t=e.facet(CL);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!=(t=e.end)?t:e.pos})),create:Cj.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),CB=yR.define();class C_{constructor(e,t,n,r,i,o){this.view=e,this.source=t,this.field=n,this.locked=r,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,i=1;if(n.isWidget())r=n.posAtStart;else{if(null==(r=e.posAtCoords(t)))return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),s=o&&o.dir==xg.RTL?-1:1;i=t.x<n.left?-s:s}this.activateHover(e,r,i)}activateHover(e,t,n,r){let i=this.source(e,t,n),o=t=>{if(t&&!(Array.isArray(t)&&!t.length)){let n=Array.isArray(t)?t:[t];r&&this.locked.set(n,r),e.dispatch({effects:this.setHover.of(n)})}};if(i&&"then"in i){let n=this.pending={pos:t};i.then(e=>{this.pending==n&&(this.pending=null,o(e))},t=>xU(e.state,t,"hover tooltip"))}else o(i)}get tooltip(){let e=this.view.plugin(CO),t=e?e.manager.tooltips.findIndex(e=>e.create==Cj.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:i}=this;if(r.length&&!this.locked.has(r)&&i&&!function(e,t){let{left:n,right:r,top:i,bottom:o}=e.getBoundingClientRect(),s;if(s=e.querySelector(".cm-tooltip-arrow")){let e=s.getBoundingClientRect();i=Math.min(e.top,i),o=Math.max(e.bottom,o)}return t.clientX>=n-4&&t.clientX<=r+4&&t.clientY>=i-4&&t.clientY<=o+4}(i.dom,e)||this.pending){let{pos:i}=r[0]||this.pending,o=null!=(n=null==(t=r[0])?void 0:t.end)?n:i;(i==o?this.view.posAtCoords(this.lastMove)!=i:!function(e,t,n,r,i){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let a=e.posAtCoords({x:r,y:i},!1);return a>=t&&a<=n}(this.view,i,o,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t);let{active:r}=this;!r.length||this.locked.has(r)||this.view.dom.contains(n.relatedTarget)||this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function Cz(e,t){let n=e.plugin(CO);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}let CV=y2.define(),CH=yR.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function C$(e,t){let n=e.plugin(CW),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}let CW=xK.fromClass(class{constructor(e){this.input=e.state.facet(CG),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(CH);for(let n of(this.top=new CU(e,!0,t.topContainer),this.bottom=new CU(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top)),this.panels))n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(CH);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new CU(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new CU(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(CG);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],o=[],s=[];for(let n of t){let t=this.specs.indexOf(n),a;t<0?(a=n(e.view),s.push(a)):(a=this.panels[t]).update&&a.update(e),r.push(a),(a.top?i:o).push(a)}for(let e of(this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(o),s))e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>SW.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class CU{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&0>e.indexOf(t)&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Cq(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Cq(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Cq(e){let t=e.nextSibling;return e.remove(),t}let CG=yR.define({enables:CW}),CY=yF.define({create:()=>[],update(e,t){for(let n of t.effects)n.is(CK)?e=[n.value].concat(e):n.is(CZ)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>CG.computeN([e],t=>t.field(e))}),CK=y2.define(),CZ=y2.define();class CX extends bn{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}CX.prototype.elementClass="",CX.prototype.toDOM=void 0,CX.prototype.mapMode=yy.TrackBefore,CX.prototype.startSide=CX.prototype.endSide=-1,CX.prototype.point=!0;let CQ=yR.define(),CJ=yR.define(),C0={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ba.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},C1=yR.define();function C2(e){return[C4(),C1.of({...C0,...e})]}let C5=yR.define({combine:e=>e.some(e=>e)});function C4(e){let t=[C3];return e&&!1===e.fixed&&t.push(C5.of(!0)),t}let C3=xK.fromClass(class{constructor(e){for(let t of(this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(C1).map(t=>new C7(e,t)),this.fixed=!e.state.facet(C5),this.gutters))"after"==t.config.side?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(C5)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ba.iter(this.view.state.facet(CQ),this.view.viewport.from),r=[],i=this.gutters.map(e=>new C9(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let o of e.type)if(o.type==bX.Text&&t){for(let e of(C8(n,r,o.from),i))e.line(this.view,o,r);t=!1}else if(o.widget)for(let e of i)e.widget(this.view,o)}else if(e.type==bX.Text)for(let t of(C8(n,r,e.from),i))t.line(this.view,e,r);else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(C1),n=e.state.facet(C1),r=e.docChanged||e.heightChanged||e.viewportChanged||!ba.eq(e.startState.facet(CQ),e.state.facet(CQ),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new C7(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),0>i.indexOf(e)&&e.destroy();for(let e of i)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>SW.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==xg.LTR?{left:r,right:i}:{right:r,left:i}})});function C6(e){return Array.isArray(e)?e:[e]}function C8(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class C9{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=ba.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let t=new Ae(e,o,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,o,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];C8(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let o=this.gutter;(0!=r.length||o.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(CJ)){let i=n(e,t.widget,t);i&&(r||(r=[])).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class C7{constructor(e,t){for(let n in this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),t.domEventHandlers)this.dom.addEventListener(n,r=>{let i=r.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();o=(e.top+e.bottom)/2}else o=r.clientY;let s=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,s,r)&&r.preventDefault()});this.markers=C6(t.markers(e)),t.initialSpacer&&(this.spacer=new Ae(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=C6(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!ba.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class Ae{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),!function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,r)&&this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let s=o,a=i<t.length?t[i++]:null,l=!1;if(a){let e=a.elementClass;e&&(n+=" "+e);for(let e=o;e<this.markers.length;e++)if(this.markers[e].compare(a)){s=e,l=!0;break}}else s=this.markers.length;for(;o<s;){let e=this.markers[o++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!a)break;a.toDOM&&(l?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),l&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}let At=yR.define(),An=yR.define(),Ar=yR.define({combine:e=>bt(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})});class Ai extends CX{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ao(e,t){return e.state.facet(Ar).formatNumber(t,e.state)}let As=C1.compute([Ar],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(At),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new Ai(Ao(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(An)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Ar)!=e.state.facet(Ar),initialSpacer:e=>new Ai(Ao(e,Aa(e.state.doc.lines))),updateSpacer(e,t){let n=Ao(t.view,Aa(t.view.state.doc.lines));return n==e.number?e:new Ai(n)},domEventHandlers:e.facet(Ar).domEventHandlers,side:"before"}));function Aa(e){let t=9;for(;t<e;)t=10*t+9;return t}let Al=new class extends CX{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Au=CQ.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(Al.range(i)))}return ba.of(t)}),Ac=new gq,Ah=new gq;class Ad{constructor(e,t,n=[],r=""){this.data=e,this.name=r,be.prototype.hasOwnProperty("tree")||Object.defineProperty(be.prototype,"tree",{get(){return Am(this)}}),this.parser=t,this.extension=[AA.of(this),be.languageData.of((e,t,n)=>{let r=Af(e,t,n),i=r.type.prop(Ac);if(!i)return[];let o=e.facet(i),s=r.type.prop(Ah);if(s){let i=r.resolve(t-r.from,n);for(let t of s)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o})].concat(n)}isActiveAt(e,t,n=-1){return Af(e,t,n).type.prop(Ac)==this.data}findRegions(e){let t=e.facet(AA);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(Ac)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(gq.mounted);if(i){if(i.tree.prop(Ac)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}else if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof gJ&&r(i,e.positions[n]+t)}};return r(Am(e),0),n}get allowsNesting(){return!0}}function Af(e,t,n){let r=e.facet(AA),i=Am(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,y.ExcludeBuffers|y.EnterBracketed))e.type.isTop&&(i=e);return i}Ad.setState=y2.define();class Ap extends Ad{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){var t;let n=(t=e.languageData,yR.define({combine:t?e=>e.concat(t):void 0}));return new Ap(n,e.parser.configure({props:[Ac.add(e=>e.isTop?n:void 0)]}),e.name)}configure(e,t){return new Ap(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Am(e){let t=e.field(Ad.state,!1);return t?t.tree:gJ.empty}class Ag{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Av=null;class Ay{constructor(e,t,n=[],r,i,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new Ay(e,t,[],gJ.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Ag(this.state.doc),this.fragments)}work(e,t){return(null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=gJ.empty&&this.isDone(null!=t?t:this.state.doc.length))?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r){if(this.fragments=this.withoutTempSkipped(va.addTree(r,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!=(n=this.parse.stoppedAt)?n:this.state.doc.length,this.tree=r,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(va.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Av;Av=this;try{return e()}finally{Av=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Ab(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:i,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,r,i)=>t.push({fromA:e,toA:n,fromB:r,toB:i})),n=va.applyChanges(n,t),r=gJ.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length)for(let t of(s=[],this.skipped)){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);n<r&&s.push({from:n,to:r})}}return new Ay(this.parser,t,n,r,i,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=Ab(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends vl{createParse(t,n,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let t=Av;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new gJ(gK.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return Av}}function Ab(e,t,n){return va.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Ax{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Ax(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Ay.create(e.facet(AA).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Ax(n)}}Ad.state=yF.define({create:Ax.init,update(e,t){for(let e of t.effects)if(e.is(Ad.setState))return e.value;return t.startState.facet(AA)!=t.state.facet(AA)?Ax.init(t.state):e.apply(t)}});let Aw=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"u">typeof requestIdleCallback&&(Aw=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});let AS="u">typeof navigator&&(null==(b=navigator.scheduling)?void 0:b.isInputPending)?()=>navigator.scheduling.isInputPending():null,AC=xK.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Ad.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ad.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Aw(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(Ad.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!AS?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&n.doc.length>r+1e3,a=i.context.work(()=>AS&&AS()||Date.now()>o,r+1e5*!s);this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Ad.setState.of(new Ax(i.context))})),this.chunkBudget>0&&!(a&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>xU(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),AA=yR.define({combine:e=>e.length?e[0]:null,enables:e=>[Ad.state,AC,SW.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Ak{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}let AM=yR.define(),AT=yR.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function AD(e){let t=e.facet(AT);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function AE(e,t){let n="",r=e.tabSize,i=e.facet(AT)[0];if(" "==i){for(;t>=r;)n+=" ",t-=r;i=" "}for(let e=0;e<t;e++)n+=i;return n}function AO(e,t){for(let n of(e instanceof be&&(e=new AR(e)),e.state.facet(AM))){let r=n(e,t);if(void 0!==r)return r}let n=Am(e.state);return n.length>=t?function(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return AP(r,e,n)}(e,n,t):null}class AR{constructor(e,t={}){this.state=e,this.options=t,this.unit=AD(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;if(null!=r&&r>=n.from&&r<=n.to)if(i&&r==e)return{text:"",from:e};else if(t<0?r<e:r<=e)return{text:n.text.slice(r-n.from),from:r};else return{text:n.text.slice(0,r-n.from),from:n.from};return n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return bb(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}let AI=new gq;function AP(e,t,n){for(let r=e;r;r=r.next){let e=function(e){let t=e.type.prop(AI);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(gq.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>(function(e,t,n,r){let i=e.textAfter,o=i.match(/^\s*/)[0].length,s=n&&i.slice(o,o+n.length)==n||r==e.pos+o,a=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==i||i<=o.from?o.to:Math.min(o.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}(e):null;return a?s?e.column(a.from):e.column(a.to):e.baseIndent+(s?0:+e.unit)})(e,!0,void 0,n&&!(e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak)?t.from:void 0)}return null==e.parent?AN:null}(r.node);if(e)return e(AL.create(t,n,r))}return 0}function AN(){return 0}class AL extends AR{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new AL(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(function(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return AP(this.context.next,this.base,this.pos)}}function Aj({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}let AF=yR.define(),AB=new gq;function A_(e,t,n){for(let r of e.facet(AF)){let i=r(e,t,n);if(i)return i}return function(e,t,n){let r=Am(e);if(r.length<n)return null;let i=r.resolveStack(n,1),o=null;for(let s=i;s;s=s.next){let i=s.node;if(i.to<=n||i.from>n)continue;if(o&&i.from<t)break;let a=i.type.prop(AB);if(a&&(i.to<r.length-50||r.length==e.doc.length||!function(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}(i))){let r=a(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(o=r)}}return o}(e,t,n)}function Az(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}let AV=y2.define({map:Az}),AH=y2.define({map:Az});function A$(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}let AW=yF.define({create:()=>bQ.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=AU(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(AV)&&!function(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}(e,r.value.from,r.value.to)?n.push(r.value):r.is(AH)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(AX),i=n.map(e=>(r?bQ.replace({widget:new A1(r(t.state,e))}):A0).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=AU(e,t.selection.main.head)),e},provide:e=>SW.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if("number"!=typeof r||"number"!=typeof i)throw RangeError("Invalid JSON for fold state");t.push(A0.range(r,i))}return bQ.set(t,!0)}});function AU(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function Aq(e,t,n){var r;let i=null;return null==(r=e.field(AW,!1))||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function AG(e,t){return e.field(AW,!1)?t:t.concat(y2.appendConfig.of(AQ()))}function AY(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return SW.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}let AK=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of A$(e)){let n=A_(e.state,t.from,t.to);if(n)return e.dispatch({effects:AG(e.state,[AV.of(n),AY(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(AW,!1))return!1;let t=[];for(let n of A$(e)){let r=Aq(e.state,n.from,n.to);r&&t.push(AH.of(r),AY(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),o=A_(t,i.from,i.to);o&&n.push(AV.of(o)),r=(o?e.lineBlockAt(o.to):i).to+1}return n.length&&e.dispatch({effects:AG(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(AW,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(AH.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],AZ={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},AX=yR.define({combine:e=>bt(e,AZ)});function AQ(e){let t=[AW,A4];return e&&t.push(AX.of(e)),t}function AJ(e,t){let{state:n}=e,r=n.facet(AX),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=Aq(e.state,n.from,n.to);r&&e.dispatch({effects:AH.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}let A0=bQ.replace({widget:new class extends bZ{toDOM(e){return AJ(e,null)}}});class A1 extends bZ{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return AJ(e,this.value)}}let A2={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class A5 extends CX{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}let A4=SW.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class A3{constructor(e,t){let n;function r(e){let t=bA.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof Ad?e=>e.prop(Ac)==o.data:o?e=>e==o:void 0,this.style=v_(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new bA(n):null,this.themeType=t.themeType}static define(e,t){return new A3(e,t||{})}}let A6=yR.define(),A8=yR.define({combine:e=>e.length?[e[0]]:null});function A9(e){let t=e.facet(A6);return t.length?t:e.facet(A8)}function A7(e,t){let n=[ke],r;return e instanceof A3&&(e.module&&n.push(SW.styleModule.of(e.module)),r=e.themeType),(null==t?void 0:t.fallback)?n.push(A8.of(e)):r?n.push(A6.computeN([SW.darkTheme],t=>t.facet(SW.darkTheme)==("dark"==r)?[e]:[])):n.push(A6.of(e)),n}let ke=y_.high(xK.fromClass(class{constructor(e){this.markCache=Object.create(null),this.tree=Am(e.state),this.decorations=this.buildDeco(e,A9(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Am(e.state),n=A9(e.state),r=n!=A9(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return bQ.none;let n=new bl;for(let{from:r,to:i}of e.visibleRanges)!function(e,t,n,r=0,i=e.length){let o=new vz(r,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),r,i,"",o.highlighters),o.flush(i)}(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=bQ.mark({class:r})))},r,i);return n.finish()}},{decorations:e=>e.decorations})),kt=A3.define([{tag:v2.meta,color:"#404740"},{tag:v2.link,textDecoration:"underline"},{tag:v2.heading,textDecoration:"underline",fontWeight:"bold"},{tag:v2.emphasis,fontStyle:"italic"},{tag:v2.strong,fontWeight:"bold"},{tag:v2.strikethrough,textDecoration:"line-through"},{tag:v2.keyword,color:"#708"},{tag:[v2.atom,v2.bool,v2.url,v2.contentSeparator,v2.labelName],color:"#219"},{tag:[v2.literal,v2.inserted],color:"#164"},{tag:[v2.string,v2.deleted],color:"#a11"},{tag:[v2.regexp,v2.escape,v2.special(v2.string)],color:"#e40"},{tag:v2.definition(v2.variableName),color:"#00f"},{tag:v2.local(v2.variableName),color:"#30a"},{tag:[v2.typeName,v2.namespace],color:"#085"},{tag:v2.className,color:"#167"},{tag:[v2.special(v2.variableName),v2.macroName],color:"#256"},{tag:v2.definition(v2.propertyName),color:"#00c"},{tag:v2.comment,color:"#940"},{tag:v2.invalid,color:"#f00"}]),kn=SW.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),kr="()[]{}",ki=yR.define({combine:e=>bt(e,{afterCursor:!0,brackets:kr,maxScanDistance:1e4,renderMatch:ka})}),ko=bQ.mark({class:"cm-matchingBracket"}),ks=bQ.mark({class:"cm-nonmatchingBracket"});function ka(e){let t=[],n=e.matched?ko:ks;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function kl(e){let t=[],n=e.facet(ki);for(let r of e.selection.ranges){if(!r.empty)continue;let i=kf(e,r.head,-1,n)||r.head>0&&kf(e,r.head-1,1,n)||n.afterCursor&&(kf(e,r.head,1,n)||r.head<e.doc.length&&kf(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return bQ.set(t,!0)}let ku=[xK.fromClass(class{constructor(e){this.paused=!1,this.decorations=kl(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=kl(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),kn],kc=new gq;function kh(e,t,n){let r=e.prop(t<0?gq.openedBy:gq.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function kd(e){let t=e.type.prop(kc);return t?t(e.node):e}function kf(e,t,n,r={}){let i=r.maxScanDistance||1e4,o=r.brackets||kr,s=Am(e),a=s.resolveInner(t,n);for(let e=a;e;e=e.parent){let r=kh(e.type,n,o);if(r&&e.from<e.to){let i=kd(e);if(i&&(n>0?t>=i.from&&t<i.to:t>i.from&&t<=i.to))return function(e,t,n,r,i){let o=t.parent,s={from:n.from,to:n.to},a=0,l=null==o?void 0:o.cursor();if(l&&(e<0?l.childBefore(t.from):l.childAfter(t.to)))do if(e<0?l.to<=t.from:l.from>=t.to){if(0==a&&r.indexOf(l.type.name)>-1&&l.from<l.to){let e=kd(l);return{start:s,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}else if(kh(l.type,e,i))a++;else if(kh(l.type,-e,i)){if(0==a){let e=kd(l);return{start:s,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}a--}}while(e<0?l.prevSibling():l.nextSibling());return{start:s,matched:!1}}(n,e,i,r,o)}}return function(e,t,n,r,i,o,s){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!c.next().done&&e<=o;){let o=c.value;n<0&&(e+=o.length);let a=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0)&&r.resolveInner(a+e,1).type==i)if(t%2==0==n>0)h++;else{if(1==h)return{start:u,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};h--}}n>0&&(e+=o.length)}return c.done?{start:u,matched:!1}:null}(e,t,n,s,a.type,i,o)}let kp=Object.create(null),km=[gK.none],kg=[],kv=Object.create(null),ky=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])ky[e]=function(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||v2[n];r?"function"==typeof r?t.length?t=t.map(r):kb(n,`Modifier ${n} used at start of tag`):t.length?kb(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:kb(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(e=>e.id),o=kv[i];if(o)return o.id;let s=kv[i]=gK.define({id:km.length,name:r,props:[vj({[r]:n})]});return km.push(s),s.id}(kp,t);function kb(e,t){kg.indexOf(e)>-1||(kg.push(e),console.warn(t))}xg.RTL,xg.LTR;let kx=Ap.define({name:"json",parser:v4.configure({props:[AI.add({Object:Aj({except:/^\s*\}/}),Array:Aj({except:/^\s*\]/})}),AB.add({"Object Array":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});class kw{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class kS{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(kL).markerFilter;r&&(e=r(e,n));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new bl,s=[],a=0,l=n.doc.iter(),u=0,c=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!s.length)break;if(s.length)t=a,n=s.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if((t=r.from)>c)break;n=r.to,s.push(r),e++}for(;e<i.length;){let r=i[e];if(r.from==t&&(r.to>r.from||r.to==t))s.push(r),e++,n=Math.min(r.to,n);else{n=Math.min(r.from,n);break}}n=Math.min(n,c);let h=!1;if(s.some(e=>e.from==t&&(e.to==n||n==c))&&!(h=t==n)&&n-t<10){let e=t-(u+l.value.length);e>0&&(l.next(e),u=t);for(let e=t;;){if(e>=n){h=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let d=kU(s);if(h)o.add(t,t,bQ.widget({widget:new k_(d),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");o.add(t,n,bQ.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>n)}))}if((a=n)==c)break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1)}let h=o.finish();return new kS(h,t,kC(h))}}function kC(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&0>i.diagnostics.indexOf(t)))if(r){if(0>i.diagnostics.indexOf(r.diagnostic))return!1;r=new kw(r.from,n,r.diagnostic)}else r=new kw(e,n,t||i.diagnostics[0])}),r}function kA(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(kL).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(kM))||e.changes.touchesRange(o.from,Math.max(o.to,r)))}function kk(e,t){return e.field(kE,!1)?t:t.concat(y2.appendConfig.of(kJ))}let kM=y2.define(),kT=y2.define(),kD=y2.define(),kE=yF.define({create:()=>new kS(bQ.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=kC(n,e.selected.diagnostic,i)||kC(n,null,i)}!n.size&&i&&t.state.facet(kL).autoPanel&&(i=null),e=new kS(n,i,r)}for(let n of t.effects)if(n.is(kM)){let r=t.state.facet(kL).autoPanel?n.value.length?kV.open:null:e.panel;e=kS.init(n.value,r,t.state)}else n.is(kT)?e=new kS(e.diagnostics,n.value?kV.open:null,e.selected):n.is(kD)&&(e=new kS(e.diagnostics,e.panel,n.value));return e},provide:e=>[CG.from(e,e=>e.panel),SW.decorations.from(e,e=>e.diagnostics)]}),kO=bQ.mark({class:"cm-lintRange cm-lintRange-active"});function kR(e,t){return bP("ul",{class:"cm-tooltip-lint"},t.map(t=>kB(e,t,!1)))}let kI=e=>{let t=e.state.field(kE,!1);return!!t&&!!t.panel&&(e.dispatch({effects:kT.of(!1)}),!0)},kP=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(kE,!1);t&&t.panel||e.dispatch({effects:kk(e.state,[kT.of(!0)])});let n=C$(e,kV.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(kE,!1);if(!t)return!1;let n=e.state.selection.main,r=kC(t.diagnostics,null,n.to+1);return(!!r||!!(r=kC(t.diagnostics,null,0))&&(r.from!=n.from||r.to!=n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!function(e,t,n={}){var r;let i=e.state.facet(CB).map(t=>e.plugin(t)).filter(e=>!!e);if(n.tooltip&&n.tooltip.active){let e=i.find(e=>e.field==n.tooltip.active);e&&(i=[e])}for(let o of i)o.activateHover(e,t,1,null!=(r=n.until)?r:()=>!1)}(e,r.from,{tooltip:kQ,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],kN=xK.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(kL);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(kL);t.length&&function(e,t,n){let r=[],i=-1;for(let o of e)o.then(n=>{r.push(n),clearTimeout(i),r.length==e.length?t(r):i=setTimeout(()=>t(r),200)},n)}(t.map(e=>Promise.resolve(e(this.view))),t=>{var n,r;this.view.state.doc==e.doc&&this.view.dispatch((n=this.view.state,r=t.reduce((e,t)=>e.concat(t)),{effects:kk(n,[kM.of(r)])}))},e=>{xU(this.view.state,e)})}}update(e){let t=e.state.facet(kL);(e.docChanged||t!=e.startState.facet(kL)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),kL=yR.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...bt(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:kj,tooltipFilter:kj,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function kj(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function kF(e){let t=[];if(e)s:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue s}}t.push("")}return t}function kB(e,t,n){var r;let i=n?kF(t.actions):[];return bP("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},bP("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null==(r=t.actions)?void 0:r.map((n,r)=>{let o=!1,s=r=>{if(r.preventDefault(),o)return;o=!0;let i=kC(e.state.field(kE).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:a}=n,l=i[r]?a.indexOf(i[r]):-1,u=l<0?a:[a.slice(0,l),bP("u",a.slice(l,l+1)),a.slice(l+1)];return bP("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${i[r]})"`}.`},u)}),t.source&&bP("div",{class:"cm-diagnosticSource"},t.source))}class k_ extends bZ{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return bP("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class kz{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(0xffffffff*Math.random()).toString(16),this.dom=kB(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class kV{constructor(e){this.view=e,this.items=[];let t=t=>{if(!t.ctrlKey&&!t.altKey&&!t.metaKey){if(27==t.keyCode)kI(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:n}=this.items[this.selectedIndex],r=kF(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=kC(this.view.state.field(kE).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=bP("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=bP("div",{class:"cm-panel-lint"},this.list,bP("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>kI(this.view)},"\xd7")),this.update()}get selectedIndex(){let e=this.view.state.field(kE).selected;if(!e)return -1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return -1}update(){let{diagnostics:e,selected:t}=this.view.state.field(kE),n=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:a})=>{for(let e of a.diagnostics){if(o.has(e))continue;o.add(e);let s=-1,a;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){s=t;break}s<0?(a=new kz(this.view,e),this.items.splice(n,0,a),r=!0):(a=this.items[s],s>n&&(this.items.splice(n,s-n),r=!0)),t&&a.diagnostic==t.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),i=a):a.dom.hasAttribute("aria-selected")&&a.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new kz(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=kC(this.view.state.field(kE).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:kD.of(t)})}static open(e){return new kV(e)}}function kH(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function k$(e){return kH(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}let kW=SW.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:k$("#f11")},".cm-lintRange-warning":{backgroundImage:k$("orange")},".cm-lintRange-info":{backgroundImage:k$("#999")},".cm-lintRange-hint":{backgroundImage:k$("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function kU(e){let t="hint",n=1;for(let i of e){var r;let e="error"==(r=i.severity)?4:"warning"==r?3:"info"==r?2:1;e>n&&(n=e,t=i.severity)}return t}class kq extends CX{constructor(e){super(),this.diagnostics=e,this.severity=kU(e)}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,r=e.state.facet(k0).tooltipFilter;return r&&(n=r(n,e.state)),n.length&&(t.onmouseover=()=>(function(e,t,n){function r(){let r,i=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(i.from)&&e.dispatch({effects:kK.of({pos:i.from,above:!1,clip:!1,create:()=>({dom:kR(e,n),getCoords:()=>t.getBoundingClientRect()})})}),t.onmouseout=t.onmousemove=null,r=n=>{let i=t.getBoundingClientRect();if(!(n.clientX>i.left-10)||!(n.clientX<i.right+10)||!(n.clientY>i.top-10)||!(n.clientY<i.bottom+10)){for(let e=n.target;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",r),e.state.field(kZ)&&e.dispatch({effects:kK.of(null)})}},window.addEventListener("mousemove",r)}let{hoverTime:i}=e.state.facet(k0),o=setTimeout(r,i);t.onmouseout=()=>{clearTimeout(o),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(o),o=setTimeout(r,i)}})(e,t,n)),t}}let kG=C2({class:"cm-gutter-lint",markers:e=>e.state.field(kY),widgetMarker:(e,t,n)=>{let r=[];return e.state.field(kY).between(n.from,n.to,(e,t,i)=>{e>n.from&&e<n.to&&r.push(...i.diagnostics)}),r.length?new kq(r):null}}),kY=yF.define({create:()=>ba.empty,update(e,t){e=e.map(t.changes);let n=t.state.facet(k0).markerFilter;for(let r of t.effects)if(r.is(kM)){let i=r.value;n&&(i=n(i||[],t.state)),e=function(e,t){let n=Object.create(null);for(let r of t){let t=e.lineAt(r.from);(n[t.from]||(n[t.from]=[])).push(r)}let r=[];for(let e in n)r.push(new kq(n[e]).range(+e));return ba.of(r,!0)}(t.state.doc,i.slice(0))}return e}}),kK=y2.define(),kZ=yF.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=kA(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(kK)?t.value:e,e)),provide:e=>CN.from(e)}),kX=SW.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:kH('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:kH('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:kH('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),kQ=function(e,t={}){let n=y2.define(),r=new WeakMap,i=yF.define({create:()=>[],update(e,o){let s=r.get(e);if(e.length&&(t.hideOnChange&&(o.docChanged||o.selection)||s&&s(o)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(o,e)))),o.docChanged&&e.length){let t=[];for(let n of e){let e=o.changes.mapPos(n.pos,-1,yy.TrackDel);if(null!=e){let r=Object.assign(Object.create(null),n);r.pos=e,null!=r.end&&(r.end=o.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of o.effects)t.is(n)&&(e=t.value,s=void 0),(t.is(CV)&&!t.value||t.value==i)&&(e=[]);return e.length&&s&&r.set(e,s),e},provide:e=>CL.from(e)}),o=xK.define(o=>new C_(o,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,o,CB.of(o),CF]}}(function(e,t,n){let{diagnostics:r}=e.state.field(kE),i,o=-1,s=-1;r.between(t-(n<0),t+ +(n>0),(e,r,{spec:a})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=a.diagnostics,o=e,s=r,!1});let a=e.state.facet(kL).tooltipFilter;return(i&&a&&(i=a(i,e.state)),i)?{pos:o,end:s,above:!0,create:()=>({dom:kR(e,i)})}:null},{hideOn:kA}),kJ=[kE,SW.decorations.compute([kE],e=>{let{selected:t,panel:n}=e.field(kE);return t&&n&&t.from!=t.to?bQ.set([kO.range(t.from,t.to)]):bQ.none}),kQ,kW],k0=yR.define({combine:e=>bt(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});var k1=n(49257);function k2(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}let k5=k2(function(e,t,n=t.selection.ranges){let r=[],i=-1;a:for(let{from:e,to:o}of n){let n=r.length,s=1e9,a;for(let n=e;n<=o;){let l=t.doc.lineAt(n);if(void 0==a&&!(a=k6(t,l.from).line))continue a;if(l.from>i&&(e==o||o>l.from)){i=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<s&&(s=e),r.push({line:l,comment:n,token:a,indent:e,empty:t,single:!1})}n=l.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=!0)}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:o,single:s}of r)(s||!o)&&e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,o=r+i.length;" "==t.text[o-t.from]&&o++,e.push({from:r,to:o})}return{changes:e}}return null},0),k4=k2(k8,0),k3=k2((e,t)=>k8(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function k6(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}function k8(e,t,n=t.selection.ranges){let r=n.map(e=>k6(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>(function(e,{open:t,close:n},r,i){let o,s,a=e.sliceDoc(r-50,r),l=e.sliceDoc(i,i+50),u=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,h=a.length-u;if(a.slice(h-t.length,h)==t&&l.slice(c,c+n.length)==n)return{open:{pos:r-u,margin:u&&1},close:{pos:i+c,margin:c&&1}};i-r<=100?o=s=e.sliceDoc(r,i):(o=e.sliceDoc(r,r+50),s=e.sliceDoc(i-50,i));let d=/^\s*/.exec(o)[0].length,f=/\s*$/.exec(s)[0].length,p=s.length-f-n.length;return o.slice(d,d+t.length)==t&&s.slice(p,p+n.length)==n?{open:{pos:r+d+t.length,margin:+!!/\s/.test(o.charAt(d+t.length))},close:{pos:i-f-n.length,margin:+!!/\s/.test(s.charAt(p-1))}}:null})(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:o,close:s}=n;e.push({from:o.pos-i.open.length,to:o.pos+o.margin},{from:s.pos-s.margin,to:s.pos+i.close.length})}return{changes:e}}return null}let k9=yJ.define(),k7=yJ.define(),Me=yR.define(),Mt=yR.define({combine:e=>bt(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),Mn=yF.define({create:()=>Mm.empty,update(e,t){let n=t.state.facet(Mt),r=t.annotation(k9);if(r){let i=Ml.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?Mu(s,s.length,n.minDepth,i):Md(s,t.startState.selection),new Mm(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(k7);if(("full"==i||"before"==i)&&(e=e.isolate()),!1===t.annotation(y5.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=Ml.fromTransaction(t),s=t.annotation(y5.time),a=t.annotation(y5.userEvent);return o?e=e.addChanges(o,s,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,n.newGroupDelay)),("full"==i||"after"==i)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new Mm(e.done.map(Ml.fromJSON),e.undone.map(Ml.fromJSON))});function Mr(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Mn,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}let Mi=Mr(0,!1),Mo=Mr(1,!1),Ms=Mr(0,!0),Ma=Mr(1,!0);class Ml{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new Ml(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null==(e=this.changes)?void 0:e.toJSON(),mapped:null==(t=this.mapped)?void 0:t.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new Ml(e.changes&&yx.fromJSON(e.changes),[],e.mapped&&yb.fromJSON(e.mapped),e.startSelection&&yD.fromJSON(e.startSelection),e.selectionsAfter.map(yD.fromJSON))}static fromTransaction(e,t){let n=Mh;for(let t of e.startState.facet(Me)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new Ml(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Mh)}static selection(e){return new Ml(void 0,Mh,void 0,void 0,e)}}function Mu(e,t,n,r){let i=e.slice(t+1>n+20?t-n-1:0,t);return i.push(r),i}function Mc(e,t){return e.length?t.length?e.concat(t):e:t}let Mh=[];function Md(e,t){if(!e.length)return[Ml.selection([t])];{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Mu(e,e.length-1,1e9,n.setSelAfter(r)))}}function Mf(e,t){if(!e.length)return e;let n=e.length,r=Mh;for(;n;){let i=function(e,t,n){let r=Mc(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Mh,n);if(!e.changes)return Ml.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new Ml(i,y2.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[Ml.selection(r)]:Mh}let Mp=/^(input\.type|delete)($|\.)/;class Mm{constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new Mm(this.done,this.undone):this}addChanges(e,t,n,r,i){var o,s;let a,l,u=this.done,c=u[u.length-1];return new Mm(u=c&&c.changes&&!c.changes.empty&&e.changes&&(!n||Mp.test(n))&&(!c.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,(o=c.changes,s=e.changes,a=[],l=!1,o.iterChangedRanges((e,t)=>a.push(e,t)),s.iterChangedRanges((e,t,n,r)=>{for(let e=0;e<a.length;){let t=a[e++],i=a[e++];r>=t&&n<=i&&(l=!0)}}),l))||"input.type.compose"==n)?Mu(u,u.length-1,r.minDepth,new Ml(e.changes.compose(c.changes),Mc(y2.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,Mh)):Mu(u,u.length,r.minDepth,e),Mh,t,n)}addSelection(e,t,n,r){var i;let o=this.done.length?this.done[this.done.length-1].selectionsAfter:Mh;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1],i.ranges.length==e.ranges.length&&0===i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length)?this:new Mm(Md(this.done,e),this.undone,t,n)}addMapping(e){return new Mm(Mf(this.done,e),Mf(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length){let n,s;return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:k9.of({side:e,rest:(n=r[r.length-1],(s=r.slice())[r.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),s),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}{if(!i.changes)return null;let n=1==r.length?Mh:r.slice(0,r.length-1);return i.mapped&&(n=Mf(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:k9.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}Mm.empty=new Mm(Mh,Mh);let Mg=[{key:"Mod-z",run:Mi,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Mo,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Mo,preventDefault:!0},{key:"Mod-u",run:Ms,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ma,preventDefault:!0}];function Mv(e,t){return yD.create(e.ranges.map(t),e.mainIndex)}function My(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Mb({state:e,dispatch:t},n){let r=Mv(e.selection,n);return!r.eq(e.selection,!0)&&(t(My(e,r)),!0)}function Mx(e,t){return yD.cursor(t?e.to:e.from)}function Mw(e,t){return Mb(e,n=>n.empty?e.moveByChar(n,t):Mx(n,t))}function MS(e){return e.textDirectionAt(e.state.selection.main.head)==xg.LTR}let MC=e=>Mw(e,!MS(e)),MA=e=>Mw(e,MS(e));function Mk(e,t){return Mb(e,n=>n.empty?e.moveByGroup(n,t):Mx(n,t))}function MM(e,t,n){let r,i,o=Am(e).resolveInner(t.head),s=n?gq.closedBy:gq.openedBy;for(let r=t.head;;){let t=n?o.childAfter(r):o.childBefore(r);if(!t)break;!function(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,s)?r=n?t.to:t.from:o=t}return i=o.type.prop(s)&&(r=n?kf(e,o.from,1):kf(e,o.to,-1))&&r.matched?n?r.end.to:r.end.from:n?o.to:o.from,yD.cursor(i,n?-1:1)}function MT(e,t){return Mb(e,n=>{if(!n.empty)return Mx(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"u">typeof Intl&&Intl.Segmenter;let MD=e=>MT(e,!1),ME=e=>MT(e,!0);function MO(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(SW.scrollMargins)){let i=t(e);(null==i?void 0:i.top)&&(n=Math.max(null==i?void 0:i.top,n)),(null==i?void 0:i.bottom)&&(r=Math.max(null==i?void 0:i.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function MR(e,t){let n,r=MO(e),{state:i}=e,o=Mv(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):Mx(n,t));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>a&&t.bottom<l&&(n=SW.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(My(i,o),{effects:n}),!0}let MI=e=>MR(e,!1),MP=e=>MR(e,!0);function MN(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=yD.cursor(r.from+n))}return i}function ML(e,t,n){let r=Mv(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=yD.range(e.head,e.anchor));let r=n(e);return yD.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(My(e.state,r)),!0)}function Mj(e,t){return ML(e,t,n=>e.moveByChar(n,t))}let MF=e=>Mj(e,!MS(e)),MB=e=>Mj(e,MS(e));function M_(e,t){return ML(e,t,n=>e.moveByGroup(n,t))}function Mz(e,t){return ML(e,t,n=>e.moveVertically(n,t))}let MV=e=>Mz(e,!1),MH=e=>Mz(e,!0);function M$(e,t){return ML(e,t,n=>e.moveVertically(n,t,MO(e).height))}let MW=e=>M$(e,!1),MU=e=>M$(e,!0),Mq=({state:e,dispatch:t})=>(t(My(e,{anchor:0})),!0),MG=({state:e,dispatch:t})=>(t(My(e,{anchor:e.doc.length})),!0),MY=({state:e,dispatch:t})=>(t(My(e,{anchor:e.selection.main.anchor,head:0})),!0),MK=({state:e,dispatch:t})=>(t(My(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function MZ(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let o=n.doc.lineAt(r.head);if(t?o.to<e.state.doc.length:o.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<o.from||r.head>o.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(My(n,yD.create(i,i.length-1))),!0)}function MX(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:o}=r;if(i==o){let s=t(r);s<i?(n="delete.backward",s=MQ(e,s,!1)):s>i&&(n="delete.forward",s=MQ(e,s,!0)),i=Math.min(i,s),o=Math.max(o,s)}else i=MQ(e,i,!1),o=MQ(e,o,!0);return i==o?{range:r}:{changes:{from:i,to:o},range:yD.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?SW.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function MQ(e,t,n){if(e instanceof SW)for(let r of e.state.facet(SW.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}let MJ=(e,t,n)=>MX(e,r=>{let i=r.from,{state:o}=e,s=o.doc.lineAt(i),a,l;if(n&&!t&&i>s.from&&i<s.from+200&&!/[^ \t]/.test(a=s.text.slice(0,i-s.from))){if(" "==a[a.length-1])return i-1;let e=bb(a,o.tabSize)%AD(o)||AD(o);for(let t=0;t<e&&" "==a[a.length-1-t];t++)i--;l=i}else(l=yf(s.text,i-s.from,t,t)+s.from)==i&&s.number!=(t?o.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,i-s.from))&&(l=yf(s.text,l-s.from,!1,!1)+s.from);return l}),M0=e=>MJ(e,!1,!0),M1=e=>MJ(e,!0,!1),M2=(e,t)=>MX(e,n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let a=yf(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),u=s(l);if(null!=e&&u!=e)break;(" "!=l||r!=n.head)&&(e=u),r=a}return r}),M5=e=>M2(e,!1);function M4(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(r.empty||r.to!=o.from||(o=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(r)}else t.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return t}function M3(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of M4(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n)for(let n of(r.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak}),t.ranges))i.push(yD.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)));else for(let n of(r.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text}),t.ranges))i.push(yD.range(n.anchor-s,n.head-s))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:yD.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function M6(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of M4(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}let M8=M7(!1),M9=M7(!0);function M7(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,o=t.doc.lineAt(r),s=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Am(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),o;return r&&i&&r.to<=t&&i.from>=t&&(o=r.type.prop(gq.closedBy))&&o.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}(t,r);e&&(r=i=(i<=o.to?o:t.doc.lineAt(i)).to);let a=new AR(t,{simulateBreak:r,simulateDoubleBreak:!!s}),l=AO(a,r);for(null==l&&(l=bb(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;s?{from:r,to:i}=s:r>o.from&&r<o.from+100&&!/\S/.test(o.text.slice(0,r))&&(r=o.from);let u=["",AE(t,l)];return s&&u.push(AE(t,a.lineIndent(o.from,-1))),{changes:{from:r,to:i,insert:yi.of(u)},range:yD.cursor(r+1+u[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Te(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let s=e.doc.lineAt(o);s.number>n&&(r.empty||r.to>s.from)&&(t(s,i,r),n=s.number),o=s.to+1}let o=e.changes(i);return{changes:i,range:yD.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}let Tt=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Te(e,(t,n)=>{n.push({from:t.from,insert:e.facet(AT)})}),{userEvent:"input.indent"})),!0),Tn=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Te(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=bb(r,e.tabSize),o=0,s=AE(e,Math.max(0,i-AD(e)));for(;o<r.length&&o<s.length&&r.charCodeAt(o)==s.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:s.slice(o)})}),{userEvent:"delete.dedent"})),!0),Tr=[{key:"Ctrl-b",run:MC,shift:MF,preventDefault:!0},{key:"Ctrl-f",run:MA,shift:MB},{key:"Ctrl-p",run:MD,shift:MV},{key:"Ctrl-n",run:ME,shift:MH},{key:"Ctrl-a",run:e=>Mb(e,t=>yD.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>ML(e,!1,t=>yD.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>Mb(e,t=>yD.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>ML(e,!0,t=>yD.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:M1},{key:"Ctrl-h",run:M0},{key:"Ctrl-k",run:e=>MX(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:M5},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:yi.of(["",""])},range:yD.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:yf(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:yf(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:yD.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:MP}],Ti=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>Mb(e,t=>MM(e.state,t,!MS(e))),shift:e=>{let t=!MS(e);return ML(e,t,n=>MM(e.state,n,t))}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>Mb(e,t=>MM(e.state,t,MS(e))),shift:e=>{let t=MS(e);return ML(e,t,n=>MM(e.state,n,t))}},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>M3(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>M6(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>M3(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>M6(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>MZ(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>MZ(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=yD.create([n.main]):n.main.empty||(r=yD.create([yD.cursor(n.main.head)])),!!r&&(t(My(e,r)),!0)}},{key:"Mod-Enter",run:M9},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=M4(e).map(({from:t,to:n})=>yD.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:yD.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=Mv(e.selection,t=>{let n=Am(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return yD.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(My(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:Tn},{key:"Mod-]",run:Tt},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new AR(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=Te(e,(t,i,o)=>{let s=AO(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=AE(e,s);(a!=l||o.from<t.from+a.length)&&(n[t.from]=s,i.push({from:t.from,to:t.from+a.length,insert:l}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(M4(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Mv(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>{let n,r;return n=!1,r=Mv(e.selection,t=>{let r=kf(e,t.head,-1)||kf(e,t.head,1)||t.head>0&&kf(e,t.head-1,1)||t.head<e.doc.length&&kf(e,t.head+1,-1);if(!r||!r.end)return t;n=!0;let i=r.start.from==t.head?r.end.to:r.end.from;return yD.cursor(i)}),!!n&&(t(My(e,r)),!0)}},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=k6(e.state,n.from);return r.line?k5(e):!!r.block&&k3(e)}},{key:"Alt-A",run:k4},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:MC,shift:MF,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>Mk(e,!MS(e)),shift:e=>M_(e,!MS(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>Mb(e,t=>MN(e,t,!MS(e))),shift:e=>{let t=!MS(e);return ML(e,t,n=>MN(e,n,t))},preventDefault:!0},{key:"ArrowRight",run:MA,shift:MB,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>Mk(e,MS(e)),shift:e=>M_(e,MS(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>Mb(e,t=>MN(e,t,MS(e))),shift:e=>{let t=MS(e);return ML(e,t,n=>MN(e,n,t))},preventDefault:!0},{key:"ArrowUp",run:MD,shift:MV,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Mq,shift:MY},{mac:"Ctrl-ArrowUp",run:MI,shift:MW},{key:"ArrowDown",run:ME,shift:MH,preventDefault:!0},{mac:"Cmd-ArrowDown",run:MG,shift:MK},{mac:"Ctrl-ArrowDown",run:MP,shift:MU},{key:"PageUp",run:MI,shift:MW},{key:"PageDown",run:MP,shift:MU},{key:"Home",run:e=>Mb(e,t=>MN(e,t,!1)),shift:e=>ML(e,!1,t=>MN(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:Mq,shift:MY},{key:"End",run:e=>Mb(e,t=>MN(e,t,!0)),shift:e=>ML(e,!0,t=>MN(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:MG,shift:MK},{key:"Enter",run:M8,shift:M8},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:M0,shift:M0,preventDefault:!0},{key:"Delete",run:M1,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:M5,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>M2(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>MX(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>MX(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(Tr.map(e=>({mac:e.key,run:e.run,shift:e.shift})))),To={key:"Tab",run:Tt,shift:Tn},Ts="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class Ta{constructor(e,t,n=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Ts(e)):Ts,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return -1;this.bufferPos=0,this.buffer=this.iter.value}return yp(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ym(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=yg(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,o=!0;;e++){let n=r.charCodeAt(e),s=this.match(n,i,o,this.bufferPos+this.bufferStart,e==r.length-1);if(s)return this.value=s,this;if(e==r.length-1)break;o&&e<t.length&&t.charCodeAt(e)==n?i++:o=!1}}}match(e,t,n,r,i){let o=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],s=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?o={from:n.from,to:r,precise:i&&n.precise}:(n.index++,s=!0)),s?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(1==this.query.length?o={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}"u">typeof Symbol&&(Ta.prototype[Symbol.iterator]=function(){return this});let Tl={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Tu="gm"+(null==/x/.unicode?"":"u");class Tc{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Tl,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Tf(e,t,n,r,i);this.re=new RegExp(t,Tu+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=Tp(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Tp(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}let Th=new WeakMap;class Td{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Th.get(e);if(!r||r.from>=n||r.to<=t){let r=new Td(t,e.sliceString(t,n));return Th.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to<n&&(i+=e.sliceString(r.to,n)),Th.set(e,new Td(o,i)),new Td(t,i.slice(t-o,n-o))}}class Tf{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Tl,this.matchPos=Tp(e,r),this.re=new RegExp(t,Tu+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=Td.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=Tp(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Td.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Tp(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}"u">typeof Symbol&&(Tc.prototype[Symbol.iterator]=Tf.prototype[Symbol.iterator]=function(){return this});let Tm={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Tg=yR.define({combine:e=>bt(e,Tm,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),Tv=bQ.mark({class:"cm-selectionMatch"}),Ty=bQ.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Tb(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=y9.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=y9.Word)}let Tx=xK.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Tg),{state:n}=e,r=n.selection;if(r.ranges.length>1)return bQ.none;let i=r.main,o,s=null;if(i.empty){if(!t.highlightWordAroundCursor)return bQ.none;let e=n.wordAt(i.head);if(!e)return bQ.none;s=n.charCategorizer(i.head),o=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return bQ.none;if(t.wholeWords){var a,l,u;if(o=n.sliceDoc(i.from,i.to),!(Tb(s=n.charCategorizer(i.head),n,i.from,i.to)&&(a=s,l=i.from,u=i.to,a(n.sliceDoc(l,l+1))==y9.Word&&a(n.sliceDoc(u-1,u))==y9.Word)))return bQ.none}else if(!(o=n.sliceDoc(i.from,i.to)))return bQ.none}let c=[];for(let r of e.visibleRanges){let e=new Ta(n.doc,o,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!s||Tb(s,n,r,o))&&(i.empty&&r<=i.from&&o>=i.to?c.push(Ty.range(r,o)):(r>=i.to||o<=i.from)&&c.push(Tv.range(r,o)),c.length>t.maxMatches))return bQ.none}}return bQ.set(c)}},{decorations:e=>e.decorations}),Tw=SW.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),TS=yR.define({combine:e=>bt(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new TX(e),scrollToMatch:e=>SW.scrollIntoView(e)})});class TC{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,Tu),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new TO(this):new TM(this)}getCursor(e,t=0,n){let r=e.doc?e:be.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?TT(this,r,t,n):Tk(this,r,t,n)}}class TA{constructor(e){this.spec=e}}function Tk(e,t,n,r){var i,o,s,a;let l;return e.wholeWord&&(s=t.doc,a=t.charCategorizer(t.selection.main.head),l=(e,t,n,r)=>((r>e||r+n.length<t)&&(r=Math.max(0,e-2),n=s.sliceString(r,Math.min(s.length,t+2))),(a(TD(n,e-r))!=y9.Word||a(TE(n,e-r))!=y9.Word)&&(a(TE(n,t-r))!=y9.Word||a(TD(n,t-r))!=y9.Word))),e.test&&(i=e.test,o=l,l=(e,n,r,s)=>(!o||!!o(e,n,r,s))&&i(e>=s&&n<=s+r.length?r.slice(e-s,n-s):t.doc.sliceString(e,n),t,e,n)),new Ta(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),l)}class TM extends TA{constructor(e){super(e)}nextMatch(e,t,n){let r=Tk(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Tk(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=Tk(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Tk(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Tk(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function TT(e,t,n,r){var i,o,s;let a;return e.wholeWord&&(s=t.charCategorizer(t.selection.main.head),a=(e,t,n)=>!n[0].length||(s(TD(n.input,n.index))!=y9.Word||s(TE(n.input,n.index))!=y9.Word)&&(s(TE(n.input,n.index+n[0].length))!=y9.Word||s(TD(n.input,n.index+n[0].length))!=y9.Word)),e.test&&(i=e.test,o=a,a=(e,n,r)=>(!o||o(e,n,r))&&i(r[0],t,e,n)),new Tc(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:a},n,r)}function TD(e,t){return e.slice(yf(e,t,!1),t)}function TE(e,t){return e.slice(t,yf(e,t))}class TO extends TA{nextMatch(e,t,n){let r=TT(this.spec,e,n,e.doc.length).next();return r.done&&(r=TT(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=TT(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=TT(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=TT(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}let TR=y2.define(),TI=y2.define(),TP=yF.define({create:e=>new TN(TU(e).create(),null),update(e,t){for(let n of t.effects)n.is(TR)?e=new TN(n.value.create(),e.panel):n.is(TI)&&(e=new TN(e.query,n.value?TW:null));return e},provide:e=>CG.from(e,e=>e.panel)});class TN{constructor(e,t){this.query=e,this.panel=t}}let TL=bQ.mark({class:"cm-searchMatch"}),Tj=bQ.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TF=xK.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(TP))}update(e){let t=e.state.field(TP);(t!=e.startState.field(TP)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return bQ.none;let{view:n}=this,r=new bl;for(let t=0,i=n.visibleRanges,o=i.length;t<o;t++){let{from:s,to:a}=i[t];for(;t<o-1&&a>i[t+1].from-500;)a=i[++t].to;e.highlight(n.state,s,a,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Tj:TL)})}return r.finish()}},{decorations:e=>e.decorations});function TB(e){return t=>{let n=t.state.field(TP,!1);return n&&n.query.spec.valid?e(t,n):TY(t)}}let T_=TB((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=yD.single(r.from,r.to),o=e.state.facet(TS);return e.dispatch({selection:i,effects:[T0(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),TG(e),!0}),Tz=TB((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let o=yD.single(i.from,i.to),s=e.state.facet(TS);return e.dispatch({selection:o,effects:[T0(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),TG(e),!0}),TV=TB((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:yD.create(n.map(e=>yD.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),TH=TB((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=t.nextMatch(n,r,r);if(!o)return!1;let s=o,a=[],l,u,c=[];s.precise?s.from==r&&s.to==i&&(u=n.toText(t.getReplacement(s)),a.push({from:s.from,to:s.to,insert:u}),s=t.nextMatch(n,s.from,s.to),c.push(SW.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):s=t.nextMatch(n,s.from,s.to);let h=e.state.changes(a);return s&&(l=yD.single(s.from,s.to).map(h),c.push(T0(e,s)),c.push(n.facet(TS).scrollToMatch(l.main,e))),e.dispatch({changes:h,selection:l,effects:c,userEvent:"input.replace"}),!0}),T$=TB((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:o}=r;o&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:SW.announce.of(r),userEvent:"input.replace.all"}),!0});function TW(e){return e.state.facet(TS).createPanel(e)}function TU(e,t){var n,r,i,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let u=e.facet(TS);return new TC({search:(null!=(n=null==t?void 0:t.literal)?n:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!=(r=null==t?void 0:t.caseSensitive)?r:u.caseSensitive,literal:null!=(i=null==t?void 0:t.literal)?i:u.literal,regexp:null!=(o=null==t?void 0:t.regexp)?o:u.regexp,wholeWord:null!=(s=null==t?void 0:t.wholeWord)?s:u.wholeWord})}function Tq(e){let t=C$(e,TW);return t&&t.dom.querySelector("[main-field]")}function TG(e){let t=Tq(e);t&&t==e.root.activeElement&&t.select()}let TY=e=>{let t=e.state.field(TP,!1);if(t&&t.panel){let n=Tq(e);if(n&&n!=e.root.activeElement){let r=TU(e.state,t.query.spec);r.valid&&e.dispatch({effects:TR.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[TI.of(!0),t?TR.of(TU(e.state,t.query.spec)):y2.appendConfig.of(T2)]});return!0},TK=e=>{let t=e.state.field(TP,!1);if(!t||!t.panel)return!1;let n=C$(e,TW);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:TI.of(!1)}),!0},TZ=[{key:"Mod-f",run:TY,scope:"editor search-panel"},{key:"F3",run:T_,shift:Tz,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:T_,shift:Tz,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:TK,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],s=0;for(let t=new Ta(e.doc,e.sliceDoc(r,i));!t.next().done;){if(o.length>1e3)return!1;t.value.from==r&&(s=o.length),o.push(yD.range(t.value.from,t.value.to))}return t(e.update({selection:yD.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{var t;let n,r,i,o,{state:s}=e,a=String(s.doc.lineAt(e.state.selection.main.head).number),{close:l,result:u}=(t={label:s.phrase("Go to line"),input:{type:"text",name:"line",value:a},focus:!0,submitLabel:s.phrase("go")},r=new Promise(e=>n=e),i=e=>(function(e,t,n){let r=t.content?t.content(e,()=>s(null)):null;if(!r){if(r=bP("form"),t.input){let e=bP("input",t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add("cm-textfield"),e.name||(e.name="input"),r.appendChild(bP("label",(t.label||"")+": ",e))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(bP("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let i="FORM"==r.nodeName?[r]:r.querySelectorAll("form");for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener("keydown",e=>{27==e.keyCode?(e.preventDefault(),s(null)):13==e.keyCode&&(e.preventDefault(),s(t))}),t.addEventListener("submit",e=>{e.preventDefault(),s(t)})}let o=bP("div",r,bP("button",{onclick:()=>s(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["\xd7"]));function s(t){o.contains(o.ownerDocument.activeElement)&&e.focus(),n(t)}return t.class&&(o.className=t.class),o.classList.add("cm-dialog"),{dom:o,top:t.top,mount:()=>{if(t.focus){let e;(e="string"==typeof t.focus?r.querySelector(t.focus):r.querySelector("input")||r.querySelector("button"))&&"select"in e?e.select():e&&"focus"in e&&e.focus()}}}})(e,t,n),e.state.field(CY,!1)?e.dispatch({effects:CK.of(i)}):e.dispatch({effects:y2.appendConfig.of(CY.init(()=>[i]))}),{close:o=CZ.of(i),result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(CY).indexOf(i)>-1&&e.dispatch({effects:o})}),t))});return u.then(t=>{let n=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!n)return void e.dispatch({effects:l});let r=s.doc.lineAt(s.selection.main.head),[,i,o,a,u]=n,c=a?+a.slice(1):0,h=o?+o:r.number;if(o&&u){let e=h/100;i&&(e=e*("-"==i?-1:1)+r.number/s.doc.lines),h=Math.round(s.doc.lines*e)}else o&&i&&(h=h*("-"==i?-1:1)+r.number);let d=s.doc.line(Math.max(1,Math.min(s.doc.lines,h))),f=yD.cursor(d.from+Math.max(0,Math.min(c,d.length)));e.dispatch({effects:[l,SW.scrollIntoView(f.from,{y:"center"})],selection:f})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=yD.create(n.ranges.map(t=>e.wordAt(t.head)||yD.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new Ta(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new Ta(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(o){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(yD.range(i.from,i.to),!1),effects:SW.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class TX{constructor(e){this.view=e;let t=this.query=e.state.field(TP).query.spec;function n(e,t,n){return bP("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=bP("input",{value:t.search,placeholder:TQ(e,"Find"),"aria-label":TQ(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=bP("input",{value:t.replace,placeholder:TQ(e,"Replace"),"aria-label":TQ(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=bP("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=bP("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=bP("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=bP("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>T_(e),[TQ(e,"next")]),n("prev",()=>Tz(e),[TQ(e,"previous")]),n("select",()=>TV(e),[TQ(e,"all")]),bP("label",null,[this.caseField,TQ(e,"match case")]),bP("label",null,[this.reField,TQ(e,"regexp")]),bP("label",null,[this.wordField,TQ(e,"by word")]),...e.state.readOnly?[]:[bP("br"),this.replaceField,n("replace",()=>TH(e),[TQ(e,"replace")]),n("replaceAll",()=>T$(e),[TQ(e,"replace all")])],bP("button",{name:"close",onclick:()=>TK(e),"aria-label":TQ(e,"close"),type:"button"},["\xd7"])])}commit(){let e=new TC({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:TR.of(e)}))}keydown(e){var t;(t=this.view,S5(S0(t.state),e,t,"search-panel"))?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Tz:T_)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),TH(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(TR)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(TS).top}}function TQ(e,t){return e.state.phrase(t)}let TJ=/[\s\.,:;?!]/;function T0(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,o=Math.max(r.from,t-30),s=Math.min(i,n+30),a=e.state.sliceDoc(o,s);if(o!=r.from){for(let e=0;e<30;e++)if(!TJ.test(a[e+1])&&TJ.test(a[e])){a=a.slice(e);break}}if(s!=i){for(let e=a.length-1;e>a.length-30;e--)if(!TJ.test(a[e-1])&&TJ.test(a[e])){a=a.slice(0,e);break}}return SW.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}let T1=SW.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),T2=[TP,y_.low(TF),T1];class T5{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Am(this.state).resolveInner(this.pos,-1);for(;t&&0>e.indexOf(t.name);)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(T8(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function T4(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class T3{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function T6(e){return e.selection.main.from}function T8(e,t){var n;let{source:r}=e,i=t&&"^"!=r[0],o="$"!=r[r.length-1];return i||o?RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,null!=(n=e.flags)?n:e.ignoreCase?"i":""):e}let T9=yJ.define(),T7=new WeakMap;function De(e){if(!Array.isArray(e))return e;let t=T7.get(e);return t||T7.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=T4(t)+T4(n)+"*$";return[RegExp("^"+r),new RegExp(r)]}(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}(e)),t}let Dt=y2.define(),Dn=y2.define();class Dr{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=yp(e,t),r=yg(n);this.chars.push(n);let i=e.slice(t,t+r),o=i.toUpperCase();this.folded.push(yp(o==i?i.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:o}=this;if(1==t.length){let r=yp(e,0),i=yg(r),o=i==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;o+=-200}return this.ret(o,[0,i])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(s<0){for(let i=0,o=Math.min(e.length,200);i<o&&l<a;){let o=yp(e,i);(o==t[l]||o==n[l])&&(r[l++]=i),i+=yg(o)}if(l<a)return null}let u=0,c=0,h=!1,d=0,f=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let r=0,l=Math.min(e.length,200),v=0;r<l&&c<a;){let l=yp(e,r);s<0&&(u<a&&l==t[u]&&(i[u++]=r),d<a&&(l==t[d]||l==n[d]?(0==d&&(f=r),p=r+1,d++):d=0));let y,b=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(y=ym(l))!=y.toLowerCase()?1:2*(y!=y.toUpperCase());(!r||1==b&&m||0==v&&0!=b)&&(t[c]==l||n[c]==l&&(h=!0)?o[c++]=r:o.length&&(g=!1)),v=b,r+=yg(l)}return c==a&&0==o[0]&&g?this.result(-100+(h?-200:0),o,e):d==a&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[f,p]):c==a?this.result(-100+(h?-200:0)+-700+(g?0:-1100),o,e):2==t.length?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?yg(yp(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class Di{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}let Do=yR.define({combine:e=>bt(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Da,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Ds(e(n),t(n)),optionClass:(e,t)=>n=>Ds(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function Ds(e,t){return e?t?e+" "+t:e:t}function Da(e,t,n,r,i,o){let s=e.textDirection==xg.RTL,a=s,l=!1,u="top",c,h,d=t.left-i.left,f=i.right-t.right,p=r.right-r.left,m=r.bottom-r.top;if(a&&d<Math.min(p,f)?a=!1:!a&&f<Math.min(p,d)&&(a=!0),p<=(a?d:f))c=Math.max(i.top,Math.min(n.top,i.bottom-m))-t.top,h=Math.min(400,a?d:f);else{l=!0,h=Math.min(400,(s?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=m||e>t.top?c=n.bottom-t.top:(u="bottom",c=t.bottom-n.top)}let g=(t.bottom-t.top)/o.offsetHeight,v=(t.right-t.left)/o.offsetWidth;return{style:`${u}: ${c/g}px; max-width: ${h/v}px`,class:"cm-completionInfo-"+(l?s?"left-narrow":"right-narrow":a?"left":"right")}}let Dl=y2.define();function Du(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}class Dc{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:i,selected:o}=r.open,s=e.state.facet(Do);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement("span");i.className="cm-completionLabel";let o=e.displayLabel||e.label,s=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>s&&i.appendChild(document.createTextNode(o.slice(s,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(t,n))),a.className="cm-completionMatchedText",s=n}return s<o.length&&i.appendChild(document.createTextNode(o.slice(s))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Du(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if("LI"==t.nodeName&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains("cm-completionListIncompleteTop")&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:Dl.of(t)}),n.preventDefault())}}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(Do).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Dn.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:i,selected:o,disabled:s}=n.open;r.open&&r.open.options==i||(this.range=Du(i.length,o,e.state.facet(Do).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),s!=(null==(t=r.open)?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Du(t.options.length,t.selected,this.view.state.facet(Do).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let o="string"==typeof i?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>xU(this.view.state,e,"completion info")):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){var t,n;let r,i,o,s=null;for(let t=this.list.firstChild,n=this.range.from;t;t=t.nextSibling,n++)"LI"==t.nodeName&&t.id?n==e?t.hasAttribute("aria-selected")||(t.setAttribute("aria-selected","true"),s=t):t.hasAttribute("aria-selected")&&(t.removeAttribute("aria-selected"),t.removeAttribute("aria-describedby")):n--;return s&&(t=this.list,n=s,r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.height/t.offsetHeight,i.top<r.top?t.scrollTop-=(r.top-i.top)/o:i.bottom>r.bottom&&(t.scrollTop+=(i.bottom-r.bottom)/o)),s}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(Do).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){let r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",e=>{e.target==r&&e.preventDefault()});let i=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:a}=e[o],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;e!=i&&(o>n.from||0==n.from)&&(i=e,"string"!=typeof l&&l.header?r.appendChild(l.header(l)):r.appendChild(document.createElement("completion-section")).textContent=e)}let u=r.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let c=this.optionClass(s);for(let e of(c&&(u.className=c),this.optionContent)){let t=e(s,this.view.state,this.view,a);t&&u.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Dh(e){return 100*(e.boost||0)+10*!!e.apply+5*!!e.info+ +!!e.type}class Dd{constructor(e,t,n,r,i,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Dd(this.options,Dg(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,i,o){if(r&&!o&&e.some(e=>e.isPending))return r.setDisabled();let s=function(e,t){let n=[],r=null,i=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some(t=>t.name==e)||r.push("string"==typeof t?{name:e}:t)}},s=t.facet(Do);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)o(new T3(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),a,l=s.filterStrict?new Di(n):new Dr(n);for(let t of r.result.options)if(a=l.match(t.label)){let n=t.displayLabel?e?e(t,a.matched):[]:a.matched,s=a.score+(t.boost||0);if(o(new T3(t,r.source,n,s)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;i||(i=Object.create(null)),i[e]=Math.max(s,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0;for(let n of r.sort((e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?i[t.name]-i[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1)))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let a=[],l=null,u=s.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||u(e.completion,t.completion))){let t=e.completion;l&&l.label==t.label&&l.detail==t.detail&&(null==l.type||null==t.type||l.type==t.type)&&l.apply==t.apply&&l.boost==t.boost?Dh(e.completion)>Dh(l)&&(a[a.length-1]=e):a.push(e),l=e.completion}return a}(e,t);if(!s.length)return r&&e.some(e=>e.isPending)?r.setDisabled():null;let a=t.facet(Do).selectOnOpen?0:-1;if(r&&r.selected!=a&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new Dd(s,Dg(n,a),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:DA,above:i.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new Dd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Dd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Df{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Df(Dv,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Do),r=(n.override||t.languageDataAt("autocomplete",T6(t)).map(De)).map(t=>(this.active.find(e=>e.source==t)||new Db(t,+!!this.active.some(e=>0!=e.state))).update(e,n));r.length==this.active.length&&r.every((e,t)=>e==this.active[t])&&(r=this.active);let i=this.open,o=e.effects.some(e=>e.is(Dw));for(let s of(i&&e.docChanged&&(i=i.map(e.changes)),e.selection||r.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,o=r==t.length;if(i||o)return i==o;if(e[n++].result!=t[r++].result)return!1}}(r,this.active)||o?i=Dd.build(r,t,this.id,i,n,o):i&&i.disabled&&!r.some(e=>e.isPending)&&(i=null),!i&&r.every(e=>!e.isPending)&&r.some(e=>e.hasResult())&&(r=r.map(e=>e.hasResult()?new Db(e.source,0):e)),e.effects))s.is(Dl)&&(i=i&&i.setSelected(s.value,this.id));return r==this.active&&i==this.open?this:new Df(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Dp:Dm}}let Dp={"aria-autocomplete":"list"},Dm={};function Dg(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}let Dv=[];function Dy(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(T9);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:16*!!e.docChanged}class Db{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=Dy(e,t),r=this;for(let t of((8&n||16&n&&this.touches(e))&&(r=new Db(r.source,0)),4&n&&0==r.state&&(r=new Db(this.source,1)),r=r.updateFor(e,n),e.effects))if(t.is(Dt))r=new Db(r.source,1,t.value);else if(t.is(Dn))r=new Db(r.source,0);else if(t.is(Dw))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(T6(e.state))}}class Dx extends Db{constructor(e,t,n,r,i,o){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=T6(e.state);if(s>o||!r||2&t&&(T6(e.startState)==this.from||s<this.limit))return new Db(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return!function(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return"function"==typeof e?e(i,n,r,t):T8(e,!0).test(i)}(r.validFor,e.state,i,o)?r.update&&(r=r.update(r,i,o,new T5(e.state,s,!1)))?new Dx(this.source,this.explicit,a,r,r.from,null!=(n=r.to)?n:T6(e.state)):new Db(this.source,1,this.explicit):new Dx(this.source,this.explicit,a,r,i,o)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new Dx(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new Db(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}let Dw=y2.define({map:(e,t)=>e.map(e=>e.map(t))}),DS=yF.define({create:()=>Df.start(),update:(e,t)=>e.update(t),provide:e=>[CN.from(e,e=>e.tooltip),SW.contentAttributes.from(e,e=>e.attrs)]});function DC(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(DS).active.find(e=>e.source==t.source);return r instanceof Dx&&("string"==typeof n?e.dispatch({...function(e,t,n,r){let{main:i}=e.selection,o=n-i.from,s=r-i.from;return{...e.changeByRange(a=>{if(a!=i&&n!=r&&e.sliceDoc(a.from+o,a.from+s)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+o,to:r==i.from?a.to:a.from+s,insert:l},range:yD.cursor(a.from+o+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}(e.state,n,r.from,r.to),annotations:T9.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}let DA=e=>new Dc(e,DS,DC);function Dk(e,t="option"){return n=>{let r=n.state.field(DS,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Do).interactionDelay)return!1;let i=1,o;"page"==t&&(o=Cz(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:s}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:Dl.of(a)}),!0}}let DM=e=>!!e.state.field(DS,!1)&&(e.dispatch({effects:Dt.of(!0)}),!0);class DT{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}let DD=xK.fromClass(class{constructor(e){for(let t of(this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0,e.state.field(DS).active))t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(DS),n=e.state.facet(Do);if(!e.selectionSet&&!e.docChanged&&e.startState.field(DS)==t)return;let r=e.transactions.some(e=>{let t=Dy(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){xU(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(Dt)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(DS);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Do).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=T6(t),r=new T5(t,n,e.explicit,this.view),i=new DT(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:Dn.of(null)}),xU(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Do).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Do),r=this.view.state.field(DS);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(void 0===o.done)continue;if(this.running.splice(i--,1),o.done){let r=T6(o.updates.length?o.updates[0].startState:this.view.state),i=Math.min(r,o.done.from+ +!o.active.explicit),s=new Dx(o.active.source,o.active.explicit,i,o.done,o.done.from,null!=(e=o.done.to)?e:r);for(let e of o.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=r.active.find(e=>e.source==o.active.source);if(s&&s.isPending)if(null==o.done){let e=new Db(o.active.source,0);for(let t of o.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Dw.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(DS,!1);if(t&&t.tooltip&&this.view.state.facet(Do).closeOnBlur){let n=t.open&&Cz(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:Dn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:Dt.of(!1)}),20),this.composing=0}}}),DE="object"==typeof navigator&&/Win/.test(navigator.platform),DO=y_.highest(SW.domEventHandlers({keydown(e,t){let n=t.state.field(DS,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(DE&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(e.key)>-1&&DC(t,r),!1}})),DR=SW.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),DI={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},DP=y2.define({map(e,t){let n=t.mapPos(e,-1,yy.TrackAfter);return null==n?void 0:n}}),DN=new class extends bn{};DN.startSide=1,DN.endSide=-1;let DL=yF.define({create:()=>ba.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(DP)&&(e=e.update({add:[DN.range(n.value,n.value+1)]}));return e}}),Dj="()[]{}<>\xab\xbb\xbb\xab[]{}";function DF(e){for(let t=0;t<Dj.length;t+=2)if(Dj.charCodeAt(t)==e)return Dj.charAt(t+1);return ym(e<128?e:e+1)}function DB(e,t){return e.languageDataAt("closeBrackets",t)[0]||DI}let D_="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Dz=SW.inputHandler.of((e,t,n,r)=>{if((D_?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==yg(yp(r,0))||t!=i.from||n!=i.to)return!1;let o=function(e,t){let n=DB(e,e.selection.main.head),r=n.brackets||DI.brackets;for(let i of r){let o=DF(yp(i,0));if(t==i)return o==i?function(e,t,n,r){let i=r.stringPrefixes||DI.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:DP.of(r.to+t.length),range:yD.range(r.anchor+t.length,r.head+t.length)};let s=r.head,a=D$(e.doc,s),l;if(a==t){if(DW(e,s))return{changes:{insert:t+t,from:s},effects:DP.of(s+t.length),range:yD.cursor(s+t.length)};else if(DH(e,s)){let r=n&&e.sliceDoc(s,s+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+r.length,insert:r},range:yD.cursor(s+r.length)}}}else if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(l=DU(e,s-2*t.length,i))>-1&&DW(e,l))return{changes:{insert:t+t+t+t,from:s},effects:DP.of(s+t.length),range:yD.cursor(s+t.length)};else if(e.charCategorizer(s)(a)!=y9.Word&&DU(e,s,i)>-1&&!function(e,t,n,r){let i=Am(e).resolveInner(t,-1),o=r.reduce((e,t)=>Math.max(e,t.length),0);for(let s=0;s<5;s++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),a=s.indexOf(n);if(!a||a>-1&&r.indexOf(s.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=i.to==t&&i.parent;if(!l)break;i=l}return!1}(e,s,t,i))return{changes:{insert:t+t,from:s},effects:DP.of(s+t.length),range:yD.cursor(s+t.length)};return{range:o=r}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,r.indexOf(i+i+i)>-1,n):function(e,t,n,r){let i=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:DP.of(o.to+t.length),range:yD.range(o.anchor+t.length,o.head+t.length)};let s=D$(e.doc,o.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:DP.of(o.head+t.length),range:yD.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,o,n.before||DI.before);if(t==o&&DH(e,e.selection.main.from))return function(e,t){let n=null,r=e.changeByRange(r=>r.empty&&D$(e.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:yD.cursor(r.head+t.length)}:n={range:r});return n?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}(e,o)}return null}(e.state,r);return!!o&&(e.dispatch(o),!0)}),DV=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=DB(e,e.selection.main.head).brackets||DI.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){var i,o;let r,s=(i=e.doc,o=t.head,yg(yp(r=i.sliceString(o-2,o),0))==r.length?r:r.slice(1));for(let r of n)if(r==s&&D$(e.doc,t.head)==DF(yp(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:yD.cursor(t.head-r.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function DH(e,t){let n=!1;return e.field(DL).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function D$(e,t){let n=e.sliceString(t,t+2);return n.slice(0,yg(yp(n,0)))}function DW(e,t){let n=Am(e).resolveInner(t+1);return n.parent&&n.from==t}function DU(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=y9.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=y9.Word)return n}return -1}let Dq=[{key:"Ctrl-Space",run:DM},{mac:"Alt-`",run:DM},{mac:"Alt-i",run:DM},{key:"Escape",run:e=>{let t=e.state.field(DS,!1);return!!t&&!!t.active.some(e=>0!=e.state)&&(e.dispatch({effects:Dn.of(null)}),!0)}},{key:"ArrowDown",run:Dk(!0)},{key:"ArrowUp",run:Dk(!1)},{key:"PageDown",run:Dk(!0,"page")},{key:"PageUp",run:Dk(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(DS,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Do).interactionDelay)&&DC(e,t.open.options[t.open.selected])}}],DG=y_.highest(SQ.computeN([Do],e=>e.facet(Do).defaultKeymap?[Dq]:[]));var DY=function(e){let t;void 0===e&&(e={});var n=e.crosshairCursor,r=[];!1!==e.closeBracketsKeymap&&(r=r.concat(DV)),!1!==e.defaultKeymap&&(r=r.concat(Ti)),!1!==e.searchKeymap&&(r=r.concat(TZ)),!1!==e.historyKeymap&&(r=r.concat(Mg)),!1!==e.foldKeymap&&(r=r.concat(AK)),!1!==e.completionKeymap&&(r=r.concat(Dq)),!1!==e.lintKeymap&&(r=r.concat(kP));var i=[];return!1!==e.lineNumbers&&i.push(function(e={}){return[Ar.of(e),C4(),As]}()),!1!==e.highlightActiveLineGutter&&i.push(Au),!1!==e.highlightSpecialChars&&i.push(function(e={}){return[Cm.of(e),Cg||(Cg=xK.fromClass(class{constructor(e){this.view=e,this.decorations=bQ.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Cm)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Cc({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,o=yp(t[0],0);if(9==o){let e=i.lineAt(r),t=n.state.tabSize,o=bb(e.text,t,r-e.from);return bQ.replace({widget:new Cy((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=bQ.replace({widget:new Cv(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Cm);e.startState.facet(Cm)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}()),!1!==e.history&&i.push(function(e={}){return[Mn,Mt.of(e),SW.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?Mi:"historyRedo"==e.inputType?Mo:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&i.push(function(e={}){let t={...A2,...e},n=new A5(t,!0),r=new A5(t,!1),i=xK.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(AA)!=e.state.facet(AA)||e.startState.field(AW,!1)!=e.state.field(AW,!1)||Am(e.startState)!=Am(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new bl;for(let i of e.viewportLineBlocks){let o=Aq(e.state,i.from,i.to)?r:A_(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)}return t.finish()}}),{domEventHandlers:o}=t;return[i,C2({class:"cm-foldGutter",markers(e){var t;return(null==(t=e.plugin(i))?void 0:t.markers)||ba.empty},initialSpacer:()=>new A5(t,!1),domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=Aq(e.state,t.from,t.to);if(r)return e.dispatch({effects:AH.of(r)}),!0;let i=A_(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:AV.of(i)}),!0)}}}),AQ()]}()),!1!==e.drawSelection&&i.push(function(e={}){return[Ce.of(e),Cn,Ci,Co,xz.of(!0)]}()),!1!==e.dropCursor&&i.push([Ca,Cl]),!1!==e.allowMultipleSelections&&i.push(be.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&i.push(be.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+200)return e;let o=n.sliceString(i.from,r);if(!t.some(e=>e.test(o)))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=AO(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=AE(s,n);r!=i&&l.push({from:t.from,to:t.from+r.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e})),!1!==e.syntaxHighlighting&&i.push(A7(kt,{fallback:!0})),!1!==e.bracketMatching&&i.push(function(e={}){return[ki.of(e),ku]}()),!1!==e.closeBrackets&&i.push([Dz,DL]),!1!==e.autocompletion&&i.push(function(e={}){return[DO,DS,Do.of(e),DD,DG,DR]}()),!1!==e.rectangularSelection&&i.push((t=e=>e.altKey&&0==e.button,SW.mouseSelectionStyle.of((e,n)=>{let r,i;return t(n)?(r=CS(e,n),i=e.state.selection,r?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(r.line).from),n=e.state.doc.lineAt(t);r={line:n.number,col:r.col,off:Math.min(r.off,n.length)},i=i.map(e.changes)}},get(t,n,o){let s=CS(e,t);if(!s)return i;let a=function(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),o=[];if(t.off>2e3||n.off>2e3||t.col<0||n.col<0){let s=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=a&&o.push(yD.range(n.from+s,n.to+a))}}else{let s=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=bx(n.text,s,e.tabSize,!0);if(r<0)o.push(yD.cursor(n.to));else{let t=bx(n.text,a,e.tabSize);o.push(yD.range(n.from+r,n.from+t))}}}return o}(e.state,r,s);return a.length?o?yD.create(a.concat(i.ranges)):yD.create(a):i}}:null):null}))),!1!==(void 0!==n&&n)&&i.push(function(e={}){let[t,n]=CC[e.key||"Alt"],r=xK.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,SW.contentAttributes.of(e=>{var t;return(null==(t=e.plugin(r))?void 0:t.isDown)?CA:null})]}()),!1!==e.highlightActiveLine&&i.push(Cx),!1!==e.highlightSelectionMatches&&i.push([Tw,Tx]),e.tabSize&&"number"==typeof e.tabSize&&i.push(AT.of(" ".repeat(e.tabSize))),i.concat([SQ.of(r.flat())]).filter(Boolean)};let DK="#e06c75",DZ="#abb2bf",DX="#7d8799",DQ="#d19a66",DJ="#2c313a",D0="#282c34",D1="#353a42",D2="#528bff",D5=[SW.theme({"&":{color:DZ,backgroundColor:D0},".cm-content":{caretColor:D2},".cm-cursor, .cm-dropCursor":{borderLeftColor:D2},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:DZ},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:D0,color:DX,border:"none"},".cm-activeLineGutter":{backgroundColor:DJ},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:D1},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:D1,borderBottomColor:D1},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:DJ,color:DZ}}},{dark:!0}),A7(A3.define([{tag:v2.keyword,color:"#c678dd"},{tag:[v2.name,v2.deleted,v2.character,v2.propertyName,v2.macroName],color:DK},{tag:[v2.function(v2.variableName),v2.labelName],color:"#61afef"},{tag:[v2.color,v2.constant(v2.name),v2.standard(v2.name)],color:DQ},{tag:[v2.definition(v2.name),v2.separator],color:DZ},{tag:[v2.typeName,v2.className,v2.number,v2.changed,v2.annotation,v2.modifier,v2.self,v2.namespace],color:"#e5c07b"},{tag:[v2.operator,v2.operatorKeyword,v2.url,v2.escape,v2.regexp,v2.link,v2.special(v2.string)],color:"#56b6c2"},{tag:[v2.meta,v2.comment],color:DX},{tag:v2.strong,fontWeight:"bold"},{tag:v2.emphasis,fontStyle:"italic"},{tag:v2.strikethrough,textDecoration:"line-through"},{tag:v2.link,color:DX,textDecoration:"underline"},{tag:v2.heading,fontWeight:"bold",color:DK},{tag:[v2.atom,v2.bool,v2.special(v2.variableName)],color:DQ},{tag:[v2.processingInstruction,v2.string,v2.inserted],color:"#98c379"},{tag:v2.invalid,color:"#ffffff"}]))];var D4=SW.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),D3=function(e){let t;void 0===e&&(e={});var n=e,r=n.indentWithTab,i=n.editable,o=n.readOnly,s=n.theme,a=void 0===s?"light":s,l=n.placeholder,u=void 0===l?"":l,c=n.basicSetup,h=void 0===c||c,d=[];switch((void 0===r||r)&&d.unshift(SQ.of([To])),h&&("boolean"==typeof h?d.unshift(DY()):d.unshift(DY(h))),u&&d.unshift((t=xK.fromClass(class{constructor(e){this.view=e,this.placeholder=u?bQ.set([bQ.widget({widget:new Cw(u),side:1}).range(0)]):bQ.none}get decorations(){return this.view.state.doc.length?bQ.none:this.placeholder}},{decorations:e=>e.decorations}),"string"==typeof u?[t,SW.contentAttributes.of({"aria-placeholder":u})]:t)),a){case"light":d.push(D4);break;case"dark":d.push(D5);break;case"none":break;default:d.push(a)}return!1===(void 0===i||i)&&d.push(SW.editable.of(!1)),void 0!==o&&o&&d.push(be.readOnly.of(!0)),[...d]};class D6{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error("TimeoutLatch callback error:",e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class D8{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var D9=null,D7=yJ.define(),Ee=[],Et=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],En=(0,w.forwardRef)((e,t)=>{var n,r,i,o,s,a,l,u,c,h,d,f,p,m,g,v,y,b,S,C,A,k,M,T,D,E,O,R,I,P,N,L,j,F,B,_,z,V,H,$,W,U,q,G,Y,K,Z,X,Q,J=e.className,ee=e.value,et=void 0===ee?"":ee,en=e.selection,er=e.extensions,ei=e.onChange,eo=e.onStatistics,es=e.onCreateEditor,ea=e.onUpdate,el=e.autoFocus,eu=e.theme,ec=void 0===eu?"light":eu,eh=e.height,ed=e.minHeight,ef=e.maxHeight,ep=e.width,em=e.minWidth,eg=e.maxWidth,ev=e.basicSetup,ey=e.placeholder,eb=e.indentWithTab,ex=e.editable,ew=e.readOnly,eS=e.root,eC=e.initialState,eA=(0,k1.A)(e,Et),ek=(0,w.useRef)(null),eM=(r=(n={root:eS,value:et,autoFocus:el,theme:ec,height:eh,minHeight:ed,maxHeight:ef,width:ep,minWidth:em,maxWidth:eg,basicSetup:ev,placeholder:ey,indentWithTab:eb,editable:ex,readOnly:ew,selection:en,onChange:ei,onStatistics:eo,onCreateEditor:es,onUpdate:ea,extensions:void 0===er?[]:er,initialState:eC}).value,i=n.selection,o=n.onChange,s=n.onStatistics,a=n.onCreateEditor,l=n.onUpdate,c=void 0===(u=n.extensions)?Ee:u,h=n.autoFocus,f=void 0===(d=n.theme)?"light":d,m=void 0===(p=n.height)?null:p,v=void 0===(g=n.minHeight)?null:g,b=void 0===(y=n.maxHeight)?null:y,C=void 0===(S=n.width)?null:S,k=void 0===(A=n.minWidth)?null:A,T=void 0===(M=n.maxWidth)?null:M,E=void 0===(D=n.placeholder)?"":D,R=void 0===(O=n.editable)||O,P=void 0!==(I=n.readOnly)&&I,L=void 0===(N=n.indentWithTab)||N,F=void 0===(j=n.basicSetup)||j,B=n.root,_=n.initialState,V=(z=(0,w.useState)())[0],H=z[1],W=($=(0,w.useState)())[0],U=$[1],G=(q=(0,w.useState)())[0],Y=q[1],K=(0,w.useState)(()=>({current:null}))[0],Z=(0,w.useState)(()=>({current:null}))[0],X=SW.theme({"&":{height:m,minHeight:v,maxHeight:b,width:C,minWidth:k,maxWidth:T},"& .cm-scroller":{height:"100% !important"}}),Q=[SW.updateListener.of(e=>{e.docChanged&&"function"==typeof o&&!e.transactions.some(e=>e.annotation(D7))&&(K.current?K.current.reset():(K.current=new D6(()=>{if(Z.current){var e=Z.current;Z.current=null,e()}K.current=null},200),("u"<typeof window?new D8:(!D9&&(D9=new D8),D9)).add(K.current)),o(e.state.doc.toString(),e)),s&&s({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)})}),X,...D3({theme:f,editable:R,readOnly:P,placeholder:E,indentWithTab:L,basicSetup:F})],l&&"function"==typeof l&&Q.push(SW.updateListener.of(l)),Q=Q.concat(c),(0,w.useLayoutEffect)(()=>{if(V&&!G){var e={doc:r,selection:i,extensions:Q},t=_?be.fromJSON(_.json,e,_.fields):be.create(e);if(Y(t),!W){var n=new SW({state:t,parent:V,root:B});U(n),a&&a(n,t)}}return()=>{W&&(Y(void 0),U(void 0))}},[V,G]),(0,w.useEffect)(()=>{n.container&&H(n.container)},[n.container]),(0,w.useEffect)(()=>()=>{W&&(W.destroy(),U(void 0)),K.current&&(K.current.cancel(),K.current=null)},[W]),(0,w.useEffect)(()=>{h&&W&&W.focus()},[h,W]),(0,w.useEffect)(()=>{W&&W.dispatch({effects:y2.reconfigure.of(Q)})},[f,c,m,v,b,C,k,T,E,R,P,L,F,o,l]),(0,w.useEffect)(()=>{if(void 0!==r){var e=W?W.state.doc.toString():"";if(W&&r!==e){var t=K.current&&!K.current.isDone,n=()=>{W&&r!==W.state.doc.toString()&&W.dispatch({changes:{from:0,to:W.state.doc.toString().length,insert:r||""},annotations:[D7.of(!0)]})};t?Z.current=n:n()}}},[r,W]),{state:G,setState:Y,view:W,setView:U,container:V,setContainer:H}),eT=eM.state,eD=eM.view,eE=eM.container,eO=eM.setContainer;(0,w.useImperativeHandle)(t,()=>({editor:ek.current,state:eT,view:eD}),[ek,eE,eT,eD]);var eR=(0,w.useCallback)(e=>{ek.current=e,eO(e)},[eO]);if("string"!=typeof et)throw Error("value must be typeof string but got "+typeof et);return(0,x.jsx)("div",(0,iL.A)({ref:eR,className:("string"==typeof ec?"cm-theme-"+ec:"cm-theme")+(J?" "+J:"")},eA))});function Er(e){let t=(0,lO.A)(),n="dark"===t.palette.mode,[r,i]=(0,w.useState)(()=>JSON.stringify(e.value,null,2)),[o,s]=(0,w.useState)(r);return(0,x.jsx)(En,{...e,style:{border:`1px solid ${t.palette.divider}`},theme:n?"dark":"light",extensions:[new Ak(kx),function(e,t={}){return[kL.of({source:e,config:t}),kN,kJ]}(e=>{try{JSON.parse(e.state.doc.toString())}catch(i){var t;let n;if(!(i instanceof SyntaxError))throw i;let r=(t=e.state.doc,(n=i.message.match(/at position (\d+)/))?Math.min(+n[1],t.length):(n=i.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+n[1]).from+ +n[2]-1,t.length):0);return[{from:r,message:i.message,severity:"error",to:r}]}return[]}),function(e={}){return[k0.of(e),kY,kG,kX,kZ]}()],value:r,onChange:t=>{i(t),e.onChange&&e.onChange(t)},onBlur:()=>{o!==r&&void 0!==e.onChange&&(e.onChange(r),s(r))},placeholder:e.placeholder})}En.displayName="CodeMirror";var Ei=n(10740);let Eo=e=>{let{mode:t,url:n,name:r,newTabOpen:i,renderVariables:o,tooltip:s}=e;return(0,x.jsxs)(H.A,{direction:"column",gap:2,flexGrow:1,children:[(0,x.jsx)(pv,{label:n.label,error:n.error?.hasError,helperText:n.error?.helperText,onChange:n.onChange,placeholder:n.placeholder,multiline:!0,maxRows:5,required:!0,fullWidth:!0,value:n.value}),(r||s)&&(0,x.jsxs)(H.A,{gap:1,direction:"inline"===t?"row":"column",children:[r&&(0,x.jsx)(pv,{sx:{flexGrow:"1"},label:r.label,onChange:r?.onChange,placeholder:r?.placeholder,value:r?.value}),s&&(0,x.jsx)(pv,{sx:{flexGrow:"1"},label:s.label,onChange:s?.onChange,placeholder:s?.placeholder,value:s?.value})]}),(0,x.jsxs)(H.A,{direction:"row",gap:1,children:[o&&(0,x.jsx)(Ei.A,{label:o.label,control:(0,x.jsx)(d2,{checked:o.value,onChange:e=>{o?.onChange(e.target.checked)}})}),(0,x.jsx)(Ei.A,{label:i.label,control:(0,x.jsx)(d2,{checked:i.value,onChange:e=>{i?.onChange(e.target.checked)}})})]})]})},Es=[{id:"value",label:"Value"},{id:"percentage",label:"Percentage"}];function Ea({disablePercentageMode:e,onChange:t,value:n="value"}){return(0,x.jsx)(pK,{label:"Mode",control:(0,x.jsx)(p0,{value:Es.find(e=>e.id===n),options:Es,getOptionLabel:e=>e.label,getOptionDisabled:t=>"percentage"===t.id&&e,onChange:(e,{id:n})=>{t(n)},disableClearable:!0})})}var El=n(69402);function Eu(e){return(0,P.Ay)("MuiSkeleton",e)}(0,I.A)("MuiSkeleton",["root","text","rectangular","rounded","circular","pulse","wave","withChildren","fitContent","heightAuto"]);let Ec=(0,El.keyframes)`
6
+ 0% {
7
+ opacity: 1;
8
+ }
9
+
10
+ 50% {
11
+ opacity: 0.4;
12
+ }
13
+
14
+ 100% {
15
+ opacity: 1;
16
+ }
17
+ `,Eh=(0,El.keyframes)`
18
+ 0% {
19
+ transform: translateX(-100%);
20
+ }
21
+
22
+ 50% {
23
+ /* +0.5s of delay between each loop */
24
+ transform: translateX(100%);
25
+ }
26
+
27
+ 100% {
28
+ transform: translateX(100%);
29
+ }
30
+ `,Ed="string"!=typeof Ec?(0,El.css)`
31
+ animation: ${Ec} 2s ease-in-out 0.5s infinite;
32
+ `:null,Ef="string"!=typeof Eh?(0,El.css)`
33
+ &::after {
34
+ animation: ${Eh} 2s linear 0.5s infinite;
35
+ }
36
+ `:null,Ep=(0,D.A)("span",{name:"MuiSkeleton",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],!1!==n.animation&&t[n.animation],n.hasChildren&&t.withChildren,n.hasChildren&&!n.width&&t.fitContent,n.hasChildren&&!n.height&&t.heightAuto]}})((0,E.A)(({theme:e})=>{let t=String(e.shape.borderRadius).match(/[\d.\-+]*\s*(.*)/)[1]||"px",n=parseFloat(e.shape.borderRadius);return{display:"block",backgroundColor:e.vars?e.vars.palette.Skeleton.bg:(0,k.X4)(e.palette.text.primary,"light"===e.palette.mode?.11:.13),height:"1.2em",variants:[{props:{variant:"text"},style:{marginTop:0,marginBottom:0,height:"auto",transformOrigin:"0 55%",transform:"scale(1, 0.60)",borderRadius:`${n}${t}/${Math.round(n/.6*10)/10}${t}`,"&:empty:before":{content:'"\\00a0"'}}},{props:{variant:"circular"},style:{borderRadius:"50%"}},{props:{variant:"rounded"},style:{borderRadius:(e.vars||e).shape.borderRadius}},{props:({ownerState:e})=>e.hasChildren,style:{"& > *":{visibility:"hidden"}}},{props:({ownerState:e})=>e.hasChildren&&!e.width,style:{maxWidth:"fit-content"}},{props:({ownerState:e})=>e.hasChildren&&!e.height,style:{height:"auto"}},{props:{animation:"pulse"},style:Ed||{animation:`${Ec} 2s ease-in-out 0.5s infinite`}},{props:{animation:"wave"},style:{position:"relative",overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)","&::after":{background:`linear-gradient(
37
+ 90deg,
38
+ transparent,
39
+ ${(e.vars||e).palette.action.hover},
40
+ transparent
41
+ )`,content:'""',position:"absolute",transform:"translateX(-100%)",bottom:0,left:0,right:0,top:0}}},{props:{animation:"wave"},style:Ef||{"&::after":{animation:`${Eh} 2s linear 0.5s infinite`}}}]}})),Em=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiSkeleton"}),{animation:r="pulse",className:i,component:o="span",height:s,style:a,variant:l="text",width:u,...c}=n,h={...n,animation:r,component:o,variant:l,hasChildren:!!c.children},d=(e=>{let{classes:t,variant:n,animation:r,hasChildren:i,width:o,height:s}=e;return(0,A.A)({root:["root",n,r,i&&"withChildren",i&&!o&&"fitContent",i&&!s&&"heightAuto"]},Eu,t)})(h);return(0,x.jsx)(Ep,{as:o,ref:t,className:(0,C.A)(d.root,i),ownerState:h,...c,style:{width:u,height:s,...a}})});function Eg(e){let{message:t}=e;return(0,x.jsx)(H.A,{sx:{height:"100%",alignItems:"center",justifyContent:"center"},children:(0,x.jsx)(fO.A,{children:t})})}function Ev(e){let{resource:t}=e;return(0,x.jsx)(Eg,{message:`No ${t}`})}function Ey(e){let{variant:t="rounded"}=e;return(0,x.jsx)(H.A,{sx:{height:"100%",alignItems:"center",justifyContent:"center",px:1},children:(0,x.jsx)(Em,{variant:t,width:"100%",height:"30%","aria-label":"Loading..."})})}let Eb=[{id:"asc",label:"Ascending"},{id:"desc",label:"Descending"}];function Ex({onChange:e,value:t="desc"}){return(0,x.jsx)(pK,{label:"Sort",control:(0,x.jsx)(p0,{value:Eb.find(e=>e.id===t),options:Eb,getOptionLabel:e=>e.label,onChange:(t,{id:n})=>{e(n)},disableClearable:!0})})}function Ew({onChange:e,value:t,...n}){let r=t=>{e(t)};return(0,x.jsxs)(_,{"aria-label":"Sort",...n,children:[(0,x.jsx)(z.A,{onClick:()=>r(void 0),variant:void 0===t?"contained":"outlined",children:"None"}),(0,x.jsx)(z.A,{onClick:()=>r("asc"),variant:"asc"===t?"contained":"outlined",children:"Asc"}),(0,x.jsx)(z.A,{onClick:()=>r("desc"),variant:"desc"===t?"contained":"outlined",children:"Desc"})]})}var ES=n(61375),EC=n(31729);let EA=(0,n(68335).A)();var Ek=n(86742),EM=n(86067);function ET({inputRef:e,label:t,color:n,value:r,mode:i,onChange:o,onColorChange:s,onBlur:a,onDelete:l}){let[u,c]=(0,w.useState)(0);return(0,x.jsxs)(H.A,{flex:1,direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[(0,x.jsx)(lD,{label:t,color:n,onColorChange:s}),(0,x.jsx)(pW.A,{htmlFor:t,children:t}),(0,x.jsx)(W.A,{id:t,inputRef:e,type:"number",value:0===r?"":r,placeholder:"0",onChange:o,onBlur:a,onKeyDown:e=>{"Enter"===e.key&&(a(),c(u+1))},InputProps:{endAdornment:"percent"===i?(0,x.jsx)(lR.A,{paddingX:1,children:"%"}):void 0}},u),(0,x.jsx)($.A,{"aria-label":`delete threshold ${t}`,size:"small",onClick:l,children:(0,x.jsx)(EM,{})})]})}function ED({thresholds:e,onChange:t,hideDefault:n,disablePercentMode:r}){let{thresholds:{defaultColor:i,palette:o}}=eD(),s=e?.defaultColor??i,a=e?.steps,l=(0,w.useRef)(null),u=(0,w.useRef)(!1);(0,w.useEffect)(()=>{l.current&&u.current&&(l.current?.focus(),u.current=!1)},[a?.length]);let c=()=>{if(void 0!==a){let n=[...a];n.sort((e,t)=>e.value-t.value),void 0!==e&&t((0,lI.produce)(e,e=>{e.steps=n}))}};return(0,x.jsxs)(pX,{title:"Thresholds",icon:(0,x.jsx)(pq,{description:"Add threshold",children:(0,x.jsx)($.A,{size:"small","aria-label":"add threshold",onClick:()=>{u.current=!0,void 0===e?t({steps:[{value:10}]}):e&&void 0===e.steps?t((0,lI.produce)(e,e=>{e.steps=[{value:10}]})):t((0,lI.produce)(e,e=>{let t=e.steps;if(t?.length){let e=t[t.length-1],n=o[t.length]??EE();t.push({color:n,value:(e?.value??0)+10})}else t&&t.push({value:10})}))},children:(0,x.jsx)(Ek,{})})}),children:[(0,x.jsx)(pK,{label:"Mode",description:"Percentage means thresholds relative to min & max",control:(0,x.jsxs)(ES.A,{exclusive:!0,disabled:r,value:e?.mode??"absolute",onChange:(n,r)=>{let i="percent"===r?"percent":void 0;void 0!==e?t((0,lI.produce)(e,e=>{e.mode=i})):t({mode:i})},sx:{height:"36px",marginLeft:"auto"},children:[(0,x.jsx)(EC.A,{"aria-label":"absolute",value:"absolute",sx:{fontWeight:500},children:"Absolute"}),(0,x.jsx)(EC.A,{"aria-label":"percent",value:"percent",sx:{fontWeight:500},children:"Percent"})]})}),a&&a.map((n,r)=>(0,x.jsx)(ET,{inputRef:r===a.length-1?l:void 0,label:`T${r+1}`,color:n.color??o[r]??s,value:n.value,mode:e?.mode,onColorChange:n=>{void 0!==e&&t((0,lI.produce)(e,e=>{if(void 0!==e.steps){let t=e.steps[r];t&&(t.color=n)}}))},onChange:n=>{void 0!==e&&t((0,lI.produce)(e,e=>{let t=e.steps?.[r];t&&(t.value=Number(n.target.value))}))},onDelete:()=>{void 0!==e&&t((0,lI.produce)(e,e=>{e.steps&&e.steps.splice(r,1)}))},onBlur:c},r)).toReversed(),!n&&(0,x.jsxs)(EA,{flex:1,direction:"row",alignItems:"center",spacing:1,children:[(0,x.jsx)(lD,{label:"default",color:s,onColorChange:n=>{void 0!==e?t((0,lI.produce)(e,e=>{e.defaultColor=n})):t({defaultColor:n})}}),(0,x.jsx)(fO.A,{children:"Default"})]})]})}let EE=()=>"#"+Math.floor(0x1000000*Math.random()).toString(16).padStart(6,"0");var EO=n(24300),ER=n(26684),EI=n(51327),EP=n(87169);function EN({props:e,name:t}){return(0,EI.A)({props:e,name:t,defaultTheme:EP.A,themeId:m4.A})}let EL=["localeText"],Ej=w.createContext(null),EF=function(e){let{localeText:t}=e,n=(0,k1.A)(e,EL),{utils:r,localeText:i}=w.useContext(Ej)??{utils:void 0,localeText:void 0},{children:o,dateAdapter:s,dateFormats:a,dateLibInstance:l,adapterLocale:u,localeText:c}=EN({props:n,name:"MuiLocalizationProvider"}),h=w.useMemo(()=>(0,iL.A)({},c,i,t),[c,i,t]),d=w.useMemo(()=>{if(!s)return r||null;let e=new s({locale:u,formats:a,instance:l});if(!e.isMUIAdapter)throw Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation"].join(`
42
+ `));return e},[s,u,a,l,r]),f=w.useMemo(()=>d?{minDate:d.date("1900-01-01T00:00:00.000"),maxDate:d.date("2099-12-31T00:00:00.000")}:null,[d]),p=w.useMemo(()=>({utils:d,defaultDates:f,localeText:h}),[f,d,h]);return(0,x.jsx)(Ej.Provider,{value:p,children:o})};var EB=n(62688),E_=n.n(EB);let Ez={previousMonth:"Previous month",nextMonth:"Next month",openPreviousView:"Open previous view",openNextView:"Open next view",calendarViewSwitchingButtonAriaLabel:e=>"year"===e?"year view is open, switch to calendar view":"calendar view is open, switch to year view",start:"Start",end:"End",startDate:"Start date",startTime:"Start time",endDate:"End date",endTime:"End time",cancelButtonLabel:"Cancel",clearButtonLabel:"Clear",okButtonLabel:"OK",todayButtonLabel:"Today",datePickerToolbarTitle:"Select date",dateTimePickerToolbarTitle:"Select date & time",timePickerToolbarTitle:"Select time",dateRangePickerToolbarTitle:"Select date range",clockLabelText:(e,t,n,r)=>`Select ${e}. ${!r&&(null===t||!n.isValid(t))?"No time selected":`Selected time is ${r??n.format(t,"fullTime")}`}`,hoursClockNumberText:e=>`${e} hours`,minutesClockNumberText:e=>`${e} minutes`,secondsClockNumberText:e=>`${e} seconds`,selectViewText:e=>`Select ${e}`,calendarWeekNumberHeaderLabel:"Week number",calendarWeekNumberHeaderText:"#",calendarWeekNumberAriaLabelText:e=>`Week ${e}`,calendarWeekNumberText:e=>`${e}`,openDatePickerDialogue:(e,t,n)=>n||null!==e&&t.isValid(e)?`Choose date, selected date is ${n??t.format(e,"fullDate")}`:"Choose date",openTimePickerDialogue:(e,t,n)=>n||null!==e&&t.isValid(e)?`Choose time, selected time is ${n??t.format(e,"fullTime")}`:"Choose time",fieldClearLabel:"Clear",timeTableLabel:"pick time",dateTableLabel:"pick date",fieldYearPlaceholder:e=>"Y".repeat(e.digitAmount),fieldMonthPlaceholder:e=>"letter"===e.contentType?"MMMM":"MM",fieldDayPlaceholder:()=>"DD",fieldWeekDayPlaceholder:e=>"letter"===e.contentType?"EEEE":"EE",fieldHoursPlaceholder:()=>"hh",fieldMinutesPlaceholder:()=>"mm",fieldSecondsPlaceholder:()=>"ss",fieldMeridiemPlaceholder:()=>"aa",year:"Year",month:"Month",day:"Day",weekDay:"Week day",hours:"Hours",minutes:"Minutes",seconds:"Seconds",meridiem:"Meridiem",empty:"Empty"};(0,iL.A)({},Ez);let EV=()=>{let e=w.useContext(Ej);if(null===e)throw Error("MUI X: Can not find the date and time pickers localization context.\nIt looks like you forgot to wrap your component in LocalizationProvider.\nThis can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package");if(null===e.utils)throw Error("MUI X: Can not find the date and time pickers adapter from its localization context.\nIt looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.");let t=w.useMemo(()=>(0,iL.A)({},Ez,e.localeText),[e.localeText]);return w.useMemo(()=>(0,iL.A)({},e,{localeText:t}),[e,t])},EH=e=>{let t=EV().utils,n=w.useRef(void 0);return void 0===n.current&&(n.current=t.date(void 0,e)),n.current},E$=(e,t,n)=>{let r=t;return r=e.setHours(r,e.getHours(n)),r=e.setMinutes(r,e.getMinutes(n)),r=e.setSeconds(r,e.getSeconds(n)),r=e.setMilliseconds(r,e.getMilliseconds(n))},EW=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:i,isDateDisabled:o,utils:s,timezone:a})=>{let l=E$(s,s.date(void 0,a),e);n&&s.isBefore(i,l)&&(i=l),t&&s.isAfter(r,l)&&(r=l);let u=e,c=e;for(s.isBefore(e,i)&&(u=i,c=null),s.isAfter(e,r)&&(c&&(c=r),u=null);u||c;){if(u&&s.isAfter(u,r)&&(u=null),c&&s.isBefore(c,i)&&(c=null),u){if(!o(u))return u;u=s.addDays(u,1)}if(c){if(!o(c))return c;c=s.addDays(c,-1)}}return null},EU=(e,t,n)=>null!=t&&e.isValid(t)?t:n,Eq=(e,t)=>{let n=[e.startOfYear(t)];for(;n.length<12;){let t=n[n.length-1];n.push(e.addMonths(t,1))}return n},EG=(e,t,n)=>"date"===n?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),EY=(e,t)=>{let n=e.setHours(e.date(),"am"===t?2:14);return e.format(n,"meridiem")},EK=["year","month","day"],EZ=e=>EK.includes(e);var EX=n(33868),EQ=n(87034),EJ=n(22857);let E0=(0,dW.A)((0,x.jsx)("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),E1=(0,dW.A)((0,x.jsx)("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),E2=(0,dW.A)((0,x.jsx)("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight");(0,dW.A)((0,x.jsx)("path",{d:"M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"}),"Calendar"),(0,dW.A)((0,x.jsxs)(w.Fragment,{children:[(0,x.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),(0,x.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");let E5=(0,dW.A)((0,x.jsx)("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"}),"DateRange"),E4=(0,dW.A)((0,x.jsxs)(w.Fragment,{children:[(0,x.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),(0,x.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time"),E3=(0,dW.A)((0,x.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");function E6(e){return(0,P.Ay)("MuiDateTimePickerTabs",e)}(0,I.A)("MuiDateTimePickerTabs",["root"]);let E8=(0,D.A)(EQ.A,{name:"MuiDateTimePickerTabs",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({boxShadow:`0 -1px 0 0 inset ${(e.vars||e).palette.divider}`,"&:last-child":{boxShadow:`0 1px 0 0 inset ${(e.vars||e).palette.divider}`,[`& .${EJ.A.indicator}`]:{bottom:"auto",top:0}}})),E9=function(e){let t=EN({props:e,name:"MuiDateTimePickerTabs"}),{dateIcon:n=(0,x.jsx)(E5,{}),onViewChange:r,timeIcon:i=(0,x.jsx)(E4,{}),view:o,hidden:s="u"<typeof window||window.innerHeight<667,className:a,sx:l}=t,u=EV().localeText,c=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"]},E6,t)})(t);return s?null:(0,x.jsxs)(E8,{ownerState:t,variant:"fullWidth",value:EZ(o)?"date":"time",onChange:(e,t)=>{r("date"===t?"day":"hours")},className:(0,C.A)(a,c.root),sx:l,children:[(0,x.jsx)(EX.A,{value:"date","aria-label":u.dateTableLabel,icon:(0,x.jsx)(w.Fragment,{children:n})}),(0,x.jsx)(EX.A,{value:"time","aria-label":u.timeTableLabel,icon:(0,x.jsx)(w.Fragment,{children:i})})]})};function E7(e){return(0,P.Ay)("MuiPickersToolbarText",e)}let Oe=(0,I.A)("MuiPickersToolbarText",["root","selected"]),Ot=["className","selected","value"],On=(0,D.A)(fO.A,{name:"MuiPickersToolbarText",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`&.${Oe.selected}`]:t.selected}]})(({theme:e})=>({transition:e.transitions.create("color"),color:(e.vars||e).palette.text.secondary,[`&.${Oe.selected}`]:{color:(e.vars||e).palette.text.primary}})),Or=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersToolbarText"}),{className:r,value:i}=n,o=(0,k1.A)(n,Ot),s=(e=>{let{classes:t,selected:n}=e;return(0,A.A)({root:["root",n&&"selected"]},E7,t)})(n);return(0,x.jsx)(On,(0,iL.A)({ref:t,className:(0,C.A)(s.root,r),component:"span"},o,{children:i}))});function Oi(e){return(0,P.Ay)("MuiPickersToolbar",e)}let Oo=(0,I.A)("MuiPickersToolbar",["root","content"]),Os=["children","className","toolbarTitle","hidden","titleId","isLandscape","classes","landscapeDirection"],Oa=(0,D.A)("div",{name:"MuiPickersToolbar",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"space-between",padding:e.spacing(2,3),variants:[{props:{isLandscape:!0},style:{height:"auto",maxWidth:160,padding:16,justifyContent:"flex-start",flexWrap:"wrap"}}]})),Ol=(0,D.A)("div",{name:"MuiPickersToolbar",slot:"Content",overridesResolver:(e,t)=>t.content})({display:"flex",flexWrap:"wrap",width:"100%",flex:1,justifyContent:"space-between",alignItems:"center",flexDirection:"row",variants:[{props:{isLandscape:!0},style:{justifyContent:"flex-start",alignItems:"flex-start",flexDirection:"column"}},{props:{isLandscape:!0,landscapeDirection:"row"},style:{flexDirection:"row"}}]}),Ou=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersToolbar"}),{children:r,className:i,toolbarTitle:o,hidden:s,titleId:a}=n,l=(0,k1.A)(n,Os),u=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],content:["content"]},Oi,t)})(n);return s?null:(0,x.jsxs)(Oa,(0,iL.A)({ref:t,className:(0,C.A)(u.root,i),ownerState:n},l,{children:[(0,x.jsx)(fO.A,{color:"text.secondary",variant:"overline",id:a,children:o}),(0,x.jsx)(Ol,{className:u.content,ownerState:n,children:r})]}))}),Oc=["align","className","selected","typographyClassName","value","variant","width"],Oh=(0,D.A)(z.A,{name:"MuiPickersToolbarButton",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:0,minWidth:16,textTransform:"none"}),Od=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersToolbarButton"}),{align:r,className:i,selected:o,typographyClassName:s,value:a,variant:l,width:u}=n,c=(0,k1.A)(n,Oc),h=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"]},Oi,t)})(n);return(0,x.jsx)(Oh,(0,iL.A)({variant:"text",ref:t,className:(0,C.A)(h.root,i)},u?{sx:{width:u}}:{},c,{children:(0,x.jsx)(Or,{align:r,className:s,variant:l,value:a,selected:o})}))});function Of(e){return(0,P.Ay)("MuiDateTimePickerToolbar",e)}let Op=(0,I.A)("MuiDateTimePickerToolbar",["root","dateContainer","timeContainer","timeDigitsContainer","separator","timeLabelReverse","ampmSelection","ampmLandscape","ampmLabel"]),Om=["hours","minutes","seconds"],Og=e=>Om.includes(e),Ov=(e,t,n)=>n&&(e>=12?"pm":"am")!==t?"am"===t?e-12:e+12:e,Oy=(e,t)=>3600*t.getHours(e)+60*t.getMinutes(e)+t.getSeconds(e),Ob=(e,t)=>(n,r)=>e?t.isAfter(n,r):Oy(n,t)>Oy(r,t);function Ox(e,t,n,r){let i=EV().utils;return{meridiemMode:e?i.getHours(e)>=12?"pm":"am":null,handleMeridiemChange:w.useCallback(o=>{var s;let a;n(null==e?null:(s=!!t,a=Ov(i.getHours(e),o,s),i.setHours(e,a)),r??"partial")},[t,e,n,r,i])}}let Ow=["ampm","ampmInClock","value","onChange","view","isLandscape","onViewChange","toolbarFormat","toolbarPlaceholder","views","disabled","readOnly","toolbarVariant","toolbarTitle","className"],OS=(0,D.A)(Ou,{name:"MuiDateTimePickerToolbar",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({paddingLeft:16,paddingRight:16,justifyContent:"space-around",position:"relative",variants:[{props:{toolbarVariant:"desktop"},style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,[`& .${Oo.content} .${Oe.selected}`]:{color:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightBold}}},{props:{toolbarVariant:"desktop",isLandscape:!0},style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:{toolbarVariant:"desktop",isLandscape:!1},style:{paddingLeft:24,paddingRight:0}}]})),OC=(0,D.A)("div",{name:"MuiDateTimePickerToolbar",slot:"DateContainer",overridesResolver:(e,t)=>t.dateContainer})({display:"flex",flexDirection:"column",alignItems:"flex-start"}),OA=(0,D.A)("div",{name:"MuiDateTimePickerToolbar",slot:"TimeContainer",overridesResolver:(e,t)=>t.timeContainer})({display:"flex",flexDirection:"row",variants:[{props:{isRtl:!0},style:{flexDirection:"row-reverse"}},{props:{toolbarVariant:"desktop",isLandscape:!1},style:{gap:9,marginRight:4,alignSelf:"flex-end"}},{props:({isLandscape:e,toolbarVariant:t})=>e&&"desktop"!==t,style:{flexDirection:"column"}},{props:({isLandscape:e,toolbarVariant:t,isRtl:n})=>e&&"desktop"!==t&&n,style:{flexDirection:"column-reverse"}}]}),Ok=(0,D.A)("div",{name:"MuiDateTimePickerToolbar",slot:"TimeDigitsContainer",overridesResolver:(e,t)=>t.timeDigitsContainer})({display:"flex",variants:[{props:{isRtl:!0},style:{flexDirection:"row-reverse"}},{props:{toolbarVariant:"desktop"},style:{gap:1.5}}]}),OM=(0,D.A)(Or,{name:"MuiDateTimePickerToolbar",slot:"Separator",overridesResolver:(e,t)=>t.separator})({margin:"0 4px 0 2px",cursor:"default",variants:[{props:{toolbarVariant:"desktop"},style:{margin:0}}]}),OT=(0,D.A)("div",{name:"MuiDateTimePickerToolbar",slot:"AmPmSelection",overridesResolver:(e,t)=>[{[`.${Op.ampmLabel}`]:t.ampmLabel},{[`&.${Op.ampmLandscape}`]:t.ampmLandscape},t.ampmSelection]})({display:"flex",flexDirection:"column",marginRight:"auto",marginLeft:12,[`& .${Op.ampmLabel}`]:{fontSize:17},variants:[{props:{isLandscape:!0},style:{margin:"4px 0 auto",flexDirection:"row",justifyContent:"space-around",width:"100%"}}]});function OD(e){let t=EN({props:e,name:"MuiDateTimePickerToolbar"}),{ampm:n,ampmInClock:r,value:i,onChange:o,view:s,isLandscape:a,onViewChange:l,toolbarFormat:u,toolbarPlaceholder:c="––",views:h,disabled:d,readOnly:f,toolbarVariant:p="mobile",toolbarTitle:m,className:g}=t,v=(0,k1.A)(t,Ow),y=(0,fn.I)(),b=(0,iL.A)({},t,{isRtl:y}),S=EV().utils,{meridiemMode:k,handleMeridiemChange:M}=Ox(i,n,o),T=!!(n&&!r),D="desktop"===p,E=EV().localeText,O=(e=>{let{classes:t,isLandscape:n,isRtl:r}=e;return(0,A.A)({root:["root"],dateContainer:["dateContainer"],timeContainer:["timeContainer",r&&"timeLabelReverse"],timeDigitsContainer:["timeDigitsContainer",r&&"timeLabelReverse"],separator:["separator"],ampmSelection:["ampmSelection",n&&"ampmLandscape"],ampmLabel:["ampmLabel"]},Of,t)})(b),R=m??E.dateTimePickerToolbarTitle,I=w.useMemo(()=>i?u?S.formatByString(i,u):S.format(i,"shortDate"):c,[i,u,c,S]);return(0,x.jsxs)(OS,(0,iL.A)({isLandscape:a,className:(0,C.A)(O.root,g),toolbarTitle:R},v,{ownerState:b,children:[(0,x.jsxs)(OC,{className:O.dateContainer,ownerState:b,children:[h.includes("year")&&(0,x.jsx)(Od,{tabIndex:-1,variant:"subtitle1",onClick:()=>l("year"),selected:"year"===s,value:i?S.format(i,"year"):"–"}),h.includes("day")&&(0,x.jsx)(Od,{tabIndex:-1,variant:D?"h5":"h4",onClick:()=>l("day"),selected:"day"===s,value:I})]}),(0,x.jsxs)(OA,{className:O.timeContainer,ownerState:b,children:[(0,x.jsxs)(Ok,{className:O.timeDigitsContainer,ownerState:b,children:[h.includes("hours")&&(0,x.jsxs)(w.Fragment,{children:[(0,x.jsx)(Od,{variant:D?"h5":"h3",width:D&&!a?48:void 0,onClick:()=>l("hours"),selected:"hours"===s,value:i?n?S.format(i,"hours12h"):S.format(i,"hours24h"):"--"}),(0,x.jsx)(OM,{variant:D?"h5":"h3",value:":",className:O.separator,ownerState:b}),(0,x.jsx)(Od,{variant:D?"h5":"h3",width:D&&!a?48:void 0,onClick:()=>l("minutes"),selected:"minutes"===s||!h.includes("minutes")&&"hours"===s,value:i?S.format(i,"minutes"):"--",disabled:!h.includes("minutes")})]}),h.includes("seconds")&&(0,x.jsxs)(w.Fragment,{children:[(0,x.jsx)(OM,{variant:D?"h5":"h3",value:":",className:O.separator,ownerState:b}),(0,x.jsx)(Od,{variant:D?"h5":"h3",width:D&&!a?48:void 0,onClick:()=>l("seconds"),selected:"seconds"===s,value:i?S.format(i,"seconds"):"--"})]})]}),T&&!D&&(0,x.jsxs)(OT,{className:O.ampmSelection,ownerState:b,children:[(0,x.jsx)(Od,{variant:"subtitle2",selected:"am"===k,typographyClassName:O.ampmLabel,value:EY(S,"am"),onClick:f?void 0:()=>M("am"),disabled:d}),(0,x.jsx)(Od,{variant:"subtitle2",selected:"pm"===k,typographyClassName:O.ampmLabel,value:EY(S,"pm"),onClick:f?void 0:()=>M("pm"),disabled:d})]}),n&&D&&(0,x.jsx)(Od,{variant:"h5",onClick:()=>l("meridiem"),selected:"meridiem"===s,value:i&&k?EY(S,k):"--",width:48})]})]}))}var OE=n(54553),OO=n(77893);function OR(e){return(0,P.Ay)("MuiPickersArrowSwitcher",e)}(0,I.A)("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);let OI=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],OP=["ownerState"],ON=["ownerState"],OL=(0,D.A)("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),Oj=(0,D.A)("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),OF=(0,D.A)($.A,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),OB=w.forwardRef(function(e,t){let n=(0,fn.I)(),r=EN({props:e,name:"MuiPickersArrowSwitcher"}),{children:i,className:o,slots:s,slotProps:a,isNextDisabled:l,isNextHidden:u,onGoToNext:c,nextLabel:h,isPreviousDisabled:d,isPreviousHidden:f,onGoToPrevious:p,previousLabel:m,labelId:g}=r,v=(0,k1.A)(r,OI),y=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},OR,t)})(r),b=s?.previousIconButton??OF,w=(0,OO.A)({elementType:b,externalSlotProps:a?.previousIconButton,additionalProps:{size:"medium",title:m,"aria-label":m,disabled:d,edge:"end",onClick:p},ownerState:(0,iL.A)({},r,{hidden:f}),className:(0,C.A)(y.button,y.previousIconButton)}),S=s?.nextIconButton??OF,k=(0,OO.A)({elementType:S,externalSlotProps:a?.nextIconButton,additionalProps:{size:"medium",title:h,"aria-label":h,disabled:l,edge:"start",onClick:c},ownerState:(0,iL.A)({},r,{hidden:u}),className:(0,C.A)(y.button,y.nextIconButton)}),M=s?.leftArrowIcon??E1,T=(0,OO.A)({elementType:M,externalSlotProps:a?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:r,className:y.leftArrowIcon}),D=(0,k1.A)(T,OP),E=s?.rightArrowIcon??E2,O=(0,OO.A)({elementType:E,externalSlotProps:a?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:r,className:y.rightArrowIcon}),R=(0,k1.A)(O,ON);return(0,x.jsxs)(OL,(0,iL.A)({ref:t,className:(0,C.A)(y.root,o),ownerState:r},v,{children:[(0,x.jsx)(b,(0,iL.A)({},w,{children:n?(0,x.jsx)(E,(0,iL.A)({},R)):(0,x.jsx)(M,(0,iL.A)({},D))})),i?(0,x.jsx)(fO.A,{variant:"subtitle1",component:"span",id:g,children:i}):(0,x.jsx)(Oj,{className:y.spacer,ownerState:r}),(0,x.jsx)(S,(0,iL.A)({},k,{children:n?(0,x.jsx)(M,(0,iL.A)({},D)):(0,x.jsx)(E,(0,iL.A)({},R))}))]}))});var O_=n(83183),Oz=n(89369);function OV({onChange:e,onViewChange:t,openTo:n,view:r,views:i,autoFocus:o,focusedView:s,onFocusedViewChange:a}){let l=w.useRef(n),u=w.useRef(i),c=w.useRef(i.includes(n)?n:i[0]),[h,d]=(0,Oz.A)({name:"useViews",state:"view",controlled:r,default:c.current}),f=w.useRef(o?h:null),[p,m]=(0,Oz.A)({name:"useViews",state:"focusedView",controlled:s,default:f.current});w.useEffect(()=>{(l.current&&l.current!==n||u.current&&u.current.some(e=>!i.includes(e)))&&(d(i.includes(n)?n:i[0]),u.current=i,l.current=n)},[n,d,h,i]);let g=i.indexOf(h),v=i[g-1]??null,y=i[g+1]??null,b=(0,O_.A)((e,t)=>{t?m(e):m(t=>e===t?null:t),a?.(e,t)}),x=(0,O_.A)(e=>{b(e,!0),e!==h&&(d(e),t&&t(e))}),S=(0,O_.A)(()=>{y&&x(y)}),C=(0,O_.A)((t,n,r)=>{let o="finish"===n,s=r?i.indexOf(r)<i.length-1:!!y;if(e(t,o&&s?"partial":n,r),r&&r!==h){let e=i[i.indexOf(r)+1];e&&x(e)}else o&&S()});return{view:h,setView:x,focusedView:p,setFocusedView:b,nextView:y,previousView:v,defaultView:i.includes(n)?n:i[0],goToNextView:S,setValueAndGoToNextView:C}}let OH=(0,D.A)("div")({overflow:"hidden",width:320,maxHeight:336,display:"flex",flexDirection:"column",margin:"0 auto"});function O$(e){return(0,P.Ay)("MuiTimeClock",e)}function OW(e){return(0,P.Ay)("MuiClockPointer",e)}(0,I.A)("MuiTimeClock",["root","arrowSwitcher"]),(0,I.A)("MuiClockPointer",["root","thumb"]);let OU=["className","hasSelected","isInner","type","viewValue"],Oq=(0,D.A)("div",{name:"MuiClockPointer",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.primary.main,position:"absolute",left:"calc(50% - 1px)",bottom:"50%",transformOrigin:"center bottom 0px",variants:[{props:{shouldAnimate:!0},style:{transition:e.transitions.create(["transform","height"])}}]})),OG=(0,D.A)("div",{name:"MuiClockPointer",slot:"Thumb",overridesResolver:(e,t)=>t.thumb})(({theme:e})=>({width:4,height:4,backgroundColor:(e.vars||e).palette.primary.contrastText,borderRadius:"50%",position:"absolute",top:-21,left:"calc(50% - 18px)",border:`16px solid ${(e.vars||e).palette.primary.main}`,boxSizing:"content-box",variants:[{props:{hasSelected:!0},style:{backgroundColor:(e.vars||e).palette.primary.main}}]}));function OY(e){let t,n=EN({props:e,name:"MuiClockPointer"}),{className:r,isInner:i,type:o,viewValue:s}=n,a=(0,k1.A)(n,OU),l=w.useRef(o);w.useEffect(()=>{l.current=o},[o]);let u=(0,iL.A)({},n,{shouldAnimate:l.current!==o}),c=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],thumb:["thumb"]},OW,t)})(u);return(0,x.jsx)(Oq,(0,iL.A)({style:(t=360/("hours"===o?12:60)*s,"hours"===o&&s>12&&(t-=360),{height:Math.round((i?.26:.4)*220),transform:`rotateZ(${t}deg)`}),className:(0,C.A)(c.root,r),ownerState:u},a,{children:(0,x.jsx)(OG,{ownerState:u,className:c.thumb})}))}let OK=110,OZ=110,OX=OK,OQ=0,OJ=OX-OK,O0=OQ-OZ,O1=(e,t,n)=>{let r=t-OK,i=n-OZ,o=180/Math.PI*(Math.atan2(OJ,O0)-Math.atan2(r,i));return{value:Math.floor((o=Math.round(o/e)*e%360)/e)||0,distance:Math.sqrt(r**2+i**2)}};function O2(e){return(0,P.Ay)("MuiClock",e)}(0,I.A)("MuiClock",["root","clock","wrapper","squareMask","pin","amButton","pmButton","meridiemText","selected"]);let O5=(0,D.A)("div",{name:"MuiClock",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",margin:e.spacing(2)})),O4=(0,D.A)("div",{name:"MuiClock",slot:"Clock",overridesResolver:(e,t)=>t.clock})({backgroundColor:"rgba(0,0,0,.07)",borderRadius:"50%",height:220,width:220,flexShrink:0,position:"relative",pointerEvents:"none"}),O3=(0,D.A)("div",{name:"MuiClock",slot:"Wrapper",overridesResolver:(e,t)=>t.wrapper})({"&:focus":{outline:"none"}}),O6=(0,D.A)("div",{name:"MuiClock",slot:"SquareMask",overridesResolver:(e,t)=>t.squareMask})({width:"100%",height:"100%",position:"absolute",pointerEvents:"auto",outline:0,touchAction:"none",userSelect:"none",variants:[{props:{disabled:!1},style:{"@media (pointer: fine)":{cursor:"pointer",borderRadius:"50%"},"&:active":{cursor:"move"}}}]}),O8=(0,D.A)("div",{name:"MuiClock",slot:"Pin",overridesResolver:(e,t)=>t.pin})(({theme:e})=>({width:6,height:6,borderRadius:"50%",backgroundColor:(e.vars||e).palette.primary.main,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"})),O9=(e,t)=>({zIndex:1,bottom:8,paddingLeft:4,paddingRight:4,width:36,variants:[{props:{meridiemMode:t},style:{backgroundColor:(e.vars||e).palette.primary.main,color:(e.vars||e).palette.primary.contrastText,"&:hover":{backgroundColor:(e.vars||e).palette.primary.light}}}]}),O7=(0,D.A)($.A,{name:"MuiClock",slot:"AmButton",overridesResolver:(e,t)=>t.amButton})(({theme:e})=>(0,iL.A)({},O9(e,"am"),{position:"absolute",left:8})),Re=(0,D.A)($.A,{name:"MuiClock",slot:"PmButton",overridesResolver:(e,t)=>t.pmButton})(({theme:e})=>(0,iL.A)({},O9(e,"pm"),{position:"absolute",right:8})),Rt=(0,D.A)(fO.A,{name:"MuiClock",slot:"meridiemText",overridesResolver:(e,t)=>t.meridiemText})({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"});function Rn(e){let t=EN({props:e,name:"MuiClock"}),{ampm:n,ampmInClock:r,autoFocus:i,children:o,value:s,handleMeridiemChange:a,isTimeDisabled:l,meridiemMode:u,minutesStep:c=1,onChange:h,selectedId:d,type:f,viewValue:p,viewRange:[m,g],disabled:v=!1,readOnly:y,className:b}=t,S=EV().utils,k=EV().localeText,M=w.useRef(!1),T=(e=>{let{classes:t,meridiemMode:n}=e;return(0,A.A)({root:["root"],clock:["clock"],wrapper:["wrapper"],squareMask:["squareMask"],pin:["pin"],amButton:["amButton","am"===n&&"selected"],pmButton:["pmButton","pm"===n&&"selected"],meridiemText:["meridiemText"]},O2,t)})(t),D=l(p,f),E=!n&&"hours"===f&&(p<1||p>12),O=(e,t)=>{v||y||l(e,f)||h(e,t)},R=(e,t)=>{let{offsetX:r,offsetY:i}=e;if(void 0===r){let t=e.target.getBoundingClientRect();r=e.changedTouches[0].clientX-t.left,i=e.changedTouches[0].clientY-t.top}O("seconds"===f||"minutes"===f?((e,t,n=1)=>{let{value:r}=O1(6*n,e,t);return r*n%60})(r,i,c):((e,t,n)=>{let{value:r,distance:i}=O1(30,e,t),o=r||12;return n?o%=12:i<74&&(o+=12,o%=24),o})(r,i,!!n),t)},I=e=>{M.current=!0,R(e,"shallow")},P=w.useMemo(()=>"hours"===f||p%5==0,[f,p]),N="minutes"===f?c:1,L=w.useRef(null);(0,mJ.A)(()=>{i&&L.current.focus()},[i]);let j=e=>Math.max(m,Math.min(g,e)),F=e=>(e+(g+1))%(g+1);return(0,x.jsxs)(O5,{className:(0,C.A)(T.root,b),children:[(0,x.jsxs)(O4,{className:T.clock,children:[(0,x.jsx)(O6,{onTouchMove:I,onTouchStart:I,onTouchEnd:e=>{M.current&&(R(e,"finish"),M.current=!1),e.preventDefault()},onMouseUp:e=>{M.current&&(M.current=!1),R(e.nativeEvent,"finish")},onMouseMove:e=>{e.buttons>0&&R(e.nativeEvent,"shallow")},ownerState:{disabled:v},className:T.squareMask}),!D&&(0,x.jsxs)(w.Fragment,{children:[(0,x.jsx)(O8,{className:T.pin}),null!=s&&(0,x.jsx)(OY,{type:f,viewValue:p,isInner:E,hasSelected:P})]}),(0,x.jsx)(O3,{"aria-activedescendant":d,"aria-label":k.clockLabelText(f,s,S,null==s?null:S.format(s,"fullTime")),ref:L,role:"listbox",onKeyDown:e=>{if(!M.current)switch(e.key){case"Home":O(m,"partial"),e.preventDefault();break;case"End":O(g,"partial"),e.preventDefault();break;case"ArrowUp":O(F(p+N),"partial"),e.preventDefault();break;case"ArrowDown":O(F(p-N),"partial"),e.preventDefault();break;case"PageUp":O(j(p+5),"partial"),e.preventDefault();break;case"PageDown":O(j(p-5),"partial"),e.preventDefault();break;case"Enter":case" ":O(p,"finish"),e.preventDefault()}},tabIndex:0,className:T.wrapper,children:o})]}),n&&r&&(0,x.jsxs)(w.Fragment,{children:[(0,x.jsx)(O7,{onClick:y?void 0:()=>a("am"),disabled:v||null===u,ownerState:t,className:T.amButton,title:EY(S,"am"),children:(0,x.jsx)(Rt,{variant:"caption",className:T.meridiemText,children:EY(S,"am")})}),(0,x.jsx)(Re,{disabled:v||null===u,onClick:y?void 0:()=>a("pm"),ownerState:t,className:T.pmButton,title:EY(S,"pm"),children:(0,x.jsx)(Rt,{variant:"caption",className:T.meridiemText,children:EY(S,"pm")})})]})]})}function Rr(e){return(0,P.Ay)("MuiClockNumber",e)}let Ri=(0,I.A)("MuiClockNumber",["root","selected","disabled"]),Ro=["className","disabled","index","inner","label","selected"],Rs=(0,D.A)("span",{name:"MuiClockNumber",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`&.${Ri.disabled}`]:t.disabled},{[`&.${Ri.selected}`]:t.selected}]})(({theme:e})=>({height:36,width:36,position:"absolute",left:"calc((100% - 36px) / 2)",display:"inline-flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",color:(e.vars||e).palette.text.primary,fontFamily:e.typography.fontFamily,"&:focused":{backgroundColor:(e.vars||e).palette.background.paper},[`&.${Ri.selected}`]:{color:(e.vars||e).palette.primary.contrastText},[`&.${Ri.disabled}`]:{pointerEvents:"none",color:(e.vars||e).palette.text.disabled},variants:[{props:{inner:!0},style:(0,iL.A)({},e.typography.body2,{color:(e.vars||e).palette.text.secondary})}]}));function Ra(e){let t=EN({props:e,name:"MuiClockNumber"}),{className:n,disabled:r,index:i,inner:o,label:s,selected:a}=t,l=(0,k1.A)(t,Ro),u=(e=>{let{classes:t,selected:n,disabled:r}=e;return(0,A.A)({root:["root",n&&"selected",r&&"disabled"]},Rr,t)})(t),c=i%12/12*Math.PI*2-Math.PI/2,h=91*(o?.65:1),d=Math.round(Math.cos(c)*h),f=Math.round(Math.sin(c)*h);return(0,x.jsx)(Rs,(0,iL.A)({className:(0,C.A)(u.root,n),"aria-disabled":!!r||void 0,"aria-selected":!!a||void 0,role:"option",style:{transform:`translate(${d}px, ${f+92}px`},ownerState:t},l,{children:s}))}let Rl=({utils:e,value:t,isDisabled:n,getClockNumberText:r,selectedId:i})=>{let o=e.formatNumber;return[[5,o("05")],[10,o("10")],[15,o("15")],[20,o("20")],[25,o("25")],[30,o("30")],[35,o("35")],[40,o("40")],[45,o("45")],[50,o("50")],[55,o("55")],[0,o("00")]].map(([e,o],s)=>{let a=e===t;return(0,x.jsx)(Ra,{label:o,id:a?i:void 0,index:s+1,inner:!1,disabled:n(e),selected:a,"aria-label":r(o)},e)})},Ru=({timezone:e,value:t,defaultValue:n,referenceDate:r,onChange:i,valueManager:o})=>{let s,a=EV().utils,l=w.useRef(n),u=t??l.current??o.emptyValue,c=w.useMemo(()=>o.getTimezone(a,u),[a,o,u]),h=(0,O_.A)(e=>null==c?e:o.setTimezone(a,c,e));return s=e||c||(r?a.getTimezone(r):"default"),{value:w.useMemo(()=>o.setTimezone(a,s,u),[o,a,s,u]),handleValueChange:(0,O_.A)((e,...t)=>{let n=h(e);i?.(n,...t)}),timezone:s}},Rc=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:i,onChange:o,valueManager:s})=>{let[a,l]=(0,Oz.A)({name:e,state:"value",controlled:n,default:r??s.emptyValue});return Ru({timezone:t,value:a,defaultValue:void 0,referenceDate:i,onChange:(0,O_.A)((e,...t)=>{l(e),o?.(e,...t)}),valueManager:s})},Rh={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},Rd=(e,t,n)=>{if(t===Rh.year)return e.startOfYear(n);if(t===Rh.month)return e.startOfMonth(n);if(t===Rh.day)return e.startOfDay(n);let r=n;return t<Rh.minutes&&(r=e.setMinutes(r,0)),t<Rh.seconds&&(r=e.setSeconds(r,0)),t<Rh.milliseconds&&(r=e.setMilliseconds(r,0)),r},Rf=(e,t)=>{let n=e.formatTokenMap[t];if(null==n)throw Error(`MUI X: The token "${t}" is not supported by the Date and Time Pickers.
43
+ Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.`);return"string"==typeof n?{type:n,contentType:"meridiem"===n?"letter":"digit",maxLength:void 0}:{type:n.sectionType,contentType:n.contentType,maxLength:n.maxLength}},Rp=(e,t)=>{let n=[],r=e.date(void 0,"default"),i=e.startOfWeek(r),o=e.endOfWeek(r),s=i;for(;e.isBefore(s,o);)n.push(s),s=e.addDays(s,1);return n.map(n=>e.formatByString(n,t))},Rm=(e,t,n,r)=>{switch(n){case"month":return Eq(e,e.date(void 0,t)).map(t=>e.formatByString(t,r));case"weekDay":return Rp(e,r);case"meridiem":{let n=e.date(void 0,t);return[e.startOfDay(n),e.endOfDay(n)].map(t=>e.formatByString(t,r))}default:return[]}},Rg=["0","1","2","3","4","5","6","7","8","9"],Rv=(e,t)=>{if("0"===t[0])return e;let n=[],r="";for(let i=0;i<e.length;i+=1){r+=e[i];let o=t.indexOf(r);o>-1&&(n.push(o.toString()),r="")}return n.join("")},Ry=(e,t)=>"0"===t[0]?e:e.split("").map(e=>t[Number(e)]).join(""),Rb=(e,t)=>{let n=Rv(e,t);return" "!==n&&!Number.isNaN(Number(n))},Rx=(e,t)=>{let n=e;for(n=Number(n).toString();n.length<t;)n=`0${n}`;return n},Rw=(e,t,n,r,i)=>{if("day"===i.type&&"digit-with-letter"===i.contentType){let r=e.setDate(n.longestMonth,t);return e.formatByString(r,i.format)}let o=t.toString();return i.hasLeadingZerosInInput&&(o=Rx(o,i.maxLength)),Ry(o,r)},RS=(e,t,n)=>{let r=e.value||e.placeholder,i="non-input"===t?e.hasLeadingZerosInFormat:e.hasLeadingZerosInInput;return"non-input"===t&&e.hasLeadingZerosInInput&&!e.hasLeadingZerosInFormat&&(r=Number(Rv(r,n)).toString()),["input-rtl","input-ltr"].includes(t)&&"digit"===e.contentType&&!i&&1===r.length&&(r=`${r}\u200e`),"input-rtl"===t&&(r=`\u2068${r}\u2069`),r},RC=(e,t,n,r)=>e.formatByString(e.parse(t,n),r),RA=(e,t,n,r)=>{if("digit"!==t)return!1;let i=e.date(void 0,"default");switch(n){case"year":if("dayjs"===e.lib&&"YY"===r)return!0;return e.formatByString(e.setYear(i,1),r).startsWith("0");case"month":return e.formatByString(e.startOfYear(i),r).length>1;case"day":return e.formatByString(e.startOfMonth(i),r).length>1;case"weekDay":return e.formatByString(e.startOfWeek(i),r).length>1;case"hours":return e.formatByString(e.setHours(i,1),r).length>1;case"minutes":return e.formatByString(e.setMinutes(i,1),r).length>1;case"seconds":return e.formatByString(e.setSeconds(i,1),r).length>1;default:throw Error("Invalid section type")}},Rk=(e,t)=>{},RM={year:1,month:2,day:3,weekDay:4,hours:5,minutes:6,seconds:7,meridiem:8,empty:9},RT=(e,t,n,r,i)=>[...n].sort((e,t)=>RM[e.type]-RM[t.type]).reduce((n,r)=>!i||r.modified?((e,t,n,r)=>{switch(t.type){case"year":return e.setYear(r,e.getYear(n));case"month":return e.setMonth(r,e.getMonth(n));case"weekDay":{let r=Rp(e,t.format),i=e.formatByString(n,t.format),o=r.indexOf(i),s=r.indexOf(t.value);return e.addDays(n,s-o)}case"day":return e.setDate(r,e.getDate(n));case"meridiem":{let t=12>e.getHours(n),i=e.getHours(r);if(t&&i>=12)return e.addHours(r,-12);if(!t&&i<12)return e.addHours(r,12);return r}case"hours":return e.setHours(r,e.getHours(n));case"minutes":return e.setMinutes(r,e.getMinutes(n));case"seconds":return e.setSeconds(r,e.getSeconds(n));default:return r}})(e,r,t,n):n,r),RD=(e,t)=>{if(null==e)return null;if("all"===e)return"all";if("string"==typeof e){let n=t.findIndex(t=>t.type===e);return -1===n?null:n}return e},RE=["value","referenceDate"],RO={emptyValue:null,getTodayValue:EG,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=(0,k1.A)(e,RE);return null!=t&&r.utils.isValid(t)?t:null!=n?n:(({props:e,utils:t,granularity:n,timezone:r,getTodayDate:i})=>{let o=i?i():Rd(t,n,EG(t,r));null!=e.minDate&&t.isAfterDay(e.minDate,o)&&(o=Rd(t,n,e.minDate)),null!=e.maxDate&&t.isBeforeDay(e.maxDate,o)&&(o=Rd(t,n,e.maxDate));let s=Ob(e.disableIgnoringDatePartForTimeValidation??!1,t);return null!=e.minTime&&s(e.minTime,o)&&(o=Rd(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:E$(t,o,e.minTime))),null!=e.maxTime&&s(o,e.maxTime)&&(o=Rd(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:E$(t,o,e.maxTime))),o})(r)},cleanValue:(e,t)=>null!=t&&e.isValid(t)?t:null,areValuesEqual:(e,t,n)=>!(e.isValid(t)||null==t||e.isValid(n))&&null!=n||e.isEqual(t,n),isSameError:(e,t)=>e===t,hasError:e=>null!=e,defaultErrorState:null,getTimezone:(e,t)=>null!=t&&e.isValid(t)?e.getTimezone(t):null,setTimezone:(e,t,n)=>null==n?null:e.setTimezone(n,t)},RR={updateReferenceValue:(e,t,n)=>null!=t&&e.isValid(t)?t:n,getSectionsFromValue:(e,t,n,r)=>!e.isValid(t)&&n?n:r(t),getV7HiddenInputValueFromSections:e=>e.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),getV6InputValueFromSections:(e,t,n)=>{let r=e.map(e=>{let r=RS(e,n?"input-rtl":"input-ltr",t);return`${e.startSeparator}${r}${e.endSeparator}`}).join("");return n?`\u2066${r}\u2069`:r},getActiveDateManager:(e,t)=>({date:t.value,referenceDate:t.referenceValue,getSections:e=>e,getNewValuesFromNewActiveDate:n=>({value:n,referenceValue:null!=n&&e.isValid(n)?n:t.referenceValue})}),parseValueStr:(e,t,n)=>n(e.trim(),t)},RI=["ampm","ampmInClock","autoFocus","slots","slotProps","value","defaultValue","referenceDate","disableIgnoringDatePartForTimeValidation","maxTime","minTime","disableFuture","disablePast","minutesStep","shouldDisableTime","showViewSwitcher","onChange","view","views","openTo","onViewChange","focusedView","onFocusedViewChange","className","disabled","readOnly","timezone"],RP=(0,D.A)(OH,{name:"MuiTimeClock",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",position:"relative"}),RN=(0,D.A)(OB,{name:"MuiTimeClock",slot:"ArrowSwitcher",overridesResolver:(e,t)=>t.arrowSwitcher})({position:"absolute",right:12,top:15}),RL=["hours","minutes"],Rj=w.forwardRef(function(e,t){let n=EV().utils,r=EN({props:e,name:"MuiTimeClock"}),{ampm:i=n.is12HourCycleInCurrentLocale(),ampmInClock:o=!1,autoFocus:s,slots:a,slotProps:l,value:u,defaultValue:c,referenceDate:h,disableIgnoringDatePartForTimeValidation:d=!1,maxTime:f,minTime:p,disableFuture:m,disablePast:g,minutesStep:v=1,shouldDisableTime:y,showViewSwitcher:b,onChange:S,view:k,views:M=RL,openTo:T,onViewChange:D,focusedView:E,onFocusedViewChange:O,className:R,disabled:I,readOnly:P,timezone:N}=r,L=(0,k1.A)(r,RI),{value:j,handleValueChange:F,timezone:B}=Rc({name:"TimeClock",timezone:N,value:u,defaultValue:c,referenceDate:h,onChange:S,valueManager:RO}),_=(({value:e,referenceDate:t,utils:n,props:r,timezone:i})=>{let o=w.useMemo(()=>RO.getInitialReferenceValue({value:e,utils:n,props:r,referenceDate:t,granularity:Rh.day,timezone:i,getTodayDate:()=>EG(n,i,"date")}),[]);return e??o})({value:j,referenceDate:h,utils:n,props:r,timezone:B}),z=EV().localeText,V=EH(B),{view:H,setView:$,previousView:W,nextView:U,setValueAndGoToNextView:q}=OV({view:k,views:M,openTo:T,onViewChange:D,onChange:F,focusedView:E,onFocusedViewChange:O}),{meridiemMode:G,handleMeridiemChange:Y}=Ox(_,i,q),K=w.useCallback((e,t)=>{let r=Ob(d,n),o="hours"===t||"minutes"===t&&M.includes("seconds"),s=({start:e,end:t})=>!(p&&r(p,t)||f&&r(e,f)||m&&r(e,V)||g&&r(V,o?t:e)),a=(e,r=1)=>{if(e%r!=0)return!1;if(y)switch(t){case"hours":return!y(n.setHours(_,e),"hours");case"minutes":return!y(n.setMinutes(_,e),"minutes");case"seconds":return!y(n.setSeconds(_,e),"seconds");default:return!1}return!0};switch(t){case"hours":{let t=Ov(e,G,i),r=n.setHours(_,t);if(n.getHours(r)!==t)return!0;return!s({start:n.setSeconds(n.setMinutes(r,0),0),end:n.setSeconds(n.setMinutes(r,59),59)})||!a(t)}case"minutes":{let t=n.setMinutes(_,e);return!s({start:n.setSeconds(t,0),end:n.setSeconds(t,59)})||!a(e,v)}case"seconds":{let t=n.setSeconds(_,e);return!s({start:t,end:t})||!a(e)}default:throw Error("not supported")}},[i,_,d,f,G,p,v,y,n,m,g,V,M]),Z=(0,OE.A)(),X=w.useMemo(()=>{switch(H){case"hours":{let e,t=(e,t)=>{let r=Ov(e,G,i);q(n.setHours(_,r),t,"hours")},r=n.getHours(_);return e=i?r>12?[12,23]:[0,11]:[0,23],{onChange:t,viewValue:r,children:(({ampm:e,value:t,getClockNumberText:n,isDisabled:r,selectedId:i,utils:o})=>{let s=t?o.getHours(t):null,a=[],l=+!!e,u=e?12:23,c=t=>null!==s&&(e?12===t?12===s||0===s:s===t||s-12===t:s===t);for(let t=l;t<=u;t+=1){let s=t.toString();0===t&&(s="00");let l=!e&&(0===t||t>12);s=o.formatNumber(s);let u=c(t);a.push((0,x.jsx)(Ra,{id:u?i:void 0,index:t,inner:l,selected:u,disabled:r(t),label:s,"aria-label":n(s)},t))}return a})({value:j,utils:n,ampm:i,onChange:t,getClockNumberText:z.hoursClockNumberText,isDisabled:e=>I||K(e,"hours"),selectedId:Z}),viewRange:e}}case"minutes":{let e=n.getMinutes(_),t=(e,t)=>{q(n.setMinutes(_,e),t,"minutes")};return{viewValue:e,onChange:t,children:Rl({utils:n,value:e,onChange:t,getClockNumberText:z.minutesClockNumberText,isDisabled:e=>I||K(e,"minutes"),selectedId:Z}),viewRange:[0,59]}}case"seconds":{let e=n.getSeconds(_),t=(e,t)=>{q(n.setSeconds(_,e),t,"seconds")};return{viewValue:e,onChange:t,children:Rl({utils:n,value:e,onChange:t,getClockNumberText:z.secondsClockNumberText,isDisabled:e=>I||K(e,"seconds"),selectedId:Z}),viewRange:[0,59]}}default:throw Error("You must provide the type for ClockView")}},[H,n,j,i,z.hoursClockNumberText,z.minutesClockNumberText,z.secondsClockNumberText,G,q,_,K,Z,I]),Q=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],arrowSwitcher:["arrowSwitcher"]},O$,t)})(r);return(0,x.jsxs)(RP,(0,iL.A)({ref:t,className:(0,C.A)(Q.root,R),ownerState:r},L,{children:[(0,x.jsx)(Rn,(0,iL.A)({autoFocus:s??!!E,ampmInClock:o&&M.includes("hours"),value:j,type:H,ampm:i,minutesStep:v,isTimeDisabled:K,meridiemMode:G,handleMeridiemChange:Y,selectedId:Z,disabled:I,readOnly:P},X)),b&&(0,x.jsx)(RN,{className:Q.arrowSwitcher,slots:a,slotProps:l,onGoToPrevious:()=>$(W),isPreviousDisabled:!W,previousLabel:z.openPreviousView,onGoToNext:()=>$(U),isNextDisabled:!U,nextLabel:z.openNextView,ownerState:r})]}))}),RF=({view:e,onViewChange:t,focusedView:n,onFocusedViewChange:r,views:i,value:o,defaultValue:s,referenceDate:a,onChange:l,className:u,classes:c,disableFuture:h,disablePast:d,minTime:f,maxTime:p,shouldDisableTime:m,minutesStep:g,ampm:v,ampmInClock:y,slots:b,slotProps:w,readOnly:S,disabled:C,sx:A,autoFocus:k,showViewSwitcher:M,disableIgnoringDatePartForTimeValidation:T,timezone:D})=>(0,x.jsx)(Rj,{view:e,onViewChange:t,focusedView:n&&Og(n)?n:null,onFocusedViewChange:r,views:i.filter(Og),value:o,defaultValue:s,referenceDate:a,onChange:l,className:u,classes:c,disableFuture:h,disablePast:d,minTime:f,maxTime:p,shouldDisableTime:m,minutesStep:g,ampm:v,ampmInClock:y,slots:b,slotProps:w,readOnly:S,disabled:C,sx:A,autoFocus:k,showViewSwitcher:M,disableIgnoringDatePartForTimeValidation:T,timezone:D}),RB=({props:e,value:t,timezone:n,adapter:r})=>{if(null===t)return null;let{shouldDisableDate:i,shouldDisableMonth:o,shouldDisableYear:s,disablePast:a,disableFuture:l}=e,u=r.utils.date(void 0,n),c=EU(r.utils,e.minDate,r.defaultDates.minDate),h=EU(r.utils,e.maxDate,r.defaultDates.maxDate);switch(!0){case!r.utils.isValid(t):return"invalidDate";case!!(i&&i(t)):return"shouldDisableDate";case!!(o&&o(t)):return"shouldDisableMonth";case!!(s&&s(t)):return"shouldDisableYear";case!!(l&&r.utils.isAfterDay(t,u)):return"disableFuture";case!!(a&&r.utils.isBeforeDay(t,u)):return"disablePast";case!!(c&&r.utils.isBeforeDay(t,c)):return"minDate";case!!(h&&r.utils.isAfterDay(t,h)):return"maxDate";default:return null}};RB.valueManager=RO;let R_=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:i,disableFuture:o,disablePast:s,timezone:a})=>{let l=EV();return w.useCallback(u=>null!==RB({adapter:l,value:u,timezone:a,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:i,disableFuture:o,disablePast:s}}),[l,e,t,n,r,i,o,s,a])};var Rz=n(44394),RV=n(96313);let RH=e=>(0,P.Ay)("MuiPickersFadeTransitionGroup",e);(0,I.A)("MuiPickersFadeTransitionGroup",["root"]);let R$=(0,D.A)(Rz.A,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function RW(e){let t=EN({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:i,transKey:o}=t,s=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"]},RH,t)})(t),a=(0,lO.A)();return i?n:(0,x.jsx)(R$,{className:(0,C.A)(s.root,r),children:(0,x.jsx)(RV.A,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:a.transitions.duration.enteringScreen,enter:a.transitions.duration.enteringScreen,exit:0},children:n},o)})}var RU=n(95591);function Rq(e){return(0,P.Ay)("MuiPickersDay",e)}let RG=(0,I.A)("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),RY=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],RK=({theme:e})=>(0,iL.A)({},e.typography.caption,{width:36,height:36,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:e.transitions.create("background-color",{duration:e.transitions.duration.short}),color:(e.vars||e).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,k.X4)(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:(0,k.X4)(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${RG.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${RG.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${RG.disabled}:not(.${RG.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${RG.disabled}&.${RG.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:"0 2px"}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${RG.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),RZ=(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableMargin&&t.dayWithMargin,!n.disableHighlightToday&&n.today&&t.today,!n.outsideCurrentMonth&&n.showDaysOutsideCurrentMonth&&t.dayOutsideMonth,n.outsideCurrentMonth&&!n.showDaysOutsideCurrentMonth&&t.hiddenDaySpacingFiller]},RX=(0,D.A)(lL.A,{name:"MuiPickersDay",slot:"Root",overridesResolver:RZ})(RK),RQ=(0,D.A)("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:RZ})(({theme:e})=>(0,iL.A)({},RK({theme:e}),{opacity:0,pointerEvents:"none"})),RJ=()=>{},R0=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:i,day:o,disabled:s=!1,disableHighlightToday:a=!1,disableMargin:l=!1,isAnimating:u,onClick:c,onDaySelect:h,onFocus:d=RJ,onBlur:f=RJ,onKeyDown:p=RJ,onMouseDown:m=RJ,onMouseEnter:g=RJ,outsideCurrentMonth:v,selected:y=!1,showDaysOutsideCurrentMonth:b=!1,children:S,today:k=!1}=n,M=(0,k1.A)(n,RY),T=(0,iL.A)({},n,{autoFocus:r,disabled:s,disableHighlightToday:a,disableMargin:l,selected:y,showDaysOutsideCurrentMonth:b,today:k}),D=(e=>{let{selected:t,disableMargin:n,disableHighlightToday:r,today:i,disabled:o,outsideCurrentMonth:s,showDaysOutsideCurrentMonth:a,classes:l}=e,u=s&&!a;return(0,A.A)({root:["root",t&&!u&&"selected",o&&"disabled",!n&&"dayWithMargin",!r&&i&&"today",s&&a&&"dayOutsideMonth",u&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},Rq,l)})(T),E=EV().utils,O=w.useRef(null),R=(0,RU.A)(O,t);return((0,mJ.A)(()=>{!r||s||u||v||O.current.focus()},[r,s,u,v]),v&&!b)?(0,x.jsx)(RQ,{className:(0,C.A)(D.root,D.hiddenDaySpacingFiller,i),ownerState:T,role:M.role}):(0,x.jsx)(RX,(0,iL.A)({className:(0,C.A)(D.root,i),ref:R,centerRipple:!0,disabled:s,tabIndex:y?0:-1,onKeyDown:e=>p(e,o),onFocus:e=>d(e,o),onBlur:e=>f(e,o),onMouseEnter:e=>g(e,o),onClick:e=>{s||h(o),v&&e.currentTarget.focus(),c&&c(e)},onMouseDown:e=>{m(e),v&&e.preventDefault()}},M,{ownerState:T,children:S||E.format(o,"dayOfMonth")}))}),R1=w.memo(R0);var R2=n(7490);function R5(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var R4=n(64863),R3=function(e,t){return e&&t&&t.split(" ").forEach(function(t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=R5(e.className,t):e.setAttribute("class",R5(e.className&&e.className.baseVal||"",t))})},R6=function(e){function t(){for(var t,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1];t.removeClasses(i,"exit"),t.addClass(i,o?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1];t.addClass(i,o?"appear":"enter","active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1]?"appear":"enter";t.removeClasses(i,o),t.addClass(i,o,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r="string"==typeof n,i=r&&n?n+"-":"",o=r?""+i+e:n[e],s=r?o+"-active":n[e+"Active"],a=r?o+"-done":n[e+"Done"];return{baseClassName:o,activeClassName:s,doneClassName:a}},t}(0,R2.A)(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var r,i=this.getClassNames(t)[n+"ClassName"],o=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&o&&(i+=" "+o),"active"===n&&e&&(0,R4.F)(e),i&&(this.appliedClasses[t][n]=i,r=i,e&&r&&r.split(" ").forEach(function(t){e.classList?e.classList.add(t):(e.classList?t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" "))||("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,o=n.done;this.appliedClasses[t]={},r&&R3(e,r),i&&R3(e,i),o&&R3(e,o)},n.render=function(){var e=this.props,t=(e.classNames,(0,k1.A)(e,["classNames"]));return S().createElement(m8.Ay,(0,iL.A)({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(S().Component);R6.defaultProps={classNames:""},R6.propTypes={};let R8=e=>(0,P.Ay)("MuiPickersSlideTransition",e),R9=(0,I.A)("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),R7=["children","className","reduceAnimations","slideDirection","transKey","classes"],Ie=(0,D.A)(Rz.A,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${R9["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${R9["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${R9.slideEnterActive}`]:t.slideEnterActive},{[`.${R9.slideExit}`]:t.slideExit},{[`.${R9["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${R9["slideExitActiveLeft-right"]}`]:t["slideExitActiveLeft-right"]}]})(({theme:e})=>{let t=e.transitions.create("transform",{duration:e.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${R9["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${R9["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${R9.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${R9.slideExit}`]:{transform:"translate(0%)"},[`& .${R9["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${R9["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}}),It=e=>(0,P.Ay)("MuiDayCalendar",e);(0,I.A)("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);let In=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],Ir=["ownerState"],Ii=(0,D.A)("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Io=(0,D.A)("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),Is=(0,D.A)(fO.A,{name:"MuiDayCalendar",slot:"WeekDayLabel",overridesResolver:(e,t)=>t.weekDayLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.secondary})),Ia=(0,D.A)(fO.A,{name:"MuiDayCalendar",slot:"WeekNumberLabel",overridesResolver:(e,t)=>t.weekNumberLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),Il=(0,D.A)(fO.A,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>(0,iL.A)({},e.typography.caption,{width:36,height:36,padding:0,margin:"0 2px",color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),Iu=(0,D.A)("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:240}),Ic=(0,D.A)(function(e){let t=EN({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:i,transKey:o}=t,s=(0,k1.A)(t,R7),a=(e=>{let{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return(0,A.A)(r,R8,t)})(t),l=(0,lO.A)();if(i)return(0,x.jsx)("div",{className:(0,C.A)(a.root,r),children:n});let u={exit:a.exit,enterActive:a.enterActive,enter:a.enter,exitActive:a.exitActive};return(0,x.jsx)(Ie,{className:(0,C.A)(a.root,r),childFactory:e=>w.cloneElement(e,{classNames:u}),role:"presentation",children:(0,x.jsx)(R6,(0,iL.A)({mountOnEnter:!0,unmountOnExit:!0,timeout:l.transitions.duration.complex,classNames:u},s,{children:n}),o)})},{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:240}),Ih=(0,D.A)("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),Id=(0,D.A)("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:"2px 0",display:"flex",justifyContent:"center"});function If(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:i,isDateDisabled:o,currentMonthNumber:s,isViewFocused:a}=e,l=(0,k1.A)(e,In),{disabled:u,disableHighlightToday:c,isMonthSwitchingAnimating:h,showDaysOutsideCurrentMonth:d,slots:f,slotProps:p,timezone:m}=t,g=EV().utils,v=EH(m),y=null!==r&&g.isSameDay(n,r),b=i.some(e=>g.isSameDay(e,n)),S=g.isSameDay(n,v),C=f?.day??R1,A=(0,OO.A)({elementType:C,externalSlotProps:p?.day,additionalProps:(0,iL.A)({disableHighlightToday:c,showDaysOutsideCurrentMonth:d,role:"gridcell",isAnimating:h,"data-timestamp":g.toJsDate(n).valueOf()},l),ownerState:(0,iL.A)({},t,{day:n,selected:b})}),k=(0,k1.A)(A,Ir),M=w.useMemo(()=>u||o(n),[u,o,n]),T=w.useMemo(()=>g.getMonth(n)!==s,[g,n,s]),D=w.useMemo(()=>{let e=g.startOfMonth(g.setMonth(n,s));return d?g.isSameDay(n,g.startOfWeek(e)):g.isSameDay(n,e)},[s,n,d,g]),E=w.useMemo(()=>{let e=g.endOfMonth(g.setMonth(n,s));return d?g.isSameDay(n,g.endOfWeek(e)):g.isSameDay(n,e)},[s,n,d,g]);return(0,x.jsx)(C,(0,iL.A)({},k,{day:n,disabled:M,autoFocus:a&&y,today:S,outsideCurrentMonth:T,isFirstVisibleCell:D,isLastVisibleCell:E,selected:b,tabIndex:y?0:-1,"aria-selected":b,"aria-current":S?"date":void 0}))}function Ip(e){let t,n=EN({props:e,name:"MuiDayCalendar"}),r=EV().utils,{onFocusedDayChange:i,className:o,currentMonth:s,selectedDays:a,focusedDay:l,loading:u,onSelectedDaysChange:c,onMonthSwitchingAnimationEnd:h,readOnly:d,reduceAnimations:f,renderLoading:p=()=>(0,x.jsx)("span",{children:"..."}),slideDirection:m,TransitionProps:g,disablePast:v,disableFuture:y,minDate:b,maxDate:S,shouldDisableDate:k,shouldDisableMonth:M,shouldDisableYear:T,dayOfWeekFormatter:D=e=>r.format(e,"weekdayShort").charAt(0).toUpperCase(),hasFocus:E,onFocusedViewChange:O,gridLabelId:R,displayWeekNumber:I,fixedWeekNumber:P,autoFocus:N,timezone:L}=n,j=EH(L),F=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},It,t)})(n),B=(0,fn.I)(),_=R_({shouldDisableDate:k,shouldDisableMonth:M,shouldDisableYear:T,minDate:b,maxDate:S,disablePast:v,disableFuture:y,timezone:L}),z=EV().localeText,[V,H]=(0,Oz.A)({name:"DayCalendar",state:"hasFocus",controlled:E,default:N??!1}),[$,W]=w.useState(()=>l||j),U=(0,O_.A)(e=>{d||c(e)}),q=e=>{_(e)||(i(e),W(e),O?.(!0),H(!0))},G=(0,O_.A)((e,t)=>{switch(e.key){case"ArrowUp":q(r.addDays(t,-7)),e.preventDefault();break;case"ArrowDown":q(r.addDays(t,7)),e.preventDefault();break;case"ArrowLeft":{let n=r.addDays(t,B?1:-1),i=r.addMonths(t,B?1:-1);q(EW({utils:r,date:n,minDate:B?n:r.startOfMonth(i),maxDate:B?r.endOfMonth(i):n,isDateDisabled:_,timezone:L})||n),e.preventDefault();break}case"ArrowRight":{let n=r.addDays(t,B?-1:1),i=r.addMonths(t,B?-1:1);q(EW({utils:r,date:n,minDate:B?r.startOfMonth(i):n,maxDate:B?n:r.endOfMonth(i),isDateDisabled:_,timezone:L})||n),e.preventDefault();break}case"Home":q(r.startOfWeek(t)),e.preventDefault();break;case"End":q(r.endOfWeek(t)),e.preventDefault();break;case"PageUp":q(r.addMonths(t,1)),e.preventDefault();break;case"PageDown":q(r.addMonths(t,-1)),e.preventDefault()}}),Y=(0,O_.A)((e,t)=>q(t)),K=(0,O_.A)((e,t)=>{V&&r.isSameDay($,t)&&O?.(!1)}),Z=r.getMonth(s),X=r.getYear(s),Q=w.useMemo(()=>a.filter(e=>!!e).map(e=>r.startOfDay(e)),[r,a]),J=`${X}-${Z}`,ee=w.useMemo(()=>w.createRef(),[J]),et=w.useMemo(()=>{let e=r.startOfMonth(s),t=r.endOfMonth(s);return _($)||r.isAfterDay($,t)||r.isBeforeDay($,e)?EW({utils:r,date:$,minDate:e,maxDate:t,disablePast:v,disableFuture:y,isDateDisabled:_,timezone:L}):$},[s,y,v,$,_,r,L]),en=w.useMemo(()=>{let e=r.getWeekArray(s),t=r.addMonths(s,1);for(;P&&e.length<P;){let n=r.getWeekArray(t),i=r.isSameDay(e[e.length-1][0],n[0][0]);n.slice(+!!i).forEach(t=>{e.length<P&&e.push(t)}),t=r.addMonths(t,1)}return e},[s,P,r]);return(0,x.jsxs)(Ii,{role:"grid","aria-labelledby":R,className:F.root,children:[(0,x.jsxs)(Io,{role:"row",className:F.header,children:[I&&(0,x.jsx)(Ia,{variant:"caption",role:"columnheader","aria-label":z.calendarWeekNumberHeaderLabel,className:F.weekNumberLabel,children:z.calendarWeekNumberHeaderText}),(t=r.startOfWeek(j),[0,1,2,3,4,5,6].map(e=>r.addDays(t,e))).map((e,t)=>(0,x.jsx)(Is,{variant:"caption",role:"columnheader","aria-label":r.format(e,"weekday"),className:F.weekDayLabel,children:D(e)},t.toString()))]}),u?(0,x.jsx)(Iu,{className:F.loadingContainer,children:p()}):(0,x.jsx)(Ic,(0,iL.A)({transKey:J,onExited:h,reduceAnimations:f,slideDirection:m,className:(0,C.A)(o,F.slideTransition)},g,{nodeRef:ee,children:(0,x.jsx)(Ih,{ref:ee,role:"rowgroup",className:F.monthContainer,children:en.map((e,t)=>(0,x.jsxs)(Id,{role:"row",className:F.weekContainer,"aria-rowindex":t+1,children:[I&&(0,x.jsx)(Il,{className:F.weekNumber,role:"rowheader","aria-label":z.calendarWeekNumberAriaLabelText(r.getWeekNumber(e[0])),children:z.calendarWeekNumberText(r.getWeekNumber(e[0]))}),e.map((e,t)=>(0,x.jsx)(If,{parentProps:n,day:e,selectedDays:Q,focusableDay:et,onKeyDown:G,onFocus:Y,onBlur:K,onDaySelect:U,isDateDisabled:_,currentMonthNumber:Z,isViewFocused:V,"aria-colindex":t+1},e.toString()))]},`week-${e[0]}`))})}))]})}function Im(e){return(0,P.Ay)("MuiPickersMonth",e)}let Ig=(0,I.A)("MuiPickersMonth",["root","monthButton","disabled","selected"]),Iv=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],Iy=(0,D.A)("div",{name:"MuiPickersMonth",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{monthsPerRow:4},style:{flexBasis:"25%"}}]}),Ib=(0,D.A)("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Ig.disabled}`]:t.disabled},{[`&.${Ig.selected}`]:t.selected}]})(({theme:e})=>(0,iL.A)({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"8px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,k.X4)(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,k.X4)(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Ig.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Ig.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),Ix=w.memo(function(e){let t=EN({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:r,children:i,disabled:o,selected:s,value:a,tabIndex:l,onClick:u,onKeyDown:c,onFocus:h,onBlur:d,"aria-current":f,"aria-label":p,slots:m,slotProps:g}=t,v=(0,k1.A)(t,Iv),y=w.useRef(null),b=(e=>{let{disabled:t,selected:n,classes:r}=e;return(0,A.A)({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},Im,r)})(t);(0,mJ.A)(()=>{n&&y.current?.focus()},[n]);let S=m?.monthButton??Ib,k=(0,OO.A)({elementType:S,externalSlotProps:g?.monthButton,additionalProps:{children:i,disabled:o,tabIndex:l,ref:y,type:"button",role:"radio","aria-current":f,"aria-checked":s,"aria-label":p,onClick:e=>u(e,a),onKeyDown:e=>c(e,a),onFocus:e=>h(e,a),onBlur:e=>d(e,a)},ownerState:t,className:b.monthButton});return(0,x.jsx)(Iy,(0,iL.A)({className:(0,C.A)(b.root,r),ownerState:t},v,{children:(0,x.jsx)(S,(0,iL.A)({},k))}))});function Iw(e){return(0,P.Ay)("MuiMonthCalendar",e)}(0,I.A)("MuiMonthCalendar",["root"]);let IS=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],IC=(0,D.A)("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:320,boxSizing:"border-box"}),IA=w.forwardRef(function(e,t){let n,r,i,o=(n=EV().utils,r=EV().defaultDates,i=EN({props:e,name:"MuiMonthCalendar"}),(0,iL.A)({disableFuture:!1,disablePast:!1},i,{minDate:EU(n,i.minDate,r.minDate),maxDate:EU(n,i.maxDate,r.maxDate)})),{className:s,value:a,defaultValue:l,referenceDate:u,disabled:c,disableFuture:h,disablePast:d,maxDate:f,minDate:p,onChange:m,shouldDisableMonth:g,readOnly:v,autoFocus:y=!1,onMonthFocus:b,hasFocus:S,onFocusedViewChange:k,monthsPerRow:M=3,timezone:T,gridLabelId:D,slots:E,slotProps:O}=o,R=(0,k1.A)(o,IS),{value:I,handleValueChange:P,timezone:N}=Rc({name:"MonthCalendar",timezone:T,value:a,defaultValue:l,referenceDate:u,onChange:m,valueManager:RO}),L=EH(N),j=(0,fn.I)(),F=EV().utils,B=w.useMemo(()=>RO.getInitialReferenceValue({value:I,utils:F,props:o,timezone:N,referenceDate:u,granularity:Rh.month}),[]),_=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"]},Iw,t)})(o),z=w.useMemo(()=>F.getMonth(L),[F,L]),V=w.useMemo(()=>null!=I?F.getMonth(I):null,[I,F]),[H,$]=w.useState(()=>V||F.getMonth(B)),[W,U]=(0,Oz.A)({name:"MonthCalendar",state:"hasFocus",controlled:S,default:y??!1}),q=(0,O_.A)(e=>{U(e),k&&k(e)}),G=w.useCallback(e=>{let t=F.startOfMonth(d&&F.isAfter(L,p)?L:p),n=F.startOfMonth(h&&F.isBefore(L,f)?L:f),r=F.startOfMonth(e);return!!(F.isBefore(r,t)||F.isAfter(r,n))||!!g&&g(r)},[h,d,f,p,L,g,F]),Y=(0,O_.A)((e,t)=>{v||P(F.setMonth(I??B,t))}),K=(0,O_.A)(e=>{!G(F.setMonth(I??B,e))&&($(e),q(!0),b&&b(e))});w.useEffect(()=>{$(e=>null!==V&&e!==V?V:e)},[V]);let Z=(0,O_.A)((e,t)=>{switch(e.key){case"ArrowUp":K((12+t-3)%12),e.preventDefault();break;case"ArrowDown":K((12+t+3)%12),e.preventDefault();break;case"ArrowLeft":K((12+t+(j?1:-1))%12),e.preventDefault();break;case"ArrowRight":K((12+t+(j?-1:1))%12),e.preventDefault()}}),X=(0,O_.A)((e,t)=>{K(t)}),Q=(0,O_.A)((e,t)=>{H===t&&q(!1)});return(0,x.jsx)(IC,(0,iL.A)({ref:t,className:(0,C.A)(_.root,s),ownerState:o,role:"radiogroup","aria-labelledby":D},R,{children:Eq(F,I??B).map(e=>{let t=F.getMonth(e),n=F.format(e,"monthShort"),r=F.format(e,"month"),i=c||G(e);return(0,x.jsx)(Ix,{selected:t===V,value:t,onClick:Y,onKeyDown:Z,autoFocus:W&&t===H,disabled:i,tabIndex:t!==H||i?-1:0,onFocus:X,onBlur:Q,"aria-current":z===t?"date":void 0,"aria-label":r,monthsPerRow:M,slots:E,slotProps:O,children:n},n)})}))});function Ik(e){return(0,P.Ay)("MuiPickersYear",e)}let IM=(0,I.A)("MuiPickersYear",["root","yearButton","selected","disabled"]),IT=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],ID=(0,D.A)("div",{name:"MuiPickersYear",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{yearsPerRow:4},style:{flexBasis:"25%"}}]}),IE=(0,D.A)("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${IM.disabled}`]:t.disabled},{[`&.${IM.selected}`]:t.selected}]})(({theme:e})=>(0,iL.A)({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"6px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.focusOpacity})`:(0,k.X4)(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,k.X4)(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${IM.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${IM.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),IO=w.memo(function(e){let t=EN({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:r,children:i,disabled:o,selected:s,value:a,tabIndex:l,onClick:u,onKeyDown:c,onFocus:h,onBlur:d,"aria-current":f,slots:p,slotProps:m}=t,g=(0,k1.A)(t,IT),v=w.useRef(null),y=(e=>{let{disabled:t,selected:n,classes:r}=e;return(0,A.A)({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},Ik,r)})(t);(0,mJ.A)(()=>{n&&v.current?.focus()},[n]);let b=p?.yearButton??IE,S=(0,OO.A)({elementType:b,externalSlotProps:m?.yearButton,additionalProps:{children:i,disabled:o,tabIndex:l,ref:v,type:"button",role:"radio","aria-current":f,"aria-checked":s,onClick:e=>u(e,a),onKeyDown:e=>c(e,a),onFocus:e=>h(e,a),onBlur:e=>d(e,a)},ownerState:t,className:y.yearButton});return(0,x.jsx)(ID,(0,iL.A)({className:(0,C.A)(y.root,r),ownerState:t},g,{children:(0,x.jsx)(b,(0,iL.A)({},S))}))});function IR(e){return(0,P.Ay)("MuiYearCalendar",e)}(0,I.A)("MuiYearCalendar",["root"]);let II=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],IP=(0,D.A)("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:320,maxHeight:280,boxSizing:"border-box",position:"relative"}),IN=w.forwardRef(function(e,t){let n,r,i,o=(n=EV().utils,r=EV().defaultDates,i=EN({props:e,name:"MuiYearCalendar"}),(0,iL.A)({disablePast:!1,disableFuture:!1},i,{yearsPerRow:i.yearsPerRow??3,minDate:EU(n,i.minDate,r.minDate),maxDate:EU(n,i.maxDate,r.maxDate)})),{autoFocus:s,className:a,value:l,defaultValue:u,referenceDate:c,disabled:h,disableFuture:d,disablePast:f,maxDate:p,minDate:m,onChange:g,readOnly:v,shouldDisableYear:y,onYearFocus:b,hasFocus:S,onFocusedViewChange:k,yearsOrder:M="asc",yearsPerRow:T,timezone:D,gridLabelId:E,slots:O,slotProps:R}=o,I=(0,k1.A)(o,II),{value:P,handleValueChange:N,timezone:L}=Rc({name:"YearCalendar",timezone:D,value:l,defaultValue:u,referenceDate:c,onChange:g,valueManager:RO}),j=EH(L),F=(0,fn.I)(),B=EV().utils,_=w.useMemo(()=>RO.getInitialReferenceValue({value:P,utils:B,props:o,timezone:L,referenceDate:c,granularity:Rh.year}),[]),z=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"]},IR,t)})(o),V=w.useMemo(()=>B.getYear(j),[B,j]),H=w.useMemo(()=>null!=P?B.getYear(P):null,[P,B]),[$,W]=w.useState(()=>H||B.getYear(_)),[U,q]=(0,Oz.A)({name:"YearCalendar",state:"hasFocus",controlled:S,default:s??!1}),G=(0,O_.A)(e=>{q(e),k&&k(e)}),Y=w.useCallback(e=>!!(f&&B.isBeforeYear(e,j)||d&&B.isAfterYear(e,j)||m&&B.isBeforeYear(e,m)||p&&B.isAfterYear(e,p))||!!y&&y(B.startOfYear(e)),[d,f,p,m,j,y,B]),K=(0,O_.A)((e,t)=>{v||N(B.setYear(P??_,t))}),Z=(0,O_.A)(e=>{Y(B.setYear(P??_,e))||(W(e),G(!0),b?.(e))});w.useEffect(()=>{W(e=>null!==H&&e!==H?H:e)},[H]);let X="desc"!==M?+T:-1*T,Q=F&&"asc"===M||!F&&"desc"===M?-1:1,J=(0,O_.A)((e,t)=>{switch(e.key){case"ArrowUp":Z(t-X),e.preventDefault();break;case"ArrowDown":Z(t+X),e.preventDefault();break;case"ArrowLeft":Z(t-Q),e.preventDefault();break;case"ArrowRight":Z(t+Q),e.preventDefault()}}),ee=(0,O_.A)((e,t)=>{Z(t)}),et=(0,O_.A)((e,t)=>{$===t&&G(!1)}),en=w.useRef(null),er=(0,RU.A)(t,en);w.useEffect(()=>{if(s||null===en.current)return;let e=en.current.querySelector('[tabindex="0"]');if(!e)return;let t=e.offsetHeight,n=e.offsetTop,r=en.current.clientHeight,i=en.current.scrollTop;t>r||n<i||(en.current.scrollTop=n+t-r/2-t/2)},[s]);let ei=B.getYearRange([m,p]);return"desc"===M&&ei.reverse(),(0,x.jsx)(IP,(0,iL.A)({ref:er,className:(0,C.A)(z.root,a),ownerState:o,role:"radiogroup","aria-labelledby":E},I,{children:ei.map(e=>{let t=B.getYear(e),n=h||Y(e);return(0,x.jsx)(IO,{selected:t===H,value:t,onClick:K,onKeyDown:J,autoFocus:U&&t===$,disabled:n,tabIndex:t!==$||n?-1:0,onFocus:ee,onBlur:et,"aria-current":V===t?"date":void 0,yearsPerRow:T,slots:O,slotProps:R,children:B.format(e,"year")},B.format(e,"year"))})}))}),IL=e=>(0,P.Ay)("MuiPickersCalendarHeader",e),Ij=(0,I.A)("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),IF=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],IB=["ownerState"],I_=(0,D.A)("div",{name:"MuiPickersCalendarHeader",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),Iz=(0,D.A)("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>(0,iL.A)({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),IV=(0,D.A)("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),IH=(0,D.A)($.A,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${Ij.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),I$=(0,D.A)(E0,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),IW=w.forwardRef(function(e,t){let n=EV().localeText,r=EV().utils,i=EN({props:e,name:"MuiPickersCalendarHeader"}),{slots:o,slotProps:s,currentMonth:a,disabled:l,disableFuture:u,disablePast:c,maxDate:h,minDate:d,onMonthChange:f,onViewChange:p,view:m,reduceAnimations:g,views:v,labelId:y,className:b,timezone:S,format:k=`${r.formats.month} ${r.formats.year}`}=i,M=(0,k1.A)(i,IF),T=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},IL,t)})(i),D=o?.switchViewButton??IH,E=(0,OO.A)({elementType:D,externalSlotProps:s?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(m)},ownerState:i,className:T.switchViewButton}),O=o?.switchViewIcon??I$,R=(0,OO.A)({elementType:O,externalSlotProps:s?.switchViewIcon,ownerState:i,className:T.switchViewIcon}),I=(0,k1.A)(R,IB),P=function(e,{disableFuture:t,maxDate:n,timezone:r}){let i=EV().utils;return w.useMemo(()=>{let o=i.date(void 0,r),s=i.startOfMonth(t&&i.isBefore(o,n)?o:n);return!i.isAfter(s,e)},[t,n,e,i,r])}(a,{disableFuture:u,maxDate:h,timezone:S}),N=function(e,{disablePast:t,minDate:n,timezone:r}){let i=EV().utils;return w.useMemo(()=>{let o=i.date(void 0,r),s=i.startOfMonth(t&&i.isAfter(o,n)?o:n);return!i.isBefore(s,e)},[t,n,e,i,r])}(a,{disablePast:c,minDate:d,timezone:S});if(1===v.length&&"year"===v[0])return null;let L=r.formatByString(a,k);return(0,x.jsxs)(I_,(0,iL.A)({},M,{ownerState:i,className:(0,C.A)(T.root,b),ref:t,children:[(0,x.jsxs)(Iz,{role:"presentation",onClick:()=>{if(1!==v.length&&p&&!l)if(2===v.length)p(v.find(e=>e!==m)||v[0]);else{let e=+(0===v.indexOf(m));p(v[e])}},ownerState:i,"aria-live":"polite",className:T.labelContainer,children:[(0,x.jsx)(RW,{reduceAnimations:g,transKey:L,children:(0,x.jsx)(IV,{id:y,ownerState:i,className:T.label,children:L})}),v.length>1&&!l&&(0,x.jsx)(D,(0,iL.A)({},E,{children:(0,x.jsx)(O,(0,iL.A)({},I))}))]}),(0,x.jsx)(RV.A,{in:"day"===m,appear:!g,enter:!g,children:(0,x.jsx)(OB,{slots:o,slotProps:s,onGoToPrevious:()=>f(r.addMonths(a,-1),"right"),isPreviousDisabled:N,previousLabel:n.previousMonth,onGoToNext:()=>f(r.addMonths(a,1),"left"),isNextDisabled:P,nextLabel:n.nextMonth})})]}))}),IU="u">typeof navigator&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),Iq=IU&&IU[1]?parseInt(IU[1],10):null,IG=IU&&IU[2]?parseInt(IU[2],10):null,IY=Iq&&Iq<10||IG&&IG<13||!1,IK=e=>(0,P.Ay)("MuiDateCalendar",e);(0,I.A)("MuiDateCalendar",["root","viewTransitionContainer"]);let IZ=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"],IX=(0,D.A)(OH,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:336}),IQ=(0,D.A)(RW,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),IJ=w.forwardRef(function(e,t){let n,r,i,o,s=EV().utils,a=(0,OE.A)(),l=(n=EV().utils,r=EV().defaultDates,i=m3("@media (prefers-reduced-motion: reduce)",{defaultMatches:!1})||IY,o=EN({props:e,name:"MuiDateCalendar"}),(0,iL.A)({},o,{loading:o.loading??!1,disablePast:o.disablePast??!1,disableFuture:o.disableFuture??!1,openTo:o.openTo??"day",views:o.views??["year","day"],reduceAnimations:o.reduceAnimations??i,renderLoading:o.renderLoading??(()=>(0,x.jsx)("span",{children:"..."})),minDate:EU(n,o.minDate,r.minDate),maxDate:EU(n,o.maxDate,r.maxDate)})),{autoFocus:u,onViewChange:c,value:h,defaultValue:d,referenceDate:f,disableFuture:p,disablePast:m,onChange:g,onYearChange:v,onMonthChange:y,reduceAnimations:b,shouldDisableDate:S,shouldDisableMonth:k,shouldDisableYear:M,view:T,views:D,openTo:E,className:O,disabled:R,readOnly:I,minDate:P,maxDate:N,disableHighlightToday:L,focusedView:j,onFocusedViewChange:F,showDaysOutsideCurrentMonth:B,fixedWeekNumber:_,dayOfWeekFormatter:z,slots:V,slotProps:H,loading:$,renderLoading:W,displayWeekNumber:U,yearsOrder:q,yearsPerRow:G,monthsPerRow:Y,timezone:K}=l,Z=(0,k1.A)(l,IZ),{value:X,handleValueChange:Q,timezone:J}=Rc({name:"DateCalendar",timezone:K,value:h,defaultValue:d,referenceDate:f,onChange:g,valueManager:RO}),{view:ee,setView:et,focusedView:en,setFocusedView:er,goToNextView:ei,setValueAndGoToNextView:eo}=OV({view:T,views:D,openTo:E,onChange:Q,onViewChange:c,autoFocus:u,focusedView:j,onFocusedViewChange:F}),{referenceDate:es,calendarState:ea,changeFocusedDay:el,changeMonth:eu,handleChangeMonth:ec,isDateDisabled:eh,onMonthSwitchingAnimationEnd:ed}=(e=>{let t,{value:n,referenceDate:r,disableFuture:i,disablePast:o,disableSwitchToMonthOnDayFocus:s=!1,maxDate:a,minDate:l,onMonthChange:u,reduceAnimations:c,shouldDisableDate:h,timezone:d}=e,f=EV().utils,p=w.useRef((t=!!c,(e,n)=>{switch(n.type){case"changeMonth":return(0,iL.A)({},e,{slideDirection:n.direction,currentMonth:n.newMonth,isMonthSwitchingAnimating:!t});case"changeMonthTimezone":{let t=n.newTimezone;if(f.getTimezone(e.currentMonth)===t)return e;let r=f.setTimezone(e.currentMonth,t);return f.getMonth(r)!==f.getMonth(e.currentMonth)&&(r=f.setMonth(r,f.getMonth(e.currentMonth))),(0,iL.A)({},e,{currentMonth:r})}case"finishMonthSwitchingAnimation":return(0,iL.A)({},e,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(null!=e.focusedDay&&null!=n.focusedDay&&f.isSameDay(n.focusedDay,e.focusedDay))return e;let r=null!=n.focusedDay&&!s&&!f.isSameMonth(e.currentMonth,n.focusedDay);return(0,iL.A)({},e,{focusedDay:n.focusedDay,isMonthSwitchingAnimating:r&&!t&&!n.withoutMonthSwitchingAnimation,currentMonth:r?f.startOfMonth(n.focusedDay):e.currentMonth,slideDirection:null!=n.focusedDay&&f.isAfterDay(n.focusedDay,e.currentMonth)?"left":"right"})}default:throw Error("missing support")}})).current,m=w.useMemo(()=>RO.getInitialReferenceValue({value:n,utils:f,timezone:d,props:e,referenceDate:r,granularity:Rh.day}),[r,d]),[g,v]=w.useReducer(p,{isMonthSwitchingAnimating:!1,focusedDay:m,currentMonth:f.startOfMonth(m),slideDirection:"left"});w.useEffect(()=>{v({type:"changeMonthTimezone",newTimezone:f.getTimezone(m)})},[m,f]);let y=w.useCallback(e=>{v((0,iL.A)({type:"changeMonth"},e)),u&&u(e.newMonth)},[u]),b=w.useCallback(e=>{f.isSameMonth(e,g.currentMonth)||y({newMonth:f.startOfMonth(e),direction:f.isAfterDay(e,g.currentMonth)?"left":"right"})},[g.currentMonth,y,f]),x=R_({shouldDisableDate:h,minDate:l,maxDate:a,disableFuture:i,disablePast:o,timezone:d}),S=w.useCallback(()=>{v({type:"finishMonthSwitchingAnimation"})},[]);return{referenceDate:m,calendarState:g,changeMonth:b,changeFocusedDay:(0,O_.A)((e,t)=>{x(e)||v({type:"changeFocusedDay",focusedDay:e,withoutMonthSwitchingAnimation:t})}),isDateDisabled:x,onMonthSwitchingAnimationEnd:S,handleChangeMonth:y}})({value:X,referenceDate:f,reduceAnimations:b,onMonthChange:y,minDate:P,maxDate:N,shouldDisableDate:S,disablePast:m,disableFuture:p,timezone:J}),ef=R&&X||P,ep=R&&X||N,em=`${a}-grid-label`,eg=null!==en,ev=V?.calendarHeader??IW,ey=(0,OO.A)({elementType:ev,externalSlotProps:H?.calendarHeader,additionalProps:{views:D,view:ee,currentMonth:ea.currentMonth,onViewChange:et,onMonthChange:(e,t)=>ec({newMonth:e,direction:t}),minDate:ef,maxDate:ep,disabled:R,disablePast:m,disableFuture:p,reduceAnimations:b,timezone:J,labelId:em},ownerState:l}),eb=(0,O_.A)(e=>{let t=s.startOfMonth(e),n=s.endOfMonth(e),r=eh(e)?EW({utils:s,date:e,minDate:s.isBefore(P,t)?t:P,maxDate:s.isAfter(N,n)?n:N,disablePast:m,disableFuture:p,isDateDisabled:eh,timezone:J}):e;r?(eo(r,"finish"),y?.(t)):(ei(),eu(t)),el(r,!0)}),ex=(0,O_.A)(e=>{let t=s.startOfYear(e),n=s.endOfYear(e),r=eh(e)?EW({utils:s,date:e,minDate:s.isBefore(P,t)?t:P,maxDate:s.isAfter(N,n)?n:N,disablePast:m,disableFuture:p,isDateDisabled:eh,timezone:J}):e;r?(eo(r,"finish"),v?.(r)):(ei(),eu(t)),el(r,!0)}),ew=(0,O_.A)(e=>e?Q(E$(s,e,X??es),"finish",ee):Q(e,"finish",ee));w.useEffect(()=>{null!=X&&s.isValid(X)&&eu(X)},[X]);let eS=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},IK,t)})(l),eC={disablePast:m,disableFuture:p,maxDate:N,minDate:P},eA={disableHighlightToday:L,readOnly:I,disabled:R,timezone:J,gridLabelId:em,slots:V,slotProps:H},ek=w.useRef(ee);w.useEffect(()=>{ek.current!==ee&&(en===ek.current&&er(ee,!0),ek.current=ee)},[en,er,ee]);let eM=w.useMemo(()=>[X],[X]);return(0,x.jsxs)(IX,(0,iL.A)({ref:t,className:(0,C.A)(eS.root,O),ownerState:l},Z,{children:[(0,x.jsx)(ev,(0,iL.A)({},ey,{slots:V,slotProps:H})),(0,x.jsx)(IQ,{reduceAnimations:b,className:eS.viewTransitionContainer,transKey:ee,ownerState:l,children:(0,x.jsxs)("div",{children:["year"===ee&&(0,x.jsx)(IN,(0,iL.A)({},eC,eA,{value:X,onChange:ex,shouldDisableYear:M,hasFocus:eg,onFocusedViewChange:e=>er("year",e),yearsOrder:q,yearsPerRow:G,referenceDate:es})),"month"===ee&&(0,x.jsx)(IA,(0,iL.A)({},eC,eA,{hasFocus:eg,className:O,value:X,onChange:eb,shouldDisableMonth:k,onFocusedViewChange:e=>er("month",e),monthsPerRow:Y,referenceDate:es})),"day"===ee&&(0,x.jsx)(Ip,(0,iL.A)({},ea,eC,eA,{onMonthSwitchingAnimationEnd:ed,onFocusedDayChange:el,reduceAnimations:b,selectedDays:eM,onSelectedDaysChange:ew,shouldDisableDate:S,shouldDisableMonth:k,shouldDisableYear:M,hasFocus:eg,onFocusedViewChange:e=>er("day",e),showDaysOutsideCurrentMonth:B,fixedWeekNumber:_,dayOfWeekFormatter:z,displayWeekNumber:U,loading:$,renderLoading:W}))]})})]}))}),I0=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:i,value:o,defaultValue:s,referenceDate:a,onChange:l,className:u,classes:c,disableFuture:h,disablePast:d,minDate:f,maxDate:p,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:y,onMonthChange:b,monthsPerRow:w,onYearChange:S,yearsOrder:C,yearsPerRow:A,slots:k,slotProps:M,loading:T,renderLoading:D,disableHighlightToday:E,readOnly:O,disabled:R,showDaysOutsideCurrentMonth:I,dayOfWeekFormatter:P,sx:N,autoFocus:L,fixedWeekNumber:j,displayWeekNumber:F,timezone:B})=>(0,x.jsx)(IJ,{view:e,onViewChange:t,views:n.filter(EZ),focusedView:r&&EZ(r)?r:null,onFocusedViewChange:i,value:o,defaultValue:s,referenceDate:a,onChange:l,className:u,classes:c,disableFuture:h,disablePast:d,minDate:f,maxDate:p,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:y,onMonthChange:b,monthsPerRow:w,onYearChange:S,yearsOrder:C,yearsPerRow:A,slots:k,slotProps:M,loading:T,renderLoading:D,disableHighlightToday:E,readOnly:O,disabled:R,showDaysOutsideCurrentMonth:I,dayOfWeekFormatter:P,sx:N,autoFocus:L,fixedWeekNumber:j,displayWeekNumber:F,timezone:B});function I1(e){let{props:t,validator:n,value:r,timezone:i,onError:o}=e,s=EV(),a=w.useRef(n.valueManager.defaultErrorState),l=n({adapter:s,value:r,timezone:i,props:t}),u=n.valueManager.hasError(l);return w.useEffect(()=>{o&&!n.valueManager.isSameError(l,a.current)&&o(l,r),a.current=l},[n,o,l,r]),{validationError:l,hasValidationError:u,getValidationErrorForNewValue:(0,O_.A)(e=>n({adapter:s,value:e,timezone:i,props:t}))}}let I2=["className","sx"],I5=(e=document)=>{let t=e.activeElement;return t?t.shadowRoot?I5(t.shadowRoot):t:null};function I4(){return"u"<typeof window?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?90===Math.abs(window.screen.orientation.angle)?"landscape":"portrait":window.orientation&&90===Math.abs(Number(window.orientation))?"landscape":"portrait"}function I3(e){return(0,P.Ay)("MuiPickersLayout",e)}let I6=(0,I.A)("MuiPickersLayout",["root","landscape","contentWrapper","toolbar","actionBar","tabs","shortcuts"]),I8=["onAccept","onClear","onCancel","onSetToday","actions"];function I9(e){let{onAccept:t,onClear:n,onCancel:r,onSetToday:i,actions:o}=e,s=(0,k1.A)(e,I8),a=EV().localeText;if(null==o||0===o.length)return null;let l=o?.map(e=>{switch(e){case"clear":return(0,x.jsx)(z.A,{onClick:n,children:a.clearButtonLabel},e);case"cancel":return(0,x.jsx)(z.A,{onClick:r,children:a.cancelButtonLabel},e);case"accept":return(0,x.jsx)(z.A,{onClick:t,children:a.okButtonLabel},e);case"today":return(0,x.jsx)(z.A,{onClick:i,children:a.todayButtonLabel},e);default:return null}});return(0,x.jsx)(pj.A,(0,iL.A)({},s,{children:l}))}var I7=n(76477),Pe=n(79223),Pt=n(6835);function Pn(e){return(0,P.Ay)("MuiListItem",e)}function Pr(e){return(0,P.Ay)("MuiListItemSecondaryAction",e)}(0,I.A)("MuiListItem",["root","container","dense","alignItemsFlexStart","divider","gutters","padding","secondaryAction"]),(0,I.A)("MuiListItemSecondaryAction",["root","disableGutters"]);let Pi=(0,D.A)("div",{name:"MuiListItemSecondaryAction",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.disableGutters&&t.disableGutters]}})({position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",variants:[{props:({ownerState:e})=>e.disableGutters,style:{right:0}}]}),Po=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiListItemSecondaryAction"}),{className:r,...i}=n,o=w.useContext(lB.A),s={...n,disableGutters:o.disableGutters},a=(e=>{let{disableGutters:t,classes:n}=e;return(0,A.A)({root:["root",t&&"disableGutters"]},Pr,n)})(s);return(0,x.jsx)(Pi,{className:(0,C.A)(a.root,r),ownerState:s,ref:t,...i})});Po.muiName="ListItemSecondaryAction";let Ps=(0,D.A)("div",{name:"MuiListItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,"flex-start"===n.alignItems&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters,!n.disablePadding&&t.padding,n.hasSecondaryAction&&t.secondaryAction]}})((0,E.A)(({theme:e})=>({display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",width:"100%",boxSizing:"border-box",textAlign:"left",variants:[{props:({ownerState:e})=>!e.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:e})=>!e.disablePadding&&e.dense,style:{paddingTop:4,paddingBottom:4}},{props:({ownerState:e})=>!e.disablePadding&&!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>!e.disablePadding&&!!e.secondaryAction,style:{paddingRight:48}},{props:({ownerState:e})=>!!e.secondaryAction,style:{[`& > .${lz.root}`]:{paddingRight:48}}},{props:{alignItems:"flex-start"},style:{alignItems:"flex-start"}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:({ownerState:e})=>e.button,style:{transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}}}},{props:({ownerState:e})=>e.hasSecondaryAction,style:{paddingRight:48}}]}))),Pa=(0,D.A)("li",{name:"MuiListItem",slot:"Container",overridesResolver:(e,t)=>t.container})({position:"relative"}),Pl=w.forwardRef(function(e,t){let n=(0,R.b)({props:e,name:"MuiListItem"}),{alignItems:r="center",children:i,className:o,component:s,components:a={},componentsProps:l={},ContainerComponent:u="li",ContainerProps:{className:c,...h}={},dense:d=!1,disableGutters:f=!1,disablePadding:p=!1,divider:m=!1,secondaryAction:g,slotProps:v={},slots:y={},...b}=n,S=w.useContext(lB.A),k=w.useMemo(()=>({dense:d||S.dense||!1,alignItems:r,disableGutters:f}),[r,S.dense,d,f]),M=w.useRef(null),T=w.Children.toArray(i),D=T.length&&(0,Pt.A)(T[T.length-1],["ListItemSecondaryAction"]),E={...n,alignItems:r,dense:k.dense,disableGutters:f,disablePadding:p,divider:m,hasSecondaryAction:D},O=(e=>{let{alignItems:t,classes:n,dense:r,disableGutters:i,disablePadding:o,divider:s,hasSecondaryAction:a}=e;return(0,A.A)({root:["root",r&&"dense",!i&&"gutters",!o&&"padding",s&&"divider","flex-start"===t&&"alignItemsFlexStart",a&&"secondaryAction"],container:["container"]},Pn,n)})(E),I=(0,lF.A)(M,t),P=y.root||a.Root||Ps,N=v.root||l.root||{},L={className:(0,C.A)(O.root,N.className,o),...b},j=s||"li";return D?(j=L.component||s?j:"div","li"===u&&("li"===j?j="div":"li"===L.component&&(L.component="div")),(0,x.jsx)(lB.A.Provider,{value:k,children:(0,x.jsxs)(Pa,{as:u,className:(0,C.A)(O.container,c),ref:I,ownerState:E,...h,children:[(0,x.jsx)(P,{...N,...!(0,Pe.A)(P)&&{as:j,ownerState:{...E,...N.ownerState}},...L,children:T}),T.pop()]})})):(0,x.jsx)(lB.A.Provider,{value:k,children:(0,x.jsxs)(P,{...N,as:j,ref:I,...!(0,Pe.A)(P)&&{ownerState:{...E,...N.ownerState}},...L,children:[T,g&&(0,x.jsx)(Po,{children:g})]})})});var Pu=n(47601);let Pc=["items","changeImportance","isLandscape","onChange","isValid"],Ph=["getValue"];function Pd(e){let{items:t,changeImportance:n="accept",onChange:r,isValid:i}=e,o=(0,k1.A)(e,Pc);if(null==t||0===t.length)return null;let s=t.map(e=>{let{getValue:t}=e,o=(0,k1.A)(e,Ph),s=t({isValid:i});return(0,iL.A)({},o,{label:o.label,onClick:()=>{r(s,n,o)},disabled:!i(s)})});return(0,x.jsx)(I7.A,(0,iL.A)({dense:!0,sx:[{maxHeight:336,maxWidth:200,overflow:"auto"},...Array.isArray(o.sx)?o.sx:[o.sx]]},o,{children:s.map(e=>(0,x.jsx)(Pl,{children:(0,x.jsx)(Pu.A,(0,iL.A)({},e))},e.id??e.label))}))}let Pf=(0,D.A)("div",{name:"MuiPickersLayout",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"grid",gridAutoColumns:"max-content auto max-content",gridAutoRows:"max-content auto max-content",[`& .${I6.actionBar}`]:{gridColumn:"1 / 4",gridRow:3},variants:[{props:{isLandscape:!0},style:{[`& .${I6.toolbar}`]:{gridColumn:1,gridRow:"2 / 3"},[`.${I6.shortcuts}`]:{gridColumn:"2 / 4",gridRow:1}}},{props:{isLandscape:!0,isRtl:!0},style:{[`& .${I6.toolbar}`]:{gridColumn:3}}},{props:{isLandscape:!1},style:{[`& .${I6.toolbar}`]:{gridColumn:"2 / 4",gridRow:1},[`& .${I6.shortcuts}`]:{gridColumn:1,gridRow:"2 / 3"}}},{props:{isLandscape:!1,isRtl:!0},style:{[`& .${I6.shortcuts}`]:{gridColumn:3}}}]}),Pp=(0,D.A)("div",{name:"MuiPickersLayout",slot:"ContentWrapper",overridesResolver:(e,t)=>t.contentWrapper})({gridColumn:2,gridRow:2,display:"flex",flexDirection:"column"}),Pm=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersLayout"}),{toolbar:r,content:i,tabs:o,actionBar:s,shortcuts:a}=(e=>{let{wrapperVariant:t,onAccept:n,onClear:r,onCancel:i,onSetToday:o,view:s,views:a,onViewChange:l,value:u,onChange:c,onSelectShortcut:h,isValid:d,isLandscape:f,disabled:p,readOnly:m,children:g,slots:v,slotProps:y}=e,b=(e=>{let{classes:t,isLandscape:n}=e;return(0,A.A)({root:["root",n&&"landscape"],contentWrapper:["contentWrapper"],toolbar:["toolbar"],actionBar:["actionBar"],tabs:["tabs"],landscape:["landscape"],shortcuts:["shortcuts"]},I3,t)})(e),w=v?.actionBar??I9,S=(0,OO.A)({elementType:w,externalSlotProps:y?.actionBar,additionalProps:{onAccept:n,onClear:r,onCancel:i,onSetToday:o,actions:"desktop"===t?[]:["cancel","accept"]},className:b.actionBar,ownerState:(0,iL.A)({},e,{wrapperVariant:t})}),C=(0,x.jsx)(w,(0,iL.A)({},S)),k=v?.toolbar,M=(0,OO.A)({elementType:k,externalSlotProps:y?.toolbar,additionalProps:{isLandscape:f,onChange:c,value:u,view:s,onViewChange:l,views:a,disabled:p,readOnly:m},className:b.toolbar,ownerState:(0,iL.A)({},e,{wrapperVariant:t})}),T=null!==M.view&&k?(0,x.jsx)(k,(0,iL.A)({},M)):null,D=v?.tabs,E=s&&D?(0,x.jsx)(D,(0,iL.A)({view:s,onViewChange:l,className:b.tabs},y?.tabs)):null,O=v?.shortcuts??Pd,R=(0,OO.A)({elementType:O,externalSlotProps:y?.shortcuts,additionalProps:{isValid:d,isLandscape:f,onChange:h},className:b.shortcuts,ownerState:{isValid:d,isLandscape:f,onChange:h,wrapperVariant:t}});return{toolbar:T,content:g,tabs:E,actionBar:C,shortcuts:s&&O?(0,x.jsx)(O,(0,iL.A)({},R)):null}})(n),{sx:l,className:u,isLandscape:c,wrapperVariant:h}=n,d=(e=>{let{isLandscape:t,classes:n}=e;return(0,A.A)({root:["root",t&&"landscape"],contentWrapper:["contentWrapper"]},I3,n)})(n);return(0,x.jsxs)(Pf,{ref:t,sx:l,className:(0,C.A)(d.root,u),ownerState:n,children:[c?a:r,c?r:a,(0,x.jsx)(Pp,{className:d.contentWrapper,children:"desktop"===h?(0,x.jsxs)(w.Fragment,{children:[i,o]}):(0,x.jsxs)(w.Fragment,{children:[o,i]})}),s]})}),Pg=["props","ref"],Pv=(0,D.A)(Pm)(({theme:e})=>({overflow:"hidden",minWidth:320,backgroundColor:(e.vars||e).palette.background.paper})),Py=({adapter:e,value:t,timezone:n,props:r})=>{if(null===t)return null;let{minTime:i,maxTime:o,minutesStep:s,shouldDisableTime:a,disableIgnoringDatePartForTimeValidation:l=!1,disablePast:u,disableFuture:c}=r,h=e.utils.date(void 0,n),d=Ob(l,e.utils);switch(!0){case!e.utils.isValid(t):return"invalidDate";case!!(i&&d(i,t)):return"minTime";case!!(o&&d(t,o)):return"maxTime";case!!(c&&e.utils.isAfter(t,h)):return"disableFuture";case!!(u&&e.utils.isBefore(t,h)):return"disablePast";case!!(a&&a(t,"hours")):return"shouldDisableTime-hours";case!!(a&&a(t,"minutes")):return"shouldDisableTime-minutes";case!!(a&&a(t,"seconds")):return"shouldDisableTime-seconds";case!!(s&&e.utils.getMinutes(t)%s!=0):return"minutesStep";default:return null}};Py.valueManager=RO;let Pb=({adapter:e,value:t,timezone:n,props:r})=>{let i=RB({adapter:e,value:t,timezone:n,props:r});return null!==i?i:Py({adapter:e,value:t,timezone:n,props:r})};Pb.valueManager=RO;let Px=w.forwardRef(function(e,t){let n,r,i,o,s,a=(n=EV().utils,r=EV().defaultDates,o=(i=EN({props:e,name:"MuiStaticDateTimePicker"})).ampm??n.is12HourCycleInCurrentLocale(),s=w.useMemo(()=>i.localeText?.toolbarTitle==null?i.localeText:(0,iL.A)({},i.localeText,{dateTimePickerToolbarTitle:i.localeText.toolbarTitle}),[i.localeText]),(0,iL.A)({},i,(({openTo:e,defaultOpenTo:t,views:n,defaultViews:r})=>{let i,o=n??r;if(null!=e)i=e;else if(o.includes(t))i=t;else if(o.length>0)i=o[0];else throw Error("MUI X: The `views` prop must contain at least one view.");return{views:o,openTo:i}})({views:i.views,openTo:i.openTo,defaultViews:["year","day","hours","minutes"],defaultOpenTo:"day"}),{ampm:o,localeText:s,orientation:i.orientation??"portrait",disableIgnoringDatePartForTimeValidation:i.disableIgnoringDatePartForTimeValidation??!!(i.minDateTime||i.maxDateTime||i.disablePast||i.disableFuture),disableFuture:i.disableFuture??!1,disablePast:i.disablePast??!1,minDate:EU(n,i.minDateTime??i.minDate,r.minDate),maxDate:EU(n,i.maxDateTime??i.maxDate,r.maxDate),minTime:i.minDateTime??i.minTime,maxTime:i.maxDateTime??i.maxTime,slots:(0,iL.A)({toolbar:OD,tabs:E9},i.slots),slotProps:(0,iL.A)({},i.slotProps,{toolbar:(0,iL.A)({ampm:o},i.slotProps?.toolbar)})})),l=a.displayStaticWrapperAs??"mobile",u=a.ampmInClock??"desktop"===l,c=(0,iL.A)({day:I0,month:I0,year:I0,hours:RF,minutes:RF,seconds:RF},a.viewRenderers),{renderPicker:h}=(e=>{let{props:t,ref:n}=e,r=(0,k1.A)(e,Pg),{localeText:i,slots:o,slotProps:s,className:a,sx:l,displayStaticWrapperAs:u,autoFocus:c}=t,{layoutProps:h,renderCurrentView:d}=(({props:e,valueManager:t,valueType:n,wrapperVariant:r,additionalViewProps:i,validator:o,autoFocusView:s,rendererInterceptor:a,fieldRef:l})=>{let u=(({props:e,valueManager:t,valueType:n,wrapperVariant:r,validator:i})=>{let{onAccept:o,onChange:s,value:a,defaultValue:l,closeOnSelect:u="desktop"===r,timezone:c,referenceDate:h}=e,{current:d}=w.useRef(l),{current:f}=w.useRef(void 0!==a),[p,m]=w.useState(c),g=EV().utils,v=EV(),{isOpen:y,setIsOpen:b}=(({open:e,onOpen:t,onClose:n})=>{let r=w.useRef("boolean"==typeof e).current,[i,o]=w.useState(!1);return w.useEffect(()=>{if(r){if("boolean"!=typeof e)throw Error("You must not mix controlling and uncontrolled mode for `open` prop");o(e)}},[r,e]),{isOpen:i,setIsOpen:w.useCallback(e=>{r||o(e),e&&t&&t(),!e&&n&&n()},[r,t,n])}})(e),{timezone:x,value:S,handleValueChange:C}=Ru({timezone:c,value:a,defaultValue:d,referenceDate:h,onChange:s,valueManager:t}),[A,k]=w.useState(()=>{let e;return{draft:e=void 0!==S?S:void 0!==d?d:t.emptyValue,lastPublishedValue:e,lastCommittedValue:e,lastControlledValue:a,hasBeenModifiedSinceMount:!1}}),M=t.getTimezone(g,A.draft);p!==c&&(m(c),c&&M&&c!==M&&k(e=>(0,iL.A)({},e,{draft:t.setTimezone(g,c,e.draft)})));let{getValidationErrorForNewValue:T}=I1({props:e,validator:i,timezone:x,value:A.draft,onError:e.onError}),D=(0,O_.A)(e=>{let n={action:e,dateState:A,hasChanged:n=>!t.areValuesEqual(g,e.value,n),isControlled:f,closeOnSelect:u},r=(e=>{let{action:t,hasChanged:n,dateState:r,isControlled:i}=e,o=!i&&!r.hasBeenModifiedSinceMount;return"setValueFromField"===t.name||("setValueFromAction"===t.name?!!(o&&["accept","today","clear"].includes(t.pickerAction))||n(r.lastPublishedValue):("setValueFromView"===t.name&&"shallow"!==t.selectionState||"setValueFromShortcut"===t.name)&&(!!o||n(r.lastPublishedValue)))})(n),i=(e=>{let{action:t,hasChanged:n,dateState:r,isControlled:i,closeOnSelect:o}=e,s=!i&&!r.hasBeenModifiedSinceMount;return"setValueFromAction"===t.name?!!(s&&["accept","today","clear"].includes(t.pickerAction))||n(r.lastCommittedValue):"setValueFromView"===t.name&&"finish"===t.selectionState&&o?!!s||n(r.lastCommittedValue):"setValueFromShortcut"===t.name&&"accept"===t.changeImportance&&n(r.lastCommittedValue)})(n),s=(e=>{let{action:t,closeOnSelect:n}=e;return"setValueFromAction"===t.name||("setValueFromView"===t.name?"finish"===t.selectionState&&n:"setValueFromShortcut"===t.name&&"accept"===t.changeImportance)})(n);k(t=>(0,iL.A)({},t,{draft:e.value,lastPublishedValue:r?e.value:t.lastPublishedValue,lastCommittedValue:i?e.value:t.lastCommittedValue,hasBeenModifiedSinceMount:!0}));let a=null,l=()=>(a||(a={validationError:"setValueFromField"===e.name?e.context.validationError:T(e.value)},"setValueFromShortcut"===e.name&&(a.shortcut=e.shortcut)),a);r&&C(e.value,l()),i&&o&&o(e.value,l()),s&&b(!1)});if(A.lastControlledValue!==a){let e=t.areValuesEqual(g,A.draft,S);k(t=>(0,iL.A)({},t,{lastControlledValue:a},e?{}:{lastCommittedValue:S,lastPublishedValue:S,draft:S,hasBeenModifiedSinceMount:!0}))}let E=(0,O_.A)(()=>{D({value:t.emptyValue,name:"setValueFromAction",pickerAction:"clear"})}),O=(0,O_.A)(()=>{D({value:A.lastPublishedValue,name:"setValueFromAction",pickerAction:"accept"})}),R=(0,O_.A)(()=>{D({value:A.lastPublishedValue,name:"setValueFromAction",pickerAction:"dismiss"})}),I=(0,O_.A)(()=>{D({value:A.lastCommittedValue,name:"setValueFromAction",pickerAction:"cancel"})}),P=(0,O_.A)(()=>{D({value:t.getTodayValue(g,x,n),name:"setValueFromAction",pickerAction:"today"})}),N=(0,O_.A)(e=>{e.preventDefault(),b(!0)}),L=(0,O_.A)(e=>{e?.preventDefault(),b(!1)}),j=(0,O_.A)((e,t="partial")=>D({name:"setValueFromView",value:e,selectionState:t})),F=(0,O_.A)((e,t,n)=>D({name:"setValueFromShortcut",value:e,changeImportance:t,shortcut:n})),B=(0,O_.A)((e,t)=>D({name:"setValueFromField",value:e,context:t})),_={onClear:E,onAccept:O,onDismiss:R,onCancel:I,onSetToday:P,onOpen:N,onClose:L},z={value:A.draft,onChange:B},V=w.useMemo(()=>t.cleanValue(g,A.draft),[g,t,A.draft]),H=(0,iL.A)({},_,{value:V,onChange:j,onSelectShortcut:F,isValid:n=>{let r=i({adapter:v,value:n,timezone:x,props:e});return!t.hasError(r)}}),$=w.useMemo(()=>({onOpen:N,onClose:L,open:y}),[y,L,N]);return{open:y,fieldProps:z,viewProps:{value:V,onChange:j,onClose:L,open:y},layoutProps:H,actions:_,contextValue:$}})({props:e,valueManager:t,valueType:n,wrapperVariant:r,validator:o}),c=(({props:e,propsFromPickerValue:t,additionalViewProps:n,autoFocusView:r,rendererInterceptor:i,fieldRef:o})=>{let{onChange:s,open:a,onClose:l}=t,{view:u,views:c,openTo:h,onViewChange:d,viewRenderers:f,timezone:p}=e,m=(0,k1.A)(e,I2),{view:g,setView:v,defaultView:y,focusedView:b,setFocusedView:x,setValueAndGoToNextView:S}=OV({view:u,views:c,openTo:h,onChange:s,onViewChange:d,autoFocus:r}),{hasUIView:C,viewModeLookup:A}=w.useMemo(()=>c.reduce((e,t)=>{let n;return n=null!=f[t]?"UI":"field",e.viewModeLookup[t]=n,"UI"===n&&(e.hasUIView=!0),e},{hasUIView:!1,viewModeLookup:{}}),[f,c]),k=w.useMemo(()=>c.reduce((e,t)=>null!=f[t]&&Og(t)?e+1:e,0),[f,c]),M=A[g],T=(0,O_.A)(()=>"UI"===M),[D,E]=w.useState("UI"===M?g:null);return D!==g&&"UI"===A[g]&&E(g),(0,mJ.A)(()=>{"field"===M&&a&&(l(),setTimeout(()=>{o?.current?.setSelectedSections(g),o?.current?.focusField(g)}))},[g]),(0,mJ.A)(()=>{if(!a)return;let e=g;"field"===M&&null!=D&&(e=D),e!==y&&"UI"===A[e]&&"UI"===A[y]&&(e=y),e!==g&&v(e),x(e,!0)},[a]),{hasUIView:C,shouldRestoreFocus:T,layoutProps:{views:c,view:D,onViewChange:v},renderCurrentView:()=>{if(null==D)return null;let e=f[D];if(null==e)return null;let r=(0,iL.A)({},m,n,t,{views:c,timezone:p,onChange:S,view:D,onViewChange:v,focusedView:b,onFocusedViewChange:x,showViewSwitcher:k>1,timeViewsCount:k});return i?i(f,D,r):e(r)}}})({props:e,additionalViewProps:i,autoFocusView:s,fieldRef:l,propsFromPickerValue:u.viewProps,rendererInterceptor:a}),h=(({props:e,propsFromPickerValue:t,propsFromPickerViews:n,wrapperVariant:r})=>{let{orientation:i}=e,o=((e,t)=>{var n;let[r,i]=w.useState(I4);return(0,mJ.A)(()=>{let e=()=>{i(I4())};return window.addEventListener("orientationchange",e),()=>{window.removeEventListener("orientationchange",e)}},[]),(Array.isArray(n=["hours","minutes","seconds"])?!n.every(t=>-1!==e.indexOf(t)):-1===e.indexOf(n))&&"landscape"===(t||r)})(n.views,i),s=(0,fn.I)();return{layoutProps:(0,iL.A)({},n,t,{isLandscape:o,isRtl:s,wrapperVariant:r,disabled:e.disabled,readOnly:e.readOnly})}})({props:e,wrapperVariant:r,propsFromPickerValue:u.layoutProps,propsFromPickerViews:c.layoutProps}),d=function(e){let{props:t,pickerValueResponse:n}=e;return w.useMemo(()=>({value:n.viewProps.value,open:n.open,disabled:t.disabled??!1,readOnly:t.readOnly??!1}),[n.viewProps.value,n.open,t.disabled,t.readOnly])}({props:e,pickerValueResponse:u});return{open:u.open,actions:u.actions,fieldProps:u.fieldProps,renderCurrentView:c.renderCurrentView,hasUIView:c.hasUIView,shouldRestoreFocus:c.shouldRestoreFocus,layoutProps:h.layoutProps,contextValue:u.contextValue,ownerState:d}})((0,iL.A)({},r,{props:t,autoFocusView:c??!1,additionalViewProps:{},wrapperVariant:u})),f=o?.layout??Pv;return{renderPicker:()=>(0,x.jsx)(EF,{localeText:i,children:(0,x.jsx)(f,(0,iL.A)({},h,s?.layout,{slots:o,slotProps:s,sx:[...Array.isArray(l)?l:[l],...Array.isArray(s?.layout?.sx)?s.layout.sx:[s?.layout?.sx]],className:(0,C.A)(a,s?.layout?.className),ref:n,children:d()}))})}})({props:(0,iL.A)({},a,{viewRenderers:c,displayStaticWrapperAs:l,ampmInClock:u,yearsPerRow:a.yearsPerRow??("mobile"===l?3:4),slotProps:(0,iL.A)({},a.slotProps,{tabs:(0,iL.A)({hidden:"desktop"===l},a.slotProps?.tabs),toolbar:(0,iL.A)({hidden:"desktop"===l,ampmInClock:u},a.slotProps?.toolbar)})}),valueManager:RO,valueType:"date-time",validator:Pb,ref:t});return h()});Px.propTypes={ampm:E_().bool,ampmInClock:E_().bool,autoFocus:E_().bool,className:E_().string,dayOfWeekFormatter:E_().func,defaultValue:E_().object,disabled:E_().bool,disableFuture:E_().bool,disableHighlightToday:E_().bool,disableIgnoringDatePartForTimeValidation:E_().bool,disablePast:E_().bool,displayStaticWrapperAs:E_().oneOf(["desktop","mobile"]),displayWeekNumber:E_().bool,fixedWeekNumber:E_().number,loading:E_().bool,localeText:E_().object,maxDate:E_().object,maxDateTime:E_().object,maxTime:E_().object,minDate:E_().object,minDateTime:E_().object,minTime:E_().object,minutesStep:E_().number,monthsPerRow:E_().oneOf([3,4]),onAccept:E_().func,onChange:E_().func,onClose:E_().func,onError:E_().func,onMonthChange:E_().func,onViewChange:E_().func,onYearChange:E_().func,openTo:E_().oneOf(["day","hours","minutes","month","seconds","year"]),orientation:E_().oneOf(["landscape","portrait"]),readOnly:E_().bool,reduceAnimations:E_().bool,referenceDate:E_().object,renderLoading:E_().func,shouldDisableDate:E_().func,shouldDisableMonth:E_().func,shouldDisableTime:E_().func,shouldDisableYear:E_().func,showDaysOutsideCurrentMonth:E_().bool,slotProps:E_().object,slots:E_().object,sx:E_().oneOfType([E_().arrayOf(E_().oneOfType([E_().func,E_().object,E_().bool])),E_().func,E_().object]),timezone:E_().string,value:E_().object,view:E_().oneOf(["day","hours","minutes","month","seconds","year"]),viewRenderers:E_().shape({day:E_().func,hours:E_().func,minutes:E_().func,month:E_().func,seconds:E_().func,year:E_().func}),views:E_().arrayOf(E_().oneOf(["day","hours","minutes","month","seconds","year"]).isRequired),yearsOrder:E_().oneOf(["asc","desc"]),yearsPerRow:E_().oneOf([3,4])};let Pw=({utils:e,date:t,shouldRespectLeadingZeros:n,localeText:r,localizedDigits:i,now:o,token:s,startSeparator:a})=>{if(""===s)throw Error("MUI X: Should not call `commitToken` with an empty token");let l=Rf(e,s),u=RA(e,l.contentType,l.type,s),c=n?u:"digit"===l.contentType,h=null!=t&&e.isValid(t),d=h?e.formatByString(t,s):"",f=null;if(c)if(u)f=""===d?e.formatByString(o,s).length:d.length;else{if(null==l.maxLength)throw Error(`MUI X: The token ${s} should have a 'maxDigitNumber' property on it's adapter`);f=l.maxLength,h&&(d=Ry(Rx(Rv(d,i),f),i))}return(0,iL.A)({},l,{format:s,maxLength:f,value:d,placeholder:((e,t,n,r)=>{switch(n.type){case"year":return t.fieldYearPlaceholder({digitAmount:e.formatByString(e.date(void 0,"default"),r).length,format:r});case"month":return t.fieldMonthPlaceholder({contentType:n.contentType,format:r});case"day":return t.fieldDayPlaceholder({format:r});case"weekDay":return t.fieldWeekDayPlaceholder({contentType:n.contentType,format:r});case"hours":return t.fieldHoursPlaceholder({format:r});case"minutes":return t.fieldMinutesPlaceholder({format:r});case"seconds":return t.fieldSecondsPlaceholder({format:r});case"meridiem":return t.fieldMeridiemPlaceholder({format:r});default:return r}})(e,r,l,s),hasLeadingZerosInFormat:u,hasLeadingZerosInInput:c,startSeparator:a,endSeparator:"",modified:!1})},PS=e=>{let t=(({utils:e,format:t})=>{let n=10,r=t,i=e.expandFormat(t);for(;i!==r;)if(r=i,i=e.expandFormat(r),(n-=1)<0)throw Error("MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the picker component.");return i})(e);e.isRtl&&e.enableAccessibleFieldDOMStructure&&(t=t.split(" ").reverse().join(" "));let n=(({utils:e,expandedFormat:t})=>{let n=[],{start:r,end:i}=e.escapedCharacters,o=RegExp(`(\\${r}[^\\${i}]*\\${i})+`,"g"),s=null;for(;s=o.exec(t);)n.push({start:s.index,end:o.lastIndex-1});return n})((0,iL.A)({},e,{expandedFormat:t})),r=(e=>{let{utils:t,expandedFormat:n,escapedParts:r}=e,i=t.date(void 0),o=[],s="",a=Object.keys(t.formatTokenMap).sort((e,t)=>t.length-e.length),l=/^([a-zA-Z]+)/,u=RegExp(`^(${a.join("|")})*$`),c=RegExp(`^(${a.join("|")})`),h=e=>r.find(t=>t.start<=e&&t.end>=e),d=0;for(;d<n.length;){let t=h(d),r=null!=t,a=l.exec(n.slice(d))?.[1];if(!r&&null!=a&&u.test(a)){let t=a;for(;t.length>0;){let n=c.exec(t)[1];t=t.slice(n.length),o.push(Pw((0,iL.A)({},e,{now:i,token:n,startSeparator:s}))),s=""}d+=a.length}else{let e=n[d];r&&t?.start===d||t?.end===d||(0===o.length?s+=e:o[o.length-1].endSeparator+=e),d+=1}}return 0===o.length&&s.length>0&&o.push({type:"empty",contentType:"letter",maxLength:null,format:"",value:"",placeholder:"",hasLeadingZerosInFormat:!1,hasLeadingZerosInInput:!1,startSeparator:s,endSeparator:"",modified:!1}),o})((0,iL.A)({},e,{expandedFormat:t,escapedParts:n}));return(({isRtl:e,formatDensity:t,sections:n})=>n.map(n=>{let r=n=>{let r=n;return e&&null!==r&&r.includes(" ")&&(r=`\u2069${r}\u2066`),"spacious"===t&&["/",".","-"].includes(r)&&(r=` ${r} `),r};return n.startSeparator=r(n.startSeparator),n.endSeparator=r(n.endSeparator),n}))((0,iL.A)({},e,{sections:r}))},PC=e=>{let{internalProps:{disabled:t,readOnly:n=!1},forwardedProps:{sectionListRef:r,onBlur:i,onClick:o,onFocus:s,onInput:a,onPaste:l,focused:u,autoFocus:c=!1},fieldValueManager:h,applyCharacterEditing:d,resetCharacterQuery:f,setSelectedSections:p,parsedSelectedSections:m,state:g,clearActiveSection:v,clearValue:y,updateSectionValue:b,updateValueFromValueStr:x,sectionOrder:S,areAllSectionsEmpty:C,sectionsValueBoundaries:A}=e,k=w.useRef(null),M=(0,RU.A)(r,k),T=EV().localeText,D=EV().utils,E=(0,OE.A)(),[O,R]=w.useState(!1),I=w.useMemo(()=>({syncSelectionToDOM:()=>{let e;if(!k.current)return;let t=document.getSelection();if(!t)return;if(null==m){t.rangeCount>0&&k.current.getRoot().contains(t.getRangeAt(0).startContainer)&&t.removeAllRanges(),O&&k.current.getRoot().blur();return}if(!k.current.getRoot().contains(I5(document)))return;let n=new window.Range;e="all"===m?k.current.getRoot():"empty"===g.sections[m].type?k.current.getSectionContainer(m):k.current.getSectionContent(m),n.selectNodeContents(e),e.focus(),t.removeAllRanges(),t.addRange(n)},getActiveSectionIndexFromDOM:()=>{let e=I5(document);return e&&k.current&&k.current.getRoot().contains(e)?k.current.getSectionIndexFromDOMElement(e):null},focusField:(e=0)=>{if(!k.current||null!=I.getActiveSectionIndexFromDOM())return;let t=RD(e,g.sections);R(!0),k.current.getSectionContent(t).focus()},setSelectedSections:e=>{if(!k.current)return;let t=RD(e,g.sections);R(null!==("all"===t?0:t)),p(e)},isFieldFocused:()=>{let e=I5(document);return!!k.current&&k.current.getRoot().contains(e)}}),[m,p,g.sections,O]),P=(0,O_.A)(e=>{if(!k.current)return;let t=g.sections[e];k.current.getSectionContent(e).innerHTML=t.value||t.placeholder,I.syncSelectionToDOM()}),N=(0,O_.A)((e,...t)=>{!e.isDefaultPrevented()&&k.current&&(R(!0),o?.(e,...t),"all"===m?setTimeout(()=>{let e=document.getSelection().getRangeAt(0).startOffset;if(0===e)return void p(S.startIndex);let t=0,n=0;for(;n<e&&t<g.sections.length;){let e=g.sections[t];t+=1,n+=`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`.length}p(t-1)}):O?k.current.getRoot().contains(e.target)||p(S.startIndex):(R(!0),p(S.startIndex)))}),L=(0,O_.A)(e=>{if(a?.(e),!k.current||"all"!==m)return;let t=e.target.textContent??"";k.current.getRoot().innerHTML=g.sections.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),I.syncSelectionToDOM(),0===t.length||10===t.charCodeAt(0)?(f(),y(),p("all")):t.length>1?x(t):("all"===m&&p(0),d({keyPressed:t,sectionIndex:0}))}),j=(0,O_.A)(e=>{if(l?.(e),n||"all"!==m)return void e.preventDefault();let t=e.clipboardData.getData("text");e.preventDefault(),f(),x(t)}),F=(0,O_.A)((...e)=>{s?.(...e),O||!k.current||(R(!0),null==k.current.getSectionIndexFromDOMElement(I5(document))&&p(S.startIndex))}),B=(0,O_.A)((...e)=>{i?.(...e),setTimeout(()=>{if(!k.current)return;let e=I5(document);k.current.getRoot().contains(e)||(R(!1),p(null))})}),_=(0,O_.A)(e=>t=>{t.isDefaultPrevented()||p(e)}),z=(0,O_.A)(e=>{e.preventDefault()}),V=(0,O_.A)(e=>()=>{p(e)}),H=(0,O_.A)(e=>{if(e.preventDefault(),n||t||"number"!=typeof m)return;let r=g.sections[m],i=e.clipboardData.getData("text"),o=/^[a-zA-Z]+$/.test(i),s=/^[0-9]+$/.test(i),a=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(i);"letter"===r.contentType&&o||"digit"===r.contentType&&s||"digit-with-letter"===r.contentType&&a?(f(),b({activeSection:r,newSectionValue:i,shouldGoToNextSection:!0})):o||s||(f(),x(i))}),$=(0,O_.A)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="none"}),W=(0,O_.A)(e=>{if(!k.current)return;let t=e.target,r=t.textContent??"",i=k.current.getSectionIndexFromDOMElement(t),o=g.sections[i];if(n||!k.current)return void P(i);if(0===r.length){if(""===o.value)return void P(i);let t=e.nativeEvent.inputType;return"insertParagraph"===t||"insertLineBreak"===t?void P(i):(f(),void v())}d({keyPressed:r,sectionIndex:i}),P(i)});(0,mJ.A)(()=>{if(O&&k.current){if("all"===m)k.current.getRoot().focus();else if("number"==typeof m){let e=k.current.getSectionContent(m);e&&e.focus()}}},[m,O]);let U=w.useMemo(()=>g.sections.reduce((e,t)=>(e[t.type]=A[t.type]({currentDate:null,contentType:t.contentType,format:t.format}),e),{}),[A,g.sections]),q="all"===m,G=w.useMemo(()=>g.sections.map((e,r)=>{let i=!q&&!t&&!n;return{container:{"data-sectionindex":r,onClick:_(r)},content:{tabIndex:q||r>0?-1:0,contentEditable:!q&&!t&&!n,role:"spinbutton",id:`${E}-${e.type}`,"aria-labelledby":`${E}-${e.type}`,"aria-readonly":n,"aria-valuenow":((e,t)=>{if(e.value)switch(e.type){case"weekDay":if("letter"===e.contentType)return;return Number(e.value);case"meridiem":{let n=t.parse(`01:00 ${e.value}`,`${t.formats.hours12h}:${t.formats.minutes} ${e.format}`);if(n)return+(t.getHours(n)>=12);return}case"day":return"digit-with-letter"===e.contentType?parseInt(e.value,10):Number(e.value);case"month":{if("digit"===e.contentType)return Number(e.value);let n=t.parse(e.value,e.format);return n?t.getMonth(n)+1:void 0}default:return"letter"!==e.contentType?Number(e.value):void 0}})(e,D),"aria-valuemin":U[e.type].minimum,"aria-valuemax":U[e.type].maximum,"aria-valuetext":e.value?((e,t)=>{if(e.value)switch(e.type){case"month":{if("digit"===e.contentType)return t.format(t.setMonth(t.date(),Number(e.value)-1),"month");let n=t.parse(e.value,e.format);return n?t.format(n,"month"):void 0}case"day":return"digit"===e.contentType?t.format(t.setDate(t.startOfYear(t.date()),Number(e.value)),"dayOfMonthFull"):e.value;default:return}})(e,D):T.empty,"aria-label":T[e.type],"aria-disabled":t,spellCheck:!i&&void 0,autoCapitalize:i?"off":void 0,autoCorrect:i?"off":void 0,[parseInt(w.version,10)>=17?"enterKeyHint":"enterkeyhint"]:i?"next":void 0,children:e.value||e.placeholder,onInput:W,onPaste:H,onFocus:V(r),onDragOver:$,onMouseUp:z,inputMode:"letter"===e.contentType?"text":"numeric"},before:{children:e.startSeparator},after:{children:e.endSeparator}}}),[g.sections,V,H,$,W,_,z,t,n,q,T,D,U,E]),Y=(0,O_.A)(e=>{x(e.target.value)}),K=w.useMemo(()=>C?"":h.getV7HiddenInputValueFromSections(g.sections),[C,g.sections,h]);return w.useEffect(()=>{if(null==k.current)throw Error("MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`\nYou probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.\n\nIf you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:\n\n<DatePicker slots={{ textField: MyCustomTextField }} />\n\nLearn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element");c&&k.current&&k.current.getSectionContent(S.startIndex).focus()},[]),{interactions:I,returnedValue:{autoFocus:c,readOnly:n,focused:u??O,sectionListRef:M,onBlur:B,onClick:N,onFocus:F,onInput:L,onPaste:j,enableAccessibleFieldDOMStructure:!0,elements:G,tabIndex:0===m?-1:0,contentEditable:q,value:K,onChange:Y,areAllSectionsEmpty:C}}},PA=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),Pk=e=>{let t=(0,fn.I)(),n=w.useRef(void 0),r=w.useRef(void 0),{forwardedProps:{onFocus:i,onClick:o,onPaste:s,onBlur:a,inputRef:l,placeholder:u},internalProps:{readOnly:c=!1,disabled:h=!1},parsedSelectedSections:d,activeSectionIndex:f,state:p,fieldValueManager:m,valueManager:g,applyCharacterEditing:v,resetCharacterQuery:y,updateSectionValue:b,updateValueFromValueStr:x,clearActiveSection:S,clearValue:C,setTempAndroidValueStr:A,setSelectedSections:k,getSectionsFromValue:M,areAllSectionsEmpty:T,localizedDigits:D}=e,E=w.useRef(null),O=(0,RU.A)(l,E),R=w.useMemo(()=>((e,t,n)=>{let r=0,i=+!!n,o=[];for(let s=0;s<e.length;s+=1){let a=e[s],l=RS(a,n?"input-rtl":"input-ltr",t),u=`${a.startSeparator}${l}${a.endSeparator}`,c=PA(u).length,h=u.length,d=PA(l),f=i+(""===d?0:l.indexOf(d[0]))+a.startSeparator.length,p=f+d.length;o.push((0,iL.A)({},a,{start:r,end:r+c,startInInput:f,endInInput:p})),r+=c,i+=h}return o})(p.sections,D,t),[p.sections,D,t]),I=w.useMemo(()=>({syncSelectionToDOM:()=>{if(!E.current)return;if(null==d){E.current.scrollLeft&&(E.current.scrollLeft=0);return}if(E.current!==I5(document))return;let e=E.current.scrollTop;if("all"===d)E.current.select();else{let e=R[d],t="empty"===e.type?e.startInInput-e.startSeparator.length:e.startInInput,n="empty"===e.type?e.endInInput+e.endSeparator.length:e.endInInput;(t!==E.current.selectionStart||n!==E.current.selectionEnd)&&E.current===I5(document)&&E.current.setSelectionRange(t,n),clearTimeout(r.current),r.current=setTimeout(()=>{E.current&&E.current===I5(document)&&E.current.selectionStart===E.current.selectionEnd&&(E.current.selectionStart!==t||E.current.selectionEnd!==n)&&I.syncSelectionToDOM()})}E.current.scrollTop=e},getActiveSectionIndexFromDOM:()=>{let e=E.current.selectionStart??0,t=E.current.selectionEnd??0;if(0===e&&0===t)return null;let n=e<=R[0].startInInput?1:R.findIndex(t=>t.startInInput-t.startSeparator.length>e);return -1===n?R.length-1:n-1},focusField:(e=0)=>{I5(document)!==E.current&&(E.current?.focus(),k(e))},setSelectedSections:e=>k(e),isFieldFocused:()=>E.current===I5(document)}),[E,d,R,k]),P=()=>{let e,t=E.current.selectionStart??0;k(-1===(e=t<=R[0].startInInput||t>=R[R.length-1].endInInput?1:R.findIndex(e=>e.startInInput-e.startSeparator.length>t))?R.length-1:e-1)},N=(0,O_.A)((...e)=>{i?.(...e);let t=E.current;clearTimeout(n.current),n.current=setTimeout(()=>{t&&t===E.current&&null==f&&(t.value.length&&Number(t.selectionEnd)-Number(t.selectionStart)===t.value.length?k("all"):P())})}),L=(0,O_.A)((e,...t)=>{e.isDefaultPrevented()||(o?.(e,...t),P())}),j=(0,O_.A)(e=>{if(s?.(e),e.preventDefault(),c||h)return;let t=e.clipboardData.getData("text");if("number"==typeof d){let e=p.sections[d],n=/^[a-zA-Z]+$/.test(t),r=/^[0-9]+$/.test(t),i=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(t);if("letter"===e.contentType&&n||"digit"===e.contentType&&r||"digit-with-letter"===e.contentType&&i){y(),b({activeSection:e,newSectionValue:t,shouldGoToNextSection:!0});return}if(n||r)return}y(),x(t)}),F=(0,O_.A)((...e)=>{a?.(...e),k(null)}),B=(0,O_.A)(e=>{let n;if(c)return;let r=e.target.value;if(""===r){y(),C();return}let i=e.nativeEvent.data,o=i&&i.length>1,s=o?i:r,a=PA(s);if("all"===d&&k(f),null==f||o)return void x(o?i:a);if("all"===d&&1===a.length)n=a;else{let e=PA(m.getV6InputValueFromSections(R,D,t)),r=-1,i=-1;for(let t=0;t<e.length;t+=1)-1===r&&e[t]!==a[t]&&(r=t),-1===i&&e[e.length-t-1]!==a[a.length-t-1]&&(i=t);let o=R[f];if(r<o.start||e.length-i-1>o.end)return;let s=a.length-e.length+o.end-PA(o.endSeparator||"").length;n=a.slice(o.start+PA(o.startSeparator||"").length,s)}if(0===n.length){navigator.userAgent.toLowerCase().includes("android")&&A(s),y(),S();return}v({keyPressed:n,sectionIndex:f})}),_=w.useMemo(()=>void 0!==u?u:m.getV6InputValueFromSections(M(g.emptyValue),D,t),[u,m,M,g.emptyValue,D,t]),z=w.useMemo(()=>p.tempValueStrAndroid??m.getV6InputValueFromSections(p.sections,D,t),[p.sections,m,p.tempValueStrAndroid,D,t]);return w.useEffect(()=>(E.current&&E.current===I5(document)&&k("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]),{interactions:I,returnedValue:{readOnly:c,onBlur:F,onClick:L,onFocus:N,onPaste:j,inputRef:O,enableAccessibleFieldDOMStructure:!1,placeholder:_,inputMode:w.useMemo(()=>null==f||"letter"===p.sections[f].contentType?"text":"numeric",[f,p.sections]),autoComplete:"off",value:!(E.current&&E.current===I5(document))&&T?"":z,onChange:B}}},PM=["disablePast","disableFuture","minDate","maxDate","shouldDisableDate","shouldDisableMonth","shouldDisableYear"],PT=["disablePast","disableFuture","minTime","maxTime","shouldDisableTime","minutesStep","ampm","disableIgnoringDatePartForTimeValidation"],PD=["minDateTime","maxDateTime"];[...PM,...PT,...PD];let PE=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],PO=["clearable","onClear","InputProps","sx","slots","slotProps"],PR=["ownerState"];var PI=n(54227),PP=n(75472);function PN(e){return(0,P.Ay)("MuiPickersTextField",e)}(0,I.A)("MuiPickersTextField",["root","focused","disabled","error","required"]);var PL=n(42872);function Pj(e){return(0,P.Ay)("MuiPickersInputBase",e)}let PF=(0,I.A)("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function PB(e){return(0,P.Ay)("MuiPickersOutlinedInput",e)}let P_=(0,iL.A)({},PF,(0,I.A)("MuiPickersOutlinedInput",["root","notchedOutline","input"])),Pz=["children","className","label","notched","shrink"],PV=(0,D.A)("fieldset",{name:"MuiPickersOutlinedInput",slot:"NotchedOutline",overridesResolver:(e,t)=>t.notchedOutline})(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%",borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}}),PH=(0,D.A)("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),P$=(0,D.A)("legend")(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:{withLabel:!1},style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:{withLabel:!0},style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:{withLabel:!0,notched:!0},style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]}));function PW(e){let{className:t,label:n}=e,r=(0,k1.A)(e,Pz),i=null!=n&&""!==n,o=(0,iL.A)({},e,{withLabel:i});return(0,x.jsx)(PV,(0,iL.A)({"aria-hidden":!0,className:t},r,{ownerState:o,children:(0,x.jsx)(P$,{ownerState:o,children:i?(0,x.jsx)(PH,{children:n}):(0,x.jsx)(PH,{className:"notranslate",children:"​"})})}))}var PU=n(85235);function Pq(e){return(0,P.Ay)("MuiPickersSectionList",e)}let PG=(0,I.A)("MuiPickersSectionList",["root","section","sectionContent"]),PY=["slots","slotProps","elements","sectionListRef"],PK=(0,D.A)("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),PZ=(0,D.A)("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),PX=(0,D.A)("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),PQ=(0,D.A)("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"});function PJ(e){let{slots:t,slotProps:n,element:r,classes:i}=e,o=t?.section??PZ,s=(0,OO.A)({elementType:o,externalSlotProps:n?.section,externalForwardedProps:r.container,className:i.section,ownerState:{}}),a=t?.sectionContent??PQ,l=(0,OO.A)({elementType:a,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:i.sectionContent,ownerState:{}}),u=t?.sectionSeparator??PX,c=(0,OO.A)({elementType:u,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),h=(0,OO.A)({elementType:u,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return(0,x.jsxs)(o,(0,iL.A)({},s,{children:[(0,x.jsx)(u,(0,iL.A)({},c)),(0,x.jsx)(a,(0,iL.A)({},l)),(0,x.jsx)(u,(0,iL.A)({},h))]}))}let P0=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:i,elements:o,sectionListRef:s}=n,a=(0,k1.A)(n,PY),l=(e=>{let{classes:t}=e;return(0,A.A)({root:["root"],section:["section"],sectionContent:["sectionContent"]},Pq,t)})(n),u=w.useRef(null),c=(0,RU.A)(t,u),h=e=>{if(!u.current)throw Error(`MUI X: Cannot call sectionListRef.${e} before the mount of the component.`);return u.current};w.useImperativeHandle(s,()=>({getRoot:()=>h("getRoot"),getSectionContainer:e=>h("getSectionContainer").querySelector(`.${PG.section}[data-sectionindex="${e}"]`),getSectionContent:e=>h("getSectionContent").querySelector(`.${PG.section}[data-sectionindex="${e}"] .${PG.sectionContent}`),getSectionIndexFromDOMElement(e){let t=h("getSectionIndexFromDOMElement");if(null==e||!t.contains(e))return null;let n=null;return(e.classList.contains(PG.section)?n=e:e.classList.contains(PG.sectionContent)&&(n=e.parentElement),null==n)?null:Number(n.dataset.sectionindex)}}));let d=r?.root??PK,f=(0,OO.A)({elementType:d,externalSlotProps:i?.root,externalForwardedProps:a,additionalProps:{ref:c,suppressContentEditableWarning:!0},className:l.root,ownerState:{}});return(0,x.jsx)(d,(0,iL.A)({},f,{children:f.contentEditable?o.map(({content:e,before:t,after:n})=>`${t.children}${e.children}${n.children}`).join(""):(0,x.jsx)(w.Fragment,{children:o.map((e,t)=>(0,x.jsx)(PJ,{slots:r,slotProps:i,element:e,classes:l},t))})}))}),P1=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],P2=(0,D.A)("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>(0,iL.A)({},e.typography.body1,{color:(e.vars||e).palette.text.primary,cursor:"text",padding:0,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",boxSizing:"border-box",letterSpacing:`${Math.round(.15/16*1e5)/1e5}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),P5=(0,D.A)(PK,{name:"MuiPickersInputBase",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})(({theme:e})=>({padding:"4px 0 5px",fontFamily:e.typography.fontFamily,fontSize:"inherit",lineHeight:"1.4375em",flexGrow:1,outline:"none",display:"flex",flexWrap:"nowrap",overflow:"hidden",letterSpacing:"inherit",width:"182px",variants:[{props:{isRtl:!0},style:{textAlign:"right /*! @noflip */"}},{props:{size:"small"},style:{paddingTop:1}},{props:{adornedStart:!1,focused:!1,filled:!1},style:{color:"currentColor",opacity:0}},{props:({adornedStart:e,focused:t,filled:n,label:r})=>!e&&!t&&!n&&null==r,style:e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:"light"===e.palette.mode?.42:.5}}]})),P4=(0,D.A)(PZ,{name:"MuiPickersInputBase",slot:"Section",overridesResolver:(e,t)=>t.section})(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit",letterSpacing:"inherit",lineHeight:"1.4375em",display:"inline-block",whiteSpace:"nowrap"})),P3=(0,D.A)(PQ,{name:"MuiPickersInputBase",slot:"SectionContent",overridesResolver:(e,t)=>t.content})(({theme:e})=>({fontFamily:e.typography.fontFamily,lineHeight:"1.4375em",letterSpacing:"inherit",width:"fit-content",outline:"none"})),P6=(0,D.A)(PX,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),P8=(0,D.A)("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})((0,iL.A)({},{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"})),P9=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:i,value:o,onChange:s,id:a,endAdornment:l,startAdornment:u,renderSuffix:c,slots:h,slotProps:d,contentEditable:f,tabIndex:p,onInput:m,onPaste:g,onKeyDown:v,name:y,readOnly:b,inputProps:S,inputRef:C,sectionListRef:k}=n,M=(0,k1.A)(n,P1),T=w.useRef(null),D=(0,RU.A)(t,T),E=(0,RU.A)(S?.ref,C),O=(0,fn.I)(),R=(0,PL.A)();if(!R)throw Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");w.useEffect(()=>{R&&R.setAdornedStart(!!u)},[R,u]),w.useEffect(()=>{R&&(i?R.onEmpty():R.onFilled())},[R,i]);let I=(0,iL.A)({},n,R,{isRtl:O}),P=(e=>{let{focused:t,disabled:n,error:r,classes:i,fullWidth:o,readOnly:s,color:a,size:l,endAdornment:u,startAdornment:c}=e,h={root:["root",t&&!n&&"focused",n&&"disabled",s&&"readOnly",r&&"error",o&&"fullWidth",`color${(0,PU.A)(a)}`,"small"===l&&"inputSizeSmall",!!c&&"adornedStart",!!u&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return(0,A.A)(h,Pj,i)})(I),N=h?.root||P2,L=(0,OO.A)({elementType:N,externalSlotProps:d?.root,externalForwardedProps:M,additionalProps:{"aria-invalid":R.error,ref:D},className:P.root,ownerState:I}),j=h?.input||P5;return(0,x.jsxs)(N,(0,iL.A)({},L,{children:[u,(0,x.jsx)(P0,{sectionListRef:k,elements:r,contentEditable:f,tabIndex:p,className:P.sectionsContainer,onFocus:e=>{R.disabled?e.stopPropagation():R.onFocus?.(e)},onBlur:R.onBlur,onInput:m,onPaste:g,onKeyDown:v,slots:{root:j,section:P4,sectionContent:P3,sectionSeparator:P6},slotProps:{root:{ownerState:I},sectionContent:{className:PF.sectionContent},sectionSeparator:({position:e})=>({className:"before"===e?PF.sectionBefore:PF.sectionAfter})}}),l,c?c((0,iL.A)({},R)):null,(0,x.jsx)(P8,(0,iL.A)({name:y,className:P.input,value:o,onChange:s,id:a,"aria-hidden":"true",tabIndex:-1,readOnly:b,required:R.required,disabled:R.disabled},S,{ref:E}))]}))}),P7=["label","autoFocus","ownerState","notched"],Ne=(0,D.A)(P2,{name:"MuiPickersOutlinedInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{padding:"0 14px",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${P_.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${P_.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${P_.focused} .${P_.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${P_.disabled}`]:{[`& .${P_.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${P_.error} .${P_.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},variants:Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t]?.main??!1).map(t=>({props:{color:t},style:{[`&.${P_.focused}:not(.${P_.error}) .${P_.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}}))}}),Nt=(0,D.A)(P5,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),Nn=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:i,notched:o}=n,s=(0,k1.A)(n,P7),a=(0,PL.A)(),l=(0,iL.A)({},n,i,a,{color:a?.color||"primary"}),u=(e=>{let{classes:t}=e,n=(0,A.A)({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},PB,t);return(0,iL.A)({},t,n)})(l);return(0,x.jsx)(P9,(0,iL.A)({slots:{root:Ne,input:Nt},renderSuffix:e=>(0,x.jsx)(PW,{shrink:!!(o||e.adornedStart||e.focused||e.filled),notched:!!(o||e.adornedStart||e.focused||e.filled),className:u.notchedOutline,label:null!=r&&""!==r&&a?.required?(0,x.jsxs)(w.Fragment,{children:[r," ","*"]}):r,ownerState:l})},s,{label:r,classes:u,ref:t}))});Nn.muiName="Input";var Nr=n(57867);function Ni(e){return(0,P.Ay)("MuiPickersFilledInput",e)}let No=(0,iL.A)({},PF,(0,I.A)("MuiPickersFilledInput",["root","underline","input"])),Ns=["label","autoFocus","disableUnderline","ownerState"],Na=(0,D.A)(P2,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>(0,Nr.MC)(e)&&"disableUnderline"!==e})(({theme:e})=>{let t="light"===e.palette.mode,n=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)";return{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)","@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n}},[`&.${No.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n},[`&.${No.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)"},variants:[...Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t].main).map(t=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${No.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${No.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`:t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)"}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${No.disabled}, .${No.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${No.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:e})=>!!e,style:{paddingLeft:12}},{props:({endAdornment:e})=>!!e,style:{paddingRight:12}}]}}),Nl=(0,D.A)(P5,{name:"MuiPickersFilledInput",slot:"sectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({startAdornment:e})=>!!e,style:{paddingLeft:0}},{props:({endAdornment:e})=>!!e,style:{paddingRight:0}},{props:{hiddenLabel:!0},style:{paddingTop:16,paddingBottom:17}},{props:{hiddenLabel:!0,size:"small"},style:{paddingTop:8,paddingBottom:9}}]}),Nu=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:i=!1,ownerState:o}=n,s=(0,k1.A)(n,Ns),a=(0,PL.A)(),l=(e=>{let{classes:t,disableUnderline:n}=e,r=(0,A.A)({root:["root",!n&&"underline"],input:["input"]},Ni,t);return(0,iL.A)({},t,r)})((0,iL.A)({},n,o,a,{color:a?.color||"primary"}));return(0,x.jsx)(P9,(0,iL.A)({slots:{root:Na,input:Nl},slotProps:{root:{disableUnderline:i}}},s,{label:r,classes:l,ref:t}))});function Nc(e){return(0,P.Ay)("MuiPickersFilledInput",e)}Nu.muiName="Input";let Nh=(0,iL.A)({},PF,(0,I.A)("MuiPickersInput",["root","input"])),Nd=["label","autoFocus","disableUnderline","ownerState"],Nf=(0,D.A)(P2,{name:"MuiPickersInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(t=`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t].main).map(t=>({props:{color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{background:"red",left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Nh.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Nh.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Nh.disabled}, .${Nh.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${Nh.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),Np=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:i=!1,ownerState:o}=n,s=(0,k1.A)(n,Nd),a=(0,PL.A)(),l=(e=>{let{classes:t,disableUnderline:n}=e,r=(0,A.A)({root:["root",!n&&"underline"],input:["input"]},Nc,t);return(0,iL.A)({},t,r)})((0,iL.A)({},n,o,a,{disableUnderline:i,color:a?.color||"primary"}));return(0,x.jsx)(P9,(0,iL.A)({slots:{root:Nf}},s,{label:r,classes:l,ref:t}))});Np.muiName="Input";let Nm=["onFocus","onBlur","className","color","disabled","error","variant","required","InputProps","inputProps","inputRef","sectionListRef","elements","areAllSectionsEmpty","onClick","onKeyDown","onKeyUp","onPaste","onInput","endAdornment","startAdornment","tabIndex","contentEditable","focused","value","onChange","fullWidth","id","name","helperText","FormHelperTextProps","label","InputLabelProps"],Ng={standard:Np,filled:Nu,outlined:Nn},Nv=(0,D.A)(p$.A,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({maxWidth:"100%"}),Ny=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:i,className:o,color:s="primary",disabled:a=!1,error:l=!1,variant:u="outlined",required:c=!1,InputProps:h,inputProps:d,inputRef:f,sectionListRef:p,elements:m,areAllSectionsEmpty:g,onClick:v,onKeyDown:y,onKeyUp:b,onPaste:S,onInput:k,endAdornment:M,startAdornment:T,tabIndex:D,contentEditable:E,focused:O,value:R,onChange:I,fullWidth:P,id:N,name:L,helperText:j,FormHelperTextProps:F,label:B,InputLabelProps:_}=n,z=(0,k1.A)(n,Nm),V=w.useRef(null),H=(0,RU.A)(t,V),$=(0,OE.A)(N),W=j&&$?`${$}-helper-text`:void 0,U=B&&$?`${$}-label`:void 0,q=(0,iL.A)({},n,{color:s,disabled:a,error:l,focused:O,required:c,variant:u}),G=(e=>{let{focused:t,disabled:n,classes:r,required:i}=e;return(0,A.A)({root:["root",t&&!n&&"focused",n&&"disabled",i&&"required"]},PN,r)})(q),Y=Ng[u];return(0,x.jsxs)(Nv,(0,iL.A)({className:(0,C.A)(G.root,o),ref:H,focused:O,onFocus:r,onBlur:i,disabled:a,variant:u,error:l,color:s,fullWidth:P,required:c,ownerState:q},z,{children:[(0,x.jsx)(PI.A,(0,iL.A)({htmlFor:$,id:U},_,{children:B})),(0,x.jsx)(Y,(0,iL.A)({elements:m,areAllSectionsEmpty:g,onClick:v,onKeyDown:y,onKeyUp:b,onInput:k,onPaste:S,endAdornment:M,startAdornment:T,tabIndex:D,contentEditable:E,value:R,onChange:I,id:$,fullWidth:P,inputProps:d,inputRef:f,sectionListRef:p,label:B,name:L,role:"group","aria-labelledby":U,"aria-describedby":W,"aria-live":W?"polite":void 0},h)),j&&(0,x.jsx)(PP.A,(0,iL.A)({id:W},F,{children:j}))]}))}),Nb=["enableAccessibleFieldDOMStructure"],Nx=["InputProps","readOnly"],Nw=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],NS=["slots","slotProps","InputProps","inputProps"],NC=w.forwardRef(function(e,t){let n=EN({props:e,name:"MuiDateTimeField"}),{slots:r,slotProps:i,InputProps:o,inputProps:s}=n,a=(0,k1.A)(n,NS),l=r?.textField??(e.enableAccessibleFieldDOMStructure?Ny:W.A),u=(0,OO.A)({elementType:l,externalSlotProps:i?.textField,externalForwardedProps:a,ownerState:n,additionalProps:{ref:t}});u.inputProps=(0,iL.A)({},s,u.inputProps),u.InputProps=(0,iL.A)({},o,u.InputProps);let c=(e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=(0,k1.A)(e,Nb);if(t){let{InputProps:e,readOnly:t}=n,r=(0,k1.A)(n,Nx);return(0,iL.A)({},r,{InputProps:(0,iL.A)({},e??{},{readOnly:t})})}let{onPaste:r,onKeyDown:i,inputMode:o,readOnly:s,InputProps:a,inputProps:l,inputRef:u}=n,c=(0,k1.A)(n,Nw);return(0,iL.A)({},c,{InputProps:(0,iL.A)({},a??{},{readOnly:s}),inputProps:(0,iL.A)({},l??{},{inputMode:o,onPaste:r,onKeyDown:i,ref:u})})})((e=>{let t,n,r,i,o,{forwardedProps:s,internalProps:a}=(t=EV().utils,n=EV().defaultDates,r=e.ampm??t.is12HourCycleInCurrentLocale()?t.formats.keyboardDateTime12h:t.formats.keyboardDateTime24h,i=(0,iL.A)({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??r,disableIgnoringDatePartForTimeValidation:!!(e.minDateTime||e.maxDateTime),minDate:EU(t,e.minDateTime??e.minDate,n.minDate),maxDate:EU(t,e.maxDateTime??e.maxDate,n.maxDate),minTime:e.minDateTime??e.minTime,maxTime:e.maxDateTime??e.maxTime}),o="date-time",w.useMemo(()=>{let e=(0,iL.A)({},i),t={},n=n=>{e.hasOwnProperty(n)&&(t[n]=e[n],delete e[n])};return PE.forEach(n),PM.forEach(n),PT.forEach(n),PD.forEach(n),{forwardedProps:e,internalProps:t}},[i,o]));return(e=>{let t=EV().utils,{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:i,enableAccessibleFieldDOMStructure:o=!1,disabled:s=!1,readOnly:a=!1},forwardedProps:{onKeyDown:l,error:u,clearable:c,onClear:h},fieldValueManager:d,valueManager:f,validator:p}=e,m=(0,fn.I)(),g=(e=>{let t=EV().utils,n=EV().localeText,r=EV(),i=(0,fn.I)(),{valueManager:o,fieldValueManager:s,valueType:a,validator:l,internalProps:u,internalProps:{value:c,defaultValue:h,referenceDate:d,onChange:f,format:p,formatDensity:m="dense",selectedSections:g,onSelectedSectionsChange:v,shouldRespectLeadingZeros:y=!1,timezone:b,enableAccessibleFieldDOMStructure:x=!1}}=e,{timezone:S,value:C,handleValueChange:A}=Ru({timezone:b,value:c,defaultValue:h,referenceDate:d,onChange:f,valueManager:o}),k=w.useMemo(()=>{let e;return e=t.date(void 0),"0"===t.formatByString(t.setSeconds(e,0),"s")?Rg:Array.from({length:10}).map((n,r)=>t.formatByString(t.setSeconds(e,r),"s"))},[t]),M=w.useMemo(()=>((e,t,n)=>{let r=e.date(void 0,n),i=e.endOfYear(r),o=e.endOfDay(r),{maxDaysInMonth:s,longestMonth:a}=Eq(e,r).reduce((t,n)=>{let r=e.getDaysInMonth(n);return r>t.maxDaysInMonth?{maxDaysInMonth:r,longestMonth:n}:t},{maxDaysInMonth:0,longestMonth:null});return{year:({format:t})=>({minimum:0,maximum:4===e.formatByString(e.date(void 0,"system"),t).length?9999:99}),month:()=>({minimum:1,maximum:e.getMonth(i)+1}),day:({currentDate:t})=>({minimum:1,maximum:null!=t&&e.isValid(t)?e.getDaysInMonth(t):s,longestMonth:a}),weekDay:({format:t,contentType:n})=>{if("digit"===n){let n=Rp(e,t).map(Number);return{minimum:Math.min(...n),maximum:Math.max(...n)}}return{minimum:1,maximum:7}},hours:({format:n})=>{let i=e.getHours(o);return Rv(e.formatByString(e.endOfDay(r),n),t)!==i.toString()?{minimum:1,maximum:Number(Rv(e.formatByString(e.startOfDay(r),n),t))}:{minimum:0,maximum:i}},minutes:()=>({minimum:0,maximum:e.getMinutes(o)}),seconds:()=>({minimum:0,maximum:e.getSeconds(o)}),meridiem:()=>({minimum:0,maximum:1}),empty:()=>({minimum:0,maximum:0})}})(t,k,S),[t,k,S]),T=w.useCallback((e,r=null)=>s.getSectionsFromValue(t,e,r,e=>PS({utils:t,localeText:n,localizedDigits:k,format:p,date:e,formatDensity:m,shouldRespectLeadingZeros:y,enableAccessibleFieldDOMStructure:x,isRtl:i})),[s,p,n,k,i,y,t,m,x]),[D,E]=w.useState(()=>{let e=T(C);Rk(e,a);let n={sections:e,value:C,referenceValue:o.emptyValue,tempValueStrAndroid:null},r=Math.max(...e.map(e=>Rh[e.type]??1)),i=o.getInitialReferenceValue({referenceDate:d,value:C,utils:t,props:u,granularity:r,timezone:S});return(0,iL.A)({},n,{referenceValue:i})}),[O,R]=(0,Oz.A)({controlled:g,default:null,name:"useField",state:"selectedSections"}),I=e=>{R(e),v?.(e)},P=w.useMemo(()=>RD(O,D.sections),[O,D.sections]),N="all"===P?0:P,L=({value:e,referenceValue:n,sections:i})=>{if(E(t=>(0,iL.A)({},t,{sections:i,value:e,referenceValue:n,tempValueStrAndroid:null})),o.areValuesEqual(t,D.value,e))return;let s={validationError:l({adapter:r,value:e,timezone:S,props:u})};A(e,s)},j=(e,t)=>{let n=[...D.sections];return n[e]=(0,iL.A)({},n[e],{value:t,modified:!0}),n};return w.useEffect(()=>{let e=T(D.value);Rk(e,a),E(t=>(0,iL.A)({},t,{sections:e}))},[p,t.locale,i]),w.useEffect(()=>{o.areValuesEqual(t,D.value,C)&&o.getTimezone(t,D.value)===o.getTimezone(t,C)||E(e=>(0,iL.A)({},e,{value:C,referenceValue:s.updateReferenceValue(t,C,e.referenceValue),sections:T(C)}))},[C]),{state:D,activeSectionIndex:N,parsedSelectedSections:P,setSelectedSections:I,clearValue:()=>{L({value:o.emptyValue,referenceValue:D.referenceValue,sections:T(o.emptyValue)})},clearActiveSection:()=>{if(null==N)return;let e=D.sections[N],n=s.getActiveDateManager(t,D,e),r=n.getSections(D.sections).filter(e=>""!==e.value).length===+(""!==e.value),i=j(N,""),o=r?null:t.getInvalidDate(),a=n.getNewValuesFromNewActiveDate(o);L((0,iL.A)({},a,{sections:i}))},updateSectionValue:({activeSection:e,newSectionValue:n,shouldGoToNextSection:r})=>{let i,o;r&&N<D.sections.length-1&&I(N+1);let a=s.getActiveDateManager(t,D,e),l=j(N,n),u=a.getSections(l),c=((e,t,n)=>{let r=t.some(e=>"day"===e.type),i=[],o=[];for(let e=0;e<t.length;e+=1){let s=t[e];r&&"weekDay"===s.type||(i.push(s.format),o.push(RS(s,"non-input",n)))}let s=i.join(" "),a=o.join(" ");return e.parse(a,s)})(t,u,k);if(null!=c&&t.isValid(c)){let e=RT(t,c,u,a.referenceDate,!0);i=a.getNewValuesFromNewActiveDate(e),o=!0}else i=a.getNewValuesFromNewActiveDate(c),o=(null!=c&&!t.isValid(c))!=(null!=a.date&&!t.isValid(a.date));return o?L((0,iL.A)({},i,{sections:l})):E(e=>(0,iL.A)({},e,i,{sections:l,tempValueStrAndroid:null}))},updateValueFromValueStr:e=>{let r=s.parseValueStr(e,D.referenceValue,(e,r)=>{let o=t.parse(e,p);if(null==o||!t.isValid(o))return null;let s=PS({utils:t,localeText:n,localizedDigits:k,format:p,date:o,formatDensity:m,shouldRespectLeadingZeros:y,enableAccessibleFieldDOMStructure:x,isRtl:i});return RT(t,o,s,r,!1)}),o=s.updateReferenceValue(t,r,D.referenceValue);L({value:r,referenceValue:o,sections:T(r,D.sections)})},setTempAndroidValueStr:e=>E(t=>(0,iL.A)({},t,{tempValueStrAndroid:e})),getSectionsFromValue:T,sectionsValueBoundaries:M,localizedDigits:k,timezone:S}})(e),{state:v,activeSectionIndex:y,parsedSelectedSections:b,setSelectedSections:x,clearValue:S,clearActiveSection:C,updateSectionValue:A,setTempAndroidValueStr:k,sectionsValueBoundaries:M,localizedDigits:T,timezone:D}=g,E=(({sections:e,updateSectionValue:t,sectionsValueBoundaries:n,localizedDigits:r,setTempAndroidValueStr:i,timezone:o})=>{let s=EV().utils,[a,l]=w.useState(null),u=(0,O_.A)(()=>l(null));w.useEffect(()=>{null!=a&&e[a.sectionIndex]?.type!==a.sectionType&&u()},[e,a,u]),w.useEffect(()=>{if(null!=a){let e=setTimeout(()=>u(),5e3);return()=>{clearTimeout(e)}}return()=>{}},[a,u]);let c=({keyPressed:t,sectionIndex:n},r,i)=>{let o=t.toLowerCase(),s=e[n];if(null!=a&&(!i||i(a.value))&&a.sectionIndex===n){let e=`${a.value}${o}`,t=r(e,s);if(null==t.saveQuery)return l({sectionIndex:n,value:e,sectionType:s.type}),t}let c=r(o,s);return null==c.saveQuery||c.saveQuery?(l({sectionIndex:n,value:o,sectionType:s.type}),null!=c.saveQuery?null:c):(u(),null)};return{applyCharacterEditing:(0,O_.A)(a=>{var l;let u,h,d,f=e[a.sectionIndex],p=Rb(a.keyPressed,r)?(l=(0,iL.A)({},a,{keyPressed:Ry(a.keyPressed,r)}),u=(e,t)=>{let i=Rv(e,r),o=Number(i),a=n[t.type]({currentDate:null,format:t.format,contentType:t.contentType});if(o>a.maximum)return{saveQuery:!1};if(o<a.minimum)return{saveQuery:!0};let l=10*o>a.maximum||i.length===a.maximum.toString().length;return{sectionValue:Rw(s,o,a,r,t),shouldGoToNextSection:l}},c(l,(e,t)=>{if("digit"===t.contentType||"digit-with-letter"===t.contentType)return u(e,t);if("month"===t.type){let n=RA(s,"digit","month","MM"),r=u(e,{type:t.type,format:"MM",hasLeadingZerosInFormat:n,hasLeadingZerosInInput:!0,contentType:"digit",maxLength:2});if(null!=r.saveQuery)return r;let i=RC(s,r.sectionValue,"MM",t.format);return(0,iL.A)({},r,{sectionValue:i})}if("weekDay"===t.type){let n=u(e,t);if(null!=n.saveQuery)return n;let r=Rp(s,t.format)[Number(n.sectionValue)-1];return(0,iL.A)({},n,{sectionValue:r})}return{saveQuery:!1}},e=>Rb(e,r))):(h=(e,t,n)=>{let r=t.filter(e=>e.toLowerCase().startsWith(n));return 0===r.length?{saveQuery:!1}:{sectionValue:r[0],shouldGoToNextSection:1===r.length}},d=(e,t,n,r)=>{let i=e=>Rm(s,o,t.type,e);if("letter"===t.contentType)return h(t.format,i(t.format),e);if(n&&null!=r&&"letter"===Rf(s,n).contentType){let t=i(n),o=h(n,t,e);return null!=o.saveQuery?{saveQuery:!1}:(0,iL.A)({},o,{sectionValue:r(o.sectionValue,t)})}return{saveQuery:!1}},c(a,(e,t)=>{switch(t.type){case"month":return d(e,t,s.formats.month,e=>RC(s,e,s.formats.month,t.format));case"weekDay":return d(e,t,s.formats.weekday,(e,t)=>t.indexOf(e).toString());case"meridiem":return d(e,t);default:return{saveQuery:!1}}}));null==p?i(null):t({activeSection:f,newSectionValue:p.sectionValue,shouldGoToNextSection:p.shouldGoToNextSection})}),resetCharacterQuery:u}})({sections:v.sections,updateSectionValue:A,sectionsValueBoundaries:M,localizedDigits:T,setTempAndroidValueStr:k,timezone:D}),{resetCharacterQuery:O}=E,R=f.areValuesEqual(t,v.value,f.emptyValue),I=o?PC:Pk,P=w.useMemo(()=>((e,t)=>{let n={};if(!t)return e.forEach((t,r)=>{let i=r===e.length-1?null:r+1;n[r]={leftIndex:0===r?null:r-1,rightIndex:i}}),{neighbors:n,startIndex:0,endIndex:e.length-1};let r={},i={},o=0,s=0,a=e.length-1;for(;a>=0;){-1===(s=e.findIndex((e,t)=>t>=o&&e.endSeparator?.includes(" ")&&" / "!==e.endSeparator))&&(s=e.length-1);for(let e=s;e>=o;e-=1)i[e]=a,r[a]=e,a-=1;o=s+1}return e.forEach((t,o)=>{let s=i[o],a=0===s?null:r[s-1],l=s===e.length-1?null:r[s+1];n[o]={leftIndex:a,rightIndex:l}}),{neighbors:n,startIndex:r[0],endIndex:r[e.length-1]}})(v.sections,m&&!o),[v.sections,m,o]),{returnedValue:N,interactions:L}=I((0,iL.A)({},e,g,E,{areAllSectionsEmpty:R,sectionOrder:P})),j=(0,O_.A)(e=>{if(l?.(e),!s)switch(!0){case(e.ctrlKey||e.metaKey)&&"A"===String.fromCharCode(e.keyCode)&&!e.shiftKey&&!e.altKey:e.preventDefault(),x("all");break;case"ArrowRight"===e.key:if(e.preventDefault(),null==b)x(P.startIndex);else if("all"===b)x(P.endIndex);else{let e=P.neighbors[b].rightIndex;null!==e&&x(e)}break;case"ArrowLeft"===e.key:if(e.preventDefault(),null==b)x(P.endIndex);else if("all"===b)x(P.startIndex);else{let e=P.neighbors[b].leftIndex;null!==e&&x(e)}break;case"Delete"===e.key:if(e.preventDefault(),a)break;null==b||"all"===b?S():C(),O();break;case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key):{if(e.preventDefault(),a||null==y)break;"all"===b&&x(y);let n=v.sections[y],r=d.getActiveDateManager(t,v,n),o=((e,t,n,r,i,o,s,a)=>{let l=(e=>{switch(e){case"ArrowUp":return 1;case"ArrowDown":return -1;case"PageUp":return 5;case"PageDown":return -5;default:return 0}})(r),u="Home"===r,c="End"===r,h=""===n.value||u||c;if("digit"===n.contentType||"digit-with-letter"===n.contentType){let r,d=i[n.type]({currentDate:s,format:n.format,contentType:n.contentType}),f="minutes"===n.type&&a?.minutesStep?a.minutesStep:1;if(h){if("year"===n.type&&!c&&!u)return e.formatByString(e.date(void 0,t),n.format);r=l>0||u?d.minimum:d.maximum}else r=parseInt(Rv(n.value,o),10)+l*f;return(r%f!=0&&((l<0||u)&&(r+=f-(f+r)%f),(l>0||c)&&(r-=r%f)),r>d.maximum)?Rw(e,d.minimum+(r-d.maximum-1)%(d.maximum-d.minimum+1),d,o,n):r<d.minimum?Rw(e,d.maximum-(d.minimum-r-1)%(d.maximum-d.minimum+1),d,o,n):Rw(e,r,d,o,n)}let d=Rm(e,t,n.type,n.format);if(0===d.length)return n.value;if(h)return l>0||u?d[0]:d[d.length-1];let f=((d.indexOf(n.value)+l)%d.length+d.length)%d.length;return d[f]})(t,D,n,e.key,M,T,r.date,{minutesStep:i});A({activeSection:n,newSectionValue:o,shouldGoToNextSection:!1})}}});(0,mJ.A)(()=>{L.syncSelectionToDOM()});let{hasValidationError:F}=I1({props:n,validator:p,timezone:D,value:v.value,onError:n.onError}),B=w.useMemo(()=>void 0!==u?u:F,[F,u]);w.useEffect(()=>{B||null!=y||O()},[v.referenceValue,y,B]),w.useEffect(()=>{null!=v.tempValueStrAndroid&&null!=y&&(O(),C())},[v.sections]),w.useImperativeHandle(r,()=>({getSections:()=>v.sections,getActiveSectionIndex:L.getActiveSectionIndexFromDOM,setSelectedSections:L.setSelectedSections,focusField:L.focusField,isFieldFocused:L.isFieldFocused}));let _={onKeyDown:j,onClear:(0,O_.A)((e,...t)=>{e.preventDefault(),h?.(e,...t),S(),L.isFieldFocused()?x(P.startIndex):L.focusField(0)}),error:B,clearable:!!(c&&!R&&!a&&!s)};return(0,iL.A)({},e.forwardedProps,_,{disabled:s,readOnly:a},N)})({forwardedProps:s,internalProps:a,valueManager:RO,fieldValueManager:RR,validator:Pb,valueType:"date-time"})})(u)),h=(e=>{let t=EV().localeText,{clearable:n,onClear:r,InputProps:i,sx:o,slots:s,slotProps:a}=e,l=(0,k1.A)(e,PO),u=s?.clearButton??$.A,c=(0,OO.A)({elementType:u,externalSlotProps:a?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),h=(0,k1.A)(c,PR),d=s?.clearIcon??E3,f=(0,OO.A)({elementType:d,externalSlotProps:a?.clearIcon,ownerState:{}});return(0,iL.A)({},l,{InputProps:(0,iL.A)({},i,{endAdornment:(0,x.jsxs)(w.Fragment,{children:[n&&(0,x.jsx)(f5.A,{position:"end",sx:{marginRight:i?.endAdornment?-1:-1.5},children:(0,x.jsx)(u,(0,iL.A)({},h,{onClick:r,children:(0,x.jsx)(d,(0,iL.A)({fontSize:"small"},f))}))}),i?.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(o)?o:[o]]})})((0,iL.A)({},c,{slots:r,slotProps:i}));return(0,x.jsx)(l,(0,iL.A)({},h))});var NA=n(65130),Nk=n(43628),NM=n(47196),NT=n(54266),ND=n(54708),NE=n(38086),NO=n(16299),NR=n(85910),NI=n(44766),NP=n(65043),NN=n(72710),NL=n(96962),Nj=n(47918),NF=n(54354),NB=n(8151),N_=n(91733),Nz=n(99042),NV=n(89321),NH=n(51148),N$=n(55578),NW=n(18463),NU=n(54752),Nq=n(36163),NG=n(28850),NY=n(45350),NK=n(67619),NZ=n(39270),NX=n(56756),NQ=n(268),NJ=n(12282),N0=n(41042),N1=n(38267),N2=n(47025),N5=n(30118),N4=n(84253),N3=n(98608),N6=n(8643),N8=n(18109),N9=n(19681),N7=n(73206),Le=n(53819),Lt=n(96058),Ln=n(682),Lr=n(67671);let Li={y:{sectionType:"year",contentType:"digit",maxLength:4},yy:"year",yyy:{sectionType:"year",contentType:"digit",maxLength:4},yyyy:"year",M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMMM:{sectionType:"month",contentType:"letter"},MMM:{sectionType:"month",contentType:"letter"},L:{sectionType:"month",contentType:"digit",maxLength:2},LL:"month",LLL:{sectionType:"month",contentType:"letter"},LLLL:{sectionType:"month",contentType:"letter"},d:{sectionType:"day",contentType:"digit",maxLength:2},dd:"day",do:{sectionType:"day",contentType:"digit-with-letter"},E:{sectionType:"weekDay",contentType:"letter"},EE:{sectionType:"weekDay",contentType:"letter"},EEE:{sectionType:"weekDay",contentType:"letter"},EEEE:{sectionType:"weekDay",contentType:"letter"},EEEEE:{sectionType:"weekDay",contentType:"letter"},i:{sectionType:"weekDay",contentType:"digit",maxLength:1},ii:"weekDay",iii:{sectionType:"weekDay",contentType:"letter"},iiii:{sectionType:"weekDay",contentType:"letter"},e:{sectionType:"weekDay",contentType:"digit",maxLength:1},ee:"weekDay",eee:{sectionType:"weekDay",contentType:"letter"},eeee:{sectionType:"weekDay",contentType:"letter"},eeeee:{sectionType:"weekDay",contentType:"letter"},eeeeee:{sectionType:"weekDay",contentType:"letter"},c:{sectionType:"weekDay",contentType:"digit",maxLength:1},cc:"weekDay",ccc:{sectionType:"weekDay",contentType:"letter"},cccc:{sectionType:"weekDay",contentType:"letter"},ccccc:{sectionType:"weekDay",contentType:"letter"},cccccc:{sectionType:"weekDay",contentType:"letter"},a:"meridiem",aa:"meridiem",aaa:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},Lo={year:"yyyy",month:"LLLL",monthShort:"MMM",dayOfMonth:"d",dayOfMonthFull:"do",weekday:"EEEE",weekdayShort:"EEEEEE",hours24h:"HH",hours12h:"hh",meridiem:"aa",minutes:"mm",seconds:"ss",fullDate:"PP",keyboardDate:"P",shortDate:"MMM d",normalDate:"d MMMM",normalDateWithWeekday:"EEE, MMM d",fullTime:"p",fullTime12h:"hh:mm aa",fullTime24h:"HH:mm",keyboardDateTime:"P p",keyboardDateTime12h:"P hh:mm aa",keyboardDateTime24h:"P HH:mm"};class Ls{constructor(e){this.isMUIAdapter=!0,this.isTimezoneCompatible=!1,this.lib=void 0,this.locale=void 0,this.formats=void 0,this.formatTokenMap=Li,this.escapedCharacters={start:"'",end:"'"},this.longFormatters=void 0,this.date=e=>void 0===e?new Date:null===e?null:new Date(e),this.getInvalidDate=()=>new Date("Invalid Date"),this.getTimezone=()=>"default",this.setTimezone=e=>e,this.toJsDate=e=>e,this.getCurrentLocaleCode=()=>this.locale.code,this.is12HourCycleInCurrentLocale=()=>/a/.test(this.locale.formatLong.time({width:"short"})),this.expandFormat=e=>e.match(/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g).map(e=>{let t=e[0];return"p"===t||"P"===t?(0,this.longFormatters[t])(e,this.locale.formatLong):e}).join(""),this.formatNumber=e=>e,this.getDayOfWeek=e=>e.getDay()+1;const{locale:t,formats:n,longFormatters:r,lib:i}=e;this.locale=t,this.formats=(0,iL.A)({},Lo,n),this.longFormatters=r,this.lib=i||"date-fns"}}class La extends Ls{constructor({locale:e,formats:t}={}){super({locale:e??Lr.c,formats:t,longFormatters:NN.m}),this.parse=(e,t)=>""===e?null:(0,NJ.qg)(e,t,new Date,{locale:this.locale}),this.isValid=e=>null!=e&&(0,NQ.f)(e),this.format=(e,t)=>this.formatByString(e,this.formats[t]),this.formatByString=(e,t)=>(0,NL.GP)(e,t,{locale:this.locale}),this.isEqual=(e,t)=>null===e&&null===t||null!==e&&null!==t&&(0,NG.n)(e,t),this.isSameYear=(e,t)=>(0,NK.s)(e,t),this.isSameMonth=(e,t)=>(0,NZ.t)(e,t),this.isSameDay=(e,t)=>(0,NY.r)(e,t),this.isSameHour=(e,t)=>(0,NX.l)(e,t),this.isAfter=(e,t)=>(0,NU.d)(e,t),this.isAfterYear=(e,t)=>(0,NU.d)(e,(0,NP.Q)(t)),this.isAfterDay=(e,t)=>(0,NU.d)(e,(0,NR.D)(t)),this.isBefore=(e,t)=>(0,Nq.Y)(e,t),this.isBeforeYear=(e,t)=>(0,Nq.Y)(e,this.startOfYear(t)),this.isBeforeDay=(e,t)=>(0,Nq.Y)(e,this.startOfDay(t)),this.isWithinRange=(e,[t,n])=>(0,Ln.v)(e,{start:t,end:n}),this.startOfYear=e=>(0,Lt.D)(e),this.startOfMonth=e=>(0,N9.w)(e),this.startOfWeek=e=>(0,Le.k)(e,{locale:this.locale}),this.startOfDay=e=>(0,N8.o)(e),this.endOfYear=e=>(0,NP.Q)(e),this.endOfMonth=e=>(0,N7.p)(e),this.endOfWeek=e=>(0,NI.$)(e,{locale:this.locale}),this.endOfDay=e=>(0,NR.D)(e),this.addYears=(e,t)=>(0,NO.e)(e,t),this.addMonths=(e,t)=>(0,NE.P)(e,t),this.addWeeks=(e,t)=>(0,ND.J)(e,t),this.addDays=(e,t)=>(0,NA.f)(e,t),this.addHours=(e,t)=>(0,NT.L)(e,t),this.addMinutes=(e,t)=>(0,NM.z)(e,t),this.addSeconds=(e,t)=>(0,Nk.p)(e,t),this.getYear=e=>(0,NW.C)(e),this.getMonth=e=>(0,Nz.t)(e),this.getDate=e=>(0,Nj.p)(e),this.getHours=e=>(0,NB.q)(e),this.getMinutes=e=>(0,N_.O)(e),this.getSeconds=e=>(0,NV.S)(e),this.getMilliseconds=e=>(0,NH.D)(e),this.setYear=(e,t)=>(0,N6.i)(e,t),this.setMonth=(e,t)=>(0,N5.Z)(e,t),this.setDate=(e,t)=>(0,N0.X)(e,t),this.setHours=(e,t)=>(0,N1.a)(e,t),this.setMinutes=(e,t)=>(0,N2.g)(e,t),this.setSeconds=(e,t)=>(0,N4.g)(e,t),this.setMilliseconds=(e,t)=>(0,N3.$)(e,t),this.getDaysInMonth=e=>(0,NF.P)(e),this.getWeekArray=e=>{let t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e)),r=0,i=t,o=[];for(;this.isBefore(i,n);){let e=Math.floor(r/7);o[e]=o[e]||[],o[e].push(i),i=this.addDays(i,1),r+=1}return o},this.getWeekNumber=e=>(0,N$.N)(e,{locale:this.locale}),this.getYearRange=([e,t])=>{let n=this.startOfYear(e),r=this.endOfYear(t),i=[],o=n;for(;this.isBefore(o,r);)i.push(o),o=this.addYears(o,1);return i}}}let Ll="yyyy-MM-dd HH:mm:ss";function Lu(e,t){let n,r;return e?(0,tJ.bB)(e)?e.pastDuration:(n=im(e.start,Ll,t),r=im(e.end,Ll,t),`${n} - ${r}`):"Custom Time Range"}let Lc=({initialTimeRange:e,onChange:t,onCancel:n,timeZone:r})=>{let i=["local","browser"].includes(r.toLowerCase())?Intl.DateTimeFormat().resolvedOptions().timeZone:r,[o,s]=(0,w.useState)(e),[a,l]=(0,w.useState)(!0),u=(e,t)=>{s(n=>({...n,[t]:e}))},c=e=>{u(e,"start")},h=e=>{u(e,"end")},d=()=>{var e,t;let n={start:o.start,end:o.end};if(e=n.start,t=n.end,(0,t0.isValid)(e)&&(0,t0.isValid)(t)?!!(0,t0.isBefore)(e,t)||(console.error("End Time is before Start Time"),!1):(console.error("Invalid Date"),!1))return n};return(0,x.jsx)(EF,{dateAdapter:La,children:(0,x.jsxs)(H.A,{spacing:2,sx:e=>({padding:e.spacing(1,0,2)}),children:[a&&(0,x.jsxs)(lR.A,{sx:e=>({".MuiPickersLayout-contentWrapper":{backgroundColor:e.palette.background.default}}),children:[(0,x.jsx)(fO.A,{variant:"h3",padding:1,paddingLeft:2,children:"Select Start Time"}),(0,x.jsx)(Px,{timezone:i,displayStaticWrapperAs:"desktop",openTo:"day",disableHighlightToday:!0,value:new id(o.start,i),onChange:e=>{null!==e&&c(e)},onAccept:()=>{l(!1)}})]}),!a&&(0,x.jsxs)(lR.A,{sx:e=>({".MuiPickersLayout-contentWrapper":{backgroundColor:e.palette.background.default}}),children:[(0,x.jsx)(fO.A,{variant:"h3",padding:1,paddingLeft:2,children:"Select End Time"}),(0,x.jsx)(Px,{timezone:i,displayStaticWrapperAs:"desktop",openTo:"day",disableHighlightToday:!0,value:new id(o.end,i),minDateTime:new id(o.start,i),onChange:e=>{null!==e&&h(e)},onAccept:e=>{null!==e&&(l(!0),h(e))}})]}),(0,x.jsxs)(H.A,{direction:"row",alignItems:"center",gap:1,pl:1,pr:1,children:[(0,x.jsx)(gz.ErrorBoundary,{FallbackComponent:g_,children:(0,x.jsx)(NC,{"data-testid":"start_time_input",timezone:i,label:"Start Time",value:new id(o.start,i),onChange:e=>{e&&c(e)},onBlur:()=>d(),format:Ll})}),(0,x.jsx)(gz.ErrorBoundary,{FallbackComponent:g_,children:(0,x.jsx)(NC,{"data-testid":"end_time_input",timezone:i,label:"End Time",value:new id(o.end,i),onChange:e=>{e&&h(e)},onBlur:()=>d(),format:Ll})})]}),(0,x.jsxs)(H.A,{direction:"row",sx:{padding:e=>e.spacing(0,1)},gap:1,children:[(0,x.jsx)(z.A,{variant:"contained",onClick:()=>{let e;(e=d())&&t(e)},fullWidth:!0,children:"Apply"}),(0,x.jsx)(z.A,{variant:"outlined",onClick:()=>n(),fullWidth:!0,children:"Cancel"})]})]})})};function Lh({value:e,timeOptions:t,onChange:n,height:r,showCustomTimeRange:i=!0,timeZone:o,timeZoneOptions:s,onTimeZoneChange:a}){let l,{timeZone:u}=lT(),c=o??u,h=(0,w.useRef)(),[d,f]=(0,w.useState)(!1),p=(0,w.useMemo)(()=>(0,tJ.bB)(e)?(0,tJ.b5)(e):e,[e]),m=(0,w.useMemo)(()=>{var t;return{value:t=(0,tJ.bB)(e)?void 0:e,display:Lu(t,c)}},[e,c]),[g,v]=(0,w.useState)(!1),y=s??t2(),[b,S]=(0,w.useState)(null),C=y.find(e=>e.value===c)?.display??c,A=ig(c),k=ig("local"),M=y.map(e=>({id:e.value,label:e.display}));{let e=y.find(e=>e.value===c);e&&(l={id:e.value,label:e.display})}return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(eA.Ay,{anchorEl:b,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:!!b,onClose:()=>S(null),sx:e=>({padding:e.spacing(1)}),children:(0,x.jsx)(lR.A,{sx:{p:1,minWidth:260},onClick:e=>{e.stopPropagation()},children:(0,x.jsx)(p0,{options:M,value:l,onChange:(e,t)=>{if(t){let e=y.find(e=>e.value===t.id);e&&a?.(e)}S(null)},disableClearable:!0,renderInput:e=>(0,x.jsx)(W.A,{...e,placeholder:"Search timezones",size:"small"})})})}),(0,x.jsx)(eA.Ay,{anchorEl:h.current,anchorOrigin:{vertical:"bottom",horizontal:"center"},open:d,onClose:()=>f(!1),sx:e=>({padding:e.spacing(2)}),children:(0,x.jsx)(Lc,{initialTimeRange:p,onChange:e=>{n(e),f(!1),v(!1)},onCancel:()=>f(!1),timeZone:c})}),(0,x.jsx)(lR.A,{ref:h,children:(0,x.jsxs)(d8.A,{open:g,value:Lu(e,c),onClick:()=>v(!g),IconComponent:EO,renderValue:()=>(0,x.jsxs)(H.A,{direction:"row",alignItems:"center",spacing:1,children:[(0,x.jsx)("span",{children:t.find(t=>Lu(t.value,c)===Lu(e,c))?.display??Lu(e,c)}),A!==k&&(0,x.jsxs)(lR.A,{sx:{typography:"caption",color:"text.secondary"},children:["\xb7 ",A]})]}),inputProps:{"aria-label":`Select time range. Currently set to ${e}`},sx:{".MuiSelect-icon":{marginTop:"1px",transform:"none"},".MuiSelect-select.MuiSelect-outlined.MuiInputBase-input":{paddingRight:"36px"},".MuiSelect-select":r?{lineHeight:r,paddingY:0}:{}},children:[(0,x.jsx)(d6.A,{disableRipple:!0,onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{cursor:"default","&:hover":{backgroundColor:"transparent"},py:.5,px:1},children:(0,x.jsxs)(lR.A,{sx:{display:"flex",alignItems:"center",width:"100%",justifyContent:"space-between"},children:[(0,x.jsxs)(lR.A,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[(0,x.jsx)(lR.A,{sx:{typography:"subtitle1"},children:"Time Range"}),(0,x.jsxs)(lR.A,{sx:{color:"text.secondary",typography:"caption",mt:.25},children:["Timezone: ",C]})]}),(0,x.jsx)(lR.A,{sx:{display:"flex",alignItems:"center",pr:1,ml:1.5},children:(0,x.jsx)($.A,{size:"small","aria-label":"Select timezone",onClick:e=>{e.preventDefault(),e.stopPropagation(),S(e.currentTarget)},children:(0,x.jsx)(ER,{fontSize:"small"})})})]})}),t.map((e,t)=>(0,x.jsx)(d6.A,{value:Lu(e.value,c),onClick:()=>{n(e.value)},children:e.display},t)),i&&(0,x.jsx)(d6.A,{value:Lu(m.value,c),onClick:()=>f(!0),children:m.display})]})})]})}function Ld({value:e,onChange:t,timeZoneOptions:n,variant:r="standard",heightPx:i,...o}){let s,a=(0,w.useMemo)(()=>n??t2(),[n]);i&&(s="number"==typeof i?`${i}px`:i);let l=(0,w.useMemo)(()=>({minWidth:"compact"===r?"80px":"150px",...s&&{lineHeight:s,paddingY:0},...o.sx}),[r,s,o.sx]);return(0,x.jsx)(d8.A,{...o,value:e,onChange:(e,n)=>{var r;let i;r=e.target.value,(i=a.find(e=>e.value===r))&&t&&t(i)},sx:l,size:"compact"===r?"small":"medium",children:a.map(e=>(0,x.jsx)(d6.A,{value:e.value,children:e.display},e.value))})}function Lf(e){let{markerColor:t,sx:n}=e;return(0,x.jsx)(lR.A,{sx:rV({display:"inline-block",width:"11px",height:"11px",borderRadius:"2px",marginRight:1,verticalAlign:"top"},n),style:{backgroundColor:t}})}function Lp(e){let{formattedY:t,markerColor:n,metricName:r,metricLabels:i}=e;return(0,x.jsxs)(H.A,{spacing:.5,children:[(0,x.jsxs)(lR.A,{sx:e=>({display:"flex",height:"16px",flexDirection:"row",alignItems:"center",justifyContent:"left",color:e.palette.common.white,fontSize:"11px"}),children:[(0,x.jsx)(Lf,{markerColor:n,sx:{marginTop:.25}}),(0,x.jsxs)(lR.A,{component:"span",children:[r,(0,x.jsx)(lR.A,{component:"span",sx:e=>({color:e.palette.common.white,fontWeight:700,paddingLeft:"2px"}),children:t})]})]}),(0,x.jsx)(f0.A,{sx:e=>({borderColor:e.palette.grey["500"]})}),(0,x.jsx)(lR.A,{sx:e=>({color:e.palette.common.white}),children:i.map(e=>{if(e){let[t,n]=e.split("="),r=void 0!==n?`${t}: `:t,i=void 0!==n?n.replace(/(^"|"$)/g,""):n;return(0,x.jsxs)(lR.A,{sx:{display:"flex",gap:"4px"},children:[(0,x.jsx)(fO.A,{sx:{fontSize:"11px"},children:r}),(0,x.jsx)(fO.A,{sx:e=>({color:e.palette.common.white,fontWeight:700,fontSize:"11px"}),children:i})]},e)}})})]})}let Lm=375,Lg=650,Lv=650,Ly=500,Lb=.75,Lx=8,Lw=750,LS="nearby series showing in tooltip",LC="emphasized series showing as bold in tooltip",LA="#2E313E",Lk=new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0}),LM={coords:{plotCanvas:{x:0,y:0},zrender:{x:0,y:0},target:null},chartWidth:0},LT=[],LD=()=>{let[e,t]=(0,w.useState)(null);return(0,w.useEffect)(()=>{let e=e=>t({page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.zrX??e.offsetX,y:e.zrY??e.offsetY},target:e.target});return window.addEventListener("mousemove",e),()=>{window.removeEventListener("mousemove",e)}},[]),e},LE={wrapLabels:!0,enablePinning:!0},LO="Click chart to pin",LR="Click chart to unpin";function LI(e){let{seriesName:t,formattedY:n,markerColor:r,totalSeries:i,emphasizeText:o=!1,wrapLabels:s=!0}=e,a=t.split("{"),l=(a[1]??t).replace(/[{}]/g,"").split(",");if(1===i&&l.length>1){let e=a[0]?`${a[0]}:`:"value:";return(0,x.jsx)(Lp,{formattedY:n,metricName:e,metricLabels:l,markerColor:r})}let u=t.replace(/[,]/g,", ");return(0,x.jsxs)(lR.A,{sx:{display:"table-row",paddingTop:.5},children:[(0,x.jsxs)(lR.A,{sx:{display:"table-cell",maxWidth:"520px"},children:[(0,x.jsx)(Lf,{markerColor:r,sx:{marginTop:.5}}),(0,x.jsx)(lR.A,{component:"span",sx:e=>({display:"inline-block",width:"calc(100% - 20px)",minWidth:150,maxWidth:Ly,overflow:"hidden",color:e.palette.common.white,fontWeight:o?e.typography.fontWeightBold:e.typography.fontWeightRegular,textOverflow:"ellipsis",whiteSpace:s?"normal":"nowrap"}),"aria-label":o?LC:LS,children:u})]}),(0,x.jsx)(lR.A,{sx:e=>({display:"table-cell",paddingLeft:1.5,textAlign:"right",verticalAlign:"top",fontWeight:o?e.typography.fontWeightBold:e.typography.fontWeightRegular}),children:n})]})}var LP=n(36961),LN=n(85180);function LL(e,t,n,r,i){if(null===e||(null!==t&&(e=t),void 0===e.plotCanvas.x))return;let o=n>0?n:Lv,s=r>0?r:Lg,a=e.page.x+32,l=e.page.y+16;if(i){let e=i.getBoundingClientRect();a=a-e.left+i.scrollLeft,l=l-e.top+i.scrollTop;let t=e.top+i.scrollHeight;l+o>t&&(l=Math.max(t-o-16,Lx/2))}else l+o>window.innerHeight+window.scrollY&&(l=Math.max(window.innerHeight+window.scrollY-o-16,Lx/2));return a+s>window.innerWidth&&(a=e.page.x-s-32),a<32&&(a=32),l<Lx/2&&(l=Lx/2),`translate3d(${a}px, ${l}px, 0)`}function Lj(e,t,n){return{minWidth:Lm,maxWidth:Lg,maxHeight:(n?n-Lx:void 0)??Lv,padding:0,position:"absolute",top:0,left:0,backgroundColor:e.palette.designSystem?.grey[800]??LA,borderRadius:"6px",color:"#fff",fontSize:"11px",visibility:"visible",opacity:1,transition:"opacity 0.1s ease-out, visibility 0.1s ease-out",zIndex:null!==t?"auto":e.zIndex.tooltip,overflow:"hidden","&:hover":{overflowY:"auto"}}}function LF(e,t){try{let n=t.convertToPixel("grid",[e,0]);return n?.[0]??null}catch{return null}}function LB(e,t,n,r){let i=n[e];if(!i)return t;let o=i.stack;if(!o)return t;let s=o.toString(),a=(r.get(s)??0)+t;return r.set(s,a),a}function L_(e,t,n){let r,i,o=t.indexOf(e);if(-1===o)return 20;let s=o>0?t[o-1]??null:null,a=o<t.length-1?t[o+1]??null:null,l=LF(e,n);if(null===l)return 20;if(null!==s&&null!==a){let e=LF(s,n)??l,t=LF(a,n)??l;r=(l+e)/2,i=(l+t)/2}else if(null!==s){let e=LF(s,n)??l;r=(l+e)/2,i=l+(l-r)}else{if(null===a)return 20;let e=LF(a,n)??l;i=(l+e)/2,r=l-(i-l)}return Math.max(1,i-r)}function Lz(e,t,n,r){let i=t/Math.max(1,r),o=n-t/2+e*i;return{left:o,right:o+i}}function LV(e,t,n){try{let r=n.convertToPixel("grid",[0,e]),i=n.convertToPixel("grid",[0,t]);if(!r||!i||void 0===r[1]||void 0===i[1])return null;return{top:Math.min(i[1],r[1]),bottom:Math.max(i[1],r[1])}}catch{return null}}let LH=5.5,L$=30,LW=5;function LU(e,t,n,r,i,o,s,a,l){let u=n[0]??null,c=n[1]??null;if(null===u||null===c||void 0===i.dispatchAction||!Array.isArray(e))return LT;let h=r_(e[0]?.values,u);if(null===h)return LT;let d=null;if(void 0!==a){let e=i.convertToPixel("grid",[0,c]),t=i.convertToPixel("grid",[0,c+r]);e&&t&&void 0!==e[1]&&void 0!==t[1]&&(d=Math.abs(t[1]-e[1]))}let f=l??LF(h,i),p=function(e,t,n,r,i,o,s,a,l){let u=[],c=e.length,h=new Map,d=[],f=e[0]?.values;if(f&&f.length>0){let e=new Set;for(let[t]of f)e.has(t)||(e.add(t),d.push(t));d=d.toSorted((e,t)=>e-t)}let p=[];for(let e=0;e<c;e++)(t[e]?.type??"line")==="bar"&&p.push(e);let m=null,g=null;p.length>0&&null!==i&&(m=L_(n,d,l),g=LF(n,l));for(let d=0;d<c;d++){let c,f=t[d];if(!f)continue;let v=e[d];if(!v)continue;let y=v.values;if(!y||!Array.isArray(y))continue;let b=f.type??"line",x=f.name?f.name.toString():"",w=f.id?f.id.toString():"",S=(f.color??"#000").toString(),C=-1,A=0;for(let e=0;e<y.length;e++){let t=y[e];if(t&&t[0]===n){C=e,A=t[0],c=t[1];break}}if(-1===C||null==c)continue;let k=!1,M=c,T=1/0;if("line"===b)if(M=LB(d,c,t,h),void 0!==o&&null!==a)try{let e=l.convertToPixel({seriesIndex:d},[C,M]);if(e&&void 0!==e[1]){let t=Math.abs(o-e[1]);k=t<=a,T=t}else{let e=Math.abs(M-r);k=e<=s,T=e}}catch{let e=Math.abs(M-r);k=e<=s,T=e}else{let e=Math.abs(M-r);k=e<=s,T=e}else if("bar"===b){if(null===i||null===m||null===g)continue;let e=p.indexOf(d);if(-1===e)continue;let n=Lz(e,m,g,p.length);if(!(i>=n.left&&i<=n.right))continue;let o=f.stack,s=!0;if(o){let e=o.toString(),n=LV(h.get(e)??0,M=LB(d,c,t,h),l);if(n){let e=l.convertToPixel("grid",[0,r]);e&&void 0!==e[1]&&(s=e[1]>=n.top&&e[1]<=n.bottom)}}else M=c;if(!s)continue;T=Math.abs(i-(n.left+n.right)/2),k=!0}k&&u.push({seriesIdx:d,datumIdx:C,seriesId:w,seriesName:x,date:n,markerColor:S,x:A,y:c,visualY:M,distance:T})}return u}(e,t,h,c,f,a,r,d,i),m=function(e){if(0===e.length)return null;let t=null;for(let n of e)(null===t||n.distance<t.distance)&&(t=n);return t}(p),g=new Set;for(let e of p)g.add(e.seriesIdx);let v=[];for(let t=0;t<e.length;t++)g.has(t)||v.push(t);return function(e,t,n,r,i,o){let s=[],a=[],l=[...o],u=[],c=[],h=new Map,d=[];for(let i of e){let e=r?.get(i.seriesId)??n,o=i.y,f=rp(o,e),p=null!==t&&i.seriesIdx===t.seriesIdx;if(p){a.push(i.seriesIdx);let e=h.get(o)??0;h.set(o,e+1),e>0&&c.push({seriesIndex:i.seriesIdx,dataIndex:i.datumIdx,seriesName:i.seriesName,yValue:o}),u.push({seriesIndex:i.seriesIdx,dataIndex:i.datumIdx,seriesName:i.seriesName,yValue:o})}else l.push(i.seriesIdx);d.push({seriesIdx:i.seriesIdx,datumIdx:i.datumIdx,seriesName:i.seriesName,date:i.date,x:i.x,y:o,formattedY:f,markerColor:i.markerColor,isClosestToCursor:p}),s.push(i.seriesIdx)}return rF(i,s,a,l,u,c),d}(p,m,o,s,i,v)}function Lq(e,t,n,r,i){let o=[],s=t[0]??null,a=t[1]??null;if(null===s||null===a)return o;let l=[],u=[],c=[],h=e.timeSeries.length;if(Array.isArray(e.xAxis)&&Array.isArray(e.timeSeries))for(let t=0;t<h;t++){let d=e.timeSeries[t];if(void 0===d||o.length>=1e3)break;let f=d.name?d.name.toString():"",p=d.color??"#000";if(Array.isArray(d.data))for(let m=0;m<d.data.length;m++){let g=e.xAxis[m]??0,v=d.data[m];if(null!=v&&s===m&&"-"!==v&&a<=v+n&&a>=v-n){let e=LY({valueToCheck:a,baseValue:v,percentage:Math.max(h>LW?2:5,100/h)});e?u.push(t):(c.push(t),r?.dispatchAction!==void 0&&r.dispatchAction({type:"downplay",seriesIndex:t}));let n=g>0x174876e7ff?g:1e3*g,s=rp(v,i);o.push({seriesIdx:t,datumIdx:m,seriesName:f,date:n,x:g,y:v,formattedY:s,markerColor:p.toString(),isClosestToCursor:e}),l.push(t)}}}return r?.dispatchAction!==void 0&&(r.dispatchAction({type:"downplay",seriesIndex:c}),u.length>0?r.dispatchAction({type:"highlight",seriesIndex:u,notBlur:!1,escapeConnect:!0}):r.dispatchAction({type:"highlight",seriesIndex:l,notBlur:!0,escapeConnect:!0})),o}function LG({mousePos:e,pinnedPos:t,data:n,seriesMapping:r,chart:i,format:o,seriesFormatMap:s,showAllSeries:a=!1}){if(void 0===i||null===e)return LT;let l=!1;if(null!==e.target){let t=e.target.parentElement;if(null!==t){let e=t.parentElement;null!==e&&i.getDom()===e&&(l=!0)}}if(null!==t&&(e=t,l=!0),!1===l||null===n||void 0===i._model||void 0===e.plotCanvas.x||void 0===e.plotCanvas.y)return LT;let u=e.plotCanvas.y,c=e.plotCanvas.x,h=rj(c,u,i);if(null!==h){let e=i._model.getComponent("yAxis").axis.scale,t="log"===e.type,l=e._interval;if(t&&e.base){let t=e.base,n=e._extent,r=t**n[0];l=(t**n[1]-r)/100}let d=LK({yInterval:l,totalSeries:n.length,showAllSeries:a}),f=r.some(e=>void 0!==e.yAxisIndex&&e.yAxisIndex>0);return LU(n,r,h,d,i,o,s,f?u:void 0,c)}return LT}function LY({valueToCheck:e,baseValue:t,percentage:n}){let r=n/100*t;return e>=t-r&&e<=t+r}function LK({yInterval:e,totalSeries:t,showAllSeries:n=!1}){if(n)return 10*e;let r=.3*e;return t>LW?Math.max(r,e*L$/t):Math.max(r,e*LH)}function LZ(e){let{series:t,wrapLabels:n}=e,r=(0,w.useMemo)(()=>null===t?null:t.toSorted((e,t)=>e.y>t.y?-1:1),[t]);return null===t||null===r?null:(0,x.jsx)(lR.A,{sx:e=>({display:"table",padding:e.spacing(.5,2)}),children:r.map(({datumIdx:e,seriesIdx:t,seriesName:i,y:o,formattedY:s,markerColor:a,isClosestToCursor:l})=>{if(null===e||null===t)return null;let u=t.toString()+e.toString();return(0,x.jsx)(LI,{seriesName:i,y:o,formattedY:s,markerColor:a,totalSeries:r.length,wrapLabels:n,emphasizeText:l},u)})})}var LX=n(68003),LQ=n(4491),LJ=n(29917);let L0=(0,w.memo)(function({nearbySeries:e,totalSeries:t,isTooltipPinned:n,showAllSeries:r,enablePinning:i=!0,onShowAllClick:o,onUnpinClick:s}){let a,l,u,{formatWithUserTimeZone:c}=lT(),h=e[0]?.date??null;if(null===h)return null;let d=i&&t>5;return(0,x.jsxs)(lR.A,{sx:e=>({width:"100%",maxWidth:Lg,padding:e.spacing(1.5,2,.5,2),backgroundColor:e.palette.designSystem?.grey[800]??LA,position:"sticky",top:0,left:0}),children:[(0,x.jsxs)(lR.A,{sx:{width:"100%",display:"flex",justifyContent:"start",alignItems:"center",paddingBottom:.5},children:[(l=c(a=new Date(h),"MMM dd, yyyy - "),u=c(a,"HH:mm:ss"),(0,x.jsxs)(lR.A,{children:[(0,x.jsx)(fO.A,{variant:"caption",sx:e=>({color:e.palette.common.white}),children:l}),(0,x.jsx)(fO.A,{variant:"caption",children:(0,x.jsx)("strong",{children:u})})]})),(0,x.jsxs)(H.A,{direction:"row",gap:1,sx:{marginLeft:"auto"},children:[d&&(0,x.jsxs)(H.A,{direction:"row",gap:.5,alignItems:"center",sx:{textAlign:"right"},children:[(0,x.jsx)(fO.A,{sx:{fontSize:11},children:"Show All"}),(0,x.jsx)(LX.A,{checked:r,size:"small",onChange:(e,t)=>{if(void 0!==o)return o(t)},sx:e=>({"& .MuiSwitch-switchBase":{color:e.palette.common.white},"& .MuiSwitch-track":{backgroundColor:e.palette.common.white}})})]}),i&&(0,x.jsxs)(H.A,{direction:"row",alignItems:"center",children:[(0,x.jsx)(fO.A,{sx:{marginRight:.5,fontSize:11,verticalAlign:"middle"},children:n?LR:LO}),n?(0,x.jsx)(LQ,{onClick:()=>{void 0!==s&&s()},sx:{fontSize:16,cursor:"pointer"}}):(0,x.jsx)(LJ,{sx:{fontSize:16}})]})]})]}),(0,x.jsx)(f0.A,{sx:e=>({width:"100%",borderColor:e.palette.grey["500"]})})]})}),L1=(0,w.memo)(function({containerId:e,chartRef:t,data:n,seriesMapping:r,enablePinning:i=!0,wrapLabels:o,format:s,seriesFormatMap:a,onUnpinClick:l,pinnedPos:u}){let[c,h]=(0,w.useState)(!1),d=(0,w.useRef)(),f=(0,w.useRef)(null),p=LD(),{height:m,width:g,ref:v}=(0,LN.default)(),y=null!==u&&i,b=(0,w.useCallback)(e=>{f.current=e,v(e)},[v]),S=e?document.querySelector(e):void 0;if((0,w.useLayoutEffect)(()=>{if(null===p)return;let e=f.current;if(!e)return;let t=e.getBoundingClientRect();if(0===t.height||0===t.width)return;let n=LL(p,u,t.height,t.width,S);n&&n!==d.current&&(d.current=n,e.style.transform=n)}),null===p||null===p.target||null===n||null===u&&"CANVAS"!==p.target.tagName)return null;let C=t.current,A=S?S.getBoundingClientRect().height:void 0;d.current=LL(p,u,m??0,g??0,S);let k=LG({mousePos:p,data:n,seriesMapping:r,pinnedPos:u,chart:C,format:s,seriesFormatMap:a,showAllSeries:c});if(0===k.length)return null;let M=n.length;return(0,x.jsx)(LP.A,{container:S,children:(0,x.jsx)(lR.A,{ref:b,sx:e=>Lj(e,u,A),style:{transform:d.current},children:(0,x.jsxs)(H.A,{spacing:.5,children:[(0,x.jsx)(L0,{nearbySeries:k,totalSeries:M,enablePinning:i,isTooltipPinned:y,showAllSeries:c,onShowAllClick:e=>h(e),onUnpinClick:l}),(0,x.jsx)(LZ,{series:k,wrapLabels:o})]})})})}),L2=(0,D.A)(z.A)(({theme:e})=>({padding:e.spacing(.5),minWidth:"auto"})),L5=(0,w.forwardRef)(function(e,t){return(0,x.jsx)(L2,{ref:t,variant:"outlined",color:"secondary",...e})}),L4=Object.entries(rf).map(([e,t])=>({...t,id:e,group:t.group||"Decimal"})).filter(e=>!e.disableSelectorOption);function L3({value:e,onChange:t,disabled:n=!1,...r}){let i=rf[e?.unit||"decimal"];return(0,x.jsx)(p0,{value:{id:e?.unit||"decimal",...i},options:L4,groupBy:e=>e.group??"Decimal",onChange:(e,n)=>{null===n?t(void 0):t({unit:n.id})},disabled:n,disableClearable:!0,renderInput:({InputProps:e,...r})=>(0,x.jsx)(W.A,{...r,slotProps:{input:{...e,endAdornment:(0,x.jsxs)(x.Fragment,{children:[e.endAdornment,(0,x.jsx)(f5.A,{position:"end",children:(0,x.jsx)($.A,{size:"small","aria-label":"clear unit",onClick:()=>t(void 0),disabled:n,tabIndex:-1,children:(0,x.jsx)(ph,{fontSize:"small"})})})]})}}}),...r})}let L6=[{id:"default",label:"Default",decimalPlaces:void 0},{id:"0",label:"0",decimalPlaces:0},{id:"1",label:"1",decimalPlaces:1},{id:"2",label:"2",decimalPlaces:2},{id:"3",label:"3",decimalPlaces:3},{id:"4",label:"4",decimalPlaces:4}];function L8({value:e,onChange:t,disabled:n=!1}){var r;let i=rC(e),o=rA(e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(pK,{label:"Short values",control:(0,x.jsx)(LX.A,{checked:!!o&&nl(e.shortValues),onChange:(n,r)=>{o&&t({...e,shortValues:r})},disabled:!o})}),(0,x.jsx)(pK,{label:"Unit",control:(0,x.jsx)(L3,{value:e,onChange:e=>{t(e||{unit:"decimal"})},disabled:n})}),(0,x.jsx)(pK,{label:"Decimals",control:(0,x.jsx)(p0,{value:(r=e.decimalPlaces,L6.find(e=>e.decimalPlaces===r)),options:L6,getOptionLabel:e=>e.label,onChange:(n,r)=>(({decimalPlaces:n})=>{i&&t({...e,decimalPlaces:n})})(r),disabled:!i,disableClearable:!0})})]})}function L9({name:e,height:t}){return(0,x.jsx)(lR.A,{style:{maxWidth:t,top:`calc(${t}px / 2)`},sx:{display:"inline-block",position:"absolute",transform:"translateX(-50%) rotate(-90deg)",transformOrigin:"top",textAlign:"center",zIndex:1},children:(0,x.jsx)(fO.A,{variant:"body1","aria-label":"y axis label",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e})})}var L7=n(74626);let je=iD((0,L7.A)({}),{echartsTheme:{textStyle:{fontFamily:"Lato"},categoryAxis:{splitLine:{show:!1}},timeAxis:{splitLine:{show:!1}},bar:{barCategoryGap:2}}}),jt={chartsTheme:je,enablePinning:!1,enableSyncGrouping:!0,lastTooltipPinnedCoords:null,setLastTooltipPinnedCoords:()=>null};var jn=n(52855);let jr={defaultProps:{variant:"standard",severity:"success"},styleOverrides:{standardError:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.error.dark,color:e.palette.error.light,[`& .${jn.A.icon}`]:{color:e.palette.error.main}}:{...e.typography.body1,backgroundColor:e.palette.error.light,color:e.palette.error.dark,[`& .${jn.A.icon}`]:{color:e.palette.error.main}},standardInfo:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.info.dark,color:e.palette.info.light,[`& .${jn.A.icon}`]:{color:e.palette.info.main}}:{...e.typography.body1,backgroundColor:e.palette.info.light,color:e.palette.info.dark,[`& .${jn.A.icon}`]:{color:e.palette.info.main}},standardSuccess:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.success.dark,color:e.palette.success.light,[`& .${jn.A.icon}`]:{color:e.palette.success.main}}:{...e.typography.body1,backgroundColor:e.palette.success.light,color:e.palette.success.dark,[`& .${jn.A.icon}`]:{color:e.palette.success.main}},standardWarning:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.warning.dark,color:e.palette.warning.light,[`& .${jn.A.icon}`]:{color:e.palette.warning.main}}:{...e.typography.body1,backgroundColor:e.palette.warning.light,color:e.palette.warning.dark,[`& .${jn.A.icon}`]:{color:e.palette.warning.main}},root:{["& ."+fI.root]:{textDecoration:"underline"}}}},ji={styleOverrides:{root:({theme:e})=>({backgroundColor:e.palette.background.default})}},jo={50:"#E7F1FC",100:"#D0E3FA",150:"#B8D5F7",200:"#A1C7F5",300:"#72ABF0",400:"#438FEB",500:"#1473E6",600:"#105CB8",700:"#0C458A",800:"#082E5C",850:"#062345",900:"#04172E",950:"#020C17"},js="#FFFFFF",ja={50:"#F0F1F6",100:"#E1E3ED",150:"#D2D5E4",200:"#C3C7DB",300:"#A4ACC8",400:"#8690B6",500:"#717CA4",600:"#535D83",700:"#3E4662",800:"#2A2E42",850:"#1F2331",900:"#151721",950:"#0A0C10"},jl={50:"#EAF9F1",100:"#D5F2E3",150:"#C1ECD4",200:"#ACE5C6",300:"#82D9AA",400:"#59CC8D",500:"#2FBF71",600:"#26995A",700:"#1C7344",800:"#134C2D",850:"#0E3922",900:"#092617",950:"#05130B"},ju={50:"#FFF5E8",100:"#FFECD2",150:"#FFE2BB",200:"#FFD9A4",300:"#FFC577",400:"#FFB249",500:"#FF9F1C",600:"#CC7F16",700:"#995F11",800:"#66400B",850:"#4D3008",900:"#332006",950:"#1A1003"},jc={50:"#EFE9FD",100:"#E0D2FC",150:"#D0BCFA",200:"#C1A6F8",300:"#A179F5",400:"#824DF1",500:"#6320EE",600:"#4F1ABE",700:"#3B138F",800:"#280D5F",850:"#1E0A47",900:"#140630",950:"#0A0318"},jh={50:"#FDEDED",100:"#FBDADA",150:"#F9C8C8",200:"#F7B5B5",300:"#F29191",400:"#EE6C6C",500:"#EA4747",600:"#BD3939",700:"#902B2B",800:"#621D1D",850:"#4C1616",900:"#350F0F",950:"#1F0808"},jd=e=>"light"===e?{main:jo["500"],dark:jo["600"],light:jo["50"]}:{main:jo["400"],dark:jo["800"],light:jo["200"]},jf={fontFamily:'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:600,fontWeightBold:700,h1:{fontSize:"1.5rem",fontWeight:600,lineHeight:"32px"},h2:{fontSize:"1.25rem",fontWeight:600,lineHeight:"28px"},h3:{fontSize:"1rem",fontWeight:600,lineHeight:"24px"},h4:{fontSize:"0.875rem",fontWeight:600,lineHeight:"22px"},h5:void 0,h6:void 0,body1:{fontSize:"0.875rem",fontWeight:400,lineHeight:"20px"},body2:{fontSize:"0.75rem",fontWeight:400,lineHeight:"18px"},subtitle1:{fontSize:"1rem",fontWeight:400,lineHeight:"24px",letterSpacing:"0.02rem"},subtitle2:{fontSize:"0.875rem",fontWeight:600,lineHeight:"22px",letterSpacing:"0.03rem",textTransform:"uppercase"},button:{fontSize:"0.875rem",fontWeight:600,lineHeight:"1.25rem",textTransform:"none",letterSpacing:"0.03rem"},caption:{fontSize:"0.6875rem",fontWeight:400,lineHeight:"16px"}},jp=({theme:e})=>({..."light"===e.palette.mode?{}:{backgroundImage:"unset",backgroundColor:e.palette.designSystem.grey[800]}});function jm(e,t={},n=!1){var r,i;let o;return(0,L7.A)({palette:function(e){let t,n,r,i;return{mode:e,primary:jd(e),secondary:"light"===e?{main:ja["600"],dark:ja["900"],light:ja["100"]}:{main:js,dark:js,light:js},grey:"light"===e?{50:ja["50"],100:ja["100"],200:ja["200"],300:ja["300"],400:ja["400"],500:ja["500"],600:ja["600"],700:ja["700"],800:ja["800"],900:ja["900"],950:ja["950"]}:{50:ja["950"],100:ja["900"],200:ja["800"],300:ja["700"],400:ja["600"],500:ja["500"],600:ja["400"],700:ja["300"],800:ja["200"],900:ja["100"],950:ja["50"]},background:(t=jo["150"],n="rgba(21, 23, 33, 0.75)","light"===e?{navigation:t,overlay:n,default:js,paper:ja["50"],code:ja["50"],tooltip:ja["100"],lighter:ja["50"],border:ja["100"]}:{navigation:t,overlay:n,default:ja["900"],paper:ja["850"],code:ja["800"],tooltip:ja["600"],lighter:ja["700"],border:ja["600"]}),text:(r=ja["800"],i=ja["300"],"light"===e?{navigation:r,accent:i,primary:ja["800"],secondary:ja["700"],disabled:ja["300"],link:jo["500"],linkHover:jo["600"]}:{navigation:r,accent:i,primary:js,secondary:ja["50"],disabled:ja["600"],link:jo["400"],linkHover:jo["500"]}),error:"light"===e?{main:jh["500"],dark:jh["600"],light:jh["50"]}:{main:jh["400"],dark:jh["800"],light:jh["300"]},warning:"light"===e?{main:ju["500"],dark:ju["700"],light:ju["50"]}:{main:ju["400"],dark:ju["800"],light:ju["300"]},info:jd(e),success:"light"===e?{main:jl["500"],dark:jl["700"],light:jl["50"]}:{main:jl["400"],dark:jl["800"],light:jl["300"]},common:{white:js,black:"#000000"},designSystem:{blue:jo,green:jl,grey:ja,orange:ju,purple:jc,red:jh}}}(e),typography:jf,mixins:{},components:(r=e,i=n,o={MuiAlert:jr,MuiFormControl:{defaultProps:{size:"small"}},MuiPaper:ji,MuiTextField:{defaultProps:{size:"small"}},MuiDrawer:{styleOverrides:{paper:jp}},MuiDialog:{styleOverrides:{paper:jp}},MuiPopover:{styleOverrides:{paper:jp}}},i?o:{MuiCssBaseline:{styleOverrides:{body:{colorScheme:r}}},...o}),...t})}var jg=n(87275),jv=n(11061),jy=n(78536),jb=n(1355);function jx({value:e,onChange:t}){return(0,x.jsxs)(H.A,{direction:"row",children:[(0,x.jsx)(pQ.A,{freeSolo:!0,multiple:!0,id:"join-columns",sx:{width:"100%"},options:[],value:e.spec.columns??[],renderInput:e=>(0,x.jsx)(W.A,{...e,variant:"outlined",label:"Columns",required:!0}),onChange:(n,r)=>{t({...e,spec:{...e.spec,columns:r}})}}),(0,x.jsx)(Ei.A,{label:"Enabled",labelPlacement:"start",control:(0,x.jsx)(LX.A,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function jw({value:e,onChange:t}){return(0,x.jsxs)(H.A,{direction:"row",gap:1,alignItems:"center",children:[(0,x.jsx)(pQ.A,{freeSolo:!0,multiple:!0,id:"merge-columns-columns",sx:{width:"100%"},options:[],value:e.spec.columns??[],renderInput:e=>(0,x.jsx)(W.A,{...e,variant:"outlined",label:"Columns",required:!0}),onChange:(n,r)=>{t({...e,spec:{...e.spec,columns:r}})}}),(0,x.jsx)(pv,{id:"merge-columns-name",variant:"outlined",label:"Output Name",value:e.spec.name??"",sx:{width:"100%"},onChange:n=>{t({...e,spec:{...e.spec,name:n}})},required:!0}),(0,x.jsx)(Ei.A,{label:"Enabled",labelPlacement:"start",control:(0,x.jsx)(LX.A,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function jS({value:e,onChange:t}){return(0,x.jsxs)(H.A,{direction:"row",children:[(0,x.jsx)(pv,{id:"merge-indexed-columns",variant:"outlined",label:"Column",placeholder:"Example: 'value' for merging 'value #1', 'value #2' and 'value #...'",value:e.spec.column??"",sx:{width:"100%"},onChange:n=>{t({...e,spec:{...e.spec,column:n}})},required:!0}),(0,x.jsx)(Ei.A,{label:"Enabled",labelPlacement:"start",control:(0,x.jsx)(LX.A,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function jC({value:e,onChange:t}){return(0,x.jsx)(H.A,{direction:"row",children:(0,x.jsx)(Ei.A,{label:"Enabled",labelPlacement:"start",control:(0,x.jsx)(LX.A,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})})}function jA({value:e,onChange:t,...n}){return(0,x.jsxs)(H.A,{gap:2,sx:{width:"100%"},mt:1,...n,children:[(0,x.jsxs)(pv,{select:!0,label:"Kind",value:e.kind,onChange:n=>t({...e,kind:n}),children:[(0,x.jsx)(d6.A,{value:"JoinByColumnValue",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Join by column value"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Regroup rows with equal cell value in a column"})]})}),(0,x.jsx)(d6.A,{value:"MergeColumns",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Merge columns"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Multiple columns are merged to one column"})]})}),(0,x.jsx)(d6.A,{value:"MergeIndexedColumns",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Merge indexed columns"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Indexed columns are merged to one column"})]})}),(0,x.jsx)(d6.A,{value:"MergeSeries",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Merge series"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Series will be merged by their labels"})]})})]}),"JoinByColumnValue"===e.kind&&(0,x.jsx)(jx,{value:e,onChange:t}),"MergeColumns"===e.kind&&(0,x.jsx)(jw,{value:e,onChange:t}),"MergeIndexedColumns"===e.kind&&(0,x.jsx)(jS,{value:e,onChange:t}),"MergeSeries"===e.kind&&(0,x.jsx)(jC,{value:e,onChange:t})]})}function jk({index:e,value:t,isCollapsed:n,onChange:r,onCollapse:i,onDelete:o,...s}){return(0,x.jsxs)(H.A,{...s,children:[(0,x.jsxs)(H.A,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,justifyContent:"space-between",gap:4,children:[(0,x.jsxs)(H.A,{direction:"row",gap:1,children:[(0,x.jsx)($.A,{"data-testid":`transform-toggle#${e}`,size:"small",onClick:()=>i(!n),children:n?(0,x.jsx)(jv,{}):(0,x.jsx)(jg,{})}),(0,x.jsx)(fO.A,{variant:"overline",component:"h4",sx:{textTransform:"none"},children:t.kind?(0,x.jsx)("span",{children:(0,x.jsx)("strong",{children:rE[t.kind]})}):(0,x.jsx)("strong",{children:"Select a transformation kind"})})]}),(0,x.jsxs)(H.A,{direction:"row",gap:1,children:[n&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(pu,{title:t.spec?.disabled?"Enable transformation":"Disable transformation",placement:"top",children:(0,x.jsx)($.A,{size:"small",sx:{marginLeft:"auto"},onClick:function(){r({...t,spec:{...t.spec,disabled:!t.spec?.disabled}})},children:t.spec?.disabled?(0,x.jsx)(jy,{}):(0,x.jsx)(jb,{})})}),(0,x.jsx)(f0.A,{flexItem:!0,orientation:"vertical",variant:"middle"})]}),(0,x.jsx)(pu,{title:"Remove transformation",placement:"top",children:(0,x.jsx)($.A,{size:"small",sx:{marginLeft:"auto"},onClick:o,children:(0,x.jsx)(EM,{})})})]})]}),!n&&(0,x.jsx)(jA,{value:t,onChange:r})]})}function jM({value:e,onChange:t,...n}){let[r,i]=(0,w.useState)(e.map(()=>!0));return(0,x.jsxs)(H.A,{gap:1,...n,children:[e.map((n,o)=>(0,x.jsx)(jk,{index:o,value:n,isCollapsed:r[o]??!0,onChange:n=>{let r;(r=[...e])[o]=n,t(r)},onDelete:()=>{let n;(n=[...e]).splice(o,1),t(n),i(e=>(e.splice(o,1),[...e]))},onCollapse:e=>{i(t=>(t[o]=e,[...t]))}},o)),(0,x.jsx)(z.A,{variant:"contained",startIcon:(0,x.jsx)(Ek,{}),sx:{marginTop:1},onClick:function(){let n=[...e];n.push({kind:"",spec:{}}),t(n),i(e=>(e.push(!1),[...e]))},children:"Add Transformation"})]})}function jT(e){let{value:t,onChange:n,timeOptions:r,height:i}=e,o=(0,w.useMemo)(()=>{if(t&&!r.some(e=>e.value.pastDuration===t))return(0,x.jsx)(d6.A,{value:t,children:t})},[r,t]);return(0,x.jsx)(p$.A,{children:(0,x.jsx)(lR.A,{children:(0,x.jsxs)(d8.A,{id:"refreshInterval",value:t,onChange:e=>{n(e.target.value)},inputProps:{"aria-label":`Select refresh interval. Currently set to ${t}`},sx:{".MuiSelect-select":i?{lineHeight:i,paddingY:0}:{}},children:[r.map((e,t)=>(0,x.jsx)(d6.A,{value:e.value.pastDuration,children:e.display},t)),o]})})})}function jD({repeatItems:e,maxPer:t,gap:n,renderItem:r,containerSx:i,rowSx:o}){let{rows:s,perRow:a}=(0,w.useMemo)(()=>{let n=Math.max(1,t),r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return{rows:r,perRow:n}},[t,e]);return(0,x.jsx)(lR.A,{sx:[{display:"flex",flexDirection:"column",width:"100%",height:"100%",gap:`${n}px`},...Array.isArray(i)?i:[i]],children:s.map((e,t)=>(0,x.jsx)(lR.A,{sx:[{display:"flex",gap:`${n}px`},...Array.isArray(o)?o:[o]],children:e.map((e,i)=>(0,x.jsx)(lR.A,{sx:{width:`calc((100% - ${n*(a-1)}px) / ${a})`,overflow:"hidden"},children:r(e,{rowIndex:t,colIndex:i})},`${t}-${i}`))},t))})}var jE=n(54381);let jO=({mapping:e,onChange:t,...n})=>{switch(e.kind){case"Value":return(0,x.jsx)(H.A,{gap:1,direction:"row",...n,children:(0,x.jsx)(W.A,{label:"Value",placeholder:"Exact value",value:e.spec?.value??"",onChange:n=>t({...e,spec:{...e.spec,value:n.target.value}}),fullWidth:!0})});case"Range":return(0,x.jsxs)(H.A,{gap:1,direction:"row",...n,children:[(0,x.jsx)(W.A,{label:"From",placeholder:"Start of range",value:e.spec?.from??"",onChange:n=>t({...e,spec:{...e.spec,from:""===n.target.value?void 0:+n.target.value}}),fullWidth:!0}),(0,x.jsx)(W.A,{label:"To",placeholder:"End of range (inclusive)",value:e.spec?.to??"",onChange:n=>t({...e,spec:{...e.spec,to:""===n.target.value?void 0:+n.target.value}}),fullWidth:!0})]});case"Regex":return(0,x.jsx)(H.A,{gap:1,direction:"row",...n,children:(0,x.jsx)(W.A,{label:"Regular Expression",placeholder:"JavaScript regular expression",value:e.spec?.pattern??"",onChange:n=>t({...e,spec:{...e.spec,pattern:n.target.value}}),fullWidth:!0})});case"Misc":return(0,x.jsx)(H.A,{gap:1,direction:"row",...n,children:(0,x.jsxs)(W.A,{select:!0,label:"Value",value:e.spec?.value??"",onChange:n=>t({...e,spec:{value:n.target.value}}),SelectProps:{renderValue:e=>{switch(e){case"empty":return"Empty";case"null":return"Null";case"NaN":return"NaN";case"true":return"True";case"false":return"False";default:return String(e)}}},fullWidth:!0,children:[(0,x.jsx)(d6.A,{value:"empty",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Empty"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Matches empty string"})]})}),(0,x.jsx)(d6.A,{value:"null",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Null"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Matches null or undefined"})]})}),(0,x.jsx)(d6.A,{value:"NaN",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"NaN"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Matches Not a Number value"})]})}),(0,x.jsx)(d6.A,{value:"true",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"True"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Matches true boolean"})]})}),(0,x.jsx)(d6.A,{value:"false",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"False"}),(0,x.jsx)(fO.A,{variant:"caption",children:"Matches false boolean"})]})})]})});default:return null}},jR=({mapping:e,onChange:t,onDelete:n,...r})=>{let i=n=>{t({...e,spec:{...e.spec,result:{...e.spec.result,color:n}}})};return(0,x.jsxs)(jE.A,{container:!0,spacing:2,...r,children:[(0,x.jsx)(jE.A,{size:{xs:5},children:(0,x.jsxs)(H.A,{direction:"row",gap:1,width:"100%",children:[(0,x.jsxs)(W.A,{select:!0,label:"Type",value:e.kind,onChange:n=>t({...e,kind:n.target.value}),required:!0,sx:{width:"120px"},children:[(0,x.jsx)(d6.A,{value:"Value",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Value"}),"Value"!==e.kind&&(0,x.jsx)(fO.A,{variant:"caption",children:"Matches an exact text value"})]})}),(0,x.jsx)(d6.A,{value:"Range",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Range"}),"Range"!==e.kind&&(0,x.jsx)(fO.A,{variant:"caption",children:"Matches against a numerical range"})]})}),(0,x.jsx)(d6.A,{value:"Regex",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Regex"}),"Regex"!==e.kind&&(0,x.jsx)(fO.A,{variant:"caption",children:"Matches against a regular expression"})]})}),(0,x.jsx)(d6.A,{value:"Misc",children:(0,x.jsxs)(H.A,{children:[(0,x.jsx)(fO.A,{children:"Misc"}),"Misc"!==e.kind&&(0,x.jsx)(fO.A,{variant:"caption",children:"Matches against empty, null and NaN values"})]})})]}),(0,x.jsx)(jO,{width:"100%",mapping:e,onChange:n=>t({...e,...n})})]})}),(0,x.jsx)(jE.A,{size:{xs:4},children:(0,x.jsx)(W.A,{label:"Display text",value:e.spec?.result?.value??"",onChange:n=>t({...e,spec:{...e.spec,result:{...e.spec?.result,value:n.target.value}}}),fullWidth:!0})}),(0,x.jsx)(jE.A,{size:{xs:1},children:(0,x.jsx)(H.A,{direction:"row",justifyContent:"center",gap:1,children:e.spec?.result?.color?(0,x.jsx)(lD,{label:"Color",color:e.spec.result.color??"#000",onColorChange:i,onClear:()=>i(void 0)}):(0,x.jsx)($.A,{onClick:()=>i("#000"),children:(0,x.jsx)(Ek,{})})})}),(0,x.jsx)(jE.A,{size:{xs:1},textAlign:"end",children:(0,x.jsx)(pu,{title:"Remove mapping settings",placement:"top",children:(0,x.jsx)($.A,{size:"small",sx:{marginLeft:"auto"},onClick:n,children:(0,x.jsx)(EM,{})})})})]})},jI=({mappings:e,onChange:t})=>{let[n,r]=(0,w.useState)(e);return(0,x.jsxs)(H.A,{spacing:1,children:[(0,x.jsxs)(jE.A,{container:!0,spacing:2,children:[(0,x.jsx)(jE.A,{size:{xs:5},children:(0,x.jsx)(fO.A,{variant:"subtitle1",children:"Condition"})}),(0,x.jsx)(jE.A,{size:{xs:4},children:(0,x.jsx)(fO.A,{variant:"subtitle1",children:"Display Text"})}),(0,x.jsx)(jE.A,{size:{xs:1},textAlign:"center",children:(0,x.jsx)(fO.A,{variant:"subtitle1",children:"Color"})}),(0,x.jsx)(jE.A,{size:{xs:1}})]}),(0,x.jsx)(H.A,{gap:1.5,divider:(0,x.jsx)(f0.A,{flexItem:!0,orientation:"horizontal"}),children:n.map((e,i)=>(0,x.jsx)(jR,{mapping:e,onChange:e=>{let o;(o=[...n])[i]=e,r(o),t(o)},onDelete:()=>{let e;(e=[...n]).splice(i,1),r(e),t(e)}},i))}),(0,x.jsx)(z.A,{variant:"contained",startIcon:(0,x.jsx)(Ek,{}),sx:{marginTop:1},onClick:function(){let e=[...n];e.push({kind:"Value",spec:{result:{value:""}}}),r(e),t(e)},children:"Add value mappings"})]})}}}]);