@posthog/rrweb 0.0.34 → 0.0.35

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.
@@ -1,16 +1,4 @@
1
- (function (g, f) {
2
- if ("object" == typeof exports && "object" == typeof module) {
3
- module.exports = f();
4
- } else if ("function" == typeof define && define.amd) {
5
- define("rrweb", [], f);
6
- } else if ("object" == typeof exports) {
7
- exports["rrweb"] = f();
8
- } else {
9
- g["rrweb"] = f();
10
- }
11
- }(this, () => {
12
- var exports = {};
13
- var module = { exports };
1
+ (function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
14
2
  "use strict";
15
3
  var __defProp = Object.defineProperty;
16
4
  var __defProps = Object.defineProperties;
@@ -1523,7 +1511,7 @@ function getDefaultExportFromCjs$1(x) {
1523
1511
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1524
1512
  }
1525
1513
  function getAugmentedNamespace$1(n2) {
1526
- if (n2.__esModule) return n2;
1514
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
1527
1515
  var f2 = n2.default;
1528
1516
  if (typeof f2 == "function") {
1529
1517
  var a2 = function a3() {
@@ -2042,6 +2030,9 @@ function requireNode$1() {
2042
2030
  return offset;
2043
2031
  }
2044
2032
  class Node2 {
2033
+ get proxyOf() {
2034
+ return this;
2035
+ }
2045
2036
  constructor(defaults = {}) {
2046
2037
  this.raws = {};
2047
2038
  this[isClean] = false;
@@ -2160,7 +2151,7 @@ function requireNode$1() {
2160
2151
  let index2 = this.parent.index(this);
2161
2152
  return this.parent.nodes[index2 + 1];
2162
2153
  }
2163
- positionBy(opts) {
2154
+ positionBy(opts = {}) {
2164
2155
  let pos = this.source.start;
2165
2156
  if (opts.index) {
2166
2157
  pos = this.positionInside(opts.index);
@@ -2189,27 +2180,38 @@ function requireNode$1() {
2189
2180
  column += 1;
2190
2181
  }
2191
2182
  }
2192
- return { column, line };
2183
+ return { column, line, offset: end };
2193
2184
  }
2194
2185
  prev() {
2195
2186
  if (!this.parent) return void 0;
2196
2187
  let index2 = this.parent.index(this);
2197
2188
  return this.parent.nodes[index2 - 1];
2198
2189
  }
2199
- rangeBy(opts) {
2190
+ rangeBy(opts = {}) {
2191
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2200
2192
  let start = {
2201
2193
  column: this.source.start.column,
2202
- line: this.source.start.line
2194
+ line: this.source.start.line,
2195
+ offset: sourceOffset(inputString, this.source.start)
2203
2196
  };
2204
2197
  let end = this.source.end ? {
2205
2198
  column: this.source.end.column + 1,
2206
- line: this.source.end.line
2199
+ line: this.source.end.line,
2200
+ offset: typeof this.source.end.offset === "number" ? (
2201
+ // `source.end.offset` is exclusive, so we don't need to add 1
2202
+ this.source.end.offset
2203
+ ) : (
2204
+ // Since line/column in this.source.end is inclusive,
2205
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
2206
+ // So, we add 1 to convert it to exclusive.
2207
+ sourceOffset(inputString, this.source.end) + 1
2208
+ )
2207
2209
  } : {
2208
2210
  column: start.column + 1,
2209
- line: start.line
2211
+ line: start.line,
2212
+ offset: start.offset + 1
2210
2213
  };
2211
2214
  if (opts.word) {
2212
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2213
2215
  let stringRepresentation = inputString.slice(
2214
2216
  sourceOffset(inputString, this.source.start),
2215
2217
  sourceOffset(inputString, this.source.end)
@@ -2217,15 +2219,14 @@ function requireNode$1() {
2217
2219
  let index2 = stringRepresentation.indexOf(opts.word);
2218
2220
  if (index2 !== -1) {
2219
2221
  start = this.positionInside(index2);
2220
- end = this.positionInside(
2221
- index2 + opts.word.length
2222
- );
2222
+ end = this.positionInside(index2 + opts.word.length);
2223
2223
  }
2224
2224
  } else {
2225
2225
  if (opts.start) {
2226
2226
  start = {
2227
2227
  column: opts.start.column,
2228
- line: opts.start.line
2228
+ line: opts.start.line,
2229
+ offset: sourceOffset(inputString, opts.start)
2229
2230
  };
2230
2231
  } else if (opts.index) {
2231
2232
  start = this.positionInside(opts.index);
@@ -2233,7 +2234,8 @@ function requireNode$1() {
2233
2234
  if (opts.end) {
2234
2235
  end = {
2235
2236
  column: opts.end.column,
2236
- line: opts.end.line
2237
+ line: opts.end.line,
2238
+ offset: sourceOffset(inputString, opts.end)
2237
2239
  };
2238
2240
  } else if (typeof opts.endIndex === "number") {
2239
2241
  end = this.positionInside(opts.endIndex);
@@ -2242,7 +2244,11 @@ function requireNode$1() {
2242
2244
  }
2243
2245
  }
2244
2246
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
2245
- end = { column: start.column + 1, line: start.line };
2247
+ end = {
2248
+ column: start.column + 1,
2249
+ line: start.line,
2250
+ offset: start.offset + 1
2251
+ };
2246
2252
  }
2247
2253
  return { end, start };
2248
2254
  }
@@ -2306,6 +2312,7 @@ function requireNode$1() {
2306
2312
  } else if (typeof value === "object" && value.toJSON) {
2307
2313
  fixed[name] = value.toJSON(null, inputs);
2308
2314
  } else if (name === "source") {
2315
+ if (value == null) continue;
2309
2316
  let inputId = inputs.get(value.input);
2310
2317
  if (inputId == null) {
2311
2318
  inputId = inputsNextIndex;
@@ -2340,14 +2347,11 @@ function requireNode$1() {
2340
2347
  });
2341
2348
  return result2;
2342
2349
  }
2343
- warn(result2, text, opts) {
2350
+ warn(result2, text, opts = {}) {
2344
2351
  let data = { node: this };
2345
2352
  for (let i2 in opts) data[i2] = opts[i2];
2346
2353
  return result2.warn(text, data);
2347
2354
  }
2348
- get proxyOf() {
2349
- return this;
2350
- }
2351
2355
  }
2352
2356
  node$1 = Node2;
2353
2357
  Node2.default = Node2;
@@ -2376,6 +2380,9 @@ function requireDeclaration$1() {
2376
2380
  hasRequiredDeclaration$1 = 1;
2377
2381
  let Node2 = requireNode$1();
2378
2382
  class Declaration extends Node2 {
2383
+ get variable() {
2384
+ return this.prop.startsWith("--") || this.prop[0] === "$";
2385
+ }
2379
2386
  constructor(defaults) {
2380
2387
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2381
2388
  defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
@@ -2383,9 +2390,6 @@ function requireDeclaration$1() {
2383
2390
  super(defaults);
2384
2391
  this.type = "decl";
2385
2392
  }
2386
- get variable() {
2387
- return this.prop.startsWith("--") || this.prop[0] === "$";
2388
- }
2389
2393
  }
2390
2394
  declaration$1 = Declaration;
2391
2395
  Declaration.default = Declaration;
@@ -2417,6 +2421,14 @@ function requireContainer$1() {
2417
2421
  }
2418
2422
  }
2419
2423
  class Container extends Node2 {
2424
+ get first() {
2425
+ if (!this.proxyOf.nodes) return void 0;
2426
+ return this.proxyOf.nodes[0];
2427
+ }
2428
+ get last() {
2429
+ if (!this.proxyOf.nodes) return void 0;
2430
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
2431
+ }
2420
2432
  append(...children) {
2421
2433
  for (let child of children) {
2422
2434
  let nodes = this.normalize(child, this.last);
@@ -2729,14 +2741,6 @@ function requireContainer$1() {
2729
2741
  }
2730
2742
  });
2731
2743
  }
2732
- get first() {
2733
- if (!this.proxyOf.nodes) return void 0;
2734
- return this.proxyOf.nodes[0];
2735
- }
2736
- get last() {
2737
- if (!this.proxyOf.nodes) return void 0;
2738
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
2739
- }
2740
2744
  }
2741
2745
  Container.registerParse = (dependant) => {
2742
2746
  parse = dependant;
@@ -2986,10 +2990,25 @@ function requireInput$1() {
2986
2990
  let CssSyntaxError = requireCssSyntaxError$1();
2987
2991
  let PreviousMap = requirePreviousMap$1();
2988
2992
  let terminalHighlight = require$$2$1;
2989
- let fromOffsetCache = Symbol("fromOffsetCache");
2993
+ let lineToIndexCache = Symbol("lineToIndexCache");
2990
2994
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
2991
2995
  let pathAvailable = Boolean(resolve && isAbsolute);
2996
+ function getLineToIndex(input2) {
2997
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
2998
+ let lines = input2.css.split("\n");
2999
+ let lineToIndex = new Array(lines.length);
3000
+ let prevIndex = 0;
3001
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
3002
+ lineToIndex[i2] = prevIndex;
3003
+ prevIndex += lines[i2].length + 1;
3004
+ }
3005
+ input2[lineToIndexCache] = lineToIndex;
3006
+ return lineToIndex;
3007
+ }
2992
3008
  class Input {
3009
+ get from() {
3010
+ return this.file || this.id;
3011
+ }
2993
3012
  constructor(css, opts = {}) {
2994
3013
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
2995
3014
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -3024,30 +3043,37 @@ function requireInput$1() {
3024
3043
  if (this.map) this.map.file = this.from;
3025
3044
  }
3026
3045
  error(message, line, column, opts = {}) {
3027
- let endColumn, endLine, result2;
3046
+ let endColumn, endLine, endOffset, offset, result2;
3028
3047
  if (line && typeof line === "object") {
3029
3048
  let start = line;
3030
3049
  let end = column;
3031
3050
  if (typeof start.offset === "number") {
3032
- let pos = this.fromOffset(start.offset);
3051
+ offset = start.offset;
3052
+ let pos = this.fromOffset(offset);
3033
3053
  line = pos.line;
3034
3054
  column = pos.col;
3035
3055
  } else {
3036
3056
  line = start.line;
3037
3057
  column = start.column;
3058
+ offset = this.fromLineAndColumn(line, column);
3038
3059
  }
3039
3060
  if (typeof end.offset === "number") {
3040
- let pos = this.fromOffset(end.offset);
3061
+ endOffset = end.offset;
3062
+ let pos = this.fromOffset(endOffset);
3041
3063
  endLine = pos.line;
3042
3064
  endColumn = pos.col;
3043
3065
  } else {
3044
3066
  endLine = end.line;
3045
3067
  endColumn = end.column;
3068
+ endOffset = this.fromLineAndColumn(end.line, end.column);
3046
3069
  }
3047
3070
  } else if (!column) {
3048
- let pos = this.fromOffset(line);
3071
+ offset = line;
3072
+ let pos = this.fromOffset(offset);
3049
3073
  line = pos.line;
3050
3074
  column = pos.col;
3075
+ } else {
3076
+ offset = this.fromLineAndColumn(line, column);
3051
3077
  }
3052
3078
  let origin = this.origin(line, column, endLine, endColumn);
3053
3079
  if (origin) {
@@ -3069,7 +3095,7 @@ function requireInput$1() {
3069
3095
  opts.plugin
3070
3096
  );
3071
3097
  }
3072
- result2.input = { column, endColumn, endLine, line, source: this.css };
3098
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
3073
3099
  if (this.file) {
3074
3100
  if (pathToFileURL) {
3075
3101
  result2.input.url = pathToFileURL(this.file).toString();
@@ -3078,21 +3104,14 @@ function requireInput$1() {
3078
3104
  }
3079
3105
  return result2;
3080
3106
  }
3107
+ fromLineAndColumn(line, column) {
3108
+ let lineToIndex = getLineToIndex(this);
3109
+ let index2 = lineToIndex[line - 1];
3110
+ return index2 + column - 1;
3111
+ }
3081
3112
  fromOffset(offset) {
3082
- let lastLine, lineToIndex;
3083
- if (!this[fromOffsetCache]) {
3084
- let lines = this.css.split("\n");
3085
- lineToIndex = new Array(lines.length);
3086
- let prevIndex = 0;
3087
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
3088
- lineToIndex[i2] = prevIndex;
3089
- prevIndex += lines[i2].length + 1;
3090
- }
3091
- this[fromOffsetCache] = lineToIndex;
3092
- } else {
3093
- lineToIndex = this[fromOffsetCache];
3094
- }
3095
- lastLine = lineToIndex[lineToIndex.length - 1];
3113
+ let lineToIndex = getLineToIndex(this);
3114
+ let lastLine = lineToIndex[lineToIndex.length - 1];
3096
3115
  let min = 0;
3097
3116
  if (offset >= lastLine) {
3098
3117
  min = lineToIndex.length - 1;
@@ -3173,9 +3192,6 @@ function requireInput$1() {
3173
3192
  }
3174
3193
  return json;
3175
3194
  }
3176
- get from() {
3177
- return this.file || this.id;
3178
- }
3179
3195
  }
3180
3196
  input$1 = Input;
3181
3197
  Input.default = Input;
@@ -3301,11 +3317,6 @@ function requireRule$1() {
3301
3317
  let Container = requireContainer$1();
3302
3318
  let list = requireList$1();
3303
3319
  class Rule extends Container {
3304
- constructor(defaults) {
3305
- super(defaults);
3306
- this.type = "rule";
3307
- if (!this.nodes) this.nodes = [];
3308
- }
3309
3320
  get selectors() {
3310
3321
  return list.comma(this.selector);
3311
3322
  }
@@ -3314,6 +3325,11 @@ function requireRule$1() {
3314
3325
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
3315
3326
  this.selector = values.join(sep);
3316
3327
  }
3328
+ constructor(defaults) {
3329
+ super(defaults);
3330
+ this.type = "rule";
3331
+ if (!this.nodes) this.nodes = [];
3332
+ }
3317
3333
  }
3318
3334
  rule$1 = Rule;
3319
3335
  Rule.default = Rule;
@@ -4212,6 +4228,8 @@ function requireParser$1() {
4212
4228
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
4213
4229
  prev.raws.ownSemicolon = this.spaces;
4214
4230
  this.spaces = "";
4231
+ prev.source.end = this.getPosition(token[2]);
4232
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
4215
4233
  }
4216
4234
  }
4217
4235
  }
@@ -4423,7 +4441,7 @@ function requireParser$1() {
4423
4441
  }
4424
4442
  unknownWord(tokens) {
4425
4443
  throw this.input.error(
4426
- "Unknown word",
4444
+ "Unknown word " + tokens[0][1],
4427
4445
  { offset: tokens[0][2] },
4428
4446
  { offset: tokens[0][2] + tokens[0][1].length }
4429
4447
  );
@@ -4516,12 +4534,15 @@ function requireResult$1() {
4516
4534
  hasRequiredResult$1 = 1;
4517
4535
  let Warning = requireWarning$1();
4518
4536
  class Result {
4537
+ get content() {
4538
+ return this.css;
4539
+ }
4519
4540
  constructor(processor2, root2, opts) {
4520
4541
  this.processor = processor2;
4521
4542
  this.messages = [];
4522
4543
  this.root = root2;
4523
4544
  this.opts = opts;
4524
- this.css = void 0;
4545
+ this.css = "";
4525
4546
  this.map = void 0;
4526
4547
  }
4527
4548
  toString() {
@@ -4540,9 +4561,6 @@ function requireResult$1() {
4540
4561
  warnings() {
4541
4562
  return this.messages.filter((i2) => i2.type === "warning");
4542
4563
  }
4543
- get content() {
4544
- return this.css;
4545
- }
4546
4564
  }
4547
4565
  result$1 = Result;
4548
4566
  Result.default = Result;
@@ -4661,6 +4679,30 @@ function requireLazyResult$1() {
4661
4679
  }
4662
4680
  let postcss2 = {};
4663
4681
  class LazyResult {
4682
+ get content() {
4683
+ return this.stringify().content;
4684
+ }
4685
+ get css() {
4686
+ return this.stringify().css;
4687
+ }
4688
+ get map() {
4689
+ return this.stringify().map;
4690
+ }
4691
+ get messages() {
4692
+ return this.sync().messages;
4693
+ }
4694
+ get opts() {
4695
+ return this.result.opts;
4696
+ }
4697
+ get processor() {
4698
+ return this.result.processor;
4699
+ }
4700
+ get root() {
4701
+ return this.sync().root;
4702
+ }
4703
+ get [Symbol.toStringTag]() {
4704
+ return "LazyResult";
4705
+ }
4664
4706
  constructor(processor2, css, opts) {
4665
4707
  this.stringified = false;
4666
4708
  this.processed = false;
@@ -5003,30 +5045,6 @@ function requireLazyResult$1() {
5003
5045
  warnings() {
5004
5046
  return this.sync().warnings();
5005
5047
  }
5006
- get content() {
5007
- return this.stringify().content;
5008
- }
5009
- get css() {
5010
- return this.stringify().css;
5011
- }
5012
- get map() {
5013
- return this.stringify().map;
5014
- }
5015
- get messages() {
5016
- return this.sync().messages;
5017
- }
5018
- get opts() {
5019
- return this.result.opts;
5020
- }
5021
- get processor() {
5022
- return this.result.processor;
5023
- }
5024
- get root() {
5025
- return this.sync().root;
5026
- }
5027
- get [Symbol.toStringTag]() {
5028
- return "LazyResult";
5029
- }
5030
5048
  }
5031
5049
  LazyResult.registerPostcss = (dependant) => {
5032
5050
  postcss2 = dependant;
@@ -5048,6 +5066,45 @@ function requireNoWorkResult$1() {
5048
5066
  let stringify = requireStringify$1();
5049
5067
  let warnOnce2 = requireWarnOnce$1();
5050
5068
  class NoWorkResult {
5069
+ get content() {
5070
+ return this.result.css;
5071
+ }
5072
+ get css() {
5073
+ return this.result.css;
5074
+ }
5075
+ get map() {
5076
+ return this.result.map;
5077
+ }
5078
+ get messages() {
5079
+ return [];
5080
+ }
5081
+ get opts() {
5082
+ return this.result.opts;
5083
+ }
5084
+ get processor() {
5085
+ return this.result.processor;
5086
+ }
5087
+ get root() {
5088
+ if (this._root) {
5089
+ return this._root;
5090
+ }
5091
+ let root2;
5092
+ let parser2 = parse;
5093
+ try {
5094
+ root2 = parser2(this._css, this._opts);
5095
+ } catch (error) {
5096
+ this.error = error;
5097
+ }
5098
+ if (this.error) {
5099
+ throw this.error;
5100
+ } else {
5101
+ this._root = root2;
5102
+ return root2;
5103
+ }
5104
+ }
5105
+ get [Symbol.toStringTag]() {
5106
+ return "NoWorkResult";
5107
+ }
5051
5108
  constructor(processor2, css, opts) {
5052
5109
  css = css.toString();
5053
5110
  this.stringified = false;
@@ -5109,45 +5166,6 @@ function requireNoWorkResult$1() {
5109
5166
  warnings() {
5110
5167
  return [];
5111
5168
  }
5112
- get content() {
5113
- return this.result.css;
5114
- }
5115
- get css() {
5116
- return this.result.css;
5117
- }
5118
- get map() {
5119
- return this.result.map;
5120
- }
5121
- get messages() {
5122
- return [];
5123
- }
5124
- get opts() {
5125
- return this.result.opts;
5126
- }
5127
- get processor() {
5128
- return this.result.processor;
5129
- }
5130
- get root() {
5131
- if (this._root) {
5132
- return this._root;
5133
- }
5134
- let root2;
5135
- let parser2 = parse;
5136
- try {
5137
- root2 = parser2(this._css, this._opts);
5138
- } catch (error) {
5139
- this.error = error;
5140
- }
5141
- if (this.error) {
5142
- throw this.error;
5143
- } else {
5144
- this._root = root2;
5145
- return root2;
5146
- }
5147
- }
5148
- get [Symbol.toStringTag]() {
5149
- return "NoWorkResult";
5150
- }
5151
5169
  }
5152
5170
  noWorkResult$1 = NoWorkResult;
5153
5171
  NoWorkResult.default = NoWorkResult;
@@ -5164,7 +5182,7 @@ function requireProcessor$1() {
5164
5182
  let Root = requireRoot$1();
5165
5183
  class Processor {
5166
5184
  constructor(plugins = []) {
5167
- this.version = "8.5.1";
5185
+ this.version = "8.5.6";
5168
5186
  this.plugins = this.normalize(plugins);
5169
5187
  }
5170
5188
  normalize(plugins) {
@@ -5885,7 +5903,7 @@ function getDefaultExportFromCjs(x) {
5885
5903
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5886
5904
  }
5887
5905
  function getAugmentedNamespace(n2) {
5888
- if (n2.__esModule) return n2;
5906
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
5889
5907
  var f2 = n2.default;
5890
5908
  if (typeof f2 == "function") {
5891
5909
  var a2 = function a3() {
@@ -6404,6 +6422,9 @@ function requireNode() {
6404
6422
  return offset;
6405
6423
  }
6406
6424
  class Node2 {
6425
+ get proxyOf() {
6426
+ return this;
6427
+ }
6407
6428
  constructor(defaults = {}) {
6408
6429
  this.raws = {};
6409
6430
  this[isClean] = false;
@@ -6522,7 +6543,7 @@ function requireNode() {
6522
6543
  let index2 = this.parent.index(this);
6523
6544
  return this.parent.nodes[index2 + 1];
6524
6545
  }
6525
- positionBy(opts) {
6546
+ positionBy(opts = {}) {
6526
6547
  let pos = this.source.start;
6527
6548
  if (opts.index) {
6528
6549
  pos = this.positionInside(opts.index);
@@ -6551,27 +6572,38 @@ function requireNode() {
6551
6572
  column += 1;
6552
6573
  }
6553
6574
  }
6554
- return { column, line };
6575
+ return { column, line, offset: end };
6555
6576
  }
6556
6577
  prev() {
6557
6578
  if (!this.parent) return void 0;
6558
6579
  let index2 = this.parent.index(this);
6559
6580
  return this.parent.nodes[index2 - 1];
6560
6581
  }
6561
- rangeBy(opts) {
6582
+ rangeBy(opts = {}) {
6583
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6562
6584
  let start = {
6563
6585
  column: this.source.start.column,
6564
- line: this.source.start.line
6586
+ line: this.source.start.line,
6587
+ offset: sourceOffset(inputString, this.source.start)
6565
6588
  };
6566
6589
  let end = this.source.end ? {
6567
6590
  column: this.source.end.column + 1,
6568
- line: this.source.end.line
6591
+ line: this.source.end.line,
6592
+ offset: typeof this.source.end.offset === "number" ? (
6593
+ // `source.end.offset` is exclusive, so we don't need to add 1
6594
+ this.source.end.offset
6595
+ ) : (
6596
+ // Since line/column in this.source.end is inclusive,
6597
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
6598
+ // So, we add 1 to convert it to exclusive.
6599
+ sourceOffset(inputString, this.source.end) + 1
6600
+ )
6569
6601
  } : {
6570
6602
  column: start.column + 1,
6571
- line: start.line
6603
+ line: start.line,
6604
+ offset: start.offset + 1
6572
6605
  };
6573
6606
  if (opts.word) {
6574
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6575
6607
  let stringRepresentation = inputString.slice(
6576
6608
  sourceOffset(inputString, this.source.start),
6577
6609
  sourceOffset(inputString, this.source.end)
@@ -6579,15 +6611,14 @@ function requireNode() {
6579
6611
  let index2 = stringRepresentation.indexOf(opts.word);
6580
6612
  if (index2 !== -1) {
6581
6613
  start = this.positionInside(index2);
6582
- end = this.positionInside(
6583
- index2 + opts.word.length
6584
- );
6614
+ end = this.positionInside(index2 + opts.word.length);
6585
6615
  }
6586
6616
  } else {
6587
6617
  if (opts.start) {
6588
6618
  start = {
6589
6619
  column: opts.start.column,
6590
- line: opts.start.line
6620
+ line: opts.start.line,
6621
+ offset: sourceOffset(inputString, opts.start)
6591
6622
  };
6592
6623
  } else if (opts.index) {
6593
6624
  start = this.positionInside(opts.index);
@@ -6595,7 +6626,8 @@ function requireNode() {
6595
6626
  if (opts.end) {
6596
6627
  end = {
6597
6628
  column: opts.end.column,
6598
- line: opts.end.line
6629
+ line: opts.end.line,
6630
+ offset: sourceOffset(inputString, opts.end)
6599
6631
  };
6600
6632
  } else if (typeof opts.endIndex === "number") {
6601
6633
  end = this.positionInside(opts.endIndex);
@@ -6604,7 +6636,11 @@ function requireNode() {
6604
6636
  }
6605
6637
  }
6606
6638
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
6607
- end = { column: start.column + 1, line: start.line };
6639
+ end = {
6640
+ column: start.column + 1,
6641
+ line: start.line,
6642
+ offset: start.offset + 1
6643
+ };
6608
6644
  }
6609
6645
  return { end, start };
6610
6646
  }
@@ -6668,6 +6704,7 @@ function requireNode() {
6668
6704
  } else if (typeof value === "object" && value.toJSON) {
6669
6705
  fixed[name] = value.toJSON(null, inputs);
6670
6706
  } else if (name === "source") {
6707
+ if (value == null) continue;
6671
6708
  let inputId = inputs.get(value.input);
6672
6709
  if (inputId == null) {
6673
6710
  inputId = inputsNextIndex;
@@ -6702,14 +6739,11 @@ function requireNode() {
6702
6739
  });
6703
6740
  return result2;
6704
6741
  }
6705
- warn(result2, text, opts) {
6742
+ warn(result2, text, opts = {}) {
6706
6743
  let data = { node: this };
6707
6744
  for (let i2 in opts) data[i2] = opts[i2];
6708
6745
  return result2.warn(text, data);
6709
6746
  }
6710
- get proxyOf() {
6711
- return this;
6712
- }
6713
6747
  }
6714
6748
  node = Node2;
6715
6749
  Node2.default = Node2;
@@ -6738,6 +6772,9 @@ function requireDeclaration() {
6738
6772
  hasRequiredDeclaration = 1;
6739
6773
  let Node2 = requireNode();
6740
6774
  class Declaration extends Node2 {
6775
+ get variable() {
6776
+ return this.prop.startsWith("--") || this.prop[0] === "$";
6777
+ }
6741
6778
  constructor(defaults) {
6742
6779
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
6743
6780
  defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
@@ -6745,9 +6782,6 @@ function requireDeclaration() {
6745
6782
  super(defaults);
6746
6783
  this.type = "decl";
6747
6784
  }
6748
- get variable() {
6749
- return this.prop.startsWith("--") || this.prop[0] === "$";
6750
- }
6751
6785
  }
6752
6786
  declaration = Declaration;
6753
6787
  Declaration.default = Declaration;
@@ -6779,6 +6813,14 @@ function requireContainer() {
6779
6813
  }
6780
6814
  }
6781
6815
  class Container extends Node2 {
6816
+ get first() {
6817
+ if (!this.proxyOf.nodes) return void 0;
6818
+ return this.proxyOf.nodes[0];
6819
+ }
6820
+ get last() {
6821
+ if (!this.proxyOf.nodes) return void 0;
6822
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6823
+ }
6782
6824
  append(...children) {
6783
6825
  for (let child of children) {
6784
6826
  let nodes = this.normalize(child, this.last);
@@ -7091,14 +7133,6 @@ function requireContainer() {
7091
7133
  }
7092
7134
  });
7093
7135
  }
7094
- get first() {
7095
- if (!this.proxyOf.nodes) return void 0;
7096
- return this.proxyOf.nodes[0];
7097
- }
7098
- get last() {
7099
- if (!this.proxyOf.nodes) return void 0;
7100
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
7101
- }
7102
7136
  }
7103
7137
  Container.registerParse = (dependant) => {
7104
7138
  parse = dependant;
@@ -7348,10 +7382,25 @@ function requireInput() {
7348
7382
  let CssSyntaxError = requireCssSyntaxError();
7349
7383
  let PreviousMap = requirePreviousMap();
7350
7384
  let terminalHighlight = require$$2;
7351
- let fromOffsetCache = Symbol("fromOffsetCache");
7385
+ let lineToIndexCache = Symbol("lineToIndexCache");
7352
7386
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
7353
7387
  let pathAvailable = Boolean(resolve && isAbsolute);
7388
+ function getLineToIndex(input2) {
7389
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
7390
+ let lines = input2.css.split("\n");
7391
+ let lineToIndex = new Array(lines.length);
7392
+ let prevIndex = 0;
7393
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
7394
+ lineToIndex[i2] = prevIndex;
7395
+ prevIndex += lines[i2].length + 1;
7396
+ }
7397
+ input2[lineToIndexCache] = lineToIndex;
7398
+ return lineToIndex;
7399
+ }
7354
7400
  class Input {
7401
+ get from() {
7402
+ return this.file || this.id;
7403
+ }
7355
7404
  constructor(css, opts = {}) {
7356
7405
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
7357
7406
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -7386,30 +7435,37 @@ function requireInput() {
7386
7435
  if (this.map) this.map.file = this.from;
7387
7436
  }
7388
7437
  error(message, line, column, opts = {}) {
7389
- let endColumn, endLine, result2;
7438
+ let endColumn, endLine, endOffset, offset, result2;
7390
7439
  if (line && typeof line === "object") {
7391
7440
  let start = line;
7392
7441
  let end = column;
7393
7442
  if (typeof start.offset === "number") {
7394
- let pos = this.fromOffset(start.offset);
7443
+ offset = start.offset;
7444
+ let pos = this.fromOffset(offset);
7395
7445
  line = pos.line;
7396
7446
  column = pos.col;
7397
7447
  } else {
7398
7448
  line = start.line;
7399
7449
  column = start.column;
7450
+ offset = this.fromLineAndColumn(line, column);
7400
7451
  }
7401
7452
  if (typeof end.offset === "number") {
7402
- let pos = this.fromOffset(end.offset);
7453
+ endOffset = end.offset;
7454
+ let pos = this.fromOffset(endOffset);
7403
7455
  endLine = pos.line;
7404
7456
  endColumn = pos.col;
7405
7457
  } else {
7406
7458
  endLine = end.line;
7407
7459
  endColumn = end.column;
7460
+ endOffset = this.fromLineAndColumn(end.line, end.column);
7408
7461
  }
7409
7462
  } else if (!column) {
7410
- let pos = this.fromOffset(line);
7463
+ offset = line;
7464
+ let pos = this.fromOffset(offset);
7411
7465
  line = pos.line;
7412
7466
  column = pos.col;
7467
+ } else {
7468
+ offset = this.fromLineAndColumn(line, column);
7413
7469
  }
7414
7470
  let origin = this.origin(line, column, endLine, endColumn);
7415
7471
  if (origin) {
@@ -7431,7 +7487,7 @@ function requireInput() {
7431
7487
  opts.plugin
7432
7488
  );
7433
7489
  }
7434
- result2.input = { column, endColumn, endLine, line, source: this.css };
7490
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
7435
7491
  if (this.file) {
7436
7492
  if (pathToFileURL) {
7437
7493
  result2.input.url = pathToFileURL(this.file).toString();
@@ -7440,21 +7496,14 @@ function requireInput() {
7440
7496
  }
7441
7497
  return result2;
7442
7498
  }
7499
+ fromLineAndColumn(line, column) {
7500
+ let lineToIndex = getLineToIndex(this);
7501
+ let index2 = lineToIndex[line - 1];
7502
+ return index2 + column - 1;
7503
+ }
7443
7504
  fromOffset(offset) {
7444
- let lastLine, lineToIndex;
7445
- if (!this[fromOffsetCache]) {
7446
- let lines = this.css.split("\n");
7447
- lineToIndex = new Array(lines.length);
7448
- let prevIndex = 0;
7449
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
7450
- lineToIndex[i2] = prevIndex;
7451
- prevIndex += lines[i2].length + 1;
7452
- }
7453
- this[fromOffsetCache] = lineToIndex;
7454
- } else {
7455
- lineToIndex = this[fromOffsetCache];
7456
- }
7457
- lastLine = lineToIndex[lineToIndex.length - 1];
7505
+ let lineToIndex = getLineToIndex(this);
7506
+ let lastLine = lineToIndex[lineToIndex.length - 1];
7458
7507
  let min = 0;
7459
7508
  if (offset >= lastLine) {
7460
7509
  min = lineToIndex.length - 1;
@@ -7535,9 +7584,6 @@ function requireInput() {
7535
7584
  }
7536
7585
  return json;
7537
7586
  }
7538
- get from() {
7539
- return this.file || this.id;
7540
- }
7541
7587
  }
7542
7588
  input = Input;
7543
7589
  Input.default = Input;
@@ -7663,11 +7709,6 @@ function requireRule() {
7663
7709
  let Container = requireContainer();
7664
7710
  let list = requireList();
7665
7711
  class Rule extends Container {
7666
- constructor(defaults) {
7667
- super(defaults);
7668
- this.type = "rule";
7669
- if (!this.nodes) this.nodes = [];
7670
- }
7671
7712
  get selectors() {
7672
7713
  return list.comma(this.selector);
7673
7714
  }
@@ -7676,6 +7717,11 @@ function requireRule() {
7676
7717
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
7677
7718
  this.selector = values.join(sep);
7678
7719
  }
7720
+ constructor(defaults) {
7721
+ super(defaults);
7722
+ this.type = "rule";
7723
+ if (!this.nodes) this.nodes = [];
7724
+ }
7679
7725
  }
7680
7726
  rule = Rule;
7681
7727
  Rule.default = Rule;
@@ -8574,6 +8620,8 @@ function requireParser() {
8574
8620
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
8575
8621
  prev.raws.ownSemicolon = this.spaces;
8576
8622
  this.spaces = "";
8623
+ prev.source.end = this.getPosition(token[2]);
8624
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
8577
8625
  }
8578
8626
  }
8579
8627
  }
@@ -8785,7 +8833,7 @@ function requireParser() {
8785
8833
  }
8786
8834
  unknownWord(tokens) {
8787
8835
  throw this.input.error(
8788
- "Unknown word",
8836
+ "Unknown word " + tokens[0][1],
8789
8837
  { offset: tokens[0][2] },
8790
8838
  { offset: tokens[0][2] + tokens[0][1].length }
8791
8839
  );
@@ -8878,12 +8926,15 @@ function requireResult() {
8878
8926
  hasRequiredResult = 1;
8879
8927
  let Warning = requireWarning();
8880
8928
  class Result {
8929
+ get content() {
8930
+ return this.css;
8931
+ }
8881
8932
  constructor(processor2, root2, opts) {
8882
8933
  this.processor = processor2;
8883
8934
  this.messages = [];
8884
8935
  this.root = root2;
8885
8936
  this.opts = opts;
8886
- this.css = void 0;
8937
+ this.css = "";
8887
8938
  this.map = void 0;
8888
8939
  }
8889
8940
  toString() {
@@ -8902,9 +8953,6 @@ function requireResult() {
8902
8953
  warnings() {
8903
8954
  return this.messages.filter((i2) => i2.type === "warning");
8904
8955
  }
8905
- get content() {
8906
- return this.css;
8907
- }
8908
8956
  }
8909
8957
  result = Result;
8910
8958
  Result.default = Result;
@@ -9023,6 +9071,30 @@ function requireLazyResult() {
9023
9071
  }
9024
9072
  let postcss2 = {};
9025
9073
  class LazyResult {
9074
+ get content() {
9075
+ return this.stringify().content;
9076
+ }
9077
+ get css() {
9078
+ return this.stringify().css;
9079
+ }
9080
+ get map() {
9081
+ return this.stringify().map;
9082
+ }
9083
+ get messages() {
9084
+ return this.sync().messages;
9085
+ }
9086
+ get opts() {
9087
+ return this.result.opts;
9088
+ }
9089
+ get processor() {
9090
+ return this.result.processor;
9091
+ }
9092
+ get root() {
9093
+ return this.sync().root;
9094
+ }
9095
+ get [Symbol.toStringTag]() {
9096
+ return "LazyResult";
9097
+ }
9026
9098
  constructor(processor2, css, opts) {
9027
9099
  this.stringified = false;
9028
9100
  this.processed = false;
@@ -9365,30 +9437,6 @@ function requireLazyResult() {
9365
9437
  warnings() {
9366
9438
  return this.sync().warnings();
9367
9439
  }
9368
- get content() {
9369
- return this.stringify().content;
9370
- }
9371
- get css() {
9372
- return this.stringify().css;
9373
- }
9374
- get map() {
9375
- return this.stringify().map;
9376
- }
9377
- get messages() {
9378
- return this.sync().messages;
9379
- }
9380
- get opts() {
9381
- return this.result.opts;
9382
- }
9383
- get processor() {
9384
- return this.result.processor;
9385
- }
9386
- get root() {
9387
- return this.sync().root;
9388
- }
9389
- get [Symbol.toStringTag]() {
9390
- return "LazyResult";
9391
- }
9392
9440
  }
9393
9441
  LazyResult.registerPostcss = (dependant) => {
9394
9442
  postcss2 = dependant;
@@ -9410,6 +9458,45 @@ function requireNoWorkResult() {
9410
9458
  let stringify = requireStringify();
9411
9459
  let warnOnce2 = requireWarnOnce();
9412
9460
  class NoWorkResult {
9461
+ get content() {
9462
+ return this.result.css;
9463
+ }
9464
+ get css() {
9465
+ return this.result.css;
9466
+ }
9467
+ get map() {
9468
+ return this.result.map;
9469
+ }
9470
+ get messages() {
9471
+ return [];
9472
+ }
9473
+ get opts() {
9474
+ return this.result.opts;
9475
+ }
9476
+ get processor() {
9477
+ return this.result.processor;
9478
+ }
9479
+ get root() {
9480
+ if (this._root) {
9481
+ return this._root;
9482
+ }
9483
+ let root2;
9484
+ let parser2 = parse;
9485
+ try {
9486
+ root2 = parser2(this._css, this._opts);
9487
+ } catch (error) {
9488
+ this.error = error;
9489
+ }
9490
+ if (this.error) {
9491
+ throw this.error;
9492
+ } else {
9493
+ this._root = root2;
9494
+ return root2;
9495
+ }
9496
+ }
9497
+ get [Symbol.toStringTag]() {
9498
+ return "NoWorkResult";
9499
+ }
9413
9500
  constructor(processor2, css, opts) {
9414
9501
  css = css.toString();
9415
9502
  this.stringified = false;
@@ -9471,45 +9558,6 @@ function requireNoWorkResult() {
9471
9558
  warnings() {
9472
9559
  return [];
9473
9560
  }
9474
- get content() {
9475
- return this.result.css;
9476
- }
9477
- get css() {
9478
- return this.result.css;
9479
- }
9480
- get map() {
9481
- return this.result.map;
9482
- }
9483
- get messages() {
9484
- return [];
9485
- }
9486
- get opts() {
9487
- return this.result.opts;
9488
- }
9489
- get processor() {
9490
- return this.result.processor;
9491
- }
9492
- get root() {
9493
- if (this._root) {
9494
- return this._root;
9495
- }
9496
- let root2;
9497
- let parser2 = parse;
9498
- try {
9499
- root2 = parser2(this._css, this._opts);
9500
- } catch (error) {
9501
- this.error = error;
9502
- }
9503
- if (this.error) {
9504
- throw this.error;
9505
- } else {
9506
- this._root = root2;
9507
- return root2;
9508
- }
9509
- }
9510
- get [Symbol.toStringTag]() {
9511
- return "NoWorkResult";
9512
- }
9513
9561
  }
9514
9562
  noWorkResult = NoWorkResult;
9515
9563
  NoWorkResult.default = NoWorkResult;
@@ -9526,7 +9574,7 @@ function requireProcessor() {
9526
9574
  let Root = requireRoot();
9527
9575
  class Processor {
9528
9576
  constructor(plugins = []) {
9529
- this.version = "8.5.1";
9577
+ this.version = "8.5.6";
9530
9578
  this.plugins = this.normalize(plugins);
9531
9579
  }
9532
9580
  normalize(plugins) {
@@ -10495,7 +10543,6 @@ function diffAfterUpdatingChildren(oldTree, newTree, replayer) {
10495
10543
  );
10496
10544
  break;
10497
10545
  }
10498
- // Props of style elements have to be updated after all children are updated. Otherwise the props can be overwritten by textContent.
10499
10546
  case "STYLE": {
10500
10547
  const styleSheet = oldElement.sheet;
10501
10548
  styleSheet && newTree.rules.forEach(
@@ -10922,7 +10969,6 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10922
10969
  case NodeType$2.COMMENT_NODE:
10923
10970
  rrNode = rrdom.createComment(node2.textContent || "");
10924
10971
  break;
10925
- // if node is a shadow root
10926
10972
  case NodeType$2.DOCUMENT_FRAGMENT_NODE:
10927
10973
  rrNode = parentRRNode.attachShadow({ mode: "open" });
10928
10974
  break;
@@ -13074,7 +13120,11 @@ function initFontObserver({ fontCb, doc }) {
13074
13120
  const fontMap = /* @__PURE__ */ new WeakMap();
13075
13121
  const originalFontFace = win.FontFace;
13076
13122
  win.FontFace = function FontFace2(family, source, descriptors) {
13077
- const fontFace = new originalFontFace(family, source, descriptors);
13123
+ const fontFace = new originalFontFace(
13124
+ family,
13125
+ source,
13126
+ descriptors
13127
+ );
13078
13128
  fontMap.set(fontFace, {
13079
13129
  family,
13080
13130
  buffer: typeof source !== "string",
@@ -13436,13 +13486,18 @@ class IframeManager {
13436
13486
  removeLoadListener() {
13437
13487
  this.loadListener = void 0;
13438
13488
  }
13489
+ trackIframeContent(iframeEl, content) {
13490
+ const iframeId = this.mirror.getId(iframeEl);
13491
+ this.attachedIframes.set(iframeId, { element: iframeEl, content });
13492
+ return iframeId;
13493
+ }
13439
13494
  attachIframe(iframeEl, childSn) {
13440
13495
  var _a2;
13441
- this.attachedIframes.set(iframeEl, childSn);
13496
+ const iframeId = this.trackIframeContent(iframeEl, childSn);
13442
13497
  this.mutationCb({
13443
13498
  adds: [
13444
13499
  {
13445
- parentId: this.mirror.getId(iframeEl),
13500
+ parentId: iframeId,
13446
13501
  nextId: null,
13447
13502
  node: childSn
13448
13503
  }
@@ -13494,7 +13549,7 @@ class IframeManager {
13494
13549
  const rootId = e2.data.node.id;
13495
13550
  this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
13496
13551
  this.patchRootIdOnNode(e2.data.node, rootId);
13497
- this.attachedIframes.set(iframeEl, e2.data.node);
13552
+ this.trackIframeContent(iframeEl, e2.data.node);
13498
13553
  return {
13499
13554
  timestamp: e2.timestamp,
13500
13555
  type: EventType.IncrementalSnapshot,
@@ -13637,21 +13692,27 @@ class IframeManager {
13637
13692
  });
13638
13693
  }
13639
13694
  }
13695
+ removeIframeById(iframeId) {
13696
+ const entry = this.attachedIframes.get(iframeId);
13697
+ if (!entry) return;
13698
+ const win = entry.element.contentWindow;
13699
+ if (win && this.nestedIframeListeners.has(win)) {
13700
+ const handler = this.nestedIframeListeners.get(win);
13701
+ win.removeEventListener("message", handler);
13702
+ this.nestedIframeListeners.delete(win);
13703
+ }
13704
+ this.attachedIframes.delete(iframeId);
13705
+ }
13640
13706
  reattachIframes() {
13641
- this.attachedIframes.forEach((content, iframe) => {
13642
- if (!iframe.isConnected) {
13643
- this.attachedIframes.delete(iframe);
13644
- return;
13645
- }
13646
- const parentId = this.mirror.getId(iframe);
13647
- if (parentId === -1) {
13648
- this.attachedIframes.delete(iframe);
13707
+ this.attachedIframes.forEach(({ content }, iframeId) => {
13708
+ if (!this.mirror.has(iframeId)) {
13709
+ this.attachedIframes.delete(iframeId);
13649
13710
  return;
13650
13711
  }
13651
13712
  this.mutationCb({
13652
13713
  adds: [
13653
13714
  {
13654
- parentId,
13715
+ parentId: iframeId,
13655
13716
  nextId: null,
13656
13717
  node: content
13657
13718
  }
@@ -14623,6 +14684,11 @@ function record(options = {}) {
14623
14684
  }
14624
14685
  };
14625
14686
  const wrappedMutationEmit = (m) => {
14687
+ if (recordCrossOriginIframes && m.removes) {
14688
+ m.removes.forEach(({ id }) => {
14689
+ iframeManager.removeIframeById(id);
14690
+ });
14691
+ }
14626
14692
  wrappedEmit({
14627
14693
  type: EventType.IncrementalSnapshot,
14628
14694
  data: __spreadValues({
@@ -17880,7 +17946,7 @@ exports.freezePage = freezePage;
17880
17946
  exports.record = record;
17881
17947
  exports.takeFullSnapshot = takeFullSnapshot;
17882
17948
  exports.utils = utils;
17883
- if (typeof module.exports == "object" && typeof exports == "object") {
17949
+ ;if (typeof module.exports == "object" && typeof exports == "object") {
17884
17950
  var __cp = (to, from, except, desc) => {
17885
17951
  if ((from && typeof from === "object") || typeof from === "function") {
17886
17952
  for (let key of Object.getOwnPropertyNames(from)) {