@cortex-js/compute-engine 0.55.4 → 0.55.6

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 (258) hide show
  1. package/dist/compile.esm.js +137 -545
  2. package/dist/compile.min.esm.js +60 -430
  3. package/dist/compile.min.umd.cjs +66 -436
  4. package/dist/compile.umd.cjs +137 -545
  5. package/dist/compute-engine.esm.js +227 -563
  6. package/dist/compute-engine.min.esm.js +68 -437
  7. package/dist/compute-engine.min.umd.cjs +68 -437
  8. package/dist/compute-engine.umd.cjs +227 -563
  9. package/dist/core.esm.js +225 -562
  10. package/dist/core.min.esm.js +67 -436
  11. package/dist/core.min.umd.cjs +67 -436
  12. package/dist/core.umd.cjs +225 -562
  13. package/dist/interval.esm.js +136 -60
  14. package/dist/interval.min.esm.js +7 -7
  15. package/dist/interval.min.umd.cjs +7 -7
  16. package/dist/interval.umd.cjs +136 -60
  17. package/dist/latex-syntax.esm.js +219 -74
  18. package/dist/latex-syntax.min.esm.js +7 -6
  19. package/dist/latex-syntax.min.umd.cjs +7 -6
  20. package/dist/latex-syntax.umd.cjs +219 -74
  21. package/dist/math-json.esm.js +2 -2
  22. package/dist/math-json.min.esm.js +2 -2
  23. package/dist/math-json.min.umd.cjs +2 -2
  24. package/dist/math-json.umd.cjs +2 -2
  25. package/dist/numerics.esm.js +2 -2
  26. package/dist/numerics.min.esm.js +2 -2
  27. package/dist/numerics.min.umd.cjs +2 -2
  28. package/dist/numerics.umd.cjs +2 -2
  29. package/dist/types/big-decimal/big-decimal.d.ts +1 -1
  30. package/dist/types/big-decimal/index.d.ts +1 -1
  31. package/dist/types/big-decimal/transcendentals.d.ts +1 -1
  32. package/dist/types/big-decimal/utils.d.ts +1 -1
  33. package/dist/types/common/ansi-codes.d.ts +1 -1
  34. package/dist/types/common/configuration-change.d.ts +1 -1
  35. package/dist/types/common/fuzzy-string-match.d.ts +1 -1
  36. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  37. package/dist/types/common/interruptible.d.ts +1 -1
  38. package/dist/types/common/one-of.d.ts +1 -1
  39. package/dist/types/common/signals.d.ts +1 -1
  40. package/dist/types/common/type/ast-nodes.d.ts +1 -1
  41. package/dist/types/common/type/boxed-type.d.ts +1 -1
  42. package/dist/types/common/type/lexer.d.ts +1 -1
  43. package/dist/types/common/type/parse.d.ts +1 -1
  44. package/dist/types/common/type/parser.d.ts +1 -1
  45. package/dist/types/common/type/primitive.d.ts +1 -1
  46. package/dist/types/common/type/reduce.d.ts +1 -1
  47. package/dist/types/common/type/serialize.d.ts +1 -1
  48. package/dist/types/common/type/subtype.d.ts +1 -1
  49. package/dist/types/common/type/type-builder.d.ts +1 -1
  50. package/dist/types/common/type/types.d.ts +1 -1
  51. package/dist/types/common/type/utils.d.ts +1 -1
  52. package/dist/types/common/utils.d.ts +1 -1
  53. package/dist/types/compile.d.ts +1 -1
  54. package/dist/types/compute-engine/assume.d.ts +1 -1
  55. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
  56. package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
  57. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
  58. package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
  59. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
  60. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
  61. package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
  62. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
  63. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
  64. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
  65. package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
  66. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
  67. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
  68. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
  69. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
  70. package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
  71. package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
  72. package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
  73. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
  74. package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
  75. package/dist/types/compute-engine/boxed-expression/constants.d.ts +1 -1
  76. package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
  77. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  78. package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
  79. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
  80. package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
  81. package/dist/types/compute-engine/boxed-expression/inequality-bounds.d.ts +1 -1
  82. package/dist/types/compute-engine/boxed-expression/init-lazy-refs.d.ts +1 -1
  83. package/dist/types/compute-engine/boxed-expression/invisible-operator.d.ts +1 -1
  84. package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
  85. package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
  86. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
  87. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  88. package/dist/types/compute-engine/boxed-expression/pattern-utils.d.ts +1 -1
  89. package/dist/types/compute-engine/boxed-expression/polynomial-degree.d.ts +1 -1
  90. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
  91. package/dist/types/compute-engine/boxed-expression/predicates.d.ts +1 -1
  92. package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
  93. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
  94. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
  95. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
  96. package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
  97. package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
  98. package/dist/types/compute-engine/boxed-expression/stochastic-equal.d.ts +1 -1
  99. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
  100. package/dist/types/compute-engine/boxed-expression/type-guards.d.ts +1 -1
  101. package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
  102. package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
  103. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  104. package/dist/types/compute-engine/compilation/base-compiler.d.ts +1 -1
  105. package/dist/types/compute-engine/compilation/compile-expression.d.ts +1 -1
  106. package/dist/types/compute-engine/compilation/constant-folding.d.ts +1 -1
  107. package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
  108. package/dist/types/compute-engine/compilation/gpu-target.d.ts +1 -47
  109. package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +1 -1
  110. package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
  111. package/dist/types/compute-engine/compilation/python-target.d.ts +1 -1
  112. package/dist/types/compute-engine/compilation/types.d.ts +1 -48
  113. package/dist/types/compute-engine/compilation/wgsl-target.d.ts +1 -1
  114. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  115. package/dist/types/compute-engine/engine-assumptions.d.ts +1 -1
  116. package/dist/types/compute-engine/engine-cache.d.ts +1 -1
  117. package/dist/types/compute-engine/engine-common-symbols.d.ts +1 -1
  118. package/dist/types/compute-engine/engine-compilation-targets.d.ts +1 -1
  119. package/dist/types/compute-engine/engine-configuration-lifecycle.d.ts +1 -1
  120. package/dist/types/compute-engine/engine-declarations.d.ts +1 -1
  121. package/dist/types/compute-engine/engine-expression-entrypoints.d.ts +1 -1
  122. package/dist/types/compute-engine/engine-extension-contracts.d.ts +1 -1
  123. package/dist/types/compute-engine/engine-library-bootstrap.d.ts +1 -1
  124. package/dist/types/compute-engine/engine-numeric-configuration.d.ts +1 -1
  125. package/dist/types/compute-engine/engine-runtime-state.d.ts +1 -1
  126. package/dist/types/compute-engine/engine-scope.d.ts +1 -1
  127. package/dist/types/compute-engine/engine-sequences.d.ts +1 -1
  128. package/dist/types/compute-engine/engine-simplification-rules.d.ts +1 -1
  129. package/dist/types/compute-engine/engine-startup-coordinator.d.ts +1 -1
  130. package/dist/types/compute-engine/engine-type-resolver.d.ts +1 -1
  131. package/dist/types/compute-engine/engine-validation-entrypoints.d.ts +1 -1
  132. package/dist/types/compute-engine/free-functions.d.ts +1 -1
  133. package/dist/types/compute-engine/function-utils.d.ts +1 -1
  134. package/dist/types/compute-engine/global-types.d.ts +1 -1
  135. package/dist/types/compute-engine/index.d.ts +2 -1
  136. package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
  137. package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
  138. package/dist/types/compute-engine/interval/elementary.d.ts +1 -1
  139. package/dist/types/compute-engine/interval/index.d.ts +1 -1
  140. package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -1
  141. package/dist/types/compute-engine/interval/types.d.ts +1 -1
  142. package/dist/types/compute-engine/interval/util.d.ts +1 -1
  143. package/dist/types/compute-engine/latex-syntax/dictionary/default-dictionary.d.ts +1 -1
  144. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  145. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  146. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  147. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  148. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  149. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  150. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  151. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  152. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  153. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  154. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  155. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  156. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  157. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-units.d.ts +1 -1
  158. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  159. package/dist/types/compute-engine/latex-syntax/dictionary/indexed-types.d.ts +1 -1
  160. package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +1 -1
  161. package/dist/types/compute-engine/latex-syntax/parse-number.d.ts +1 -1
  162. package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
  163. package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
  164. package/dist/types/compute-engine/latex-syntax/serialize-dms.d.ts +1 -1
  165. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  166. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  167. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +4 -2
  168. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  169. package/dist/types/compute-engine/latex-syntax/types.d.ts +1 -1
  170. package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
  171. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  172. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  173. package/dist/types/compute-engine/library/collections.d.ts +1 -1
  174. package/dist/types/compute-engine/library/colors.d.ts +1 -1
  175. package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
  176. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  177. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  178. package/dist/types/compute-engine/library/core.d.ts +1 -1
  179. package/dist/types/compute-engine/library/fractals.d.ts +1 -1
  180. package/dist/types/compute-engine/library/library.d.ts +1 -1
  181. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  182. package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
  183. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  184. package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
  185. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  186. package/dist/types/compute-engine/library/quantity-arithmetic.d.ts +1 -1
  187. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  188. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  189. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  190. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  191. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  192. package/dist/types/compute-engine/library/type-handlers.d.ts +1 -1
  193. package/dist/types/compute-engine/library/unit-data.d.ts +1 -1
  194. package/dist/types/compute-engine/library/units.d.ts +1 -1
  195. package/dist/types/compute-engine/library/utils.d.ts +1 -1
  196. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
  197. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
  198. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
  199. package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
  200. package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
  201. package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
  202. package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
  203. package/dist/types/compute-engine/numerics/linear-algebra.d.ts +1 -1
  204. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
  205. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  206. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  207. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  208. package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
  209. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  210. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  211. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  212. package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
  213. package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
  214. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  215. package/dist/types/compute-engine/numerics/types.d.ts +1 -1
  216. package/dist/types/compute-engine/numerics/unit-data.d.ts +1 -1
  217. package/dist/types/compute-engine/oeis.d.ts +1 -1
  218. package/dist/types/compute-engine/sequence.d.ts +1 -1
  219. package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
  220. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  221. package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
  222. package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
  223. package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
  224. package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
  225. package/dist/types/compute-engine/symbolic/logic-utils.d.ts +1 -1
  226. package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
  227. package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
  228. package/dist/types/compute-engine/symbolic/simplify-factorial.d.ts +1 -1
  229. package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
  230. package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
  231. package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
  232. package/dist/types/compute-engine/symbolic/simplify-logic.d.ts +1 -1
  233. package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
  234. package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
  235. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
  236. package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
  237. package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
  238. package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
  239. package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
  240. package/dist/types/compute-engine/types-definitions.d.ts +1 -1
  241. package/dist/types/compute-engine/types-engine.d.ts +1 -1
  242. package/dist/types/compute-engine/types-evaluation.d.ts +1 -1
  243. package/dist/types/compute-engine/types-expression.d.ts +1 -1
  244. package/dist/types/compute-engine/types-kernel-evaluation.d.ts +1 -1
  245. package/dist/types/compute-engine/types-kernel-serialization.d.ts +1 -1
  246. package/dist/types/compute-engine/types-serialization.d.ts +1 -1
  247. package/dist/types/compute-engine/types.d.ts +1 -1
  248. package/dist/types/compute-engine.d.ts +2 -1
  249. package/dist/types/core.d.ts +1 -1
  250. package/dist/types/interval.d.ts +1 -1
  251. package/dist/types/latex-syntax.d.ts +2 -2
  252. package/dist/types/math-json/symbols.d.ts +1 -1
  253. package/dist/types/math-json/types.d.ts +1 -1
  254. package/dist/types/math-json/utils.d.ts +1 -1
  255. package/dist/types/math-json.d.ts +2 -2
  256. package/dist/types/numerics.d.ts +1 -1
  257. package/package.json +1 -1
  258. package/dist/types/compute-engine/compilation/fractal-orbit.d.ts +0 -13
