jclic 2.1.21 → 2.1.23

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 (175) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/jclic-node.js +9 -8
  3. package/dist/jclic-node.js.map +1 -1
  4. package/dist/jclic.min.js +2 -2
  5. package/dist/jclic.min.js.map +1 -1
  6. package/package.json +4 -4
  7. package/src/GlobalData.js +1 -1
  8. package/src/JClicPlayer.js +2 -2
  9. package/src/bags/MediaBag.js +6 -5
  10. package/dist/1078.jclic-node.js +0 -282
  11. package/dist/1078.jclic-node.js.map +0 -1
  12. package/dist/1196.jclic-node.js +0 -808
  13. package/dist/1196.jclic-node.js.map +0 -1
  14. package/dist/1253.jclic-node.js +0 -1432
  15. package/dist/1253.jclic-node.js.map +0 -1
  16. package/dist/13.jclic-node.js +0 -103
  17. package/dist/13.jclic-node.js.map +0 -1
  18. package/dist/1567.jclic-node.js +0 -2313
  19. package/dist/1567.jclic-node.js.map +0 -1
  20. package/dist/1588.jclic-node.js +0 -602
  21. package/dist/1588.jclic-node.js.map +0 -1
  22. package/dist/1725.jclic-node.js +0 -836
  23. package/dist/1725.jclic-node.js.map +0 -1
  24. package/dist/1731.jclic-node.js +0 -438
  25. package/dist/1731.jclic-node.js.map +0 -1
  26. package/dist/1842.jclic-node.js +0 -651
  27. package/dist/1842.jclic-node.js.map +0 -1
  28. package/dist/2160.jclic-node.js +0 -1016
  29. package/dist/2160.jclic-node.js.map +0 -1
  30. package/dist/222.jclic-node.js +0 -129
  31. package/dist/222.jclic-node.js.map +0 -1
  32. package/dist/2316.jclic-node.js +0 -949
  33. package/dist/2316.jclic-node.js.map +0 -1
  34. package/dist/2355.jclic-node.js +0 -371
  35. package/dist/2355.jclic-node.js.map +0 -1
  36. package/dist/2366.jclic-node.js +0 -431
  37. package/dist/2366.jclic-node.js.map +0 -1
  38. package/dist/2379.jclic-node.js +0 -202
  39. package/dist/2379.jclic-node.js.map +0 -1
  40. package/dist/2437.jclic-node.js +0 -450
  41. package/dist/2437.jclic-node.js.map +0 -1
  42. package/dist/2531.jclic-node.js +0 -869
  43. package/dist/2531.jclic-node.js.map +0 -1
  44. package/dist/2608.jclic-node.js +0 -160
  45. package/dist/2608.jclic-node.js.map +0 -1
  46. package/dist/2715.jclic-node.js +0 -554
  47. package/dist/2715.jclic-node.js.map +0 -1
  48. package/dist/277.jclic-node.js +0 -22
  49. package/dist/277.jclic-node.js.map +0 -1
  50. package/dist/2921.jclic-node.js +0 -660
  51. package/dist/2921.jclic-node.js.map +0 -1
  52. package/dist/2952.jclic-node.js +0 -101
  53. package/dist/2952.jclic-node.js.map +0 -1
  54. package/dist/3018.jclic-node.js +0 -421
  55. package/dist/3018.jclic-node.js.map +0 -1
  56. package/dist/3019.jclic-node.js +0 -682
  57. package/dist/3019.jclic-node.js.map +0 -1
  58. package/dist/3231.jclic-node.js +0 -274
  59. package/dist/3231.jclic-node.js.map +0 -1
  60. package/dist/331.jclic-node.js +0 -115
  61. package/dist/331.jclic-node.js.map +0 -1
  62. package/dist/3391.jclic-node.js +0 -276
  63. package/dist/3391.jclic-node.js.map +0 -1
  64. package/dist/3502.jclic-node.js +0 -671
  65. package/dist/3502.jclic-node.js.map +0 -1
  66. package/dist/3653.jclic-node.js +0 -982
  67. package/dist/3653.jclic-node.js.map +0 -1
  68. package/dist/371.jclic.min.js +0 -2
  69. package/dist/371.jclic.min.js.map +0 -1
  70. package/dist/3856.jclic-node.js +0 -575
  71. package/dist/3856.jclic-node.js.map +0 -1
  72. package/dist/4112.jclic-node.js +0 -659
  73. package/dist/4112.jclic-node.js.map +0 -1
  74. package/dist/4123.jclic-node.js +0 -910
  75. package/dist/4123.jclic-node.js.map +0 -1
  76. package/dist/427.jclic-node.js +0 -894
  77. package/dist/427.jclic-node.js.map +0 -1
  78. package/dist/4483.jclic-node.js +0 -327
  79. package/dist/4483.jclic-node.js.map +0 -1
  80. package/dist/4548.jclic-node.js +0 -1078
  81. package/dist/4548.jclic-node.js.map +0 -1
  82. package/dist/466.jclic-node.js +0 -99
  83. package/dist/466.jclic-node.js.map +0 -1
  84. package/dist/485.jclic-node.js +0 -783
  85. package/dist/485.jclic-node.js.map +0 -1
  86. package/dist/4921.jclic-node.js +0 -500
  87. package/dist/4921.jclic-node.js.map +0 -1
  88. package/dist/5091.jclic-node.js +0 -239
  89. package/dist/5091.jclic-node.js.map +0 -1
  90. package/dist/520.jclic-node.js +0 -550
  91. package/dist/520.jclic-node.js.map +0 -1
  92. package/dist/5312.jclic-node.js +0 -1126
  93. package/dist/5312.jclic-node.js.map +0 -1
  94. package/dist/5338.jclic-node.js +0 -212
  95. package/dist/5338.jclic-node.js.map +0 -1
  96. package/dist/5344.jclic-node.js +0 -229
  97. package/dist/5344.jclic-node.js.map +0 -1
  98. package/dist/5550.jclic-node.js +0 -238
  99. package/dist/5550.jclic-node.js.map +0 -1
  100. package/dist/5626.jclic-node.js +0 -614
  101. package/dist/5626.jclic-node.js.map +0 -1
  102. package/dist/5977.jclic-node.js +0 -1081
  103. package/dist/5977.jclic-node.js.map +0 -1
  104. package/dist/6148.jclic-node.js +0 -345
  105. package/dist/6148.jclic-node.js.map +0 -1
  106. package/dist/6176.jclic-node.js +0 -481
  107. package/dist/6176.jclic-node.js.map +0 -1
  108. package/dist/6221.jclic-node.js +0 -1072
  109. package/dist/6221.jclic-node.js.map +0 -1
  110. package/dist/6238.jclic-node.js +0 -718
  111. package/dist/6238.jclic-node.js.map +0 -1
  112. package/dist/6454.jclic-node.js +0 -1413
  113. package/dist/6454.jclic-node.js.map +0 -1
  114. package/dist/6565.jclic-node.js +0 -294
  115. package/dist/6565.jclic-node.js.map +0 -1
  116. package/dist/6579.jclic-node.js +0 -719
  117. package/dist/6579.jclic-node.js.map +0 -1
  118. package/dist/6715.jclic-node.js +0 -148
  119. package/dist/6715.jclic-node.js.map +0 -1
  120. package/dist/6777.jclic-node.js +0 -171
  121. package/dist/6777.jclic-node.js.map +0 -1
  122. package/dist/6782.jclic-node.js +0 -1611
  123. package/dist/6782.jclic-node.js.map +0 -1
  124. package/dist/6847.jclic-node.js +0 -601
  125. package/dist/6847.jclic-node.js.map +0 -1
  126. package/dist/6856.jclic-node.js +0 -252
  127. package/dist/6856.jclic-node.js.map +0 -1
  128. package/dist/696.jclic-node.js +0 -1821
  129. package/dist/696.jclic-node.js.map +0 -1
  130. package/dist/698.jclic-node.js +0 -583
  131. package/dist/698.jclic-node.js.map +0 -1
  132. package/dist/704.jclic-node.js +0 -80
  133. package/dist/704.jclic-node.js.map +0 -1
  134. package/dist/7046.jclic-node.js +0 -735
  135. package/dist/7046.jclic-node.js.map +0 -1
  136. package/dist/7220.jclic-node.js +0 -156
  137. package/dist/7220.jclic-node.js.map +0 -1
  138. package/dist/7257.jclic-node.js +0 -931
  139. package/dist/7257.jclic-node.js.map +0 -1
  140. package/dist/743.jclic-node.js +0 -583
  141. package/dist/743.jclic-node.js.map +0 -1
  142. package/dist/757.jclic-node.js +0 -1072
  143. package/dist/757.jclic-node.js.map +0 -1
  144. package/dist/7781.jclic-node.js +0 -202
  145. package/dist/7781.jclic-node.js.map +0 -1
  146. package/dist/7912.jclic-node.js +0 -2103
  147. package/dist/7912.jclic-node.js.map +0 -1
  148. package/dist/827.jclic-node.js +0 -708
  149. package/dist/827.jclic-node.js.map +0 -1
  150. package/dist/8276.jclic-node.js +0 -409
  151. package/dist/8276.jclic-node.js.map +0 -1
  152. package/dist/8322.jclic-node.js +0 -498
  153. package/dist/8322.jclic-node.js.map +0 -1
  154. package/dist/8641.jclic-node.js +0 -360
  155. package/dist/8641.jclic-node.js.map +0 -1
  156. package/dist/8837.jclic-node.js +0 -651
  157. package/dist/8837.jclic-node.js.map +0 -1
  158. package/dist/8895.jclic-node.js +0 -151
  159. package/dist/8895.jclic-node.js.map +0 -1
  160. package/dist/9072.jclic-node.js +0 -1285
  161. package/dist/9072.jclic-node.js.map +0 -1
  162. package/dist/9078.jclic-node.js +0 -935
  163. package/dist/9078.jclic-node.js.map +0 -1
  164. package/dist/9103.jclic-node.js +0 -718
  165. package/dist/9103.jclic-node.js.map +0 -1
  166. package/dist/9359.jclic-node.js +0 -145
  167. package/dist/9359.jclic-node.js.map +0 -1
  168. package/dist/9409.jclic-node.js +0 -921
  169. package/dist/9409.jclic-node.js.map +0 -1
  170. package/dist/9513.jclic-node.js +0 -720
  171. package/dist/9513.jclic-node.js.map +0 -1
  172. package/dist/9704.jclic-node.js +0 -81
  173. package/dist/9704.jclic-node.js.map +0 -1
  174. package/dist/9950.jclic-node.js +0 -827
  175. package/dist/9950.jclic-node.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"9078.jclic-node.js","mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE2C;AACa;AACjB;;AAEvC;AACA,mCAAmC,wDAAwD;AAC3F,+BAA+B,uDAAuD;AACtF;AACA;AACA;AACO,qBAAqB,uDAAW;AACvC;AACA;AACA,aAAa,sCAAsC;AACnD,aAAa,sBAAsB;AACnC,aAAa,8BAA8B;AAC3C;AACA;AACA;AACA;AACA,+BAA+B,wDAAS;AACxC;AACA;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC,aAAa,WAAW;AACxB,MAAM;AACN,sCAAsC,yCAAyC,IAAI,8CAA8C;AACjI,aAAa,QAAQ;AACrB,eAAe,sBAAsB;AACrC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,sBAAsB;AACnC,aAAa,WAAW;AACxB,MAAM;AACN,sCAAsC,yCAAyC,IAAI,8CAA8C;AACjI,aAAa,WAAW;AACxB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,wDAAS;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,wDAAS;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,wDAAS;AAC3B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,eAAe,wDAAS;AACxB,eAAe,yDAAQ;AACvB,eAAe,yDAAQ;AACvB;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA,eAAe,wDAAS;AACxB;;AAEA;AACA,cAAc,wDAAwD;AACtE,aAAa,sCAAsC;AACnD;AACA;AACA;AACA;;AAEA;AACA,MAAM,wDAAS;AACf;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,sCAAsC;AACnD,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,sCAAsC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,wDAAS;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,wDAAS;AAC9C;AACA;AACA,gBAAgB,wDAAS;AACzB;AACA;AACA,KAAK;AACL;AACA,cAAc,wDAAS;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,sDAAsD;AACtE;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,uDAAuD;AACvE;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,2DAA2D;AAC3E;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,sDAAsD;AACtE;AACA,aAAa,wBAAwB;AACrC;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,iBAAiB,wDAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,oDAAK;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,kBAAkB,oDAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA,aAAa,mCAAmC;AAChD;AACA,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,8BAA8B,wDAAwD;AACtF,aAAa,kBAAkB;AAC/B,eAAe;AACf;AACA;AACA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,wCAAwC;AACpD;AACA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC,uBAAuB,wDAAS;AAChC;AACA;AACA;AACA,YAAY,sCAAsC;AAClD;AACA,CAAC;;AAED,iEAAe,MAAM,EAAC;;;;;;;;;;;;;;;;ACnftB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEuB;AACiG;AAC1D;;AAE9D,sBAAsB,yDAAQ;;AAE9B;AACA,sEAAsE,wDAAwD;AAC9H;AACA;AACA;AACA,yBAAyB,wDAAwD;AACjF,yBAAyB,wCAAwC;AACjE;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,8BAA8B;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA,IAAI,gEAAW;AACf;AACA;AACA;AACA,uBAAuB,+DAAU;AACjC;AACA;AACA;AACA;AACA;AACA,kCAAkC,qDAAM;AACxC;AACA;AACA,kCAAkC,qDAAM;AACxC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,oBAAoB,6CAAC;AACrB;AACA;AACA,2BAA2B,mDAAI;AAC/B;;AAEA;AACA,gCAAgC,uDAAQ;AACxC;;AAEA;AACA,2BAA2B,+DAAU;AACrC,2BAA2B,+DAAU;AACrC,6BAA6B,+DAAU;AACvC,+BAA+B,+DAAU;AACzC,kCAAkC,+DAAU;AAC5C,6BAA6B,+DAAU;AACvC;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,WAAW,4DAAO;AAClB;AACA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C,mBAAmB,4BAA4B;AAC/C,qBAAqB,8BAA8B;AACnD,uBAAuB,gCAAgC;AACvD,0BAA0B,mCAAmC;AAC7D,qBAAqB,8BAA8B;AACnD;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;AACA,WAAW,4DAAO;AAClB;AACA,QAAQ,yBAAyB,qDAAM,EAAE;AACzC,QAAQ,yBAAyB,qDAAM,EAAE;AACzC,QAAQ,iBAAiB,mDAAI,EAAE;AAC/B,QAAQ,uBAAuB,uDAAQ,EAAE;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,gEAAW;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB,aAAa,SAAS;AACtB,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,MAAM,KAAK,MAAM,SAAS,MAAM;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,mCAAmC;AAChD,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe,UAAU;AACzB,oFAAoF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA,cAAc,gEAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,wDAAS;AAC3B,OAAO;;AAEP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,8BAA8B;AAC1C;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAiB;AAC7B,YAAY,mDAAI;AAChB;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,qBAAqB;AACjC;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,YAAY,mBAAmB;AAC/B,oBAAoB,qDAAM;AAC1B;AACA;AACA;AACA,YAAY,mBAAmB;AAC/B,oBAAoB,qDAAM;AAC1B,CAAC;;AAED;;AAEA,iEAAe,OAAO,EAAC","sources":["webpack://jclic/./src/boxes/BoxBag.js","webpack://jclic/./src/boxes/BoxBase.js"],"sourcesContent":["/**\n * File : boxes/BoxBag.js\n * Created : 21/04/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport AbstractBox from './AbstractBox.js';\nimport { Rectangle, Dimension, Point } from '../AWT.js';\nimport { settings } from '../Utils.js';\n\n/**\n * BoxBag is a class derived from {@link module:boxes/AbstractBox.AbstractBox AbstractBox} that contains a collection of \"boxes\"\n * (objects also derived from {@link module:boxes/AbstractBox.AbstractBox AbstractBox}). This class implements methods to add, remove\n * and retrieve boxes, and to manage some of its properties like visibility, status, location and size.\n * @extends module:boxes/AbstractBox.AbstractBox\n */\nexport class BoxBag extends AbstractBox {\n /**\n * BoxBag constructor\n * @param {module:boxes/AbstractBox.AbstractBox} [parent] - The AbstractBox to which this box bag belongs\n * @param {module:AWT.Container} [container] - The container where this box bag is placed.\n * @param {module:boxes/BoxBase.BoxBase} [boxBase] - The object where colors, fonts, border and other graphic properties\n */\n constructor(parent, container, boxBase) {\n // BoxBag extends AbstractBox\n super(parent, container, boxBase);\n this.preferredBounds = new Rectangle();\n this.cells = [];\n }\n\n /**\n * Static method that sets the position and dimension of a `Resizable` object based on a\n * preferred maximum dimension and a margin.\n * @param {module:AWT.Dimension} preferredMaxSize - The preferred maximum size\n * @param {Resizable} rs - A resizable object implementing the methods described in the\n * {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/boxes/Resizable.html Resizable}\n * interface of JClic. Currently a {@link module:boxes/BoxBag.BoxBag BoxBag} or {@link module:boxes/TextGrid.TextGrid TextGrid}.\n * @param {number} margin - The margin between the available area and the BoxBag\n * @returns {module:AWT.Dimension} - The resulting size of the container\n */\n static layoutSingle(preferredMaxSize, rs, margin) {\n\n // Avoid exceptions when rs is null\n if (!rs)\n return preferredMaxSize;\n\n // optimal, maximal and minimal dimensions\n let\n d = rs.getPreferredSize(),\n minSize = rs.getMinimumSize(),\n maxSize = preferredMaxSize;\n\n // remove margins\n maxSize.width -= 2 * margin;\n maxSize.height -= 2 * margin;\n // correct maxSize if less than minSize\n if (minSize.width > maxSize.width || minSize.height > maxSize.height) {\n maxSize = minSize;\n }\n // compute scale factor\n let scale = d.width > maxSize.width ? maxSize.width / d.width : 1;\n if (scale * d.height > maxSize.height)\n scale = maxSize.height / d.height;\n\n // resize the `Resizable` object\n d = rs.getScaledSize(scale);\n rs.setBounds(margin, margin, d.width, d.height);\n\n // restore margins\n d.width += 2 * margin;\n d.height += 2 * margin;\n\n return d;\n }\n\n /**\n * Static method that sets the position and dimension of two `Resizable` objects based on a\n * preferred maximum size, a layout schema and a margin.\n * @param {module:AWT.Dimension} desiredMaxSize - The preferred maximum size\n * @param {Resizable} rsA - First resizable object implementing the methods described in the\n * {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/boxes/Resizable.html Resizable}\n * interface of JClic. Currently a {@link module:boxes/BoxBag.BoxBag BoxBag} or {@link module:boxes/TextGrid.TextGrid TextGrid}.\n * @param {Resizable} rsB - Second resizable object\n * @param {string} boxGridPos - The layout schema. Possible values are:\n * - \"AB\" (_A_ at left, _B_ at right)\n * - \"BA\" (_B_ at left, _A_ at right)\n * - \"AUB\" (_A_ above _B_)\n * - \"BUA\" (_A_ below _B_).\n * @param {number} margin - The margin between the available area and the BoxBag\n * @returns {module:AWT.Dimension} - The resulting size of the container\n */\n static layoutDouble(desiredMaxSize, rsA, rsB, boxGridPos, margin) {\n // number of horizontal and vertical grid lines\n let\n isHLayout = false,\n nbh = 1,\n nbv = 1;\n switch (boxGridPos) {\n case 'AB':\n case 'BA':\n nbh = 2;\n nbv = 1;\n isHLayout = true;\n break;\n case 'AUB':\n case 'BUA':\n nbh = 1;\n nbv = 2;\n isHLayout = false;\n break;\n }\n const\n ra = rsA.getBounds(),\n rb = rsB.getBounds();\n\n // optimal dimensions\n let\n da = rsA.getPreferredSize(),\n db = rsB.getPreferredSize();\n\n const d = new Dimension(\n isHLayout ? da.width + db.width : Math.max(da.width, db.width),\n isHLayout ? Math.max(da.height, db.height) : da.height + db.height\n );\n\n // minimal dimensions\n const\n minSizeA = rsA.getMinimumSize(),\n minSizeB = rsB.getMinimumSize(),\n minSize = new Dimension(\n isHLayout ? minSizeA.width + minSizeB.width : Math.max(minSizeA.width, minSizeB.width),\n isHLayout ? Math.max(minSizeA.height, minSizeB.height) : minSizeA.height + minSizeB.height\n ),\n maxSize = desiredMaxSize;\n\n // remove margins\n maxSize.width -= (1 + nbh) * margin;\n maxSize.height -= (1 + nbv) * margin;\n\n // correct maxSize if less than minSize\n if (minSize.width > maxSize.width || minSize.height > maxSize.height)\n maxSize.setDimension(minSize);\n\n // compute scale factor\n let scale = d.width > maxSize.width ? maxSize.width / d.width : 1;\n if (scale * d.height > maxSize.height)\n scale = maxSize.height / d.height;\n\n //\n // correct possible minimal infractions\n // ...\n // resize\n da = rsA.getScaledSize(scale);\n db = rsB.getScaledSize(scale);\n\n // set margins to center one box relative to the other\n let\n dah = db.width > da.width ? (db.width - da.width) / 2 : 0,\n dbh = da.width > db.width ? (da.width - db.width) / 2 : 0,\n dav = db.height > da.height ? (db.height - da.height) / 2 : 0,\n dbv = da.height > db.height ? (da.height - db.height) / 2 : 0;\n\n switch (boxGridPos) {\n case 'AB':\n rsA.setBounds(margin, margin + dav, da.width, da.height);\n rsB.setBounds(2 * margin + da.width, margin + dbv, db.width, db.height);\n break;\n case 'BA':\n rsB.setBounds(margin, margin + dbv, db.width, db.height);\n rsA.setBounds(2 * margin + db.width, margin + dav, da.width, da.height);\n break;\n case 'AUB':\n rsA.setBounds(margin + dah, margin, da.width, da.height);\n rsB.setBounds(margin + dbh, 2 * margin + da.height, db.width, db.height);\n break;\n case 'BUA':\n rsB.setBounds(margin + dbh, margin, db.width, db.height);\n rsA.setBounds(margin + dah, 2 * margin + db.height, da.width, da.height);\n break;\n default:\n rsA.setBounds(\n Math.round(margin + scale * ra.pos.x),\n Math.round(margin + scale * ra.pos.y),\n da.width, da.height);\n rsB.setBounds(\n Math.round(margin + scale * rb.pos.x),\n Math.round(margin + scale * rb.pos.y),\n da.width, da.height);\n break;\n }\n\n // recompute 'd' adding margins\n const r = new Rectangle(rsA.getBounds());\n r.add(rsB.getBounds());\n d.width = r.dim.width + 2 * margin;\n d.height = r.dim.height + 2 * margin;\n\n return d;\n }\n\n /**\n * Gets the preferred size of this `BoxBag`\n * @returns {module:AWT.Dimension}\n */\n getPreferredSize() {\n return this.preferredBounds.dim;\n }\n\n /**\n * Gets the minimum size requested by this `BoxBag`\n * @returns {module:AWT.Dimension}\n */\n getMinimumSize() {\n const d = this.getPreferredSize();\n return new Dimension(\n Math.max(settings.MIN_CELL_SIZE, d.width),\n Math.max(settings.MIN_CELL_SIZE, d.height));\n }\n\n /**\n * Scales the current size of this box bag, multiplying all values by a specific factor\n * @param {number} scale - The scale factor\n * @returns {module:AWT.Dimension}\n */\n getScaledSize(scale) {\n const d = this.getPreferredSize();\n return new Dimension(Math.round(scale * d.width), Math.round(scale * d.height));\n }\n\n /**\n * Adds an {@link module:boxes/AbstractBox.AbstractBox AbstractBox} to the collection of cells\n * @param {module:boxes/AbstractBox.AbstractBox} bx - The box to add\n */\n addBox(bx) {\n this.cells.push(bx);\n bx.setParent(this);\n\n if (this.cells.length === 1)\n Rectangle.prototype.setBounds.call(this, bx);\n else\n this.add(bx);\n\n this.preferredBounds.setBounds(this.getBounds());\n }\n\n /**\n * Returns the index of a specific box in the `cells` array\n * @param {module:boxes/AbstractBox.AbstractBox} bx\n * @returns {number}\n */\n boxIndex(bx) {\n return bx === null ? -1 : this.cells.indexOf(bx);\n }\n\n /**\n * Returns the box at a specific index in the `cells` array\n * @param {number} n - The index\n * @returns {module:boxes/AbstractBox.AbstractBox}\n */\n getBox(n) {\n return n < 0 || n >= this.cells.length ? null : this.cells[n];\n }\n\n /**\n * Gets the background box\n * @returns {module:boxes/AbstractBox.AbstractBox}\n */\n getBackgroundBox() {\n return this.backgroundBox;\n }\n\n /**\n * Sets the background box\n * @param {module:boxes/AbstractBox.AbstractBox} bx\n */\n setBackgroundBox(bx) {\n this.backgroundBox = bx;\n if (bx !== null) {\n bx.setParent(this);\n bx.isBackground = true;\n }\n // Add the `backgroundbox` rectangle to the global BoxBag rectangle\n Rectangle.prototype.add.call(this, bx);\n this.preferredBounds.setBounds(this.getBounds());\n }\n\n /**\n * Recalculates the total size of this BoxBag (useful after direct additions o deletions of\n * elements in the `cells` array).\n * Updates `preferredBounds` and the current position and size of the box bag.\n */\n recalcSize() {\n let r = this.backgroundBox ? new Rectangle(this.backgroundBox.pos, this.backgroundBox.dim) : null;\n this.cells.forEach(cell => {\n if (!r)\n r = new Rectangle(cell.pos, cell.dim);\n else\n r.add(cell);\n });\n if (!r)\n r = new Rectangle(this.pos.x, this.pos.y, 0, 0);\n this.preferredBounds.setRect(r);\n this.x = r.pos.x;\n this.y = r.pos.y;\n this.dim.width = r.dim.width;\n this.dim.height = r.dim.height;\n }\n\n /**\n * Returns the number of cells stored in this BoxBag\n * @returns {number}\n */\n getNumCells() {\n return this.cells.length;\n }\n\n /**\n * Sets the specified key - value pair to all cells of this bag.\n * @param {string} key - The key to be established\n * @param {any} value - The value, of any type\n */\n setCellAttr(key, value) {\n this.cells.forEach(bx => bx[key] = value);\n if (this.backgroundBox)\n this.backgroundBox[key] = value;\n }\n\n /**\n * Overrides {@link module:boxes/AbstractBox.AbstractBox#setBorder} iterating over all the cells stored in this box bag.\n * @override\n * @param {boolean} newVal - Whether to set or unset the border\n */\n setBorder(newVal) {\n this.cells.forEach(bx => bx.setBorder(newVal));\n }\n\n /**\n * Overrides {@link module:boxes/AbstractBox.AbstractBox#setVisible} iterating over all the cells stored in this box bag.\n * @override\n * @param {boolean} newVal - Whether to set the cells visible or not\n */\n setVisible(newVal) {\n this.cells.forEach(bx => bx.setVisible(newVal));\n }\n\n /**\n * Overrides {@link module:boxes/AbstractBox.AbstractBox#setAlternative} iterating over all the cells stored in this box bag.\n * @override\n * @param {boolean} newVal - Whether to set or unset the cells in \"alternative\" mode\n */\n setAlternative(newVal) {\n super.setAlternative(newVal);\n this.cells.forEach(bx => bx.setAlternative(newVal));\n }\n\n /**\n * Overrides {@link module:boxes/AbstractBox.AbstractBox#setBounds} adjusting the position and size of all cells\n * @override\n * @param {(AWT.Rectangle|number)} rect - An AWT.Rectangle object, or the `x` coordinate of the\n * upper-left corner of a new rectangle.\n * @param {number} [ry] - `y` coordinate of the upper-left corner of the new rectangle.\n * @param {number} [rw] - Width of the new rectangle.\n * @param {number} [rh] - Height of the new rectangle.\n */\n setBounds(rect, ry, rw, rh) {\n if (typeof rect === 'number') {\n // Arguments are co-ordinates and size\n rect = new Rectangle(rect, ry, rw, rh);\n }\n if (rect.getSurface() > 0 && !rect.equals(this)) {\n const\n scaleW = rect.dim.width / this.dim.width,\n scaleH = rect.dim.height / this.dim.height,\n dx = rect.pos.x - this.pos.x,\n dy = rect.pos.y - this.pos.y;\n this.cells.forEach(bx => {\n const p = new Point(bx.pos.x - this.pos.x, bx.pos.y - this.pos.y);\n bx.setBounds(\n dx + this.pos.x + scaleW * p.x,\n dy + this.pos.y + scaleH * p.y,\n scaleW * bx.dim.width,\n scaleH * bx.dim.height);\n // Clear pos0\n bx.pos0 = null;\n });\n if (this.backgroundBox !== null) {\n const\n bx = this.backgroundBox,\n p = new Point(bx.pos.x - this.pos.x, bx.pos.y - this.pos.y);\n bx.setBounds(\n dx + this.pos.x + scaleW * p.x,\n dy + this.pos.y + scaleH * p.y,\n scaleW * bx.dim.width,\n scaleH * bx.dim.height);\n }\n }\n super.setBounds(rect);\n }\n\n /**\n * Performs graphics operations for each cell.\n * Overrides {@link module:boxes/AbstractBox.AbstractBox#update}\n * @override\n * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the\n * box contents.\n * @param {module:AWT.Rectangle} [dirtyRegion] - The area that must be repainted. `null` refers to the whole box.\n */\n update(ctx, dirtyRegion) {\n if (this.isEmpty() || !this.isVisible() || this.isTemporaryHidden())\n return false;\n\n if (dirtyRegion && !this.intersects(dirtyRegion))\n return false;\n\n if (this.backgroundBox !== null)\n this.backgroundBox.update(ctx, dirtyRegion);\n\n this.cells.forEach(bx => {\n if (!bx.isMarked())\n bx.update(ctx, dirtyRegion);\n });\n\n // Make a second loop to repaint marked cells\n this.cells.forEach(bx => {\n if (bx.isMarked())\n bx.update(ctx, dirtyRegion);\n });\n return true;\n }\n\n /**\n * Finds the first visible {@link module:boxes/AbstractBox.AbstractBox AbstractBox} located under the specified point\n * @param {module:AWT.Point} p\n * @returns {module:boxes/AbstractBox.AbstractBox}\n */\n findBox(p) {\n let result = null;\n for (let i = this.cells.length - 1; i >= 0; i--) {\n const bx = this.getBox(i);\n if (bx.isVisible() && bx.contains(p)) {\n result = bx;\n break;\n }\n }\n return result;\n }\n\n /**\n * Count the number of cells of this BoxBag that are in \"inactive\" state\n * @returns {number}\n */\n countInactiveCells() {\n return this.cells.reduce((n, bx) => bx.isInactive() ? ++n : n, 0);\n }\n}\n\nObject.assign(BoxBag.prototype, {\n /**\n * The array of cells\n * @name module:boxes/BoxBag.BoxBag#cells\n * @type {module:boxes/AbstractBox.AbstractBox[]} */\n cells: [],\n /**\n * Rectangle containing the preferred bounds of the BoxBag\n * @name module:boxes/BoxBag.BoxBag#preferredBounds\n * @type {module:AWT.Rectangle} */\n preferredBounds: new Rectangle(),\n /**\n * An optional box used as a background by this BoxBag\n * @name module:boxes/BoxBag.BoxBag#backgroundBox\n * @type {module:boxes/AbstractBox.AbstractBox} */\n backgroundBox: null,\n});\n\nexport default BoxBag;\n","/**\n * File : boxes/BoxBase.js\n * Created : 12/04/2015\n * By : Francesc Busquets <francesc@gmail.com>\n *\n * JClic.js\n * An HTML5 player of JClic activities\n * https://projectestac.github.io/jclic.js\n *\n * @source https://github.com/projectestac/jclic.js\n *\n * @license EUPL-1.2\n * @licstart\n * (c) 2000-2020 Catalan Educational Telematic Network (XTEC)\n *\n * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by\n * the European Commission- subsequent versions of the EUPL (the \"Licence\");\n * You may not use this work except in compliance with the Licence.\n *\n * You may obtain a copy of the Licence at:\n * https://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an \"AS IS\" basis, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * Licence for the specific language governing permissions and limitations\n * under the Licence.\n * @licend\n * @module\n */\n\nimport $ from 'jquery';\nimport { settings, attrForEach, getBoolean, checkColor, getAttr, setAttr, cloneObject, isSeparator } from '../Utils.js';\nimport { Stroke, Gradient, Font, Dimension } from '../AWT.js';\n\nconst defaultValues = settings.BoxBase;\n\n/**\n * This class contains all the main visual attributes needed to draw {@link module:boxes/AbstractBox.AbstractBox AbstractBox} objects:\n * background and foreground colors, gradients, colors for special states (inactive, alternative,\n * disabled...), margins, fonts, border strokes, etc.\n *\n * Objects derived from {@link module:boxes/AbstractBox.AbstractBox AbstractBox} can have inheritance: boxes that act as \"containers\"\n * of other boxes (like {@link module:boxes/BoxBag.BoxBag BoxBag}). Most of the attributes of `BoxBase` can be `null`,\n * meaning that the value of the ancestor -or the default value if the box has no ancestors- must\n * be used.\n */\nexport class BoxBase {\n /**\n * BoxBase constructor\n * @param {module:boxes/BoxBase.BoxBase} [parent] - Another BoxBase object used to determine the value of properties not\n * locally set.\n */\n constructor(parent) {\n this.parent = parent || null;\n }\n\n /**\n * Loads the BoxBase settings from a specific JQuery XML element\n * @param {external:jQuery} $xml - The XML element to parse\n */\n setProperties($xml) {\n //\n // Read attributes\n attrForEach($xml.get(0).attributes, (name, val) => {\n switch (name) {\n case 'shadow':\n case 'transparent':\n this[name] = getBoolean(val, false);\n break;\n case 'margin':\n this[name] = Number(val);\n break;\n case 'borderStroke':\n this.borderStroke = new Stroke(Number(val));\n break;\n case 'markerStroke':\n this.markerStroke = new Stroke(Number(val));\n break;\n }\n });\n //\n // Read inner elements\n $xml.children().each((_n, child) => {\n const $node = $(child);\n switch (child.nodeName) {\n case 'font':\n this.font = (new Font()).setProperties($node);\n break;\n\n case 'gradient':\n this.bgGradient = new Gradient().setProperties($node);\n break;\n\n case 'color':\n this.textColor = checkColor($node.attr('foreground'), this.textColor);\n this.backColor = checkColor($node.attr('background'), this.backColor);\n this.shadowColor = checkColor($node.attr('shadow'), this.shadowColor);\n this.inactiveColor = checkColor($node.attr('inactive'), this.inactiveColor);\n this.alternativeColor = checkColor($node.attr('alternative'), this.alternativeColor);\n this.borderColor = checkColor($node.attr('border'), this.borderColor);\n break;\n }\n });\n return this;\n }\n\n /**\n * Gets a object with the basic attributes needed to rebuild this instance excluding functions,\n * parent references, constants and also attributes retaining the default value.\n * The resulting object is commonly usued to serialize elements in JSON format.\n * @returns {object} - The resulting object, with minimal attrributes\n */\n getAttributes() {\n return getAttr(this, [\n 'shadow', 'transparent', 'margin',\n 'borderStroke', 'markerStroke', // AWT.Stroke\n 'font', // AWT.Font\n 'bgGradient', // AWT.Gradient\n `textColor|${BoxBase.prototype.textColor}`,\n `backColor|${BoxBase.prototype.backColor}`,\n `shadowColor|${BoxBase.prototype.shadowColor}`,\n `inactiveColor|${BoxBase.prototype.inactiveColor}`,\n `alternativeColor|${BoxBase.prototype.alternativeColor}`,\n `borderColor|${BoxBase.prototype.borderColor}`,\n ]);\n }\n\n /**\n * Reads the properties of this BoxBase from a data object\n * @param {object} data - The data object to be parsed\n * @returns {module:boxes/BoxBase.BoxBase}\n */\n setAttributes(data) {\n return setAttr(this, data, [\n 'shadow', 'transparent', 'margin',\n { key: 'borderStroke', fn: Stroke },\n { key: 'markerStroke', fn: Stroke },\n { key: 'font', fn: Font },\n { key: 'bgGradient', fn: Gradient },\n 'textColor',\n 'backColor',\n 'shadowColor',\n 'inactiveColor',\n 'alternativeColor',\n 'borderColor',\n ]);\n }\n\n /**\n * Gets the value of the specified property, scanning down to parents and prototype if not defined.\n * @param {string} property - The property to retrieve\n * @returns {any} - The object or value associated to this property\n */\n get(property) {\n if (this.hasOwnProperty(property) || this.parent === null)\n return this[property];\n else\n return this.parent.get(property);\n }\n\n /**\n * Sets the value of a specific property.\n * @param {string} property - The property name.\n * @param {any} value - Depends on the type of property\n */\n set(property, value) {\n this[property] = value;\n return this;\n }\n\n /**\n * Gets the value of the specified property, scanning down to parents if not defined, and returning\n * always an own property (not from prototype)\n * @param {string} property - The property to retrieve\n * @returns {any} - The object or value associated to this property\n */\n getOwn(property) {\n if (this.hasOwnProperty(property))\n return this[property];\n else if (this.parent !== null)\n return this.parent.getOwn(property);\n else {\n if (typeof this[property] === 'object')\n this[property] = cloneObject(BoxBase.prototype[property]);\n else\n this[property] = BoxBase.prototype[property];\n }\n return this[property];\n }\n\n /**\n * Gets the properties defined in this BoxBase as a collection of CSS attributes\n * @param {object} [css] - An optional set of initial CSS properties\n * @param {boolean} [inactive=false] - When `true`, get CSS attributes for an inactive cell\n * @param {boolean} [inverse=false] - When `true`, get CSS attributes for an inverse cell\n * @param {boolean} [alternative=false] - When `true`, get CSS attributes for an alternative cell\n * @returns {object}\n */\n getCSS(css, inactive = false, inverse = false, alternative = false) {\n // (css will be created by [AWT.Font.toCss](AWT.html) if null or undefined)\n const font = this.get('font');\n css = font.toCss(css);\n\n css['color'] = inverse ? this.get('backColor')\n : alternative ? this.get('alternativeColor')\n : this.get('textColor');\n\n const transparent = this.get('transparent');\n css['background-color'] = transparent ? 'transparent'\n : inactive ? this.get('inactiveColor')\n : inverse ? this.get('textColor') : this.get('backColor');\n\n const bgGradient = this.get('bgGradient');\n if (bgGradient && !transparent)\n css['background-image'] = bgGradient.getCss();\n\n if (this.shadow === 1) {\n const delta = Math.max(1, Math.round(font.size / 10));\n const color = this.get('shadowColor');\n css['text-shadow'] = `${delta}px ${delta}px 3px ${color}`;\n }\n return css;\n }\n\n /**\n * This utility method computes the width and height of text lines rendered on an HTML\n * __canvas__ element, reducing the font size of the BoxBase as needed when they exceed the maximum\n * width and/or height.\n * @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the text.\n * @param {string} text - The text to drawn.\n * @param {number} maxWidth - Maximum width\n * @param {number} maxHeight - Maximum height\n * @returns {object[]} - An array of objects representing lines of text. Each object has a `text`\n * member with the text displayed in the line, and a `size` member with the line {@link module:AWT.Dimension}\n */\n prepareText(ctx, text, maxWidth, maxHeight) {\n const\n result = [],\n font = this.get('font'),\n height = font.getHeight();\n let totalHeight = 0;\n\n // divide the text in lines\n const lines = text.trim().split('\\n');\n ctx.font = font.cssFont();\n for (let l = 0; l < lines.length; l++) {\n let line = lines[l].trim();\n let width = ctx.measureText(line).width;\n if (width > maxWidth) {\n // retain the last string offset that was inside maxWidth\n let\n lastOK = 0,\n lastOKWidth = 0;\n for (let p = 0; p < line.length; p++) {\n // Find next separator\n if (isSeparator(line[p])) {\n const w = ctx.measureText(line.substring(0, p).trim()).width;\n if (w > maxWidth)\n break;\n lastOK = p;\n lastOKWidth = w;\n }\n }\n if (lastOK > 0) {\n // Add a new line with the tail of the line\n lines.splice(l + 1, 0, line.substring(lastOK + 1).trim());\n // Adjust the current line\n line = lines[l] = line.substring(0, lastOK).trim();\n width = lastOKWidth;\n }\n else {\n // No solution found. Try resizing down the font.\n if (font.size > defaultValues.MIN_FONT_SIZE) {\n this.getOwn('font').zoom(-1);\n return this.prepareText(ctx, text, maxWidth, maxHeight);\n }\n }\n }\n\n // Add the line and the calculated dimension to `result`\n result.push({\n text: line,\n size: new Dimension(width, height)\n });\n\n totalHeight += height;\n\n if (totalHeight > maxHeight && font.size > defaultValues.MIN_FONT_SIZE) {\n // Max height exceeded. Try resizing down the font\n this.getOwn('font').zoom(-1);\n return this.prepareText(ctx, text, maxWidth, maxHeight);\n }\n }\n return result;\n }\n}\n\nObject.assign(BoxBase.prototype, {\n /**\n * The parent BoxBase object\n * @name module:boxes/BoxBase.BoxBase#parent\n * @type {module:boxes/BoxBase.BoxBase} */\n parent: null,\n /**\n * Default values\n * @name module:boxes/BoxBase.BoxBase#defaultValues\n * @type {object} */\n default: defaultValues,\n /**\n * Font size can be dynamically reduced to fit the available space if any element using this\n * `BoxBase` requests it. When this happen, this field contains the real font currently used\n * to draw text.\n * @name module:boxes/BoxBase.BoxBase#font\n * @type {module:AWT.Font} */\n font: new Font(),\n /**\n * The current font size of this BoxBase. Can be dynamically adjusted when drawing.\n * @name module:boxes/BoxBase.BoxBase#dynFontSize\n * @type {number} */\n dynFontSize: 0,\n /**\n * Counts the number of times the `dynFontSize` has been reset. This is useful to avoid excessive\n * recursive loops searching the optimal font size.\n * @name module:boxes/BoxBase.BoxBase#resetFontCounter\n * @type {number} */\n resetFontCounter: 0,\n /**\n * The background color\n * @name module:boxes/BoxBase.BoxBase#backColor\n * @type {string} */\n backColor: defaultValues.BACK_COLOR,\n /**\n * The background gradient. Default is `null`.\n * @name module:boxes/BoxBase.BoxBase#bgGradient\n * @type {module:AWT.Gradient} */\n bgGradient: null,\n /**\n * The color used to write text.\n * @name module:boxes/BoxBase.BoxBase#textColor\n * @type {string} */\n textColor: defaultValues.TEXT_COLOR,\n /**\n * The color used to draw a shadow below regular text.\n * @name module:boxes/BoxBase.BoxBase#shadowColor\n * @type {string} */\n shadowColor: defaultValues.SHADOW_COLOR,\n /**\n * The color of the border.\n * @name module:boxes/BoxBase.BoxBase#borderColor\n * @type {string} */\n borderColor: defaultValues.BORDER_COLOR,\n /**\n * The color used to draw text when a cell is in `inactive` state.\n * @name module:boxes/BoxBase.BoxBase#inactiveColor\n * @type {string} */\n inactiveColor: defaultValues.INACTIVE_COLOR,\n /**\n * The color used to draw text when a cell is in `alternative` state.\n * @name module:boxes/BoxBase.BoxBase#alternativeColor\n * @type {string} */\n alternativeColor: defaultValues.ALTERNATIVE_COLOR,\n /**\n * Whether the text should have a shadow or not\n * @name module:boxes/BoxBase.BoxBase#shadow\n * @type {boolean} */\n shadow: false,\n /**\n * Whether the cell's background (and its hosted component, if any) should be transparent\n * @name module:boxes/BoxBase.BoxBase#transparent\n * @type {boolean} */\n transparent: false,\n /**\n * Wheter the cell's background should be painted or not. This property has no effect on\n * hosted components.\n * @name module:boxes/BoxBase.BoxBase#dontFill\n * @type {boolean} */\n dontFill: false,\n /**\n * The margin to respect between text elements and the limits of the cell or other elements.\n * @name module:boxes/BoxBase.BoxBase#textMargin\n * @type {number} */\n textMargin: defaultValues.AC_MARGIN,\n /**\n * The stroke used to draw the border.\n * @name module:boxes/BoxBase.BoxBase#borderStroke\n * @type {module:AWT.Stroke} */\n borderStroke: new Stroke(defaultValues.BORDER_STROKE_WIDTH),\n /**\n * The stroke used to draw a border around marked cells.\n * @name module:boxes/BoxBase.BoxBase#markerStroke\n * @type {module:AWT.Stroke} */\n markerStroke: new Stroke(defaultValues.MARKER_STROKE_WIDTH),\n});\n\nBoxBase.DEFAULT_BOX_BASE = new BoxBase();\n\nexport default BoxBase;\n"],"names":[],"sourceRoot":""}