mol_dump_lib 0.0.868 → 0.0.870

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.
package/web.js CHANGED
@@ -449,7 +449,7 @@ var $;
449
449
  if (this[$mol_ambient_ref])
450
450
  return this[$mol_ambient_ref];
451
451
  const owner = $mol_owning_get(this);
452
- return this[$mol_ambient_ref] = owner?.$ || $mol_object2.$;
452
+ return this[$mol_ambient_ref] = owner?.$ || this.constructor.$ || $mol_object2.$;
453
453
  }
454
454
  set $(next) {
455
455
  if (this[$mol_ambient_ref])
@@ -5527,12 +5527,41 @@ var $;
5527
5527
  "use strict";
5528
5528
  var $;
5529
5529
  (function ($) {
5530
- const TextEncoder = globalThis.TextEncoder ?? $node.util.TextEncoder;
5531
- const encoder = new TextEncoder();
5532
- function $mol_charset_encode(value) {
5533
- return encoder.encode(value);
5530
+ let buf = new Uint8Array(2 ** 12);
5531
+ function $mol_charset_encode(str) {
5532
+ const capacity = str.length * 3;
5533
+ if (buf.byteLength < capacity)
5534
+ buf = new Uint8Array(capacity);
5535
+ return buf.slice(0, $mol_charset_encode_to(str, buf));
5534
5536
  }
5535
5537
  $.$mol_charset_encode = $mol_charset_encode;
5538
+ function $mol_charset_encode_to(str, buf, from = 0) {
5539
+ let pos = from;
5540
+ for (let i = 0; i < str.length; i++) {
5541
+ let code = str.charCodeAt(i);
5542
+ if (code < 0x80) {
5543
+ buf[pos++] = code;
5544
+ }
5545
+ else if (code < 0x800) {
5546
+ buf[pos++] = 0xc0 | (code >> 6);
5547
+ buf[pos++] = 0x80 | (code & 0x3f);
5548
+ }
5549
+ else if (code < 0xd800 || code >= 0xe000) {
5550
+ buf[pos++] = 0xe0 | (code >> 12);
5551
+ buf[pos++] = 0x80 | ((code >> 6) & 0x3f);
5552
+ buf[pos++] = 0x80 | (code & 0x3f);
5553
+ }
5554
+ else {
5555
+ const point = ((code - 0xd800) << 10) + str.charCodeAt(++i) + 0x2400;
5556
+ buf[pos++] = 0xf0 | (point >> 18);
5557
+ buf[pos++] = 0x80 | ((point >> 12) & 0x3f);
5558
+ buf[pos++] = 0x80 | ((point >> 6) & 0x3f);
5559
+ buf[pos++] = 0x80 | (point & 0x3f);
5560
+ }
5561
+ }
5562
+ return pos - from;
5563
+ }
5564
+ $.$mol_charset_encode_to = $mol_charset_encode_to;
5536
5565
  })($ || ($ = {}));
5537
5566
 
5538
5567
  ;