@stlite/desktop 0.42.5 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/bin/dump_artifacts.js +1 -1
  2. package/build/asset-manifest.json +79 -74
  3. package/build/index.html +1 -1
  4. package/build/static/css/8050.c24b25fa.chunk.css +1 -0
  5. package/build/static/css/9699.7ce51b75.chunk.css +1 -0
  6. package/build/static/css/main.fb5f4d99.css +1 -0
  7. package/build/static/js/1046.ea522608.chunk.js +1 -0
  8. package/build/static/js/1122.422f58fc.chunk.js +1 -0
  9. package/build/static/js/1189.71b89117.chunk.js +1 -0
  10. package/build/static/js/1261.242b7386.chunk.js +1 -0
  11. package/build/static/js/142.dbf9ec20.chunk.js +1 -0
  12. package/build/static/js/144.046792d9.chunk.js +1 -0
  13. package/build/static/js/1729.d59ed152.chunk.js +1 -0
  14. package/build/static/js/1740.2c71a97a.chunk.js +1 -0
  15. package/build/static/js/1839.0d0dcac8.chunk.js +1 -0
  16. package/build/static/js/2372.844b5190.chunk.js +2 -0
  17. package/build/static/js/2372.844b5190.chunk.js.LICENSE.txt +10 -0
  18. package/build/static/js/2385.2cbc4e3c.chunk.js +1 -0
  19. package/build/static/js/2448.e6f85eda.chunk.js +1 -0
  20. package/build/static/js/2753.c27b6faa.chunk.js +1 -0
  21. package/build/static/js/2873.f5c04f3b.chunk.js +1 -0
  22. package/build/static/js/2940.dd2240b9.chunk.js +1 -0
  23. package/build/static/js/3208.55e0b2fa.chunk.js +1 -0
  24. package/build/static/js/4021.ec2e87b0.chunk.js +1 -0
  25. package/build/static/js/4482.a9238ad0.chunk.js +1 -0
  26. package/build/static/js/4494.6bb6fb20.chunk.js +1 -0
  27. package/build/static/js/4694.aa16aaee.chunk.js +1 -0
  28. package/build/static/js/4721.2185bda3.chunk.js +1 -0
  29. package/build/static/js/4724.374578aa.chunk.js +1 -0
  30. package/build/static/js/4785.76a05d79.chunk.js +1 -0
  31. package/build/static/js/4831.391fe620.chunk.js +1 -0
  32. package/build/static/js/4949.391c96be.chunk.js +2 -0
  33. package/build/static/js/{2961.54b0c743.chunk.js.LICENSE.txt → 4949.391c96be.chunk.js.LICENSE.txt} +15 -15
  34. package/build/static/js/5299.beb80829.chunk.js +1 -0
  35. package/build/static/js/6093.209cd165.chunk.js +1 -0
  36. package/build/static/js/6134.b9e5b2db.chunk.js +1 -0
  37. package/build/static/js/6679.f4ee1d77.chunk.js +2 -0
  38. package/build/static/js/6679.f4ee1d77.chunk.js.LICENSE.txt +62 -0
  39. package/build/static/js/6802.df955c77.chunk.js +1 -0
  40. package/build/static/js/6865.12e417bf.chunk.js +1 -0
  41. package/build/static/js/698.116a166b.chunk.js +1 -0
  42. package/build/static/js/7125.afecc159.chunk.js +1 -0
  43. package/build/static/js/{7332.2f57919b.chunk.js → 7332.cb5400eb.chunk.js} +1 -1
  44. package/build/static/js/7579.ea965a43.chunk.js +1 -0
  45. package/build/static/js/7696.c9589682.chunk.js +1 -0
  46. package/build/static/js/790.4b5acd65.chunk.js +1 -0
  47. package/build/static/js/8050.029f3dc8.chunk.js +1 -0
  48. package/build/static/js/8097.4837946f.chunk.js +2 -0
  49. package/build/static/js/{3603.e3f6f11d.chunk.js → 8186.2f2e42e5.chunk.js} +2 -2
  50. package/build/static/js/865.143ae622.chunk.js +1 -0
  51. package/build/static/js/8801.77babe65.chunk.js +1 -0
  52. package/build/static/js/8850.6abc7336.chunk.js +1 -0
  53. package/build/static/js/9005.87bae37e.chunk.js +1 -0
  54. package/build/static/js/9166.f234f6b4.chunk.js +2 -0
  55. package/build/static/js/9166.f234f6b4.chunk.js.LICENSE.txt +13 -0
  56. package/build/static/js/9311.7c7348b0.chunk.js +1 -0
  57. package/build/static/js/9320.14465db9.chunk.js +1 -0
  58. package/build/static/js/9449.a2c361bb.chunk.js +2 -0
  59. package/build/static/js/9449.a2c361bb.chunk.js.LICENSE.txt +40 -0
  60. package/build/static/js/9699.df050cd6.chunk.js +1 -0
  61. package/build/static/js/9813.1821ef79.chunk.js +1 -0
  62. package/build/static/js/main.ca9c9d66.js +28 -0
  63. package/build/static/js/{main.52e22014.js.LICENSE.txt → main.ca9c9d66.js.LICENSE.txt} +23 -23
  64. package/build/static/media/SourceCodePro-Bold.17a68a0751a813474a0e.woff2 +0 -0
  65. package/build/static/media/SourceCodePro-BoldItalic.d45b7a3df103d441d78b.woff2 +0 -0
  66. package/build/static/media/SourceCodePro-Italic.ec122a420df4175e74f2.woff2 +0 -0
  67. package/build/static/media/SourceCodePro-Regular.84b900b88d09398d86b0.woff2 +0 -0
  68. package/build/static/media/SourceCodePro-SemiBold.17291d1c493cb25eb2c3.woff2 +0 -0
  69. package/build/static/media/SourceCodePro-SemiBoldItalic.f879ae27307c3926522b.woff2 +0 -0
  70. package/build/static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2 +0 -0
  71. package/build/static/media/SourceSansPro-BoldItalic.1d664be59d2eb5fef029.woff2 +0 -0
  72. package/build/static/media/SourceSansPro-Italic.8a9bfea74d43927d6eec.woff2 +0 -0
  73. package/build/static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2 +0 -0
  74. package/build/static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2 +0 -0
  75. package/build/static/media/SourceSansPro-SemiBoldItalic.befb0a2824eabc5ce36b.woff2 +0 -0
  76. package/build/static/media/SourceSerifPro-Bold.d7975b56594770699ae0.woff2 +0 -0
  77. package/build/static/media/SourceSerifPro-BoldItalic.913697a7178b128caa4c.woff2 +0 -0
  78. package/build/static/media/SourceSerifPro-Italic.d3529cb5797663ac5d88.woff2 +0 -0
  79. package/build/static/media/SourceSerifPro-Regular.e6c37aa3926474cc93e1.woff2 +0 -0
  80. package/build/static/media/SourceSerifPro-SemiBold.5c1d378dd5990ef334ca.woff2 +0 -0
  81. package/build/static/media/SourceSerifPro-SemiBoldItalic.249e948b885d0c7d30a8.woff2 +0 -0
  82. package/build/static/media/index.c05687ef19f5bac24939.cjs +1 -0
  83. package/build/static/media/index.cf5b321a6e04bf47c12e.cjs +1 -0
  84. package/build/static/media/index.db61103fb7fdd62b9c44.cjs +1 -0
  85. package/build/static/media/index.f29488c1099d5e3883ac.cjs +1 -0
  86. package/package.json +5 -5
  87. package/build/static/css/5099.60b7ada4.chunk.css +0 -1
  88. package/build/static/css/main.73ab603a.css +0 -1
  89. package/build/static/js/1318.57c335d2.chunk.js +0 -1
  90. package/build/static/js/142.3d0fb3e3.chunk.js +0 -1
  91. package/build/static/js/172.0ee3e7c6.chunk.js +0 -5
  92. package/build/static/js/1839.29b0ce99.chunk.js +0 -1
  93. package/build/static/js/2327.b8572a38.chunk.js +0 -1
  94. package/build/static/js/2775.c1ed54fa.chunk.js +0 -5
  95. package/build/static/js/291.aa03bc71.chunk.js +0 -1
  96. package/build/static/js/2961.54b0c743.chunk.js +0 -2
  97. package/build/static/js/3580.31cb6ce5.chunk.js +0 -1
  98. package/build/static/js/3744.6440bac0.chunk.js +0 -2
  99. package/build/static/js/3744.6440bac0.chunk.js.LICENSE.txt +0 -5
  100. package/build/static/js/3975.5538132d.chunk.js +0 -1
  101. package/build/static/js/4140.edb6c36a.chunk.js +0 -1
  102. package/build/static/js/4141.623ab362.chunk.js +0 -9
  103. package/build/static/js/4320.5977ee6b.chunk.js +0 -2
  104. package/build/static/js/4320.5977ee6b.chunk.js.LICENSE.txt +0 -20
  105. package/build/static/js/5093.304fcb1e.chunk.js +0 -1
  106. package/build/static/js/5099.51feed45.chunk.js +0 -1
  107. package/build/static/js/5177.21c4f353.chunk.js +0 -2
  108. package/build/static/js/5241.0326c97c.chunk.js +0 -1
  109. package/build/static/js/5440.c7134ed1.chunk.js +0 -1
  110. package/build/static/js/5617.837c33c0.chunk.js +0 -1
  111. package/build/static/js/6557.fd2f35c8.chunk.js +0 -1
  112. package/build/static/js/6679.a8b5d830.chunk.js +0 -2
  113. package/build/static/js/6679.a8b5d830.chunk.js.LICENSE.txt +0 -60
  114. package/build/static/js/6683.aab9fa01.chunk.js +0 -1
  115. package/build/static/js/6756.2cb6963c.chunk.js +0 -1
  116. package/build/static/js/6862.886eab8e.chunk.js +0 -1
  117. package/build/static/js/6865.b0803b6b.chunk.js +0 -1
  118. package/build/static/js/6913.30734208.chunk.js +0 -17
  119. package/build/static/js/6939.c09d92c1.chunk.js +0 -1
  120. package/build/static/js/787.a500c8a4.chunk.js +0 -1
  121. package/build/static/js/792.04aad606.chunk.js +0 -1
  122. package/build/static/js/8035.dc118cc9.chunk.js +0 -1
  123. package/build/static/js/8295.c3cd87de.chunk.js +0 -1
  124. package/build/static/js/8418.aed275df.chunk.js +0 -1
  125. package/build/static/js/8486.e56533d6.chunk.js +0 -1
  126. package/build/static/js/865.9e23130b.chunk.js +0 -1
  127. package/build/static/js/9004.6a66722a.chunk.js +0 -1
  128. package/build/static/js/9042.a6fcbc74.chunk.js +0 -5
  129. package/build/static/js/9107.b49ea9ea.chunk.js +0 -5
  130. package/build/static/js/9130.8e10440e.chunk.js +0 -1
  131. package/build/static/js/9166.1a468fb9.chunk.js +0 -2
  132. package/build/static/js/9166.1a468fb9.chunk.js.LICENSE.txt +0 -13
  133. package/build/static/js/9382.c417d448.chunk.js +0 -1
  134. package/build/static/js/9615.c725e9d2.chunk.js +0 -1
  135. package/build/static/js/9733.e3808291.chunk.js +0 -2
  136. package/build/static/js/9733.e3808291.chunk.js.LICENSE.txt +0 -8
  137. package/build/static/js/9915.fe11690a.chunk.js +0 -1
  138. package/build/static/js/main.52e22014.js +0 -28
  139. package/build/static/media/SourceCodePro-Bold.52ac8f3034507f1d9e53.ttf +0 -0
  140. package/build/static/media/SourceCodePro-BoldItalic.05b618077343fbbd92b7.ttf +0 -0
  141. package/build/static/media/SourceCodePro-Italic.454577c22304619db035.ttf +0 -0
  142. package/build/static/media/SourceCodePro-Regular.70cc7ff27245e82ad414.ttf +0 -0
  143. package/build/static/media/SourceCodePro-SemiBold.4d4c53c06b5bebed1cf3.ttf +0 -0
  144. package/build/static/media/SourceCodePro-SemiBoldItalic.2f5470bc8b2cd27a5c4b.ttf +0 -0
  145. package/build/static/media/SourceSansPro-Bold.12e6acd2589d00c9d0aa.ttf +0 -0
  146. package/build/static/media/SourceSansPro-BoldItalic.7c4f9b00300acb82f0f6.ttf +0 -0
  147. package/build/static/media/SourceSansPro-Italic.3c01996d38a55834ddcb.ttf +0 -0
  148. package/build/static/media/SourceSansPro-Regular.efa76f8326aa5cee3bdd.ttf +0 -0
  149. package/build/static/media/SourceSansPro-SemiBold.43cc81b496222dc9ce3c.ttf +0 -0
  150. package/build/static/media/SourceSansPro-SemiBoldItalic.c30987e28fc21daba1ae.ttf +0 -0
  151. package/build/static/media/SourceSerifPro-Bold.bada4fe17051c992f22f.ttf +0 -0
  152. package/build/static/media/SourceSerifPro-BoldItalic.9f9b1eb2d82e26bb2f4a.ttf +0 -0
  153. package/build/static/media/SourceSerifPro-Italic.90931d6ad253cd8de8e4.ttf +0 -0
  154. package/build/static/media/SourceSerifPro-Regular.6f22301c30206f4bad62.ttf +0 -0
  155. package/build/static/media/SourceSerifPro-SemiBold.b27cb117978bab2c80a3.ttf +0 -0
  156. package/build/static/media/SourceSerifPro-SemiBoldItalic.1266f2c17835efdcff7b.ttf +0 -0
  157. package/build/static/media/index.09797f5e19b3c0491904.cjs +0 -1
  158. package/build/static/media/index.1e3d64b0fcde879f0060.cjs +0 -1
  159. package/build/static/media/index.85823dd8655ed4119d0c.cjs +0 -1
  160. package/build/static/media/index.b599194a631d76b49328.cjs +0 -1
  161. /package/build/static/css/{4320.1edfa457.chunk.css → 9449.1edfa457.chunk.css} +0 -0
  162. /package/build/static/js/{5177.21c4f353.chunk.js.LICENSE.txt → 8097.4837946f.chunk.js.LICENSE.txt} +0 -0
  163. /package/build/static/js/{3603.e3f6f11d.chunk.js.LICENSE.txt → 8186.2f2e42e5.chunk.js.LICENSE.txt} +0 -0