@@ -1,4 +1,4 @@
1
- /** Compute Engine 0.55.4 */
1
+ /** Compute Engine 0.55.6 */
2
2
  (function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComputeEngine = {}));})(this, (function (exports) { 'use strict';
3
3
  var ComputeEngine = (() => {
4
4
  var __defProp = Object.defineProperty;
@@ -25,6 +25,7 @@ var ComputeEngine = (() => {
25
25
  ALGEBRA_DICTIONARY: () => DEFINITIONS_ALGEBRA,
26
26
  ARITHMETIC_DICTIONARY: () => DEFINITIONS_ARITHMETIC,
27
27
  BaseCompiler: () => BaseCompiler,
28
+ BigDecimal: () => BigDecimal,
28
29
  CALCULUS_DICTIONARY: () => DEFINITIONS_CALCULUS,
29
30
  COMPLEX_DICTIONARY: () => DEFINITIONS_COMPLEX,
30
31
  CORE_DICTIONARY: () => DEFINITIONS_CORE,
@@ -11112,10 +11113,6 @@ var ComputeEngine = (() => {
11112
11113
  // Lagrange notation
11113
11114
  {
11114
11115
  name: "Derivative",
11115
- // @todo: Leibniz notation: {% latex " \\frac{d^n}{dx^n} f(x)" %}
11116
- // @todo: Euler modified notation: This notation is used by Mathematica. The Euler notation uses `D` instead of
11117
- // `\partial`: `\partial_{x} f`, `\partial_{x,y} f`
11118
- // Newton notation (\dot{v}, \ddot{v}) is implemented below
11119
11116
  serialize: (serializer, expr2) => {
11120
11117
  const degree = machineValue(operand(expr2, 2)) ?? 1;
11121
11118
  const base = serializer.serialize(operand(expr2, 1));
@@ -12153,14 +12150,18 @@ var ComputeEngine = (() => {
12153
12150
  return ["Complement", lhs];
12154
12151
  }
12155
12152
  // precedence: 240,
12156
- // @todo: serialize for the multiple argument case
12157
12153
  },
12158
12154
  {
12159
12155
  name: "Complement",
12160
12156
  latexTrigger: ["^", "<{>", "\\complement", "<}>"],
12161
- kind: "postfix"
12157
+ kind: "postfix",
12162
12158
  // precedence: 240,
12163
- // @todo: serialize for the multiple argument case
12159
+ serialize: (serializer, expr2) => {
12160
+ return joinLatex([
12161
+ serializer.serialize(operand(expr2, 1)),
12162
+ "^\\complement"
12163
+ ]);
12164
+ }
12164
12165
  },
12165
12166
  {
12166
12167
  name: "Intersection",
@@ -12247,7 +12248,6 @@ var ComputeEngine = (() => {
12247
12248
  // commands like \rbrack a, b \rbrack which are unambiguous.
12248
12249
  {
12249
12250
  name: "Multiple",
12250
- // @todo: parse
12251
12251
  serialize: serializeSet
12252
12252
  },
12253
12253
  {
@@ -12256,14 +12256,28 @@ var ComputeEngine = (() => {
12256
12256
  kind: "infix",
12257
12257
  precedence: 350
12258
12258
  },
12259
+ // \mid as a separator/operator (used in set-builder notation: {x \mid x > 0})
12260
+ // Low precedence so it binds loosely — everything on each side is parsed first
12261
+ {
12262
+ name: "Divides",
12263
+ latexTrigger: ["\\mid"],
12264
+ kind: "infix",
12265
+ precedence: 160
12266
+ },
12259
12267
  {
12260
12268
  name: "Set",
12261
12269
  kind: "matchfix",
12262
12270
  openTrigger: "{",
12263
12271
  closeTrigger: "}",
12264
- // @todo: the set syntax can also include conditions...
12265
12272
  parse: (_parser, body) => {
12266
12273
  if (isEmptySequence(body)) return "EmptySet";
12274
+ const h = operator(body);
12275
+ if (h === "Divides" || h === "Colon") {
12276
+ const expr2 = operand(body, 1);
12277
+ const condition = operand(body, 2);
12278
+ if (expr2 !== null && condition !== null)
12279
+ return ["Set", expr2, ["Condition", condition]];
12280
+ }
12267
12281
  if (operator(body) == "Delimiter" && stringValue(operand(body, 2)) === ",") {
12268
12282
  body = operand(body, 1);
12269
12283
  }
@@ -12271,6 +12285,17 @@ var ComputeEngine = (() => {
12271
12285
  return ["Set", ...operands(body)];
12272
12286
  },
12273
12287
  serialize: (serializer, expr2) => {
12288
+ if (nops(expr2) === 2 && operator(operand(expr2, 2)) === "Condition") {
12289
+ const condition = operand(expr2, 2);
12290
+ return joinLatex([
12291
+ "\\lbrace",
12292
+ serializer.serialize(operand(expr2, 1)),
12293
+ "\\mid",
12294
+ // Serialize the inner expression of the Condition wrapper
12295
+ serializer.serialize(operand(condition, 1)),
12296
+ "\\rbrace"
12297
+ ]);
12298
+ }
12274
12299
  return joinLatex([
12275
12300
  "\\lbrace",
12276
12301
  operands(expr2).map((x) => serializer.serialize(x)).join(", "),
@@ -12437,23 +12462,6 @@ var ComputeEngine = (() => {
12437
12462
  if (expr2 === null) return "";
12438
12463
  const h = operator(expr2);
12439
12464
  if (!h) return "";
12440
- if (h === "Set") {
12441
- if (nops(expr2) === 0) return "\\emptyset";
12442
- if (nops(expr2) === 2 && operator(operand(expr2, 2)) === "Condition") {
12443
- return joinLatex([
12444
- "\\left\\lbrace",
12445
- serializer.serialize(operand(expr2, 1)),
12446
- "\\middle\\mid",
12447
- serializer.serialize(operand(expr2, 2)),
12448
- "\\right\\rbrace"
12449
- ]);
12450
- }
12451
- return joinLatex([
12452
- "\\left\\lbrace",
12453
- ...operands(expr2).map((x) => serializer.serialize(x) + " ,"),
12454
- "\\right\\rbrace"
12455
- ]);
12456
- }
12457
12465
  if (h === "Multiple") {
12458
12466
  }
12459
12467
  if (h === "Range") {
@@ -13601,11 +13609,13 @@ var ComputeEngine = (() => {
13601
13609
  if (!parser.match("_")) return null;
13602
13610
  const base = parser.parseGroup();
13603
13611
  if (operator(base) !== "To") return null;
13604
- const expr2 = parser.parseArguments("implicit");
13612
+ const expr2 = parser.parseExpression({
13613
+ minPrec: MULTIPLICATION_PRECEDENCE
13614
+ });
13605
13615
  if (!expr2) return null;
13606
13616
  return [
13607
13617
  "Limit",
13608
- ["Function", expr2[0], operand(base, 1)],
13618
+ ["Function", expr2, operand(base, 1)],
13609
13619
  operand(base, 2)
13610
13620
  ];
13611
13621
  },
@@ -15902,12 +15912,52 @@ var ComputeEngine = (() => {
15902
15912
  ];
15903
15913
 
15904
15914
  // src/compute-engine/latex-syntax/dictionary/definitions-other.ts
15915
+ var TEX_UNITS = [
15916
+ "pt",
15917
+ "em",
15918
+ "mu",
15919
+ "ex",
15920
+ "mm",
15921
+ "cm",
15922
+ "in",
15923
+ "bp",
15924
+ "sp",
15925
+ "dd",
15926
+ "cc",
15927
+ "pc",
15928
+ "nc",
15929
+ "nd"
15930
+ ];
15931
+ function skipTexDimension(parser) {
15932
+ parser.skipSpace();
15933
+ if (parser.peek === "-" || parser.peek === "+") parser.nextToken();
15934
+ while (/^[\d.]$/.test(parser.peek)) parser.nextToken();
15935
+ for (const unit of TEX_UNITS) {
15936
+ if (parser.matchAll([...unit])) return;
15937
+ }
15938
+ }
15905
15939
  function parseSingleArg(cmd) {
15906
15940
  return (parser) => {
15907
15941
  const arg = parser.parseGroup();
15908
15942
  return arg === null ? [cmd] : [cmd, arg];
15909
15943
  };
15910
15944
  }
15945
+ function parseMathStyleSwitch(mathStyle) {
15946
+ return (parser) => {
15947
+ const body = parser.parseExpression();
15948
+ if (body !== null && !isEmptySequence(body))
15949
+ return ["Annotated", body, { dict: { mathStyle } }];
15950
+ return "Nothing";
15951
+ };
15952
+ }
15953
+ function parseSizeSwitch(size) {
15954
+ return (parser) => {
15955
+ const body = parser.parseExpression();
15956
+ if (body !== null && !isEmptySequence(body))
15957
+ return ["Annotated", body, { dict: { size } }];
15958
+ return "Nothing";
15959
+ };
15960
+ }
15911
15961
  var DEFINITIONS_OTHERS = [
15912
15962
  {
15913
15963
  name: "Overscript",
@@ -16147,80 +16197,71 @@ var ComputeEngine = (() => {
16147
16197
  },
16148
16198
  {
16149
16199
  latexTrigger: ["\\displaystyle"],
16150
- parse: () => "Nothing"
16151
- // @todo: parse as ['Annotated'...]
16200
+ parse: parseMathStyleSwitch("normal")
16152
16201
  },
16153
16202
  {
16154
16203
  latexTrigger: ["\\textstyle"],
16155
- parse: () => "Nothing"
16156
- // @todo: parse as ['Annotated'...]
16204
+ parse: parseMathStyleSwitch("compact")
16157
16205
  },
16158
16206
  {
16159
16207
  latexTrigger: ["\\scriptstyle"],
16160
- parse: () => "Nothing"
16161
- // @todo: parse as ['Annotated'...]
16208
+ parse: parseMathStyleSwitch("script")
16162
16209
  },
16163
16210
  {
16164
16211
  latexTrigger: ["\\scriptscriptstyle"],
16165
- parse: () => "Nothing"
16166
- // @todo: parse as ['Annotated'...]
16212
+ parse: parseMathStyleSwitch("scriptscript")
16167
16213
  },
16168
16214
  {
16169
16215
  latexTrigger: ["\\color"],
16170
16216
  parse: (parser) => {
16171
- parser.parseGroup();
16217
+ const color = parser.parseStringGroup();
16218
+ if (color !== null) {
16219
+ const body = parser.parseExpression();
16220
+ if (body !== null && !isEmptySequence(body))
16221
+ return ["Annotated", body, { dict: { color } }];
16222
+ }
16172
16223
  return "Nothing";
16173
16224
  }
16174
16225
  },
16175
16226
  {
16176
16227
  latexTrigger: ["\\tiny"],
16177
- parse: () => "Nothing"
16178
- // @todo: parse as ['Annotated'...]
16228
+ parse: parseSizeSwitch(1)
16179
16229
  },
16180
16230
  {
16181
16231
  latexTrigger: ["\\scriptsize"],
16182
- parse: () => "Nothing"
16183
- // @todo: parse as ['Annotated'...]
16232
+ parse: parseSizeSwitch(2)
16184
16233
  },
16185
16234
  {
16186
16235
  latexTrigger: ["\\footnotesize"],
16187
- parse: () => "Nothing"
16188
- // @todo: parse as ['Annotated'...]
16236
+ parse: parseSizeSwitch(3)
16189
16237
  },
16190
16238
  {
16191
16239
  latexTrigger: ["\\small"],
16192
- parse: () => "Nothing"
16193
- // @todo: parse as ['Annotated'...]
16240
+ parse: parseSizeSwitch(4)
16194
16241
  },
16195
16242
  {
16196
16243
  latexTrigger: ["\\normalsize"],
16197
- parse: () => "Nothing"
16198
- // @todo: parse as ['Annotated'...]
16244
+ parse: parseSizeSwitch(5)
16199
16245
  },
16200
16246
  {
16201
16247
  latexTrigger: ["\\large"],
16202
- parse: () => "Nothing"
16203
- // @todo: parse as ['Annotated'...]
16248
+ parse: parseSizeSwitch(6)
16204
16249
  },
16205
16250
  {
16206
16251
  latexTrigger: ["\\Large"],
16207
- parse: () => "Nothing"
16208
- // @todo: parse as ['Annotated'...]
16252
+ parse: parseSizeSwitch(7)
16209
16253
  },
16210
16254
  {
16211
16255
  latexTrigger: ["\\LARGE"],
16212
- parse: () => "Nothing"
16213
- // @todo: parse as ['Annotated'...]
16256
+ parse: parseSizeSwitch(8)
16214
16257
  },
16215
16258
  {
16216
16259
  latexTrigger: ["\\huge"],
16217
- parse: () => "Nothing"
16218
- // @todo: parse as ['Annotated'...]
16260
+ parse: parseSizeSwitch(9)
16219
16261
  },
16220
16262
  {
16221
16263
  latexTrigger: ["\\Huge"],
16222
- parse: () => "Nothing"
16223
- // @todo: parse as ['Annotated'...]
16264
+ parse: parseSizeSwitch(10)
16224
16265
  },
16225
16266
  {
16226
16267
  name: "Annotated",
@@ -16232,6 +16273,10 @@ var ComputeEngine = (() => {
16232
16273
  result = joinLatex(["{\\displaystyle", result, "}"]);
16233
16274
  else if (dict.dict.mathStyle === "compact")
16234
16275
  result = joinLatex(["{\\textstyle", result, "}"]);
16276
+ else if (dict.dict.mathStyle === "script")
16277
+ result = joinLatex(["{\\scriptstyle", result, "}"]);
16278
+ else if (dict.dict.mathStyle === "scriptscript")
16279
+ result = joinLatex(["{\\scriptscriptstyle", result, "}"]);
16235
16280
  const v = dict.dict.size;
16236
16281
  if (v !== null && v >= 1 && v <= 10) {
16237
16282
  result = joinLatex([
@@ -16319,6 +16364,28 @@ var ComputeEngine = (() => {
16319
16364
  latexTrigger: ["\\enspace"],
16320
16365
  parse: () => ["HorizontalSpacing", 9]
16321
16366
  },
16367
+ {
16368
+ latexTrigger: ["\\hspace"],
16369
+ parse: (parser) => {
16370
+ if (parser.peek === "*") parser.nextToken();
16371
+ parser.parseStringGroup();
16372
+ return ["HorizontalSpacing", 0];
16373
+ }
16374
+ },
16375
+ {
16376
+ latexTrigger: ["\\hskip"],
16377
+ parse: (parser) => {
16378
+ skipTexDimension(parser);
16379
+ return ["HorizontalSpacing", 0];
16380
+ }
16381
+ },
16382
+ {
16383
+ latexTrigger: ["\\kern"],
16384
+ parse: (parser) => {
16385
+ skipTexDimension(parser);
16386
+ return ["HorizontalSpacing", 0];
16387
+ }
16388
+ },
16322
16389
  {
16323
16390
  latexTrigger: ["\\phantom"],
16324
16391
  parse: (parser) => {
@@ -16369,7 +16436,17 @@ var ComputeEngine = (() => {
16369
16436
  // `["HorizontalSpacing", expr, 'op'|'bin'|rel]` -> indicate a spacing around and expression, i.e. `\mathbin{x}`, etc...
16370
16437
  serialize: (serializer, expr2) => {
16371
16438
  if (operand(expr2, 2) !== null) {
16372
- return serializer.serialize(operand(expr2, 1));
16439
+ const cls = stringValue(operand(expr2, 2));
16440
+ const inner = serializer.serialize(operand(expr2, 1));
16441
+ if (cls === "bin") return `\\mathbin{${inner}}`;
16442
+ if (cls === "op") return `\\mathop{${inner}}`;
16443
+ if (cls === "rel") return `\\mathrel{${inner}}`;
16444
+ if (cls === "ord") return `\\mathord{${inner}}`;
16445
+ if (cls === "open") return `\\mathopen{${inner}}`;
16446
+ if (cls === "close") return `\\mathclose{${inner}}`;
16447
+ if (cls === "punct") return `\\mathpunct{${inner}}`;
16448
+ if (cls === "inner") return `\\mathinner{${inner}}`;
16449
+ return inner;
16373
16450
  }
16374
16451
  const v = machineValue(operand(expr2, 1));
16375
16452
  if (v === null) return "";
@@ -16760,25 +16837,47 @@ var ComputeEngine = (() => {
16760
16837
  result.arguments = entry.arguments;
16761
16838
  return result;
16762
16839
  }
16840
+ function serializeTabularBody(serializer, body) {
16841
+ if (!body) return "";
16842
+ if (operator(body) !== "List") return serializer.serialize(body);
16843
+ const rows = operands(body);
16844
+ if (rows.length === 0) return "";
16845
+ if (!rows.every((row) => operator(row) === "List"))
16846
+ return serializer.serialize(body);
16847
+ return rows.map(
16848
+ (row) => operands(row).map((cell) => serializer.serialize(cell)).join(" & ")
16849
+ ).join(" \\\\\n");
16850
+ }
16763
16851
  function makeSerializeHandler(entry, latexTrigger, idTrigger) {
16764
16852
  if (typeof entry.serialize === "function") return entry.serialize;
16765
16853
  const kind = entry["kind"] ?? "expression";
16766
16854
  if (kind === "environment") {
16767
16855
  const envName = entry["symbolTrigger"] ?? entry.name ?? "unknown";
16768
- return (serializer, expr2) => joinLatex([
16769
- `\\begin{${envName}}`,
16770
- serializer.serialize(operand(expr2, 1)),
16771
- `\\end{${envName}}`
16772
- ]);
16856
+ return (serializer, expr2) => {
16857
+ const body = operand(expr2, 1);
16858
+ return joinLatex([
16859
+ `\\begin{${envName}}`,
16860
+ serializeTabularBody(serializer, body),
16861
+ `\\end{${envName}}`
16862
+ ]);
16863
+ };
16773
16864
  }
16774
16865
  if (isMatchfixEntry(entry)) {
16775
16866
  const openDelim = typeof entry.openTrigger === "string" ? DEFAULT_DELIMITER[entry.openTrigger] : tokensToString(entry.openTrigger);
16776
16867
  const closeDelim = typeof entry.closeTrigger === "string" ? DEFAULT_DELIMITER[entry.closeTrigger] : tokensToString(entry.closeTrigger);
16777
- return (serializer, expr2) => joinLatex([
16778
- openDelim,
16779
- serializer.serialize(operand(expr2, 1)),
16780
- closeDelim
16781
- ]);
16868
+ return (serializer, expr2) => {
16869
+ const style = serializer.groupStyle(expr2, serializer.level + 1);
16870
+ const inner = serializer.serialize(operand(expr2, 1));
16871
+ if (style === "scaled")
16872
+ return joinLatex([`\\left${openDelim}`, inner, `\\right${closeDelim}`]);
16873
+ if (style === "big")
16874
+ return joinLatex([
16875
+ `\\Bigl${openDelim}`,
16876
+ inner,
16877
+ `\\Bigr${closeDelim}`
16878
+ ]);
16879
+ return joinLatex([openDelim, inner, closeDelim]);
16880
+ };
16782
16881
  }
16783
16882
  let latex = entry.serialize;
16784
16883
  if (latex === void 0 && latexTrigger) latex = tokensToString(latexTrigger);
@@ -17663,6 +17762,16 @@ var ComputeEngine = (() => {
17663
17762
  }
17664
17763
 
17665
17764
  // src/compute-engine/latex-syntax/parse.ts
17765
+ var _symbolToUnicode = null;
17766
+ function getSymbolToUnicode() {
17767
+ if (!_symbolToUnicode) {
17768
+ _symbolToUnicode = /* @__PURE__ */ new Map();
17769
+ for (const [, latex, codepoint] of SYMBOLS2) {
17770
+ _symbolToUnicode.set(latex, String.fromCodePoint(codepoint));
17771
+ }
17772
+ }
17773
+ return _symbolToUnicode;
17774
+ }
17666
17775
  var DELIMITER_SHORTHAND2 = {
17667
17776
  "(": ["\\lparen", "("],
17668
17777
  ")": ["\\rparen", ")"],
@@ -18110,6 +18219,35 @@ var ComputeEngine = (() => {
18110
18219
  this.nextToken();
18111
18220
  this.skipVisualSpace();
18112
18221
  }
18222
+ if (this.match("\\hspace")) {
18223
+ this.match("*");
18224
+ this.parseStringGroup();
18225
+ this.skipVisualSpace();
18226
+ }
18227
+ if (this.match("\\hskip") || this.match("\\kern")) {
18228
+ this.skipSpace();
18229
+ this.match("-") || this.match("+");
18230
+ while (/^[\d.]$/.test(this.peek)) this.nextToken();
18231
+ for (const unit of [
18232
+ "pt",
18233
+ "em",
18234
+ "mu",
18235
+ "ex",
18236
+ "mm",
18237
+ "cm",
18238
+ "in",
18239
+ "bp",
18240
+ "sp",
18241
+ "dd",
18242
+ "cc",
18243
+ "pc",
18244
+ "nc",
18245
+ "nd"
18246
+ ]) {
18247
+ if (this.matchAll([...unit])) break;
18248
+ }
18249
+ this.skipVisualSpace();
18250
+ }
18113
18251
  this.skipSpace();
18114
18252
  }
18115
18253
  match(token) {
@@ -18447,7 +18585,8 @@ var ComputeEngine = (() => {
18447
18585
  } else if (token === "<space>") {
18448
18586
  result += " ";
18449
18587
  } else if (token[0] === "\\") {
18450
- result += token;
18588
+ const unicode = getSymbolToUnicode().get(token);
18589
+ result += unicode ?? token;
18451
18590
  } else {
18452
18591
  result += token;
18453
18592
  }
@@ -19807,7 +19946,7 @@ var ComputeEngine = (() => {
19807
19946
  sansserif: (s) => `\\mathsf{${s}}`,
19808
19947
  monospace: (s) => `\\mathtt{${s}}`
19809
19948
  };
19810
- var Serializer4 = class {
19949
+ var Serializer5 = class {
19811
19950
  options;
19812
19951
  dictionary;
19813
19952
  level = -1;
@@ -19822,11 +19961,18 @@ var ComputeEngine = (() => {
19822
19961
  /**
19823
19962
  * Serialize the expression, and if the expression is an operator
19824
19963
  * of precedence less than or equal to prec, wrap it in some parens.
19825
- * @todo: don't wrap Abs, Floor, Ceil, Delimiter
19964
+ *
19965
+ * Skip wrapping for matchfix operators (Abs, Floor, Ceil, Norm, etc.)
19966
+ * and Delimiter since they already have visible delimiters.
19826
19967
  */
19827
19968
  wrap(expr2, prec) {
19828
19969
  if (expr2 === null || expr2 === void 0) return "";
19829
19970
  if (prec === void 0) {
19971
+ const name2 = operator(expr2);
19972
+ if (name2) {
19973
+ const def = this.dictionary.ids.get(name2);
19974
+ if (def?.kind === "matchfix") return this.serialize(expr2);
19975
+ }
19830
19976
  return this.wrapString(
19831
19977
  this.serialize(expr2),
19832
19978
  this.options.groupStyle(expr2, this.level + 1)
@@ -20120,7 +20266,7 @@ var ComputeEngine = (() => {
20120
20266
  return body;
20121
20267
  }
20122
20268
  function serializeLatex(expr2, dict, options) {
20123
- const serializer = new Serializer4(dict, options);
20269
+ const serializer = new Serializer5(dict, options);
20124
20270
  return serializer.serialize(expr2);
20125
20271
  }
20126
20272
 
@@ -42159,12 +42305,14 @@ ${e.message}
42159
42305
  canonical: canonicalBlock,
42160
42306
  evaluate: evaluateBlock
42161
42307
  },
42162
- // A condition expression tests for one or more conditions of an expression
42163
- // ['Condition', value, "positive"]
42308
+ // A condition expression tests for one or more conditions of an expression.
42309
+ // Two forms:
42310
+ // ['Condition', value, "positive"] — tests value against named condition(s)
42311
+ // ['Condition', predicate] — set-builder predicate (e.g. x > 0)
42164
42312
  Condition: {
42165
42313
  description: "Test whether a value satisfies one or more conditions.",
42166
42314
  lazy: true,
42167
- signature: "(value, symbol) -> boolean",
42315
+ signature: "(expression, symbol?) -> boolean",
42168
42316
  evaluate: ([value, conds], { engine }) => {
42169
42317
  let conditions = [];
42170
42318
  if (isSymbol2(conds)) {
@@ -61338,33 +61486,6 @@ Error in definition of "${name}"`,
61338
61486
  return b;
61339
61487
  }
61340
61488
 
61341
- // src/compute-engine/compilation/fractal-orbit.ts
61342
- function computeReferenceOrbit(center, maxIter, precision) {
61343
- const prevPrecision = BigDecimal.precision;
61344
- BigDecimal.precision = precision;
61345
- try {
61346
- const cr = new BigDecimal(center[0]);
61347
- const ci = new BigDecimal(center[1]);
61348
- let zr = BigDecimal.ZERO;
61349
- let zi = BigDecimal.ZERO;
61350
- const ESCAPE = new BigDecimal(256);
61351
- const points = [];
61352
- for (let i = 0; i < maxIter; i++) {
61353
- points.push(zr.toNumber(), zi.toNumber());
61354
- const zr2 = zr.mul(zr).toPrecision(precision);
61355
- const zi2 = zi.mul(zi).toPrecision(precision);
61356
- const mag2 = zr2.add(zi2);
61357
- if (mag2.cmp(ESCAPE) > 0) break;
61358
- const new_zi = zr.mul(zi).toPrecision(precision).mul(2).add(ci);
61359
- zr = zr2.sub(zi2).add(cr);
61360
- zi = new_zi;
61361
- }
61362
- return new Float32Array(points);
61363
- } finally {
61364
- BigDecimal.precision = prevPrecision;
61365
- }
61366
- }
61367
-
61368
61489
  // src/compute-engine/compilation/gpu-target.ts
61369
61490
  var GPU_OPERATORS = {
61370
61491
  Add: ["+", 11],
@@ -61448,13 +61569,6 @@ Error in definition of "${name}"`,
61448
61569
  ];
61449
61570
  return lines.join("\n");
61450
61571
  }
61451
- function selectFractalStrategy(target) {
61452
- const radius = target.hints?.viewport?.radius;
61453
- if (radius === void 0) return "single";
61454
- if (radius > 1e-6) return "single";
61455
- if (radius > 1e-14) return "double";
61456
- return "perturbation";
61457
- }
61458
61572
  var GPU_FUNCTIONS = {
61459
61573
  // Variadic arithmetic (for function-call form, e.g., with vectors)
61460
61574
  Add: (args, compile3, target) => {
@@ -61950,32 +62064,12 @@ Error in definition of "${name}"`,
61950
62064
  if (c === null || maxIter === null)
61951
62065
  throw new Error("Mandelbrot: missing arguments");
61952
62066
  const iterCode = compileIntArg(maxIter, compile3, target);
61953
- const strategy = selectFractalStrategy(target);
61954
- if (strategy === "double") {
61955
- const cCode = compile3(c);
61956
- return `_fractal_mandelbrot_dp(vec4(${cCode}, vec2(0.0)), ${iterCode})`;
61957
- }
61958
- if (strategy === "perturbation") {
61959
- const cCode = compile3(c);
61960
- return `_fractal_mandelbrot_pt(${cCode}, ${iterCode})`;
61961
- }
61962
62067
  return `_fractal_mandelbrot(${compile3(c)}, ${iterCode})`;
61963
62068
  },
61964
62069
  Julia: ([z, c, maxIter], compile3, target) => {
61965
62070
  if (z === null || c === null || maxIter === null)
61966
62071
  throw new Error("Julia: missing arguments");
61967
62072
  const iterCode = compileIntArg(maxIter, compile3, target);
61968
- const strategy = selectFractalStrategy(target);
61969
- if (strategy === "double") {
61970
- const zCode = compile3(z);
61971
- const cCode = compile3(c);
61972
- return `_fractal_julia_dp(vec4(${zCode}, vec2(0.0)), vec4(${cCode}, vec2(0.0)), ${iterCode})`;
61973
- }
61974
- if (strategy === "perturbation") {
61975
- const zCode = compile3(z);
61976
- const cCode = compile3(c);
61977
- return `_fractal_julia_pt(${zCode}, ${cCode}, ${iterCode})`;
61978
- }
61979
62073
  return `_fractal_julia(${compile3(z)}, ${compile3(c)}, ${iterCode})`;
61980
62074
  },
61981
62075
  // Vector/Matrix operations
@@ -62572,200 +62666,6 @@ fn _gpu_besselJ(n_in: i32, x_in: f32) -> f32 {
62572
62666
  for (var k2: i32 = 2; k2 <= M; k2 += 2) { norm += 2.0 * vals[k2]; }
62573
62667
  return sgn * vals[n] / norm;
62574
62668
  }
62575
- `;
62576
- var GPU_DS_ARITHMETIC_PREAMBLE_GLSL = `
62577
- // Split a float into high and low parts for exact multiplication
62578
- vec2 ds_split(float a) {
62579
- const float SPLIT = 4097.0; // 2^12 + 1
62580
- float t = SPLIT * a;
62581
- float hi = t - (t - a);
62582
- float lo = a - hi;
62583
- return vec2(hi, lo);
62584
- }
62585
-
62586
- // Create a double-single from a single float
62587
- vec2 ds_from(float a) {
62588
- return vec2(a, 0.0);
62589
- }
62590
-
62591
- // Error-free addition (Knuth TwoSum)
62592
- vec2 ds_add(vec2 a, vec2 b) {
62593
- float s = a.x + b.x;
62594
- float v = s - a.x;
62595
- float e = (a.x - (s - v)) + (b.x - v);
62596
- float lo = (a.y + b.y) + e;
62597
- float hi = s + lo;
62598
- lo = lo - (hi - s);
62599
- return vec2(hi, lo);
62600
- }
62601
-
62602
- // Double-single subtraction
62603
- vec2 ds_sub(vec2 a, vec2 b) {
62604
- return ds_add(a, vec2(-b.x, -b.y));
62605
- }
62606
-
62607
- // Error-free multiplication (Dekker TwoProduct)
62608
- vec2 ds_mul(vec2 a, vec2 b) {
62609
- float p = a.x * b.x;
62610
- vec2 sa = ds_split(a.x);
62611
- vec2 sb = ds_split(b.x);
62612
- float err = ((sa.x * sb.x - p) + sa.x * sb.y + sa.y * sb.x) + sa.y * sb.y;
62613
- err += a.x * b.y + a.y * b.x;
62614
- float hi = p + err;
62615
- float lo = err - (hi - p);
62616
- return vec2(hi, lo);
62617
- }
62618
-
62619
- // Optimized self-multiply
62620
- vec2 ds_sqr(vec2 a) {
62621
- float p = a.x * a.x;
62622
- vec2 sa = ds_split(a.x);
62623
- float err = ((sa.x * sa.x - p) + 2.0 * sa.x * sa.y) + sa.y * sa.y;
62624
- err += 2.0 * a.x * a.y;
62625
- float hi = p + err;
62626
- float lo = err - (hi - p);
62627
- return vec2(hi, lo);
62628
- }
62629
-
62630
- // Compare magnitude: returns -1, 0, or 1
62631
- float ds_cmp(vec2 a, vec2 b) {
62632
- float d = a.x - b.x;
62633
- if (d != 0.0) return sign(d);
62634
- return sign(a.y - b.y);
62635
- }
62636
- `;
62637
- var GPU_DS_ARITHMETIC_PREAMBLE_WGSL = `
62638
- fn ds_split(a: f32) -> vec2f {
62639
- const SPLIT: f32 = 4097.0;
62640
- let t = SPLIT * a;
62641
- let hi = t - (t - a);
62642
- let lo = a - hi;
62643
- return vec2f(hi, lo);
62644
- }
62645
-
62646
- fn ds_from(a: f32) -> vec2f {
62647
- return vec2f(a, 0.0);
62648
- }
62649
-
62650
- fn ds_add(a: vec2f, b: vec2f) -> vec2f {
62651
- let s = a.x + b.x;
62652
- let v = s - a.x;
62653
- let e = (a.x - (s - v)) + (b.x - v);
62654
- let lo_t = (a.y + b.y) + e;
62655
- let hi = s + lo_t;
62656
- let lo = lo_t - (hi - s);
62657
- return vec2f(hi, lo);
62658
- }
62659
-
62660
- fn ds_sub(a: vec2f, b: vec2f) -> vec2f {
62661
- return ds_add(a, vec2f(-b.x, -b.y));
62662
- }
62663
-
62664
- fn ds_mul(a: vec2f, b: vec2f) -> vec2f {
62665
- let p = a.x * b.x;
62666
- let sa = ds_split(a.x);
62667
- let sb = ds_split(b.x);
62668
- var err = ((sa.x * sb.x - p) + sa.x * sb.y + sa.y * sb.x) + sa.y * sb.y;
62669
- err += a.x * b.y + a.y * b.x;
62670
- let hi = p + err;
62671
- let lo = err - (hi - p);
62672
- return vec2f(hi, lo);
62673
- }
62674
-
62675
- fn ds_sqr(a: vec2f) -> vec2f {
62676
- let p = a.x * a.x;
62677
- let sa = ds_split(a.x);
62678
- var err = ((sa.x * sa.x - p) + 2.0 * sa.x * sa.y) + sa.y * sa.y;
62679
- err += 2.0 * a.x * a.y;
62680
- let hi = p + err;
62681
- let lo = err - (hi - p);
62682
- return vec2f(hi, lo);
62683
- }
62684
-
62685
- fn ds_cmp(a: vec2f, b: vec2f) -> f32 {
62686
- let d = a.x - b.x;
62687
- if (d != 0.0) { return sign(d); }
62688
- return sign(a.y - b.y);
62689
- }
62690
- `;
62691
- var GPU_FRACTAL_DP_PREAMBLE_GLSL = `
62692
- float _fractal_mandelbrot_dp(vec4 c, int maxIter) {
62693
- // c = (re_hi, im_hi, re_lo, im_lo)
62694
- vec2 cr = vec2(c.x, c.z); // real part as ds
62695
- vec2 ci = vec2(c.y, c.w); // imag part as ds
62696
- vec2 zr = vec2(0.0, 0.0);
62697
- vec2 zi = vec2(0.0, 0.0);
62698
- for (int i = 0; i < maxIter; i++) {
62699
- vec2 zr2 = ds_sqr(zr);
62700
- vec2 zi2 = ds_sqr(zi);
62701
- // |z|^2 > 4.0 ?
62702
- vec2 mag2 = ds_add(zr2, zi2);
62703
- if (mag2.x > 4.0)
62704
- return clamp((float(i) - log2(log2(mag2.x)) + 4.0) / float(maxIter), 0.0, 1.0);
62705
- // z = z^2 + c
62706
- vec2 new_zi = ds_add(ds_mul(ds_add(zr, zr), zi), ci); // 2*zr*zi + ci
62707
- zr = ds_add(ds_sub(zr2, zi2), cr); // zr^2 - zi^2 + cr
62708
- zi = new_zi;
62709
- }
62710
- return 1.0;
62711
- }
62712
-
62713
- float _fractal_julia_dp(vec4 z_in, vec4 c, int maxIter) {
62714
- vec2 zr = vec2(z_in.x, z_in.z);
62715
- vec2 zi = vec2(z_in.y, z_in.w);
62716
- vec2 cr = vec2(c.x, c.z);
62717
- vec2 ci = vec2(c.y, c.w);
62718
- for (int i = 0; i < maxIter; i++) {
62719
- vec2 zr2 = ds_sqr(zr);
62720
- vec2 zi2 = ds_sqr(zi);
62721
- vec2 mag2 = ds_add(zr2, zi2);
62722
- if (mag2.x > 4.0)
62723
- return clamp((float(i) - log2(log2(mag2.x)) + 4.0) / float(maxIter), 0.0, 1.0);
62724
- vec2 new_zi = ds_add(ds_mul(ds_add(zr, zr), zi), ci);
62725
- zr = ds_add(ds_sub(zr2, zi2), cr);
62726
- zi = new_zi;
62727
- }
62728
- return 1.0;
62729
- }
62730
- `;
62731
- var GPU_FRACTAL_DP_PREAMBLE_WGSL = `
62732
- fn _fractal_mandelbrot_dp(c: vec4f, maxIter: i32) -> f32 {
62733
- let cr = vec2f(c.x, c.z);
62734
- let ci = vec2f(c.y, c.w);
62735
- var zr = vec2f(0.0, 0.0);
62736
- var zi = vec2f(0.0, 0.0);
62737
- for (var i: i32 = 0; i < maxIter; i++) {
62738
- let zr2 = ds_sqr(zr);
62739
- let zi2 = ds_sqr(zi);
62740
- let mag2 = ds_add(zr2, zi2);
62741
- if (mag2.x > 4.0) {
62742
- return clamp((f32(i) - log2(log2(mag2.x)) + 4.0) / f32(maxIter), 0.0, 1.0);
62743
- }
62744
- let new_zi = ds_add(ds_mul(ds_add(zr, zr), zi), ci);
62745
- zr = ds_add(ds_sub(zr2, zi2), cr);
62746
- zi = new_zi;
62747
- }
62748
- return 1.0;
62749
- }
62750
-
62751
- fn _fractal_julia_dp(z_in: vec4f, c: vec4f, maxIter: i32) -> f32 {
62752
- var zr = vec2f(z_in.x, z_in.z);
62753
- var zi = vec2f(z_in.y, z_in.w);
62754
- let cr = vec2f(c.x, c.z);
62755
- let ci = vec2f(c.y, c.w);
62756
- for (var i: i32 = 0; i < maxIter; i++) {
62757
- let zr2 = ds_sqr(zr);
62758
- let zi2 = ds_sqr(zi);
62759
- let mag2 = ds_add(zr2, zi2);
62760
- if (mag2.x > 4.0) {
62761
- return clamp((f32(i) - log2(log2(mag2.x)) + 4.0) / f32(maxIter), 0.0, 1.0);
62762
- }
62763
- let new_zi = ds_add(ds_mul(ds_add(zr, zr), zi), ci);
62764
- zr = ds_add(ds_sub(zr2, zi2), cr);
62765
- zi = new_zi;
62766
- }
62767
- return 1.0;
62768
- }
62769
62669
  `;
62770
62670
  var GPU_FRACTAL_PREAMBLE_GLSL = `
62771
62671
  float _fractal_mandelbrot(vec2 c, int maxIter) {
@@ -62809,188 +62709,6 @@ fn _fractal_julia(z_in: vec2f, c: vec2f, maxIter: i32) -> f32 {
62809
62709
  }
62810
62710
  return 1.0;
62811
62711
  }
62812
- `;
62813
- var GPU_FRACTAL_PT_PREAMBLE_GLSL = `
62814
- uniform sampler2D _refOrbit;
62815
- uniform int _refOrbitLen;
62816
- uniform int _refOrbitTexWidth;
62817
-
62818
- vec2 _pt_fetch_orbit(int i) {
62819
- int y = i / _refOrbitTexWidth;
62820
- int x = i - y * _refOrbitTexWidth;
62821
- return texelFetch(_refOrbit, ivec2(x, y), 0).rg;
62822
- }
62823
-
62824
- float _fractal_mandelbrot_pt(vec2 delta_c, int maxIter) {
62825
- float dr = 0.0;
62826
- float di = 0.0;
62827
- int orbitLen = min(maxIter, _refOrbitLen);
62828
- for (int i = 0; i < orbitLen; i++) {
62829
- vec2 Zn = _pt_fetch_orbit(i);
62830
- // delta_{n+1} = 2*Z_n*delta_n + delta_n^2 + delta_c
62831
- float new_dr = 2.0 * (Zn.x * dr - Zn.y * di) + dr * dr - di * di + delta_c.x;
62832
- float new_di = 2.0 * (Zn.x * di + Zn.y * dr) + 2.0 * dr * di + delta_c.y;
62833
- dr = new_dr;
62834
- di = new_di;
62835
- // Full z = Z_{n+1} + delta for escape check
62836
- vec2 Zn1 = (i + 1 < orbitLen) ? _pt_fetch_orbit(i + 1) : vec2(0.0);
62837
- float zr = Zn1.x + dr;
62838
- float zi = Zn1.y + di;
62839
- float mag2 = zr * zr + zi * zi;
62840
- if (mag2 > 4.0)
62841
- return clamp((float(i) - log2(log2(mag2)) + 4.0) / float(maxIter), 0.0, 1.0);
62842
- // Glitch detection: |delta|^2 > |Z|^2
62843
- float dmag2 = dr * dr + di * di;
62844
- float Zmag2 = Zn.x * Zn.x + Zn.y * Zn.y;
62845
- if (dmag2 > Zmag2 && Zmag2 > 0.0) {
62846
- // Rebase to absolute coordinates and continue with single-float
62847
- float abs_zr = Zn1.x + dr;
62848
- float abs_zi = Zn1.y + di;
62849
- // Reconstruct absolute c from reference + delta
62850
- // (Use ds_from for the concept, but single-float suffices for fallback)
62851
- float cx = abs_zr - dr + delta_c.x;
62852
- float cy = abs_zi - di + delta_c.y;
62853
- for (int j = i + 1; j < maxIter; j++) {
62854
- float new_zr = abs_zr * abs_zr - abs_zi * abs_zi + cx;
62855
- abs_zi = 2.0 * abs_zr * abs_zi + cy;
62856
- abs_zr = new_zr;
62857
- mag2 = abs_zr * abs_zr + abs_zi * abs_zi;
62858
- if (mag2 > 4.0)
62859
- return clamp((float(j) - log2(log2(mag2)) + 4.0) / float(maxIter), 0.0, 1.0);
62860
- }
62861
- return 1.0;
62862
- }
62863
- }
62864
- return 1.0;
62865
- }
62866
-
62867
- float _fractal_julia_pt(vec2 z_delta, vec2 delta_c, int maxIter) {
62868
- float dr = z_delta.x;
62869
- float di = z_delta.y;
62870
- int orbitLen = min(maxIter, _refOrbitLen);
62871
- for (int i = 0; i < orbitLen; i++) {
62872
- vec2 Zn = _pt_fetch_orbit(i);
62873
- float new_dr = 2.0 * (Zn.x * dr - Zn.y * di) + dr * dr - di * di + delta_c.x;
62874
- float new_di = 2.0 * (Zn.x * di + Zn.y * dr) + 2.0 * dr * di + delta_c.y;
62875
- dr = new_dr;
62876
- di = new_di;
62877
- vec2 Zn1 = (i + 1 < orbitLen) ? _pt_fetch_orbit(i + 1) : vec2(0.0);
62878
- float zr = Zn1.x + dr;
62879
- float zi = Zn1.y + di;
62880
- float mag2 = zr * zr + zi * zi;
62881
- if (mag2 > 4.0)
62882
- return clamp((float(i) - log2(log2(mag2)) + 4.0) / float(maxIter), 0.0, 1.0);
62883
- float dmag2 = dr * dr + di * di;
62884
- float Zmag2 = Zn.x * Zn.x + Zn.y * Zn.y;
62885
- if (dmag2 > Zmag2 && Zmag2 > 0.0) {
62886
- float abs_zr = Zn1.x + dr;
62887
- float abs_zi = Zn1.y + di;
62888
- float cx = delta_c.x;
62889
- float cy = delta_c.y;
62890
- for (int j = i + 1; j < maxIter; j++) {
62891
- float new_zr = abs_zr * abs_zr - abs_zi * abs_zi + cx;
62892
- abs_zi = 2.0 * abs_zr * abs_zi + cy;
62893
- abs_zr = new_zr;
62894
- mag2 = abs_zr * abs_zr + abs_zi * abs_zi;
62895
- if (mag2 > 4.0)
62896
- return clamp((float(j) - log2(log2(mag2)) + 4.0) / float(maxIter), 0.0, 1.0);
62897
- }
62898
- return 1.0;
62899
- }
62900
- }
62901
- return 1.0;
62902
- }
62903
- `;
62904
- var GPU_FRACTAL_PT_PREAMBLE_WGSL = `
62905
- @group(0) @binding(1) var _refOrbit: texture_2d<f32>;
62906
- var<uniform> _refOrbitLen: i32;
62907
- var<uniform> _refOrbitTexWidth: i32;
62908
-
62909
- fn _pt_fetch_orbit(i: i32) -> vec2f {
62910
- let y = i / _refOrbitTexWidth;
62911
- let x = i - y * _refOrbitTexWidth;
62912
- return textureLoad(_refOrbit, vec2i(x, y), 0).rg;
62913
- }
62914
-
62915
- fn _fractal_mandelbrot_pt(delta_c: vec2f, maxIter: i32) -> f32 {
62916
- var dr: f32 = 0.0;
62917
- var di: f32 = 0.0;
62918
- let orbitLen = min(maxIter, _refOrbitLen);
62919
- for (var i: i32 = 0; i < orbitLen; i++) {
62920
- let Zn = _pt_fetch_orbit(i);
62921
- let new_dr = 2.0 * (Zn.x * dr - Zn.y * di) + dr * dr - di * di + delta_c.x;
62922
- let new_di = 2.0 * (Zn.x * di + Zn.y * dr) + 2.0 * dr * di + delta_c.y;
62923
- dr = new_dr;
62924
- di = new_di;
62925
- var Zn1 = vec2f(0.0);
62926
- if (i + 1 < orbitLen) { Zn1 = _pt_fetch_orbit(i + 1); }
62927
- let zr = Zn1.x + dr;
62928
- let zi = Zn1.y + di;
62929
- var mag2 = zr * zr + zi * zi;
62930
- if (mag2 > 4.0) {
62931
- return clamp((f32(i) - log2(log2(mag2)) + 4.0) / f32(maxIter), 0.0, 1.0);
62932
- }
62933
- let dmag2 = dr * dr + di * di;
62934
- let Zmag2 = Zn.x * Zn.x + Zn.y * Zn.y;
62935
- if (dmag2 > Zmag2 && Zmag2 > 0.0) {
62936
- var f_zr = Zn1.x + dr;
62937
- var f_zi = Zn1.y + di;
62938
- let cx = delta_c.x;
62939
- let cy = delta_c.y;
62940
- for (var j: i32 = i + 1; j < maxIter; j++) {
62941
- let t_zr = f_zr * f_zr - f_zi * f_zi + cx;
62942
- f_zi = 2.0 * f_zr * f_zi + cy;
62943
- f_zr = t_zr;
62944
- mag2 = f_zr * f_zr + f_zi * f_zi;
62945
- if (mag2 > 4.0) {
62946
- return clamp((f32(j) - log2(log2(mag2)) + 4.0) / f32(maxIter), 0.0, 1.0);
62947
- }
62948
- }
62949
- return 1.0;
62950
- }
62951
- }
62952
- return 1.0;
62953
- }
62954
-
62955
- fn _fractal_julia_pt(z_delta: vec2f, delta_c: vec2f, maxIter: i32) -> f32 {
62956
- var dr = z_delta.x;
62957
- var di = z_delta.y;
62958
- let orbitLen = min(maxIter, _refOrbitLen);
62959
- for (var i: i32 = 0; i < orbitLen; i++) {
62960
- let Zn = _pt_fetch_orbit(i);
62961
- let new_dr = 2.0 * (Zn.x * dr - Zn.y * di) + dr * dr - di * di + delta_c.x;
62962
- let new_di = 2.0 * (Zn.x * di + Zn.y * dr) + 2.0 * dr * di + delta_c.y;
62963
- dr = new_dr;
62964
- di = new_di;
62965
- var Zn1 = vec2f(0.0);
62966
- if (i + 1 < orbitLen) { Zn1 = _pt_fetch_orbit(i + 1); }
62967
- let zr = Zn1.x + dr;
62968
- let zi = Zn1.y + di;
62969
- var mag2 = zr * zr + zi * zi;
62970
- if (mag2 > 4.0) {
62971
- return clamp((f32(i) - log2(log2(mag2)) + 4.0) / f32(maxIter), 0.0, 1.0);
62972
- }
62973
- let dmag2 = dr * dr + di * di;
62974
- let Zmag2 = Zn.x * Zn.x + Zn.y * Zn.y;
62975
- if (dmag2 > Zmag2 && Zmag2 > 0.0) {
62976
- var f_zr = Zn1.x + dr;
62977
- var f_zi = Zn1.y + di;
62978
- let cx = delta_c.x;
62979
- let cy = delta_c.y;
62980
- for (var j: i32 = i + 1; j < maxIter; j++) {
62981
- let t_zr = f_zr * f_zr - f_zi * f_zi + cx;
62982
- f_zi = 2.0 * f_zr * f_zi + cy;
62983
- f_zr = t_zr;
62984
- mag2 = f_zr * f_zr + f_zi * f_zi;
62985
- if (mag2 > 4.0) {
62986
- return clamp((f32(j) - log2(log2(mag2)) + 4.0) / f32(maxIter), 0.0, 1.0);
62987
- }
62988
- }
62989
- return 1.0;
62990
- }
62991
- }
62992
- return 1.0;
62993
- }
62994
62712
  `;
62995
62713
  var GPU_COLOR_PREAMBLE_GLSL = `
62996
62714
  float _gpu_srgb_to_linear(float c) {
@@ -63430,7 +63148,6 @@ fn _gpu_apca(bg: vec3f, fg: vec3f) -> f32 {
63430
63148
  const constants = this.getConstants();
63431
63149
  const v2 = this.languageId === "wgsl" ? "vec2f" : "vec2";
63432
63150
  const target = this.createTarget({
63433
- hints: options.hints,
63434
63151
  functions: (id) => {
63435
63152
  if (userFunctions && id in userFunctions) {
63436
63153
  const fn = userFunctions[id];
@@ -63469,65 +63186,12 @@ fn _gpu_apca(bg: vec3f, fg: vec3f) -> f32 {
63469
63186
  if (code.includes("_gpu_besselJ"))
63470
63187
  preamble += this.languageId === "wgsl" ? GPU_BESSELJ_PREAMBLE_WGSL : GPU_BESSELJ_PREAMBLE_GLSL;
63471
63188
  if (code.includes("_fractal_")) {
63472
- if (code.includes("_fractal_mandelbrot_pt") || code.includes("_fractal_julia_pt")) {
63473
- preamble += this.languageId === "wgsl" ? GPU_DS_ARITHMETIC_PREAMBLE_WGSL : GPU_DS_ARITHMETIC_PREAMBLE_GLSL;
63474
- preamble += this.languageId === "wgsl" ? GPU_FRACTAL_PT_PREAMBLE_WGSL : GPU_FRACTAL_PT_PREAMBLE_GLSL;
63475
- } else if (code.includes("_fractal_mandelbrot_dp") || code.includes("_fractal_julia_dp")) {
63476
- preamble += this.languageId === "wgsl" ? GPU_DS_ARITHMETIC_PREAMBLE_WGSL : GPU_DS_ARITHMETIC_PREAMBLE_GLSL;
63477
- preamble += this.languageId === "wgsl" ? GPU_FRACTAL_DP_PREAMBLE_WGSL : GPU_FRACTAL_DP_PREAMBLE_GLSL;
63478
- } else {
63479
- preamble += this.languageId === "wgsl" ? GPU_FRACTAL_PREAMBLE_WGSL : GPU_FRACTAL_PREAMBLE_GLSL;
63480
- }
63189
+ preamble += this.languageId === "wgsl" ? GPU_FRACTAL_PREAMBLE_WGSL : GPU_FRACTAL_PREAMBLE_GLSL;
63481
63190
  }
63482
63191
  if (code.includes("_gpu_srgb_to") || code.includes("_gpu_oklab") || code.includes("_gpu_oklch") || code.includes("_gpu_color_mix") || code.includes("_gpu_apca")) {
63483
63192
  preamble += this.languageId === "wgsl" ? GPU_COLOR_PREAMBLE_WGSL : GPU_COLOR_PREAMBLE_GLSL;
63484
63193
  }
63485
63194
  if (preamble) result.preamble = preamble;
63486
- if (code.includes("_fractal_") && options.hints?.viewport) {
63487
- const strategy = selectFractalStrategy(target);
63488
- const radius = options.hints.viewport.radius;
63489
- switch (strategy) {
63490
- case "single":
63491
- result.staleWhen = { radiusBelow: 1e-6 };
63492
- break;
63493
- case "double":
63494
- result.staleWhen = { radiusBelow: 1e-14, radiusAbove: 1e-5 };
63495
- break;
63496
- case "perturbation":
63497
- result.staleWhen = {
63498
- radiusAbove: 1e-5,
63499
- radiusBelow: radius * 0.01,
63500
- centerDistance: radius * 2
63501
- };
63502
- break;
63503
- }
63504
- }
63505
- if ((code.includes("_fractal_mandelbrot_pt") || code.includes("_fractal_julia_pt")) && options.hints?.viewport) {
63506
- const viewport = options.hints.viewport;
63507
- const digits = Math.max(50, Math.ceil(-Math.log10(viewport.radius)) + 10);
63508
- const maxIter = 1e3;
63509
- const orbit = computeReferenceOrbit(
63510
- viewport.center,
63511
- maxIter,
63512
- digits
63513
- );
63514
- const orbitLen = orbit.length / 2;
63515
- const texWidth = Math.min(orbitLen, 4096);
63516
- const texHeight = Math.ceil(orbitLen / texWidth);
63517
- result.textures = {
63518
- _refOrbit: {
63519
- data: orbit,
63520
- width: texWidth,
63521
- height: texHeight,
63522
- format: "rg32f"
63523
- }
63524
- };
63525
- result.uniforms = {
63526
- ...result.uniforms,
63527
- _refOrbitLen: orbitLen,
63528
- _refOrbitTexWidth: texWidth
63529
- };
63530
- }
63531
63195
  return result;
63532
63196
  }
63533
63197
  compileToSource(expr2, _options = {}) {
@@ -68932,14 +68596,14 @@ ${code}`;
68932
68596
  _setDefaultEngineFactory(() => new ComputeEngine());
68933
68597
 
68934
68598
  // src/compute-engine.ts
68935
- var version = "0.55.4";
68599
+ var version = "0.55.6";
68936
68600
  ComputeEngine._latexSyntaxFactory = () => new LatexSyntax();
68937
68601
  _setDefaultEngineFactory(
68938
68602
  () => new ComputeEngine({ latexSyntax: new LatexSyntax() })
68939
68603
  );
68940
68604
  globalThis[/* @__PURE__ */ Symbol.for("io.cortexjs.compute-engine")] = {
68941
68605
  ComputeEngine: ComputeEngine.prototype.constructor,
68942
- version: "0.55.4"
68606
+ version: "0.55.6"
68943
68607
  };
68944
68608
  return __toCommonJS(compute_engine_exports);
68945
68609
  })();