@@ -0,0 +1,62 @@
1
+ /*
2
+ * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc
3
+ * @license MIT
4
+ * @preserve Project Home: https://github.com/voidqk/polybooljs
5
+ */
6
+
7
+ /*
8
+ object-assign
9
+ (c) Sindre Sorhus
10
+ @license MIT
11
+ */
12
+
13
+ /*!
14
+ * The buffer module from node.js, for the browser.
15
+ *
16
+ * @author Feross Aboukhadijeh <https://feross.org>
17
+ * @license MIT
18
+ */
19
+
20
+ /*!
21
+ * Determine if an object is a Buffer
22
+ *
23
+ * @author Feross Aboukhadijeh <https://feross.org>
24
+ * @license MIT
25
+ */
26
+
27
+ /*!
28
+ * pad-left <https://github.com/jonschlinkert/pad-left>
29
+ *
30
+ * Copyright (c) 2014-2015, Jon Schlinkert.
31
+ * Licensed under the MIT license.
32
+ */
33
+
34
+ /*!
35
+ * repeat-string <https://github.com/jonschlinkert/repeat-string>
36
+ *
37
+ * Copyright (c) 2014-2015, Jon Schlinkert.
38
+ * Licensed under the MIT License.
39
+ */
40
+
41
+ /*!
42
+ * The buffer module from node.js, for the browser.
43
+ *
44
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
45
+ * @license MIT
46
+ */
47
+
48
+ /*!
49
+ * The buffer module from node.js, for the browser.
50
+ *
51
+ * @author Feross Aboukhadijeh <https://feross.org>
52
+ * @license MIT
53
+ */
54
+
55
+ /*! Native Promise Only
56
+ v0.8.1 (c) Kyle Simpson
57
+ MIT License: http://getify.mit-license.org
58
+ */
59
+
60
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
61
+
62
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -0,0 +1 @@
1
+ (globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6802],{70318:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>u});var n=i(5057),a=i(30669),s=i(46928),o=i(70714),r=i(50651);const h=(0,i(82160).Z)("div",{target:"e1uym6o70"})((t=>{let{theme:e,isFullScreen:i}=t;return{"& *":{fontFamily:e.genericFonts.bodyFont,fontSize:"9.6px"},"& svg":{maxWidth:"100%",width:i?"100%":"auto",height:i?"100%":"auto"},width:i?"100%":"auto",height:i?"100%":"auto"}}),"");var c=i(96266);const u=(0,r.Z)((function(t){let{element:e,isFullScreen:i}=t;const r="graphviz-chart-".concat(e.elementId);return(0,n.useEffect)((()=>{try{if((0,s.graphviz)("#".concat(r)).zoom(!1).fit(!0).scale(1).engine(e.engine).renderDot(e.spec),i||e.useContainerWidth){const t=(0,a.Ys)("#".concat(r," > svg")).node();t.removeAttribute("width"),t.removeAttribute("height")}}catch(t){(0,o.H)(t)}}),[r,e.engine,e.spec,e.useContainerWidth,i]),(0,c.jsx)(h,{className:"graphviz stGraphVizChart","data-testid":"stGraphVizChart",id:r,isFullScreen:i})}))},63778:()=>{},32725:()=>{},14966:()=>{}}]);
@@ -0,0 +1 @@
1
+ (globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6865],{52707:(e,t,r)=>{"use strict";r.d(t,{W:()=>a});var n=r(7896),o=r(5057),i=r(63947),a=o.forwardRef((function(e,t){return o.createElement(i.D,(0,n.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),o.createElement("path",{d:"M0 3v2h8V3H0z"}))}));a.displayName="Minus"},84332:(e,t,r)=>{"use strict";r.d(t,{v:()=>a});var n=r(7896),o=r(5057),i=r(63947),a=o.forwardRef((function(e,t){return o.createElement(i.D,(0,n.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),o.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))}));a.displayName="Plus"},30124:(e,t,r)=>{"use strict";r.d(t,{Z:()=>k});var n=r(5057),o=r(80099),i=r(91224),a=r(97135),s=r(4547),c=r(18150);function u(e){return u="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},u(e)}var l=["Root","StartEnhancer","EndEnhancer"],p=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(c){s=!0,o=c}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function m(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=w(e);if(t){var o=w(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===u(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,r)}}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function j(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var x=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}(w,e);var t,r,u,d=m(w);function w(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,w);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return j(v(e=d.call.apply(d,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),j(v(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),j(v(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=w,(r=[{key:"render",value:function(){var e=this.props,t=e.startEnhancer,r=e.endEnhancer,u=e.overrides,d=u.Root,h=u.StartEnhancer,g=u.EndEnhancer,m=b(u,l),v=b(e,p),w=y((0,o.jb)(d,s.fC),2),j=w[0],x=w[1],k=y((0,o.jb)(h,s.Fp),2),E=k[0],S=k[1],F=y((0,o.jb)(g,s.Fp),2),P=F[0],C=F[1],I=(0,i.t)(this.props,this.state);return n.createElement(j,f({"data-baseweb":"input"},I,x,{$adjoined:O(t,r),$hasIconTrailing:this.props.clearable||"password"==this.props.type}),_(t)&&n.createElement(E,f({},I,S,{$position:c.Xf.start}),"function"===typeof t?t(I):t),n.createElement(a.Z,f({},v,{overrides:m,adjoined:O(t,r),onFocus:this.onFocus,onBlur:this.onBlur})),_(r)&&n.createElement(P,f({},I,C,{$position:c.Xf.end}),"function"===typeof r?r(I):r))}}])&&h(t.prototype,r),u&&h(t,u),Object.defineProperty(t,"prototype",{writable:!1}),w}(n.Component);function O(e,t){return _(e)&&_(t)?c.y4.both:_(e)?c.y4.left:_(t)?c.y4.right:c.y4.none}function _(e){return Boolean(e||0===e)}j(x,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:c.NO.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});const k=x},59500:(e,t,r)=>{var n;!function(){"use strict";var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function i(e){return function(e,t){var r,n,a,s,c,u,l,p,f,y=1,d=e.length,b="";for(n=0;n<d;n++)if("string"===typeof e[n])b+=e[n];else if("object"===typeof e[n]){if((s=e[n]).keys)for(r=t[y],a=0;a<s.keys.length;a++){if(void 0==r)throw new Error(i('[sprintf] Cannot access property "%s" of undefined value "%s"',s.keys[a],s.keys[a-1]));r=r[s.keys[a]]}else r=s.param_no?t[s.param_no]:t[y++];if(o.not_type.test(s.type)&&o.not_primitive.test(s.type)&&r instanceof Function&&(r=r()),o.numeric_arg.test(s.type)&&"number"!==typeof r&&isNaN(r))throw new TypeError(i("[sprintf] expecting number but found %T",r));switch(o.number.test(s.type)&&(p=r>=0),s.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,s.width?parseInt(s.width):0);break;case"e":r=s.precision?parseFloat(r).toExponential(s.precision):parseFloat(r).toExponential();break;case"f":r=s.precision?parseFloat(r).toFixed(s.precision):parseFloat(r);break;case"g":r=s.precision?String(Number(r.toPrecision(s.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=s.precision?r.substring(0,s.precision):r;break;case"t":r=String(!!r),r=s.precision?r.substring(0,s.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=s.precision?r.substring(0,s.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=s.precision?r.substring(0,s.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}o.json.test(s.type)?b+=r:(!o.number.test(s.type)||p&&!s.sign?f="":(f=p?"+":"-",r=r.toString().replace(o.sign,"")),u=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",l=s.width-(f+r).length,c=s.width&&l>0?u.repeat(l):"",b+=s.align?f+r+c:"0"===u?f+c+r:c+f+r)}return b}(function(e){if(s[e])return s[e];var t,r=e,n=[],i=0;for(;r;){if(null!==(t=o.text.exec(r)))n.push(t[0]);else if(null!==(t=o.modulo.exec(r)))n.push("%");else{if(null===(t=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){i|=1;var a=[],c=t[2],u=[];if(null===(u=o.key.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a.push(u[1]);""!==(c=c.substring(u[0].length));)if(null!==(u=o.key_access.exec(c)))a.push(u[1]);else{if(null===(u=o.index_access.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");a.push(u[1])}t[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}r=r.substring(t[0].length)}return s[e]=n}(e),arguments)}function a(e,t){return i.apply(null,[e].concat(t||[]))}var s=Object.create(null);t.sprintf=i,t.vsprintf=a,"undefined"!==typeof window&&(window.sprintf=i,window.vsprintf=a,void 0===(n=function(){return{sprintf:i,vsprintf:a}}.call(t,r,t,e))||(e.exports=n))}()}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[698],{69212:(e,t,s)=>{s.d(t,{$:()=>c,Z:()=>h});var i=s(5057),r=s(47206),o=s(31808),a=s(96601),n=s(16449),l=s(80099),d=s(96266);let c=function(e){return e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl",e}({});const h=function(e){let{value:t,width:s,size:h=c.SMALL,overrides:u}=e;const g=(0,r.u)(),p={xs:g.spacing.twoXS,sm:g.spacing.sm,md:g.spacing.lg,lg:g.spacing.xl,xl:g.spacing.twoXL},{activeTheme:m}=i.useContext(o.E),f=!(0,a.MJ)(m),S={BarContainer:{style:{marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:s?s.toString():void 0,marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none,height:p[h],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?g.colors.primary:g.colors.blue70,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})}};return(0,d.jsx)(n.Z,{value:t,overrides:(0,l.aO)(S,u)})}},30698:(e,t,s)=>{s.r(t),s.d(t,{default:()=>q});var i=s(30967),r=s(51673),o=s(50482),a=s.n(o),n=s(5057),l=s(60913),d=s(73401),c=s(98790),h=s(21034),u=s(38944),g=s(93905),p=s(52955),m=s(70714),f=s(50120),S=s(61914),C=s(69212),R=s(82160),b=s(59990),x=function(e){return e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large",e}(x||{});function w(e,t){switch(e){case x.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case x.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case x.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}const F=(0,R.Z)("div",{target:"etz5kuj9"})((()=>({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"})),""),v=(0,R.Z)("div",{target:"etz5kuj8"})((e=>{let{theme:t,width:s}=e;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.lg," ").concat(t.radii.lg," 0 0"),width:"100%",height:9*s/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),I=(0,R.Z)("p",{target:"etz5kuj7"})((e=>{let{theme:t}=e;return{marginTop:t.spacing.sm,textAlign:"center"}}),""),M=(0,R.Z)("img",{target:"etz5kuj6"})((e=>{let{theme:t,opacity:s}=e;return{borderRadius:"".concat(t.radii.lg," ").concat(t.radii.lg," 0 0"),objectFit:"contain",opacity:s}}),""),y=(0,R.Z)("a",{target:"etz5kuj5"})((e=>{let{theme:t}=e;return{color:t.colors.primary,display:"block",textDecoration:"none"}}),""),E=(0,R.Z)("span",{target:"etz5kuj4"})((()=>({display:"flex",alignItems:"center"})),""),T=(0,R.Z)("div",{target:"etz5kuj3"})((e=>{let{theme:t}=e;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),j=(0,R.Z)("div",{target:"etz5kuj1"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),L=(0,R.Z)("button",{target:"etz5kuj0"})((e=>{let{theme:t}=e;return{position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"1px solid ".concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.lg," ").concat(t.radii.lg),"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:"".concat(t.spacing.xs," ").concat(t.spacing.md),margin:0,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,b.DZ)(t.colors.primary,.5))},...w(x.MEDIUM,t)}}),"");var U=s(96266);const P=function(e){let{disabled:t,onClick:s,children:i,progress:r}=e;return(0,U.jsxs)(L,{disabled:t||!1,onClick:s||(()=>{}),progress:r||null,"data-testid":"stCameraInputButton",children:[i,r&&(0,U.jsx)(j,{children:(0,U.jsx)(C.Z,{value:r,size:C.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})};var k=s(96457),z=s(38830),Z=s(44088),D=s(44176);let O=function(e){return e.USER="user",e.ENVIRONMENT="environment",e}({});const X=e=>{let{switchFacingMode:t}=e;return(0,U.jsx)(T,{"data-testid":"stCameraSwitchButton",children:(0,U.jsx)(c.Z,{content:"Switch camera",placement:c.u.TOP_RIGHT,children:(0,U.jsx)(z.ZP,{kind:Z.nW.MINIMAL,onClick:t,children:(0,U.jsx)(d.Z,{content:k.Z,size:"twoXL",color:D.Z.white})})})})};var B=s(85585),_=s(47206),W=s(11226),A=s(74947),V=s.n(A),G=s(11103);let N=function(e){return e.PENDING="pending",e.SUCCESS="success",e.ERROR="error",e}({});const H=e=>{let{width:t}=e;return(0,U.jsxs)(v,{width:t,children:[(0,U.jsx)(d.Z,{size:"threeXL",color:D.Z.gray60,content:B.n}),(0,U.jsxs)(I,{children:["This app would like to use your camera.",(0,U.jsx)(y,{href:G.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},$=e=>{let{handleCapture:t,width:s,disabled:i,clearPhotoInProgress:r,setClearPhotoInProgress:o,facingMode:a,setFacingMode:l,testOverride:d}=e;const[c,h]=(0,n.useState)(d||N.PENDING),u=(0,n.useRef)(null),[g,p]=(0,n.useState)(s),m=(0,n.useCallback)((0,f.Ds)(1e3,p),[]);(0,n.useEffect)((()=>{m(s)}),[s,m]);const S=(0,_.u)();return(0,U.jsxs)(F,{width:g,"data-testid":"stWebcamComponent",children:[c===N.SUCCESS||i||r?W.tq&&(0,U.jsx)(X,{switchFacingMode:l}):(0,U.jsx)(H,{width:g}),(0,U.jsx)(v,{"data-testid":"stWebcamStyledBox",hidden:c!==N.SUCCESS&&!i&&!r,width:g,children:!i&&(0,U.jsx)(V(),{audio:!1,ref:u,screenshotFormat:"image/jpeg",screenshotQuality:1,width:g,height:9*g/16,style:{borderRadius:"".concat(S.radii.lg," ").concat(S.radii.lg," 0 0")},onUserMediaError:()=>{h(N.ERROR)},onUserMedia:()=>{h(N.SUCCESS),o(!1)},videoConstraints:{width:{ideal:g},facingMode:a}})}),(0,U.jsx)(P,{onClick:function(){if(null!==u.current){const e=u.current.getScreenshot();t(e)}},disabled:c!==N.SUCCESS||i||r,children:"Take Photo"})]})};class K extends n.PureComponent{constructor(e){super(e),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new p.K,this.getProgress=()=>{if(this.state.files.length>0&&"uploading"===this.state.files[this.state.files.length-1].status.type){return this.state.files[this.state.files.length-1].status.progress}},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState((e=>({facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER})))},this.handleCapture=e=>{if(null===e)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});return(t=e,s="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((e=>e.arrayBuffer())).then((e=>new File([e],s,{type:"image/jpeg"})))).then((e=>this.props.uploadClient.fetchFileURLs([e]).then((t=>({file:e,fileUrls:t[0]}))))).then((e=>{let{file:t,fileUrls:s}=e;return this.uploadFile(s,t)})).then((()=>{return e=150,new Promise((t=>setTimeout(t,e)));var e})).then((()=>{this.setState(((t,s)=>({imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0})))})).catch((e=>{(0,m.H)(e)}));var t,s},this.removeCapture=()=>{0!==this.state.files.length&&(this.state.files.forEach((e=>this.deleteFile(e.id))),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:s}=this.props,i=s.getFileUploaderStateValue(t);a()(e,i)||s.setFileUploaderStateValue(t,e,{fromUi:!0})},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();null!=e&&(this.setState({imgSrc:null}),this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0}))}))},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState((t=>({files:[...t.files,e]})))},this.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((s=>({files:s.files.map((s=>s.id===e?t:s))})))},this.onUploadComplete=(e,t)=>{this.setState((()=>({shutter:!1})));const s=this.getFile(e);null!=s&&"uploading"===s.status.type&&this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(null==s||"uploading"!==s.status.type)return;const i=Math.round(100*e.loaded/e.total);s.status.progress!==i&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:i}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,t)=>{const s=r.Z.CancelToken.source(),i=new S.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(i),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,i.id)),s.token).then((()=>this.onUploadComplete(i.id,e))).catch((e=>{r.Z.isCancel(e)||this.updateFile(i.id,i.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.state=this.initialValue}get initialValue(){const e={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},{widgetMgr:t,element:s}=this.props,i=t.getFileUploaderStateValue(s);if(null==i)return e;const{uploadedFileInfo:r}=i;return null==r||0===r.length?e:{files:r.map((e=>{const t=e.name,s=e.size,i=e.fileId,r=e.fileUrls;return new S.R(t,s,this.nextLocalFileId(),{type:"uploaded",fileId:i,fileUrls:r})})),imgSrc:0===r.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:s}=this.props;void 0===s.getFileUploaderStateValue(t)&&s.setFileUploaderStateValue(t,e,{fromUi:!1})}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:s,status:i}=e;return new l.jM({fileId:i.fileId,fileUrls:i.fileUrls,name:t,size:s})}));return new l.xO({uploadedFileInfo:e})}render(){var e;const{element:t,widgetMgr:s,disabled:r,width:o}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,U.jsxs)(F,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,U.jsx)(u.O,{label:t.label,disabled:r,labelVisibility:(0,f.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,U.jsx)(g.dT,{children:(0,U.jsx)(h.Z,{content:t.help,placement:c.u.TOP_RIGHT})})}),this.state.imgSrc?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(v,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,U.jsx)(M,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,U.jsx)(P,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||r,children:this.getProgress()?"Uploading...":(0,U.jsxs)(E,{children:[(0,U.jsx)(d.Z,{content:i.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,U.jsx)($,{handleCapture:this.handleCapture,width:o,disabled:r,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}const q=K},61914:(e,t,s)=>{s.d(t,{R:()=>i});class i{setStatus(e){return new i(this.name,this.size,this.id,e)}constructor(e,t,s,i){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=s,this.status=i}}},52955:(e,t,s)=>{s.d(t,{K:()=>r});var i=s(50120);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,s){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,s),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7125],{69212:(e,t,i)=>{i.d(t,{$:()=>c,Z:()=>p});var s=i(5057),n=i(47206),l=i(31808),a=i(96601),r=i(16449),o=i(80099),d=i(96266);let c=function(e){return e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl",e}({});const p=function(e){let{value:t,width:i,size:p=c.SMALL,overrides:g}=e;const h=(0,n.u)(),u={xs:h.spacing.twoXS,sm:h.spacing.sm,md:h.spacing.lg,lg:h.spacing.xl,xl:h.spacing.twoXL},{activeTheme:m}=s.useContext(l.E),f=!(0,a.MJ)(m),x={BarContainer:{style:{marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:i?i.toString():void 0,marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none,height:u[p],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?h.colors.primary:h.colors.blue70,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS})}};return(0,d.jsx)(r.Z,{value:t,overrides:(0,o.aO)(x,g)})}},61914:(e,t,i)=>{i.d(t,{R:()=>s});class s{setStatus(e){return new s(this.name,this.size,this.id,e)}constructor(e,t,i,s){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=i,this.status=s}}},97125:(e,t,i)=>{i.r(t),i.d(t,{default:()=>he});var s=i(51673),n=i(50482),l=i.n(n),a=i(38954),r=i.n(a),o=i(5057),d=i(60913),c=i(52955),p=i(50120);let g=function(e){return e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b",e}({});const h=(0,p.rA)()?1024:1e3,u=[g.Gigabyte,g.Megabyte,g.Kilobyte,g.Byte],m=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t||(t=g.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=u.indexOf(t);return s&&e>h/2?m(e/h,u[s-1],i):"".concat(e.toFixed(i)).concat(t.toUpperCase())};var f=i(38944),x=i(93905),w=i(21034),b=i(98790),y=i(49525),S=i(38830),F=i(44088),v=i(82160);const j=(0,v.Z)("section",{target:"e1b2p2ww15"})((e=>{let{isDisabled:t,theme:i}=e;return{display:"flex",alignItems:"center",padding:i.spacing.lg,backgroundColor:i.colors.secondaryBg,borderRadius:i.radii.lg,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(i.colors.primary)},color:t?i.colors.gray:i.colors.bodyText}}),""),I=(0,v.Z)("div",{target:"e1b2p2ww14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),M=(0,v.Z)("span",{target:"e1b2p2ww13"})((e=>{let{theme:t}=e;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),z=(0,v.Z)("span",{target:"e1b2p2ww12"})((e=>{let{theme:t}=e;return{marginBottom:t.spacing.twoXS}}),""),L=(0,v.Z)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),U=(0,v.Z)("div",{target:"e1b2p2ww10"})((e=>{let{theme:t}=e;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),C=(0,v.Z)("ul",{target:"e1b2p2ww9"})((()=>({listStyleType:"none",marginBottom:0})),""),B=(0,v.Z)("li",{target:"e1b2p2ww8"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,padding:t.spacing.none}}),""),Z=(0,v.Z)("div",{target:"e1b2p2ww7"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:t.spacing.lg,overflow:"hidden"}}),""),R=(0,v.Z)("div",{target:"e1b2p2ww6"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),k=(0,v.Z)("div",{target:"e1b2p2ww5"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginBottom:t.spacing.twoXS}}),""),T=(0,v.Z)("span",{target:"e1b2p2ww4"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.twoXS}}),""),D=(0,v.Z)("div",{target:"e1b2p2ww3"})((e=>{let{theme:t}=e;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),X=(0,v.Z)("small",{target:"e1b2p2ww2"})((e=>{let{theme:t}=e;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),P=(0,v.Z)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),E=e=>({[j]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[I]:{marginBottom:e.spacing.lg},[M]:{display:"none"},[U]:{paddingRight:e.spacing.lg},[k]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[R]:{width:e.sizes.full},[Z]:{flexDirection:"column"},[X]:{height:"auto",whiteSpace:"initial"},[P]:{display:"none"},[B]:{margin:e.spacing.none,padding:e.spacing.none}}),A=(0,v.Z)("div",{target:"e1b2p2ww0"})((e=>{let{theme:t}=e;return t.inSidebar?E(t):{["@media (max-width: ".concat(t.breakpoints.sm,")")]:E(t)}}),"");var V=i(44071),W=i(73401),N=i(67600),O=i(96266);const H=e=>{let{multiple:t,acceptedExtensions:i,maxSizeBytes:s}=e;return(0,O.jsxs)(I,{"data-testid":"stFileDropzoneInstructions",children:[(0,O.jsx)(M,{children:(0,O.jsx)(W.Z,{content:V.n,size:"threeXL"})}),(0,O.jsxs)(L,{children:[(0,O.jsxs)(z,{children:["Drag and drop file",t?"s":""," here"]}),(0,O.jsxs)(N.x,{children:["Limit ".concat(m(s,g.Byte,0)," per file"),i.length?" \u2022 ".concat(i.map((e=>e.replace(/^\./,"").toUpperCase())).join(", ")):null]})]})]})},_=e=>{let{onDrop:t,multiple:i,acceptedExtensions:s,maxSizeBytes:n,disabled:l,label:a}=e;return(0,O.jsx)(y.ZP,{onDrop:t,multiple:i,accept:s.length?s:void 0,maxSize:n,disabled:l,useFsAccessApi:!1,children:e=>{let{getRootProps:t,getInputProps:r}=e;return(0,O.jsxs)(j,{...t(),"data-testid":"stFileUploadDropzone",isDisabled:l,"aria-label":a,children:[(0,O.jsx)("input",{"data-testid":"stDropzoneInput",...r()}),(0,O.jsx)(H,{multiple:i,acceptedExtensions:s,maxSizeBytes:n}),(0,O.jsx)(S.ZP,{kind:F.nW.SECONDARY,disabled:l,size:F.V5.SMALL,children:"Browse files"})]})}})};var G=i(56129),K=i.n(G),$=i(75427),q=i(5642);const J=(0,v.Z)("div",{target:"e16k0npc1"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),Y=(0,v.Z)("div",{target:"e16k0npc0"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",color:t.colors.fadedText40}}),""),Q=e=>{let{className:t,currentPage:i,totalPages:s,onNext:n,onPrevious:l}=e;return(0,O.jsxs)(J,{className:t,"data-testid":"stPagination",children:[(0,O.jsx)(N.x,{children:"Showing page ".concat(i," of ").concat(s)}),(0,O.jsxs)(Y,{children:[(0,O.jsx)(S.ZP,{onClick:l,kind:F.nW.MINIMAL,children:(0,O.jsx)(W.Z,{content:$.s,size:"xl"})}),(0,O.jsx)(S.ZP,{onClick:n,kind:F.nW.MINIMAL,children:(0,O.jsx)(W.Z,{content:q._,size:"xl"})})]})]})};var ee=i(15717);const te=(e,t)=>Math.ceil(e.length/t),ie=e=>K()((t=>{let{pageSize:i,items:s,resetOnAdd:n,...l}=t;const[a,r]=(0,o.useState)(0),[d,c]=(0,o.useState)(te(s,i)),p=(0,ee.D)(s);(0,o.useEffect)((()=>{p&&p.length!==s.length&&c(te(s,i)),p&&p.length<s.length?n&&r(0):a+1>=d&&r(d-1)}),[s,a,i,p,n,d]);const g=s.slice(a*i,a*i+i);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(e,{items:g,...l}),s.length>i?(0,O.jsx)(Q,{className:"streamlit-paginator",pageSize:i,totalPages:d,currentPage:a+1,onNext:()=>{r(Math.min(a+1,d-1))},onPrevious:()=>{r(Math.max(0,a-1))}}):null]})}),e);var se=i(15766),ne=i(31906),le=i(13324),ae=i(69212);const re=e=>{let{fileInfo:t}=e;return"uploading"===t.status.type?(0,O.jsx)(ae.Z,{value:t.status.progress,size:ae.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,O.jsxs)(X,{children:[(0,O.jsx)(T,{"data-testid":"stUploadedFileErrorMessage",children:t.status.errorMessage}),(0,O.jsx)(P,{children:(0,O.jsx)(W.Z,{content:se.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,O.jsx)(N.x,{children:m(t.size,g.Byte)}):null},oe=e=>{let{fileInfo:t,onDelete:i}=e;return(0,O.jsxs)(k,{className:"uploadedFile","data-testid":"stUploadedFile",children:[(0,O.jsx)(D,{children:(0,O.jsx)(W.Z,{content:ne.h,size:"twoXL"})}),(0,O.jsxs)(Z,{className:"uploadedFileData",children:[(0,O.jsx)(R,{className:"uploadedFileName",title:t.name,children:t.name}),(0,O.jsx)(re,{fileInfo:t})]}),(0,O.jsx)("div",{"data-testid":"fileDeleteBtn",children:(0,O.jsx)(S.ZP,{onClick:()=>i(t.id),kind:F.nW.MINIMAL,children:(0,O.jsx)(W.Z,{content:le.U,size:"lg"})})})]})},de=ie((e=>{let{items:t,onDelete:i}=e;return(0,O.jsx)(C,{children:t.map((e=>(0,O.jsx)(B,{children:(0,O.jsx)(oe,{fileInfo:e,onDelete:i})},e.id)))})})),ce=e=>(0,O.jsx)(U,{children:(0,O.jsx)(de,{...e})});var pe=i(61914);class ge extends o.PureComponent{constructor(e){super(e),this.formClearHelper=new c.K,this.localFileIdCounter=1,this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:i}=this.props,s=i.getFileUploaderStateValue(t);l()(e,s)||i.setFileUploaderStateValue(t,e,{fromUi:!0})},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:i}=this.props,{multipleFiles:s}=i;if(!s&&0===e.length&&t.length>1){const i=t.findIndex((e=>1===e.errors.length&&"too-many-files"===e.errors[0].code));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then((t=>{if(!s&&e.length>0){const e=this.state.files.find((e=>"error"!==e.status.type));e&&this.deleteFile(e.id)}r()(t,e).forEach((e=>{let[t,i]=e;this.uploadFile(t,i)}))})).catch((t=>{this.addFiles(e.map((e=>new pe.R(e.name,e.size,this.nextLocalFileId(),{type:"error",errorMessage:t}))))})),t.length>0){const e=t.map((e=>{const{file:t}=e;return new pe.R(t.name,t.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(e.errors[0].code,e.file)})}));this.addFiles(e)}},this.uploadFile=(e,t)=>{const i=s.Z.CancelToken.source(),n=new pe.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,n.id)),i.token).then((()=>this.onUploadComplete(n.id,e))).catch((e=>{s.Z.isCancel(e)||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.onUploadComplete=(e,t)=>{const i=this.getFile(e);null!=i&&"uploading"===i.status.type&&this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return"File must be ".concat(m(this.maxUploadSizeInBytes,g.Byte)," or smaller.");case"file-invalid-type":return"".concat(t.type," files are not allowed.");case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState((t=>({files:[...t.files,e]})))},this.addFiles=e=>{this.setState((t=>({files:[...t.files,...e]})))},this.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((i=>({files:i.files.map((i=>i.id===e?t:i))})))},this.onUploadProgress=(e,t)=>{const i=this.getFile(t);if(null==i||"uploading"!==i.status.type)return;const s=Math.round(100*e.loaded/e.total);i.status.progress!==s&&this.updateFile(t,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:s}))},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();null!=e&&this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0})}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0},{widgetMgr:t,element:i}=this.props,s=t.getFileUploaderStateValue(i);if(null==s)return e;const{uploadedFileInfo:n}=s;return null==n||0===n.length?e:{files:n.map((e=>{const t=e.name,i=e.size,s=e.fileId,n=e.fileUrls;return new pe.R(t,i,this.nextLocalFileId(),{type:"uploaded",fileId:s,fileUrls:n})}))}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=u.findIndex((e=>e===t)),n=u.findIndex((e=>e===i));if(-1===s||-1===n)throw Error("Unexpected byte unit provided");if(s===n)return e;const l=Math.abs(s-n),a=h**l;return s>n?e/a:e*a})(this.props.element.maxUploadSizeMb,g.Megabyte,g.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:i}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1})}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e,{fileId:n,fileUrls:l}=s;return new d.jM({fileId:n,fileUrls:l,name:t,size:i})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:n}=this.props,l=i.type;this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared);const a=t.slice().reverse();return(0,O.jsxs)(A,{"data-testid":"stFileUploader",children:[(0,O.jsx)(f.O,{label:i.label,disabled:s,labelVisibility:(0,p.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,O.jsx)(x.dT,{children:(0,O.jsx)(w.Z,{content:i.help,placement:b.u.TOP_RIGHT})})}),(0,O.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:l,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),a.length>0&&(0,O.jsx)(ce,{items:a,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const he=ge},52955:(e,t,i)=>{i.d(t,{K:()=>n});var s=i(50120);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
@@ -1 +1 @@
1
- (()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",o=0,s=-1,a=0,i=0;i<=e.length;++i){if(i<e.length)r=e.charCodeAt(i);else{if(47===r)break;r=47}if(47===r){if(s===i-1||1===a);else if(s!==i-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),s=i,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,s=i,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(s+1,i):n=e.slice(s+1,i),o=i-s-1;s=i,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var e,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&o&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var o=arguments[r];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var s=e.length,a=s-o,i=1;i<r.length&&47===r.charCodeAt(i);++i);for(var l=r.length-i,c=a<l?a:l,g=-1,d=0;d<=c;++d){if(d===c){if(l>c){if(47===r.charCodeAt(i+d))return r.slice(i+d+1);if(0===d)return r.slice(i+d)}else a>c&&(47===e.charCodeAt(o+d)?g=d:0===d&&(g=0));break}var h=e.charCodeAt(o+d);if(h!==r.charCodeAt(i+d))break;47===h&&(g=d)}var p="";for(d=o+g+1;d<=s;++d)d!==s&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(i+g):(i+=g,47===r.charCodeAt(i)&&++i,r.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,o=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(r=e.charCodeAt(a))){if(!s){o=a;break}}else s=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,r){if(void 0!==r&&"string"!==typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,o=0,s=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var i=r.length-1,l=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!a){o=n+1;break}}else-1===l&&(a=!1,l=n+1),i>=0&&(c===r.charCodeAt(i)?-1===--i&&(s=n):(i=-1,s=l))}return o===s?s=l:-1===s&&(s=e.length),e.slice(o,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){o=n+1;break}}else-1===s&&(a=!1,s=n+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var r=-1,n=0,o=-1,s=!0,a=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47!==l)-1===o&&(s=!1,o=i+1),46===l?-1===r?r=i:1!==a&&(a=1):-1!==r&&(a=-1);else if(!s){n=i+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":e.slice(r,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,o=e.charCodeAt(0),s=47===o;s?(r.root="/",n=1):n=0;for(var a=-1,i=0,l=-1,c=!0,g=e.length-1,d=0;g>=n;--g)if(47!==(o=e.charCodeAt(g)))-1===l&&(c=!1,l=g+1),46===o?-1===a?a=g:1!==d&&(d=1):-1!==a&&(d=-1);else if(!c){i=g+1;break}return-1===a||-1===l||0===d||1===d&&a===l-1&&a===i+1?-1!==l&&(r.base=r.name=0===i&&s?e.slice(1,l):e.slice(i,l)):(0===i&&s?(r.name=e.slice(1,a),r.base=e.slice(1,l)):(r.name=e.slice(i,a),r.base=e.slice(i,l)),r.ext=e.slice(a,l)),i>0?r.dir=e.slice(0,i-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e=r(56977),t=r.n(e);function n(e,r){const n=t().normalize(r),o=t().dirname(n).split("/"),s=[];for(const t of o){s.push(t);const r=s.join("/");if(e.FS.analyzePath(r).exists){if(e.FS.isDir(r))throw new Error(`"${r}" already exists and is not a directory.`)}else try{e.FS.mkdir(r)}catch(a){throw console.error(`Failed to create a directory "${r}"`),a}}}function o(e,t,r,o){n(e,t),e.FS.writeFile(t,r,o)}function s(e){e.forEach((e=>{let t;try{t=new URL(e)}catch(r){return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}))}function a(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var i=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function a(e){try{l(n.next(e))}catch(t){s(t)}}function i(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,i)}l((n=n.apply(e,t||[])).next())}))};let l,c;const g=self,d=new class{constructor(){this.promise=new Promise(((e,t)=>{this.resolveInternal=e,this.rejectInternal=t}))}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};function h(e){g.postMessage({type:"event:progress",data:{message:e}})}const p="https://cdn.jsdelivr.net/pyodide/v0.23.3/full/pyodide.js";const u=function(){return i(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,archives:r,requirements:n,wheels:u,mountedSitePackagesSnapshotFilePath:f,pyodideUrl:m=p,streamlitConfig:y}=yield d.promise;if(h("Loading Pyodide."),console.debug("Loading Pyodide"),l=yield function(e,t){return i(this,void 0,void 0,(function*(){const r=e.slice(0,e.lastIndexOf("/")+1);let n;return e.endsWith(".mjs")?n=(yield import(e)).loadPyodide:(importScripts(e),n=self.loadPyodide),n(Object.assign(Object.assign({},t),{indexURL:r}))}))}(m,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),h("Mounting files."),yield Promise.all(Object.keys(t).map((e=>i(this,void 0,void 0,(function*(){const r=t[e];let n;"url"in r?(console.debug(`Fetch a file from ${r.url}`),n=yield fetch(r.url).then((e=>e.arrayBuffer())).then((e=>new Uint8Array(e)))):n=r.data;const{opts:s}=t[e];console.debug(`Write a file "${e}"`),o(l,e,n,s)}))))),h("Unpacking archives."),yield Promise.all(r.map((e=>i(this,void 0,void 0,(function*(){let t;"url"in e?(console.debug(`Fetch an archive from ${e.url}`),t=yield fetch(e.url).then((e=>e.arrayBuffer()))):t=e.buffer;const{format:r,options:n}=e;console.debug("Unpack an archive",{format:r,options:n}),l.unpackArchive(t,r,n)}))))),!f&&!u)throw new Error("Neither snapshot nor wheel files are provided.");f&&(h("Restoring the snapshot."),yield l.runPythonAsync("import tarfile, shutil, site"),yield l.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${f}`),yield l.runPythonAsync(`\n with tarfile.open("${f}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),h("Mocking some packages."),console.debug("Mock pyarrow"),a(l),console.debug("Mocked pyarrow")),s(n),h("Installing packages."),yield l.loadPackage("micropip");const b=l.pyimport("micropip");u?(yield b.install("altair<5.2.0",{keep_going:!0}),console.debug("Installing the wheels:",u,"and the requirements:",n),yield b.install.callKwargs([u.stliteServer,u.streamlit,...n],{keep_going:!0}),console.debug("Installed the wheels and the requirements"),h("Mocking some packages."),console.debug("Mock pyarrow"),a(l),console.debug("Mocked pyarrow")):(console.debug("Installing the requirements:",n),yield b.install.callKwargs(n,{keep_going:!0}),console.debug("Installed the requirements")),yield l.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),h("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield l.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),h("Setting up the loggers."),console.debug("Setting the loggers"),yield l.runPythonAsync("\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n ");self.__logCallback__=e=>{e.startsWith("CRITICAL")||e.startsWith("ERROR")?console.error(e):e.startsWith("WARNING")?console.warn(e):e.startsWith("INFO")?console.info(e):e.startsWith("DEBUG")?console.debug(e):console.log(e)},yield l.runPythonAsync('\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(msg)\n\n\n main_formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s")\n\n js_handler = JsHandler()\n js_handler.setFormatter(main_formatter)\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_logger.addHandler(js_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_handler = logging.getLogger("streamlit")\n streamlit_handler.setLevel(logging.DEBUG)\n '),console.debug("Set the loggers"),h("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield l.runPythonAsync("\n import streamlit\n\n def is_cacheable_msg(msg):\n return False\n\n streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg\n "),console.debug("Mocked some Streamlit functions"),h("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),self.__streamlitFlagOptions__=Object.assign(Object.assign({},y),{"browser.gatherUsageStats":!1,"runner.fastReruns":!1}),yield l.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n from js import __streamlitFlagOptions__\n\n flag_options = __streamlitFlagOptions__.to_py()\n load_config_options(flag_options)\n\n main_script_path = "${e}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),c=l.globals.get("server").copy(),console.debug("Set up the HTTP server"),g.postMessage({type:"event:loaded"})}))}().catch((e=>{throw g.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>i(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void d.resolve(t.data);yield u;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;c.start_websocket(e,((e,t)=>{if(t){const t=e.getBuffer("u8");e.destroy();const r=new Uint8ClampedArray(t.data.buffer,t.data.byteOffset,t.data.byteLength);g.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else g.postMessage({type:"websocket:message",data:{payload:e}})})),r.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;c.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,n=(e,t,n)=>{const o=t.toJs(),s=n.toJs();console.debug({statusCode:e,headers:o,body:s});const a={type:"http:response",data:{response:{statusCode:e,headers:o,body:s}}};r.postMessage(a)};c.receive_http_from_js(e.method,e.path,e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:s}=t.data;console.debug(`Write a file "${e}"`),o(l,e,n,s),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:o}=t.data;console.debug(`Rename "${e}" to ${o}`),function(e,t,r){n(e,r),e.FS.rename(t,r)}(l,e,o),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),l.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=l.pyimport("micropip");console.debug("Install the requirements:",e),s(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return l.runPythonAsync("\n from stlite_server.bootstrap import _fix_matplotlib_crash\n _fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),r.postMessage({type:"reply"})}))}}}catch(a){if(console.error(a),!(a instanceof Error))throw a;const e=new Error(a.message);e.name=a.name,e.stack=a.stack,r.postMessage({type:"reply",error:e})}})),g.postMessage({type:"event:start"})})()})();
1
+ (()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",o=0,s=-1,a=0,i=0;i<=e.length;++i){if(i<e.length)r=e.charCodeAt(i);else{if(47===r)break;r=47}if(47===r){if(s===i-1||1===a);else if(s!==i-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),s=i,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,s=i,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(s+1,i):n=e.slice(s+1,i),o=i-s-1;s=i,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var e,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&o&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var o=arguments[r];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var s=e.length,a=s-o,i=1;i<r.length&&47===r.charCodeAt(i);++i);for(var l=r.length-i,c=a<l?a:l,g=-1,d=0;d<=c;++d){if(d===c){if(l>c){if(47===r.charCodeAt(i+d))return r.slice(i+d+1);if(0===d)return r.slice(i+d)}else a>c&&(47===e.charCodeAt(o+d)?g=d:0===d&&(g=0));break}var h=e.charCodeAt(o+d);if(h!==r.charCodeAt(i+d))break;47===h&&(g=d)}var p="";for(d=o+g+1;d<=s;++d)d!==s&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(i+g):(i+=g,47===r.charCodeAt(i)&&++i,r.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,o=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(r=e.charCodeAt(a))){if(!s){o=a;break}}else s=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,r){if(void 0!==r&&"string"!==typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,o=0,s=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var i=r.length-1,l=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!a){o=n+1;break}}else-1===l&&(a=!1,l=n+1),i>=0&&(c===r.charCodeAt(i)?-1===--i&&(s=n):(i=-1,s=l))}return o===s?s=l:-1===s&&(s=e.length),e.slice(o,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){o=n+1;break}}else-1===s&&(a=!1,s=n+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var r=-1,n=0,o=-1,s=!0,a=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47!==l)-1===o&&(s=!1,o=i+1),46===l?-1===r?r=i:1!==a&&(a=1):-1!==r&&(a=-1);else if(!s){n=i+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":e.slice(r,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,o=e.charCodeAt(0),s=47===o;s?(r.root="/",n=1):n=0;for(var a=-1,i=0,l=-1,c=!0,g=e.length-1,d=0;g>=n;--g)if(47!==(o=e.charCodeAt(g)))-1===l&&(c=!1,l=g+1),46===o?-1===a?a=g:1!==d&&(d=1):-1!==a&&(d=-1);else if(!c){i=g+1;break}return-1===a||-1===l||0===d||1===d&&a===l-1&&a===i+1?-1!==l&&(r.base=r.name=0===i&&s?e.slice(1,l):e.slice(i,l)):(0===i&&s?(r.name=e.slice(1,a),r.base=e.slice(1,l)):(r.name=e.slice(i,a),r.base=e.slice(i,l)),r.ext=e.slice(a,l)),i>0?r.dir=e.slice(0,i-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e=r(56977),t=r.n(e);function n(e,r){const n=t().normalize(r),o=t().dirname(n).split("/"),s=[];for(const t of o){s.push(t);const r=s.join("/");if(e.FS.analyzePath(r).exists){if(e.FS.isDir(r))throw new Error(`"${r}" already exists and is not a directory.`)}else try{e.FS.mkdir(r)}catch(a){throw console.error(`Failed to create a directory "${r}"`),a}}}function o(e,t,r,o){n(e,t),e.FS.writeFile(t,r,o)}function s(e){e.forEach((e=>{let t;try{t=new URL(e)}catch(r){return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}))}function a(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var i=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function a(e){try{l(n.next(e))}catch(t){s(t)}}function i(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,i)}l((n=n.apply(e,t||[])).next())}))};let l,c;const g=self,d=new class{constructor(){this.promise=new Promise(((e,t)=>{this.resolveInternal=e,this.rejectInternal=t}))}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};function h(e){g.postMessage({type:"event:progress",data:{message:e}})}const p="https://cdn.jsdelivr.net/pyodide/v0.23.3/full/pyodide.js";const u=function(){return i(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,archives:r,requirements:n,wheels:u,mountedSitePackagesSnapshotFilePath:f,pyodideUrl:m=p,streamlitConfig:y}=yield d.promise;if(h("Loading Pyodide."),console.debug("Loading Pyodide"),l=yield function(e,t){return i(this,void 0,void 0,(function*(){const r=e.slice(0,e.lastIndexOf("/")+1);let n;return e.endsWith(".mjs")?n=(yield import(e)).loadPyodide:(importScripts(e),n=self.loadPyodide),n(Object.assign(Object.assign({},t),{indexURL:r}))}))}(m,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),h("Mounting files."),yield Promise.all(Object.keys(t).map((e=>i(this,void 0,void 0,(function*(){const r=t[e];let n;"url"in r?(console.debug(`Fetch a file from ${r.url}`),n=yield fetch(r.url).then((e=>e.arrayBuffer())).then((e=>new Uint8Array(e)))):n=r.data;const{opts:s}=t[e];console.debug(`Write a file "${e}"`),o(l,e,n,s)}))))),h("Unpacking archives."),yield Promise.all(r.map((e=>i(this,void 0,void 0,(function*(){let t;"url"in e?(console.debug(`Fetch an archive from ${e.url}`),t=yield fetch(e.url).then((e=>e.arrayBuffer()))):t=e.buffer;const{format:r,options:n}=e;console.debug("Unpack an archive",{format:r,options:n}),l.unpackArchive(t,r,n)}))))),!f&&!u)throw new Error("Neither snapshot nor wheel files are provided.");f&&(h("Restoring the snapshot."),yield l.runPythonAsync("import tarfile, shutil, site"),yield l.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${f}`),yield l.runPythonAsync(`\n with tarfile.open("${f}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),h("Mocking some packages."),console.debug("Mock pyarrow"),a(l),console.debug("Mocked pyarrow")),s(n),h("Installing packages."),yield l.loadPackage("micropip");const b=l.pyimport("micropip");u?(console.debug("Installing the wheels:",u,"and the requirements:",n),yield b.install.callKwargs([u.stliteServer,u.streamlit,...n],{keep_going:!0}),console.debug("Installed the wheels and the requirements"),h("Mocking some packages."),console.debug("Mock pyarrow"),a(l),console.debug("Mocked pyarrow")):(console.debug("Installing the requirements:",n),yield b.install.callKwargs(n,{keep_going:!0}),console.debug("Installed the requirements")),yield l.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),h("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield l.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),h("Setting up the loggers."),console.debug("Setting the loggers"),yield l.runPythonAsync("\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n ");self.__logCallback__=e=>{e.startsWith("CRITICAL")||e.startsWith("ERROR")?console.error(e):e.startsWith("WARNING")?console.warn(e):e.startsWith("INFO")?console.info(e):e.startsWith("DEBUG")?console.debug(e):console.log(e)},yield l.runPythonAsync('\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(msg)\n\n\n main_formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s")\n\n js_handler = JsHandler()\n js_handler.setFormatter(main_formatter)\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_logger.addHandler(js_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_handler = logging.getLogger("streamlit")\n streamlit_handler.setLevel(logging.DEBUG)\n '),console.debug("Set the loggers"),h("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield l.runPythonAsync("\n import streamlit\n\n def is_cacheable_msg(msg):\n return False\n\n streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg\n "),console.debug("Mocked some Streamlit functions"),h("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),self.__streamlitFlagOptions__=Object.assign(Object.assign({"browser.gatherUsageStats":!1},y),{"runner.fastReruns":!1}),yield l.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n from js import __streamlitFlagOptions__\n\n flag_options = __streamlitFlagOptions__.to_py()\n load_config_options(flag_options)\n\n main_script_path = "${e}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),c=l.globals.get("server").copy(),console.debug("Set up the HTTP server"),g.postMessage({type:"event:loaded"})}))}().catch((e=>{throw g.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>i(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void d.resolve(t.data);yield u;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;c.start_websocket(e,((e,t)=>{if(t){const t=e.getBuffer("u8");e.destroy();const r=new Uint8ClampedArray(t.data.buffer,t.data.byteOffset,t.data.byteLength);g.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else g.postMessage({type:"websocket:message",data:{payload:e}})})),r.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;c.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,n=(e,t,n)=>{const o=t.toJs(),s=n.toJs();console.debug({statusCode:e,headers:o,body:s});const a={type:"http:response",data:{response:{statusCode:e,headers:o,body:s}}};r.postMessage(a)};c.receive_http_from_js(e.method,e.path,e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:s}=t.data;console.debug(`Write a file "${e}"`),o(l,e,n,s),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:o}=t.data;console.debug(`Rename "${e}" to ${o}`),function(e,t,r){n(e,r),e.FS.rename(t,r)}(l,e,o),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),l.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=l.pyimport("micropip");console.debug("Install the requirements:",e),s(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return l.runPythonAsync("\n from stlite_server.bootstrap import _fix_matplotlib_crash\n _fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),r.postMessage({type:"reply"})}))}}}catch(a){if(console.error(a),!(a instanceof Error))throw a;const e=new Error(a.message);e.name=a.name,e.stack=a.stack,r.postMessage({type:"reply",error:e})}})),g.postMessage({type:"event:start"})})()})();
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7579],{97579:(e,t,r)=>{r.r(t),r.d(t,{default:()=>b});var o=r(5057),n=r(7742),s=r.n(n),i=r(96601),a=r(46403),l=r(31808),c=r(82160),d=r(70765),h=r(69194);const g=(0,c.Z)(d.Q,{shouldForwardProp:h.Z,target:"e1se5lgy2"})((e=>{let{theme:t,usingCustomTheme:r}=e;return{fontSize:t.fontSizes.sm,width:"1.375rem",height:"1.375rem",borderWidth:"3px",radius:"4px",justifyContents:"center",padding:t.spacing.none,margin:t.spacing.none,borderColor:t.colors.fadedText10,borderTopColor:r?t.colors.primary:t.colors.blue70,flexGrow:0,flexShrink:0}}),""),u=(0,c.Z)("div",{target:"e1se5lgy1"})((e=>{let{theme:t,width:r,cache:o}=e;return{width:r,...o?{paddingBottom:"1rem",background:"linear-gradient(to bottom, ".concat(t.colors.bgColor," 0%, ").concat(t.colors.bgColor," 80%, transparent 100%)")}:null}}),""),p=(0,c.Z)("div",{target:"e1se5lgy0"})((e=>{let{theme:t}=e;return{display:"flex",gap:t.spacing.sm,alignItems:"center",width:"100%"}}),"");var m=r(96266);const b=function(e){let{width:t,element:r}=e;const{activeTheme:n}=o.useContext(l.E),c=!(0,i.MJ)(n),{cache:d}=r;return(0,m.jsx)(u,{className:s()({stSpinner:!0,cacheSpinner:d}),"data-testid":"stSpinner",width:t,cache:d,children:(0,m.jsxs)(p,{children:[(0,m.jsx)(g,{usingCustomTheme:c}),(0,m.jsx)(a.ZP,{source:r.text,allowHTML:!1})]})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7696],{52955:(e,t,i)=>{i.d(t,{K:()=>o});var s=i(50120);class o{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}},87696:(e,t,i)=>{i.r(t),i.d(t,{default:()=>F});var s=i(5057),o=i(8708),n=i.n(o),r=i(55790),a=i(47206),l=i(59500),d=i(52955),h=i(60913),m=i(50120),u=i(88084),c=i.n(u),g=i(38944),p=i(93905),f=i(21034),b=i(98790),v=i(82160),T=i(59990);const y=(0,v.Z)("div",{target:"ew7r33m3"})((e=>{let{disabled:t,theme:i}=e;return{alignItems:"center",backgroundColor:t?i.colors.gray:i.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",height:i.radii.xl,justifyContent:"center",width:i.radii.xl,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,T.DZ)(i.colors.primary,.5))}}}),""),R=(0,v.Z)("div",{target:"ew7r33m2"})((e=>{let{disabled:t,theme:i}=e;return{fontFamily:i.genericFonts.codeFont,fontSize:i.fontSizes.sm,paddingBottom:i.spacing.twoThirdsSmFont,color:t?i.colors.gray:i.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:i.colors.transparent,lineHeight:i.lineHeights.base,fontWeight:"normal"}}),""),V=(0,v.Z)("div",{target:"ew7r33m1"})((e=>{let{theme:t}=e;return{paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:t.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"}}),""),x=(0,v.Z)("div",{target:"ew7r33m0"})((e=>{let{disabled:t,theme:i}=e;return{lineHeight:i.lineHeights.base,fontWeight:"normal",fontSize:i.fontSizes.sm,fontFamily:i.genericFonts.codeFont,color:t?i.colors.fadedText40:"inherit"}}),"");var C=i(96266);class w extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new d.K,this.state=void 0,this.sliderRef=s.createRef(),this.thumbRef=[],this.thumbValueRef=[],this.commitWidgetValueDebounced=void 0,this.commitWidgetValue=e=>{this.props.widgetMgr.setDoubleArrayValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=e=>{let{value:t}=e;this.setState({value:t},(()=>this.commitWidgetValueDebounced({fromUi:!0})))},this.renderThumb=s.forwardRef(((e,t)=>{var i;const{$value:o,$thumbIndex:r}=e,a=r||0;this.thumbRef[a]=t,(i=this.thumbValueRef)[a]||(i[a]=s.createRef());const l=o?this.formatValue(o[r]):"",d=n()(e,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),h={};return(this.props.element.options.length>0||this.isDateTimeType())&&(h["aria-valuetext"]=l),(0,C.jsx)(y,{...d,disabled:!0===e.$disabled,ref:this.thumbRef[a],"aria-valuetext":l,"aria-label":this.props.element.label,children:(0,C.jsx)(R,{className:"StyledThumbValue","data-testid":"stThumbValue",disabled:!0===e.$disabled,ref:this.thumbValueRef[a],children:l})})})),this.renderTickBar=()=>{const{disabled:e,element:t}=this.props,{max:i,min:s}=t;return(0,C.jsxs)(V,{"data-testid":"stTickBar",children:[(0,C.jsx)(x,{disabled:e,"data-testid":"stTickBarMin",children:this.formatValue(s)}),(0,C.jsx)(x,{disabled:e,"data-testid":"stTickBarMax",children:this.formatValue(i)})]})},this.commitWidgetValueDebounced=(0,m.Ds)(200,this.commitWidgetValue.bind(this)),this.state={value:this.initialValue}}get initialValue(){const e=this.props.widgetMgr.getDoubleArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){setTimeout((()=>{this.thumbValueAlignment()}),0),this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get value(){const{min:e,max:t}=this.props.element,{value:i}=this.state;let s=i[0],o=i.length>1?i[1]:i[0];return s>o&&(s=o),s<e&&(s=e),s>t&&(s=t),o<e&&(o=e),o>t&&(o=t),i.length>1?[s,o]:[s]}isDateTimeType(){const{dataType:e}=this.props.element;return e===h.iR.DataType.DATETIME||e===h.iR.DataType.DATE||e===h.iR.DataType.TIME}formatValue(e){const{format:t,options:i}=this.props.element;return this.isDateTimeType()?c().utc(e/1e3).format(t):i.length>0?(0,l.sprintf)(t,i[e]):(0,l.sprintf)(t,e)}alignValueOnThumb(e,t,i){if(e&&t&&i){const s=e.getBoundingClientRect(),o=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=o.left+o.width/2,a=r-n.width/2<s.left,l=r+n.width/2>s.right;i.style.left=a?"0":"",i.style.right=l?"0":""}}thumbValueAlignment(){var e,t,i,s;const o=this.sliderRef.current,n=null===(e=this.thumbRef[0])||void 0===e?void 0:e.current,r=null===(t=this.thumbRef[1])||void 0===t?void 0:t.current,a=null===(i=this.thumbValueRef[0])||void 0===i?void 0:i.current,l=null===(s=this.thumbValueRef[1])||void 0===s?void 0:s.current;if(this.alignValueOnThumb(o,n,a),this.alignValueOnThumb(o,r,l),o&&n&&r&&a&&l){const e=o.getBoundingClientRect(),t=n.getBoundingClientRect(),i=r.getBoundingClientRect(),s=a.getBoundingClientRect(),d=l.getBoundingClientRect();if(s.right+16>d.left){d.left-16-s.width>e.left?a.style.right="".concat(d.width+16-(i.right-t.right),"px"):l.style.left="".concat(s.width+16-(i.left-t.left),"px")}}}render(){var e;const{disabled:t,element:i,theme:s,width:o,widgetMgr:n}=this.props,{colors:a,fonts:l,fontSizes:d,spacing:h}=s,u={width:o};return this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared),this.thumbValueAlignment(),(0,C.jsxs)("div",{ref:this.sliderRef,className:"stSlider",style:u,children:[(0,C.jsx)(g.O,{label:i.label,disabled:t,labelVisibility:(0,m.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,C.jsx)(p.dT,{children:(0,C.jsx)(f.Z,{content:i.help,placement:b.u.TOP_RIGHT})})}),(0,C.jsx)(r.Z,{min:i.min,max:i.max,step:i.step,value:this.value,onChange:this.handleChange,disabled:t,overrides:{Root:{style:{paddingTop:h.twoThirdsSmFont}},Thumb:this.renderThumb,Tick:{style:{fontFamily:l.monospace,fontSize:d.sm}},Track:{style:{backgroundColor:"none !important",paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:h.twoThirdsSmFont}},InnerTrack:{style:e=>{let{$disabled:t}=e;return{height:"4px",...t?{background:a.darkenedBgMix25}:{}}}},TickBar:this.renderTickBar}})]})}}const F=(0,a.b)(w)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[790],{70790:(e,t,r)=>{r.r(t),r.d(t,{default:()=>F});var a,n=r(65850),o=r(5057);function u(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r}function i(){}function l(e){return!!(e||"").match(/\d/)}function s(e){return null===e||void 0===e}function c(e){return s(e)||function(e){return"number"===typeof e&&isNaN(e)}(e)||"number"===typeof e&&!isFinite(e)}function f(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function v(e,t){void 0===t&&(t=!0);var r="-"===e[0],a=r&&t,n=(e=e.replace("-","")).split(".");return{beforeDecimal:n[0],afterDecimal:n[1]||"",hasNegation:r,addNegation:a}}function d(e,t,r){for(var a="",n=r?"0":"",o=0;o<=t-1;o++)a+=e[o]||n;return a}function g(e,t){return Array(t+1).join(e)}function m(e){var t=e+"",r="-"===t[0]?"-":"";r&&(t=t.substring(1));var a=t.split(/[eE]/g),n=a[0],o=a[1];if(!(o=Number(o)))return r+n;var u=1+o,i=(n=n.replace(".","")).length;return u<0?n="0."+g("0",Math.abs(u))+n:u>=i?n+=g("0",u-i):n=(n.substring(0,u)||"0")+"."+n.substring(u),r+n}function p(e,t,r){if(-1!==["","-"].indexOf(e))return e;var a=(-1!==e.indexOf(".")||r)&&t,n=v(e),o=n.beforeDecimal,u=n.afterDecimal,i=n.hasNegation,l=parseFloat("0."+(u||"0")),s=(u.length<=t?"0."+u:l.toFixed(t)).split(".");return""+(i?"-":"")+o.split("").reverse().reduce((function(e,t,r){return e.length>r?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),s[0])+(a?".":"")+d(s[1]||"",t,r)}function h(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}!function(e){e.event="event",e.props="prop"}(a||(a={}));var S=function(e){var t,r=void 0;return function(){for(var a=[],n=arguments.length;n--;)a[n]=arguments[n];return t&&a.length===t.length&&a.every((function(e,r){return e===t[r]}))?r:(t=a,r=e.apply(void 0,a))}}((function(e,t){for(var r=0,a=0,n=e.length,o=t.length;e[r]===t[r]&&r<n;)r++;for(;e[n-1-a]===t[o-1-a]&&o-a>r&&n-a>r;)a++;return{from:{start:r,end:n-a},to:{start:r,end:o-a}}}));function b(e){return Math.max(e.selectionStart,e.selectionEnd)}function y(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function V(e){var t=e.currentValue,r=e.formattedValue,a=e.currentValueIndex,n=e.formattedValueIndex;return t[a]===r[n]}function w(e,t,r,a){var n,o,u,i=e.length;if(n=t,o=0,u=i,t=Math.min(Math.max(n,o),u),"left"===a){for(;t>=0&&!r[t];)t--;-1===t&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return-1===t&&(t=i),t}function x(e){for(var t=Array.from({length:e.length+1}).map((function(){return!0})),r=0,a=t.length;r<a;r++)t[r]=Boolean(l(e[r])||l(e[r-1]));return t}function N(e,t,r,a,n,u){void 0===u&&(u=i);var l=function(e){var t=(0,o.useRef)(e);t.current=e;var r=(0,o.useRef)((function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return t.current.apply(t,e)}));return r.current}((function(e,t){var r,o;return c(e)?(o="",r=""):"number"===typeof e||t?(o="number"===typeof e?m(e):e,r=a(o)):(o=n(e,void 0),r=a(o)),{formattedValue:r,numAsString:o}})),f=(0,o.useState)((function(){return l(s(e)?t:e,r)})),v=f[0],d=f[1],g=e,p=r;s(e)&&(g=v.numAsString,p=!0);var h=l(g,p);return(0,o.useMemo)((function(){d(h)}),[h.formattedValue]),[v,function(e,t){e.formattedValue!==v.formattedValue&&d({formattedValue:e.formattedValue,numAsString:e.value}),u(e,t)}]}function D(e){return e.replace(/[^0-9]/g,"")}function O(e){return e}function C(e){var t=e.type;void 0===t&&(t="text");var r=e.displayType;void 0===r&&(r="input");var n=e.customInput,s=e.renderText,c=e.getInputRef,f=e.format;void 0===f&&(f=O);var v=e.removeFormatting;void 0===v&&(v=D);var d=e.defaultValue,g=e.valueIsNumericString,m=e.onValueChange,p=e.isAllowed,y=e.onChange;void 0===y&&(y=i);var C=e.onKeyDown;void 0===C&&(C=i);var E=e.onMouseUp;void 0===E&&(E=i);var T=e.onFocus;void 0===T&&(T=i);var I=e.onBlur;void 0===I&&(I=i);var A=e.value,R=e.getCaretBoundary;void 0===R&&(R=x);var j=e.isValidInputCharacter;void 0===j&&(j=l);var B=e.isCharacterSame,F=u(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),k=N(A,d,Boolean(g),f,v,m),M=k[0],P=M.formattedValue,W=M.numAsString,L=k[1],K=(0,o.useRef)({formattedValue:P,numAsString:W}),U=function(e,t){K.current={formattedValue:e.formattedValue,numAsString:e.value},L(e,t)},_=(0,o.useState)(!1),G=_[0],$=_[1],z=(0,o.useRef)(null),Z=(0,o.useRef)({setCaretTimeout:null,focusTimeout:null});(0,o.useEffect)((function(){return $(!0),function(){clearTimeout(Z.current.setCaretTimeout),clearTimeout(Z.current.focusTimeout)}}),[]);var q=f,H=function(e,t){var r=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(r)?void 0:r}},J=function(e,t,r){0===e.selectionStart&&e.selectionEnd===e.value.length||(h(e,t),Z.current.setCaretTimeout=setTimeout((function(){e.value===r&&e.selectionStart!==e.selectionEnd&&h(e,t)}),0))},Q=function(e,t,r){return w(e,t,R(e),r)},X=function(e,t,r){var a=R(t),n=function(e,t,r,a,n,o,u){void 0===u&&(u=V);var i=n.findIndex((function(e){return e})),l=e.slice(0,i);t||r.startsWith(l)||(t=l,r=l+r,a+=l.length);for(var s=r.length,c=e.length,f={},v=new Array(s),d=0;d<s;d++){v[d]=-1;for(var g=0,m=c;g<m;g++)if(u({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:d,formattedValueIndex:g})&&!0!==f[g]){v[d]=g,f[g]=!0;break}}for(var p=a;p<s&&(-1===v[p]||!o(r[p]));)p++;var h=p===s||-1===v[p]?c:v[p];for(p=a-1;p>0&&-1===v[p];)p--;var S=-1===p||-1===v[p]?0:v[p]+1;return S>h?h:a-S<h-a?S:h}(t,P,e,r,a,j,B);return n=w(t,n,a)};(0,o.useEffect)((function(){var e=K.current,t=e.formattedValue,r=e.numAsString;P===t||P===W&&t===r||U(H(P,W),{event:void 0,source:a.props})}),[P,W]);var Y=z.current?b(z.current):void 0;("undefined"!==typeof window?o.useLayoutEffect:o.useEffect)((function(){var e=z.current;if(P!==K.current.formattedValue&&e){var t=X(K.current.formattedValue,P,Y);e.value=P,J(e,t,P)}}),[P]);var ee=function(e,t,r){var a=S(P,e),n=Object.assign(Object.assign({},a),{lastValue:P}),o=v(e,n),u=q(o);if(o=v(u,void 0),p&&!p(H(u,o))){var i=t.target,l=b(i),s=X(e,P,l);return i.value=P,J(i,s,P),!1}return function(e){var t=e.formattedValue;void 0===t&&(t="");var r=e.input,a=e.setCaretPosition;void 0===a&&(a=!0);var n=e.source,o=e.event,u=e.numAsString,i=e.caretPos;if(r){if(void 0===i&&a){var l=e.inputValue||r.value,s=b(r);r.value=t,i=X(l,t,s)}r.value=t,a&&void 0!==i&&J(r,i,t)}t!==P&&U(H(t,u),{event:o,source:n})}({formattedValue:u,numAsString:o,inputValue:e,event:t,source:r,setCaretPosition:!0,input:t.target}),!0},te=!G||"undefined"===typeof navigator||navigator.platform&&/iPhone|iPod/.test(navigator.platform)?void 0:"numeric",re=Object.assign({inputMode:te},F,{type:t,value:P,onChange:function(e){var t=e.target.value;ee(t,e,a.event)&&y(e)},onKeyDown:function(e){var t,r=e.target,a=e.key,n=r.selectionStart,o=r.selectionEnd,u=r.value;if(void 0===u&&(u=""),"ArrowLeft"===a||"Backspace"===a?t=Math.max(n-1,0):"ArrowRight"===a?t=Math.min(n+1,u.length):"Delete"===a&&(t=n),void 0!==t&&n===o){var i=t;if("ArrowLeft"===a||"ArrowRight"===a)(i=Q(u,t,"ArrowLeft"===a?"left":"right"))!==t&&e.preventDefault();else"Delete"!==a||j(u[t])?"Backspace"!==a||j(u[t])||(i=Q(u,t,"left")):i=Q(u,t,"right");i!==t&&J(r,i,u),e.isUnitTestRun&&J(r,i,u),C(e)}else C(e)},onMouseUp:function(e){var t=e.target,r=t.selectionStart,a=t.selectionEnd,n=t.value;if(void 0===n&&(n=""),r===a){var o=Q(n,r);o!==r&&J(t,o,n)}E(e)},onFocus:function(e){e.persist&&e.persist();var t=e.target;z.current=t,Z.current.focusTimeout=setTimeout((function(){var r=t.selectionStart,a=t.selectionEnd,n=t.value;void 0===n&&(n="");var o=Q(n,r);o===r||0===r&&a===n.length||J(t,o,n),T(e)}),0)},onBlur:function(e){z.current=null,clearTimeout(Z.current.focusTimeout),clearTimeout(Z.current.setCaretTimeout),I(e)}});if("text"===r)return s?o.createElement(o.Fragment,null,s(P,F)||null):o.createElement("span",Object.assign({},F,{ref:c}),P);if(n){var ae=n;return o.createElement(ae,Object.assign({},re,{ref:c}))}return o.createElement("input",Object.assign({},re,{ref:c}))}function E(e,t){var r=t.decimalScale,a=t.fixedDecimalScale,n=t.prefix;void 0===n&&(n="");var o=t.suffix;void 0===o&&(o="");var u=t.allowNegative,i=t.thousandsGroupStyle;if(void 0===i&&(i="thousand"),""===e||"-"===e)return e;var l=T(t),s=l.thousandSeparator,c=l.decimalSeparator,f=0!==r&&-1!==e.indexOf(".")||r&&a,g=v(e,u),m=g.beforeDecimal,p=g.afterDecimal,h=g.addNegation;return void 0!==r&&(p=d(p,r,!!a)),s&&(m=function(e,t,r){var a=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),n=e.search(/[1-9]/);return n=-1===n?e.length:n,e.substring(0,n)+e.substring(n,e.length).replace(a,"$1"+t)}(m,s,i)),n&&(m=n+m),o&&(p+=o),h&&(m="-"+m),e=m+(f&&c||"")+p}function T(e){var t=e.decimalSeparator;void 0===t&&(t=".");var r=e.thousandSeparator,a=e.allowedDecimalSeparators;return!0===r&&(r=","),a||(a=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:a}}function I(e,t,r){var a;void 0===t&&(t=y(e));var n=r.allowNegative,o=r.prefix;void 0===o&&(o="");var u=r.suffix;void 0===u&&(u="");var i=r.decimalScale,s=t.from,c=t.to,d=c.start,g=c.end,m=T(r),p=m.allowedDecimalSeparators,h=m.decimalSeparator,S=e[g]===h;if(l(e)&&(e===o||e===u)&&""===t.lastValue)return e;if(g-d===1&&-1!==p.indexOf(e[d])){var b=0===i?"":h;e=e.substring(0,d)+b+e.substring(d+1,e.length)}var V=function(e,t,r){var a=!1,n=!1;o.startsWith("-")?a=!1:e.startsWith("--")?(a=!1,n=!0):u.startsWith("-")&&e.length===u.length?a=!1:"-"===e[0]&&(a=!0);var i=a?1:0;return n&&(i=2),i&&(e=e.substring(i),t-=i,r-=i),{value:e,start:t,end:r,hasNegation:a}},w=V(e,d,g),x=w.hasNegation;e=(a=w).value,d=a.start,g=a.end;var N=V(t.lastValue,s.start,s.end),D=N.start,O=N.end,C=N.value,E=e.substring(d,g);!(e.length&&C.length&&(D>C.length-u.length||O<o.length))||E&&u.startsWith(E)||(e=C);var I=0;e.startsWith(o)?I+=o.length:d<o.length&&(I=d),g-=I;var A=(e=e.substring(I)).length,R=e.length-u.length;e.endsWith(u)?A=R:(g>R||g>e.length-u.length)&&(A=g),e=e.substring(0,A),e=function(e,t){void 0===e&&(e="");var r=new RegExp("(-)"),a=new RegExp("(-)(.)*(-)"),n=r.test(e),o=a.test(e);return e=e.replace(/-/g,""),n&&!o&&t&&(e="-"+e),e}(x?"-"+e:e,n),e=(e.match(function(e,t){return new RegExp("(^-)|[0-9]|"+f(e),t?"g":void 0)}(h,!0))||[]).join("");var j=e.indexOf(h),B=v(e=e.replace(new RegExp(f(h),"g"),(function(e,t){return t===j?".":""})),n),F=B.beforeDecimal,k=B.afterDecimal,M=B.addNegation;return c.end-c.start<s.end-s.start&&""===F&&S&&!parseFloat(k)&&(e=M?"-":""),e}function A(e){e=function(e){var t=T(e),r=t.thousandSeparator,a=t.decimalSeparator,n=e.prefix;void 0===n&&(n="");var o=e.allowNegative;if(void 0===o&&(o=!0),r===a)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+a+" (default value for decimalSeparator is .)\n ");return n.startsWith("-")&&o&&(console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: "+n+"\n allowNegative: "+o+"\n "),o=!1),Object.assign(Object.assign({},e),{allowNegative:o})}(e);e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,o=e.onKeyDown;void 0===o&&(o=i);var f=e.onBlur;void 0===f&&(f=i);var v=e.thousandSeparator,d=e.decimalScale,g=e.fixedDecimalScale,b=e.prefix;void 0===b&&(b="");var y=e.defaultValue,V=e.value,w=e.valueIsNumericString,x=e.onValueChange,D=u(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),O=T(e),C=O.decimalSeparator,A=O.allowedDecimalSeparators,R=function(t){return E(t,e)},j=function(t,r){return I(t,r,e)},B=s(V)?y:V,F=null!==w&&void 0!==w?w:function(e,t,r){return""===e||!(null===t||void 0===t?void 0:t.match(/\d/))&&!(null===r||void 0===r?void 0:r.match(/\d/))&&"string"===typeof e&&!isNaN(Number(e))}(B,b,t);s(V)?s(y)||(F=F||"number"===typeof y):F=F||"number"===typeof V;var k=function(e){return c(e)?e:("number"===typeof e&&(e=m(e)),F&&"number"===typeof d?p(e,d,Boolean(g)):e)},M=N(k(V),k(y),Boolean(F),R,j,x),P=M[0],W=P.numAsString,L=P.formattedValue,K=M[1];return Object.assign(Object.assign({},D),{value:L,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===C||l(e)},isCharacterSame:function(e){var t=e.currentValue,r=e.lastValue,a=e.formattedValue,n=e.currentValueIndex,o=e.formattedValueIndex,u=t[n],i=a[o],l=S(r,t).to;return!!(n>=l.start&&n<l.end&&A&&A.includes(u)&&i===C)||u===i},onValueChange:K,format:R,removeFormatting:j,getCaretBoundary:function(t){return function(e,t){var r=t.prefix;void 0===r&&(r="");var a=t.suffix;void 0===a&&(a="");var n=Array.from({length:e.length+1}).map((function(){return!0})),o="-"===e[0];n.fill(!1,0,r.length+(o?1:0));var u=e.length;return n.fill(!1,u-a.length+1,u+1),n}(t,e)},onKeyDown:function(e){var t=e.target,a=e.key,n=t.selectionStart,u=t.selectionEnd,i=t.value;if(void 0===i&&(i=""),n===u){"Backspace"===a&&"-"===i[0]&&n===b.length+1&&r&&h(t,1),d&&g&&("Backspace"===a&&i[n-1]===C?(h(t,n-1),e.preventDefault()):"Delete"===a&&i[n]===C&&e.preventDefault()),(null===A||void 0===A?void 0:A.includes(a))&&i[n]===C&&h(t,n+1);var l=!0===v?",":v;"Backspace"===a&&i[n-1]===l&&h(t,n-1),"Delete"===a&&i[n]===l&&h(t,n+1),o(e)}else o(e)},onBlur:function(t){var r=W;if(r.match(/\d/g)||(r=""),n||(r=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var r=e.split("."),a=r[0].replace(/^0+/,"")||"0",n=r[1]||"";return(t?"-":"")+a+(n?"."+n:"")}(r)),g&&d&&(r=p(r,d,g)),r!==W){var o=E(r,e);K({formattedValue:o,value:r,floatValue:parseFloat(r)},{event:t,source:a.event})}f(t)}})}function R(e){var t=A(e);return o.createElement(C,Object.assign({},t))}var j=(0,n.d)("div")({name:"NumberOverlayEditorStyle",class:"n1czszh3"});function B(){var e,t,r;const a=null==(r=null==(t=null==(e=Intl.NumberFormat())?void 0:e.formatToParts(1.1))?void 0:t.find((e=>"decimal"===e.type)))?void 0:r.value;return null!=a?a:"."}var F=e=>{const{value:t,onChange:r,disabled:a,highlight:n,validatedSelection:u,fixedDecimals:i,allowNegative:l,thousandSeparator:s,decimalSeparator:c}=e,f=o.useRef();return o.useLayoutEffect((()=>{var e;if(void 0!==u){const t="number"===typeof u?[u,null]:u;null==(e=f.current)||e.setSelectionRange(t[0],t[1])}}),[u]),o.createElement(j,null,o.createElement(R,{autoFocus:!0,getInputRef:f,className:"gdg-input",onFocus:e=>e.target.setSelectionRange(n?0:e.target.value.length,e.target.value.length),disabled:!0===a,decimalScale:i,allowNegative:l,thousandSeparator:null!=s?s:"."===B()?",":".",decimalSeparator:null!=c?c:B(),value:Object.is(t,-0)?"-":null!=t?t:"",onValueChange:r}))}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8050],{8050:(t,e,o)=>{o.r(e),o.d(e,{default:()=>V});var n=o(5057),i=o(47206),a=o(5361),s=o(1110),r=o(79220),l=o(70714),d=o(50651),c=o(64327),h=o(87241),g=o(40807),u=o.n(g),m=o(71486),f=o.n(m),p=o(96601);function b(t,e){const o={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:e.fontSizes.smPx+2,orient:"top",offset:26},header:{titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.mdPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal"},axis:{labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.smPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",ticks:!1,gridColor:(0,p.ny)(e),domain:!1,domainWidth:1,domainColor:(0,p.ny)(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:e.spacing.lgPx,labelPadding:e.spacing.lgPx,labelSeparation:e.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:e.fontSizes.smPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),titleFontSize:e.fontSizes.smPx,titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,p.Xy)(e),titlePadding:5,labelPadding:e.spacing.lgPx,columnPadding:e.spacing.smPx,rowPadding:e.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,p.iY)(e),diverging:(0,p.ru)(e),ramp:(0,p.Gy)(e),heatmap:(0,p.Gy)(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,...(0,p.Iy)(e)?{color:"#0068C9"}:{color:"#83C9FF"}},bar:{binSpacing:e.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?f()({},o,t,((t,e)=>Array.isArray(e)?e:void 0)):o}const y=(0,o(82160).Z)("div",{target:"egd2k5h0"})((t=>{let{theme:e}=t;return{"&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:e.zIndices.popupMenu,backgroundColor:e.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:"1px solid ".concat(e.colors.fadedText10),a:{fontFamily:e.genericFonts.bodyFont,fontWeight:e.fontWeights.normal,fontSize:e.fontSizes.md,margin:0,padding:"".concat(e.spacing.twoXS," ").concat(e.spacing.twoXL),color:e.colors.bodyText},"a:hover":{backgroundColor:e.colors.secondaryBg,color:e.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:e.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:e.radii.lg,color:e.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:e.colors.bodyText,opacity:"1 !important",background:e.colors.darkenedBgMix25}}}}}),"");var w=o(96266);const v={DATAFRAME_INDEX:"(index)"},x="source",S=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class F extends n.PureComponent{constructor(){super(...arguments),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=x,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{var t;const{element:e,theme:o}=this.props,n=JSON.parse(e.spec),{useContainerWidth:i}=e;if("streamlit"===e.vegaLiteTheme?n.config=b(n.config,o):"streamlit"===(null===(t=n.usermeta)||void 0===t||null===(t=t.embedOptions)||void 0===t?void 0:t.theme)?(n.config=b(n.config,o),n.usermeta.embedOptions.theme=void 0):n.config=function(t,e){const{colors:o,fontSizes:n,genericFonts:i}=e,a={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:n.twoSmPx,titleFontSize:n.twoSmPx},s={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,p.ny)(e),...a},legend:{labelColor:o.bodyText,titleColor:o.bodyText,...a},title:{color:o.bodyText,subtitleColor:o.bodyText,...a},header:{labelColor:o.bodyText,titleColor:o.bodyText,...a},view:{stroke:(0,p.ny)(e),continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return t?u()({},s,t):s}(n.config,o),this.props.height?(n.width=this.props.width,n.height=this.props.height):i&&(n.width=this.props.width),n.padding||(n.padding={}),null==n.padding.bottom&&(n.padding.bottom=20),n.datasets)throw new Error("Datasets should not be passed as part of the spec");return n}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,c.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:o}=t,{element:n,theme:i}=this.props,a=e.spec,{spec:s}=n;if(!this.vegaView||a!==s||o!==i||t.width!==this.props.width||t.height!==this.props.height||t.element.vegaLiteTheme!==this.props.element.vegaLiteTheme){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,c.b)(u);this.setState({error:t})}return}const r=e.data,{data:d}=n;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=z(e)||{},g=z(n)||{};for(const[l,c]of Object.entries(g)){const t=l||this.defaultDataName,e=h[t];this.updateData(t,e,c)}for(const l of Object.keys(h))g.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,s.truthy))}if(!e||0===e.data.numRows)return void this.vegaView.insert(t,C(o));const{dataRows:n,dataColumns:i}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,n,i,a){if(o!==a)return!1;if(e>=i)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==n.getDataValue(0,s)||t.getDataValue(r,s)!==n.getDataValue(r,s))return!1;return!0}(e,n,i,o,a,r))n<a&&this.vegaView.insert(t,C(o,n));else{const e=s.changeset().remove(s.truthy).insert(C(o));this.vegaView.change(t,e),(0,l.ji)("Had to clear the ".concat(t," dataset before inserting data through Vega view."))}}async createView(){if((0,l.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),o={ast:!0,expr:r.N,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:n,view:i,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=i,this.vegaFinalizer=s;const d=function(t){const e=z(t);if(null==e)return null;const o={};for(const[n,i]of Object.entries(e))o[n]=C(i);return o}(t),c=d?Object.keys(d):[];if(1===c.length){const[t]=c;this.defaultDataName=t}else 0===c.length&&n.data&&(this.defaultDataName=x);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return C(e)}(t);if(h&&i.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))i.insert(a,r);await i.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,w.jsx)(y,{"data-testid":"stArrowVegaLiteChart",ref:t=>{this.element=t}})}}function z(t){var e;if(0===(null===(e=t.datasets)||void 0===e?void 0:e.length))return null;const o={};return t.datasets.forEach((t=>{if(!t)return;const e=t.hasName?t.name:null;o[e]=t.data})),o}function C(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.isEmpty())return[];const o=[],{dataRows:n,dataColumns:i}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=S.has(a);for(let r=e;r<n;r++){const e={};if(s){const o=t.getIndexValue(r,0);e[v.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<i;o++){const n=t.getDataValue(r,o);e[t.columns[0][o]]="bigint"===typeof n?Number(n):n}o.push(e)}return o}const V=(0,i.b)((0,d.Z)(F))}}]);