@posthog/rrweb-record 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;
@@ -1477,7 +1465,7 @@ function getDefaultExportFromCjs$1(x) {
1477
1465
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1478
1466
  }
1479
1467
  function getAugmentedNamespace$1(n2) {
1480
- if (n2.__esModule) return n2;
1468
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
1481
1469
  var f2 = n2.default;
1482
1470
  if (typeof f2 == "function") {
1483
1471
  var a2 = function a3() {
@@ -1996,6 +1984,9 @@ function requireNode$1() {
1996
1984
  return offset;
1997
1985
  }
1998
1986
  class Node2 {
1987
+ get proxyOf() {
1988
+ return this;
1989
+ }
1999
1990
  constructor(defaults = {}) {
2000
1991
  this.raws = {};
2001
1992
  this[isClean] = false;
@@ -2114,7 +2105,7 @@ function requireNode$1() {
2114
2105
  let index2 = this.parent.index(this);
2115
2106
  return this.parent.nodes[index2 + 1];
2116
2107
  }
2117
- positionBy(opts) {
2108
+ positionBy(opts = {}) {
2118
2109
  let pos = this.source.start;
2119
2110
  if (opts.index) {
2120
2111
  pos = this.positionInside(opts.index);
@@ -2143,27 +2134,38 @@ function requireNode$1() {
2143
2134
  column += 1;
2144
2135
  }
2145
2136
  }
2146
- return { column, line };
2137
+ return { column, line, offset: end };
2147
2138
  }
2148
2139
  prev() {
2149
2140
  if (!this.parent) return void 0;
2150
2141
  let index2 = this.parent.index(this);
2151
2142
  return this.parent.nodes[index2 - 1];
2152
2143
  }
2153
- rangeBy(opts) {
2144
+ rangeBy(opts = {}) {
2145
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2154
2146
  let start = {
2155
2147
  column: this.source.start.column,
2156
- line: this.source.start.line
2148
+ line: this.source.start.line,
2149
+ offset: sourceOffset(inputString, this.source.start)
2157
2150
  };
2158
2151
  let end = this.source.end ? {
2159
2152
  column: this.source.end.column + 1,
2160
- line: this.source.end.line
2153
+ line: this.source.end.line,
2154
+ offset: typeof this.source.end.offset === "number" ? (
2155
+ // `source.end.offset` is exclusive, so we don't need to add 1
2156
+ this.source.end.offset
2157
+ ) : (
2158
+ // Since line/column in this.source.end is inclusive,
2159
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
2160
+ // So, we add 1 to convert it to exclusive.
2161
+ sourceOffset(inputString, this.source.end) + 1
2162
+ )
2161
2163
  } : {
2162
2164
  column: start.column + 1,
2163
- line: start.line
2165
+ line: start.line,
2166
+ offset: start.offset + 1
2164
2167
  };
2165
2168
  if (opts.word) {
2166
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2167
2169
  let stringRepresentation = inputString.slice(
2168
2170
  sourceOffset(inputString, this.source.start),
2169
2171
  sourceOffset(inputString, this.source.end)
@@ -2171,15 +2173,14 @@ function requireNode$1() {
2171
2173
  let index2 = stringRepresentation.indexOf(opts.word);
2172
2174
  if (index2 !== -1) {
2173
2175
  start = this.positionInside(index2);
2174
- end = this.positionInside(
2175
- index2 + opts.word.length
2176
- );
2176
+ end = this.positionInside(index2 + opts.word.length);
2177
2177
  }
2178
2178
  } else {
2179
2179
  if (opts.start) {
2180
2180
  start = {
2181
2181
  column: opts.start.column,
2182
- line: opts.start.line
2182
+ line: opts.start.line,
2183
+ offset: sourceOffset(inputString, opts.start)
2183
2184
  };
2184
2185
  } else if (opts.index) {
2185
2186
  start = this.positionInside(opts.index);
@@ -2187,7 +2188,8 @@ function requireNode$1() {
2187
2188
  if (opts.end) {
2188
2189
  end = {
2189
2190
  column: opts.end.column,
2190
- line: opts.end.line
2191
+ line: opts.end.line,
2192
+ offset: sourceOffset(inputString, opts.end)
2191
2193
  };
2192
2194
  } else if (typeof opts.endIndex === "number") {
2193
2195
  end = this.positionInside(opts.endIndex);
@@ -2196,7 +2198,11 @@ function requireNode$1() {
2196
2198
  }
2197
2199
  }
2198
2200
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
2199
- end = { column: start.column + 1, line: start.line };
2201
+ end = {
2202
+ column: start.column + 1,
2203
+ line: start.line,
2204
+ offset: start.offset + 1
2205
+ };
2200
2206
  }
2201
2207
  return { end, start };
2202
2208
  }
@@ -2260,6 +2266,7 @@ function requireNode$1() {
2260
2266
  } else if (typeof value === "object" && value.toJSON) {
2261
2267
  fixed[name] = value.toJSON(null, inputs);
2262
2268
  } else if (name === "source") {
2269
+ if (value == null) continue;
2263
2270
  let inputId = inputs.get(value.input);
2264
2271
  if (inputId == null) {
2265
2272
  inputId = inputsNextIndex;
@@ -2294,14 +2301,11 @@ function requireNode$1() {
2294
2301
  });
2295
2302
  return result2;
2296
2303
  }
2297
- warn(result2, text, opts) {
2304
+ warn(result2, text, opts = {}) {
2298
2305
  let data = { node: this };
2299
2306
  for (let i2 in opts) data[i2] = opts[i2];
2300
2307
  return result2.warn(text, data);
2301
2308
  }
2302
- get proxyOf() {
2303
- return this;
2304
- }
2305
2309
  }
2306
2310
  node$1 = Node2;
2307
2311
  Node2.default = Node2;
@@ -2330,6 +2334,9 @@ function requireDeclaration$1() {
2330
2334
  hasRequiredDeclaration$1 = 1;
2331
2335
  let Node2 = requireNode$1();
2332
2336
  class Declaration extends Node2 {
2337
+ get variable() {
2338
+ return this.prop.startsWith("--") || this.prop[0] === "$";
2339
+ }
2333
2340
  constructor(defaults) {
2334
2341
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2335
2342
  defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
@@ -2337,9 +2344,6 @@ function requireDeclaration$1() {
2337
2344
  super(defaults);
2338
2345
  this.type = "decl";
2339
2346
  }
2340
- get variable() {
2341
- return this.prop.startsWith("--") || this.prop[0] === "$";
2342
- }
2343
2347
  }
2344
2348
  declaration$1 = Declaration;
2345
2349
  Declaration.default = Declaration;
@@ -2371,6 +2375,14 @@ function requireContainer$1() {
2371
2375
  }
2372
2376
  }
2373
2377
  class Container extends Node2 {
2378
+ get first() {
2379
+ if (!this.proxyOf.nodes) return void 0;
2380
+ return this.proxyOf.nodes[0];
2381
+ }
2382
+ get last() {
2383
+ if (!this.proxyOf.nodes) return void 0;
2384
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
2385
+ }
2374
2386
  append(...children) {
2375
2387
  for (let child of children) {
2376
2388
  let nodes = this.normalize(child, this.last);
@@ -2683,14 +2695,6 @@ function requireContainer$1() {
2683
2695
  }
2684
2696
  });
2685
2697
  }
2686
- get first() {
2687
- if (!this.proxyOf.nodes) return void 0;
2688
- return this.proxyOf.nodes[0];
2689
- }
2690
- get last() {
2691
- if (!this.proxyOf.nodes) return void 0;
2692
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
2693
- }
2694
2698
  }
2695
2699
  Container.registerParse = (dependant) => {
2696
2700
  parse = dependant;
@@ -2940,10 +2944,25 @@ function requireInput$1() {
2940
2944
  let CssSyntaxError = requireCssSyntaxError$1();
2941
2945
  let PreviousMap = requirePreviousMap$1();
2942
2946
  let terminalHighlight = require$$2$1;
2943
- let fromOffsetCache = Symbol("fromOffsetCache");
2947
+ let lineToIndexCache = Symbol("lineToIndexCache");
2944
2948
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
2945
2949
  let pathAvailable = Boolean(resolve && isAbsolute);
2950
+ function getLineToIndex(input2) {
2951
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
2952
+ let lines = input2.css.split("\n");
2953
+ let lineToIndex = new Array(lines.length);
2954
+ let prevIndex = 0;
2955
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2956
+ lineToIndex[i2] = prevIndex;
2957
+ prevIndex += lines[i2].length + 1;
2958
+ }
2959
+ input2[lineToIndexCache] = lineToIndex;
2960
+ return lineToIndex;
2961
+ }
2946
2962
  class Input {
2963
+ get from() {
2964
+ return this.file || this.id;
2965
+ }
2947
2966
  constructor(css, opts = {}) {
2948
2967
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
2949
2968
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -2978,30 +2997,37 @@ function requireInput$1() {
2978
2997
  if (this.map) this.map.file = this.from;
2979
2998
  }
2980
2999
  error(message, line, column, opts = {}) {
2981
- let endColumn, endLine, result2;
3000
+ let endColumn, endLine, endOffset, offset, result2;
2982
3001
  if (line && typeof line === "object") {
2983
3002
  let start = line;
2984
3003
  let end = column;
2985
3004
  if (typeof start.offset === "number") {
2986
- let pos = this.fromOffset(start.offset);
3005
+ offset = start.offset;
3006
+ let pos = this.fromOffset(offset);
2987
3007
  line = pos.line;
2988
3008
  column = pos.col;
2989
3009
  } else {
2990
3010
  line = start.line;
2991
3011
  column = start.column;
3012
+ offset = this.fromLineAndColumn(line, column);
2992
3013
  }
2993
3014
  if (typeof end.offset === "number") {
2994
- let pos = this.fromOffset(end.offset);
3015
+ endOffset = end.offset;
3016
+ let pos = this.fromOffset(endOffset);
2995
3017
  endLine = pos.line;
2996
3018
  endColumn = pos.col;
2997
3019
  } else {
2998
3020
  endLine = end.line;
2999
3021
  endColumn = end.column;
3022
+ endOffset = this.fromLineAndColumn(end.line, end.column);
3000
3023
  }
3001
3024
  } else if (!column) {
3002
- let pos = this.fromOffset(line);
3025
+ offset = line;
3026
+ let pos = this.fromOffset(offset);
3003
3027
  line = pos.line;
3004
3028
  column = pos.col;
3029
+ } else {
3030
+ offset = this.fromLineAndColumn(line, column);
3005
3031
  }
3006
3032
  let origin = this.origin(line, column, endLine, endColumn);
3007
3033
  if (origin) {
@@ -3023,7 +3049,7 @@ function requireInput$1() {
3023
3049
  opts.plugin
3024
3050
  );
3025
3051
  }
3026
- result2.input = { column, endColumn, endLine, line, source: this.css };
3052
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
3027
3053
  if (this.file) {
3028
3054
  if (pathToFileURL) {
3029
3055
  result2.input.url = pathToFileURL(this.file).toString();
@@ -3032,21 +3058,14 @@ function requireInput$1() {
3032
3058
  }
3033
3059
  return result2;
3034
3060
  }
3061
+ fromLineAndColumn(line, column) {
3062
+ let lineToIndex = getLineToIndex(this);
3063
+ let index2 = lineToIndex[line - 1];
3064
+ return index2 + column - 1;
3065
+ }
3035
3066
  fromOffset(offset) {
3036
- let lastLine, lineToIndex;
3037
- if (!this[fromOffsetCache]) {
3038
- let lines = this.css.split("\n");
3039
- lineToIndex = new Array(lines.length);
3040
- let prevIndex = 0;
3041
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
3042
- lineToIndex[i2] = prevIndex;
3043
- prevIndex += lines[i2].length + 1;
3044
- }
3045
- this[fromOffsetCache] = lineToIndex;
3046
- } else {
3047
- lineToIndex = this[fromOffsetCache];
3048
- }
3049
- lastLine = lineToIndex[lineToIndex.length - 1];
3067
+ let lineToIndex = getLineToIndex(this);
3068
+ let lastLine = lineToIndex[lineToIndex.length - 1];
3050
3069
  let min = 0;
3051
3070
  if (offset >= lastLine) {
3052
3071
  min = lineToIndex.length - 1;
@@ -3127,9 +3146,6 @@ function requireInput$1() {
3127
3146
  }
3128
3147
  return json;
3129
3148
  }
3130
- get from() {
3131
- return this.file || this.id;
3132
- }
3133
3149
  }
3134
3150
  input$1 = Input;
3135
3151
  Input.default = Input;
@@ -3255,11 +3271,6 @@ function requireRule$1() {
3255
3271
  let Container = requireContainer$1();
3256
3272
  let list = requireList$1();
3257
3273
  class Rule extends Container {
3258
- constructor(defaults) {
3259
- super(defaults);
3260
- this.type = "rule";
3261
- if (!this.nodes) this.nodes = [];
3262
- }
3263
3274
  get selectors() {
3264
3275
  return list.comma(this.selector);
3265
3276
  }
@@ -3268,6 +3279,11 @@ function requireRule$1() {
3268
3279
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
3269
3280
  this.selector = values.join(sep);
3270
3281
  }
3282
+ constructor(defaults) {
3283
+ super(defaults);
3284
+ this.type = "rule";
3285
+ if (!this.nodes) this.nodes = [];
3286
+ }
3271
3287
  }
3272
3288
  rule$1 = Rule;
3273
3289
  Rule.default = Rule;
@@ -4166,6 +4182,8 @@ function requireParser$1() {
4166
4182
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
4167
4183
  prev.raws.ownSemicolon = this.spaces;
4168
4184
  this.spaces = "";
4185
+ prev.source.end = this.getPosition(token[2]);
4186
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
4169
4187
  }
4170
4188
  }
4171
4189
  }
@@ -4377,7 +4395,7 @@ function requireParser$1() {
4377
4395
  }
4378
4396
  unknownWord(tokens) {
4379
4397
  throw this.input.error(
4380
- "Unknown word",
4398
+ "Unknown word " + tokens[0][1],
4381
4399
  { offset: tokens[0][2] },
4382
4400
  { offset: tokens[0][2] + tokens[0][1].length }
4383
4401
  );
@@ -4470,12 +4488,15 @@ function requireResult$1() {
4470
4488
  hasRequiredResult$1 = 1;
4471
4489
  let Warning = requireWarning$1();
4472
4490
  class Result {
4491
+ get content() {
4492
+ return this.css;
4493
+ }
4473
4494
  constructor(processor2, root2, opts) {
4474
4495
  this.processor = processor2;
4475
4496
  this.messages = [];
4476
4497
  this.root = root2;
4477
4498
  this.opts = opts;
4478
- this.css = void 0;
4499
+ this.css = "";
4479
4500
  this.map = void 0;
4480
4501
  }
4481
4502
  toString() {
@@ -4494,9 +4515,6 @@ function requireResult$1() {
4494
4515
  warnings() {
4495
4516
  return this.messages.filter((i2) => i2.type === "warning");
4496
4517
  }
4497
- get content() {
4498
- return this.css;
4499
- }
4500
4518
  }
4501
4519
  result$1 = Result;
4502
4520
  Result.default = Result;
@@ -4615,6 +4633,30 @@ function requireLazyResult$1() {
4615
4633
  }
4616
4634
  let postcss2 = {};
4617
4635
  class LazyResult {
4636
+ get content() {
4637
+ return this.stringify().content;
4638
+ }
4639
+ get css() {
4640
+ return this.stringify().css;
4641
+ }
4642
+ get map() {
4643
+ return this.stringify().map;
4644
+ }
4645
+ get messages() {
4646
+ return this.sync().messages;
4647
+ }
4648
+ get opts() {
4649
+ return this.result.opts;
4650
+ }
4651
+ get processor() {
4652
+ return this.result.processor;
4653
+ }
4654
+ get root() {
4655
+ return this.sync().root;
4656
+ }
4657
+ get [Symbol.toStringTag]() {
4658
+ return "LazyResult";
4659
+ }
4618
4660
  constructor(processor2, css, opts) {
4619
4661
  this.stringified = false;
4620
4662
  this.processed = false;
@@ -4957,30 +4999,6 @@ function requireLazyResult$1() {
4957
4999
  warnings() {
4958
5000
  return this.sync().warnings();
4959
5001
  }
4960
- get content() {
4961
- return this.stringify().content;
4962
- }
4963
- get css() {
4964
- return this.stringify().css;
4965
- }
4966
- get map() {
4967
- return this.stringify().map;
4968
- }
4969
- get messages() {
4970
- return this.sync().messages;
4971
- }
4972
- get opts() {
4973
- return this.result.opts;
4974
- }
4975
- get processor() {
4976
- return this.result.processor;
4977
- }
4978
- get root() {
4979
- return this.sync().root;
4980
- }
4981
- get [Symbol.toStringTag]() {
4982
- return "LazyResult";
4983
- }
4984
5002
  }
4985
5003
  LazyResult.registerPostcss = (dependant) => {
4986
5004
  postcss2 = dependant;
@@ -5002,6 +5020,45 @@ function requireNoWorkResult$1() {
5002
5020
  let stringify = requireStringify$1();
5003
5021
  let warnOnce2 = requireWarnOnce$1();
5004
5022
  class NoWorkResult {
5023
+ get content() {
5024
+ return this.result.css;
5025
+ }
5026
+ get css() {
5027
+ return this.result.css;
5028
+ }
5029
+ get map() {
5030
+ return this.result.map;
5031
+ }
5032
+ get messages() {
5033
+ return [];
5034
+ }
5035
+ get opts() {
5036
+ return this.result.opts;
5037
+ }
5038
+ get processor() {
5039
+ return this.result.processor;
5040
+ }
5041
+ get root() {
5042
+ if (this._root) {
5043
+ return this._root;
5044
+ }
5045
+ let root2;
5046
+ let parser2 = parse;
5047
+ try {
5048
+ root2 = parser2(this._css, this._opts);
5049
+ } catch (error) {
5050
+ this.error = error;
5051
+ }
5052
+ if (this.error) {
5053
+ throw this.error;
5054
+ } else {
5055
+ this._root = root2;
5056
+ return root2;
5057
+ }
5058
+ }
5059
+ get [Symbol.toStringTag]() {
5060
+ return "NoWorkResult";
5061
+ }
5005
5062
  constructor(processor2, css, opts) {
5006
5063
  css = css.toString();
5007
5064
  this.stringified = false;
@@ -5063,45 +5120,6 @@ function requireNoWorkResult$1() {
5063
5120
  warnings() {
5064
5121
  return [];
5065
5122
  }
5066
- get content() {
5067
- return this.result.css;
5068
- }
5069
- get css() {
5070
- return this.result.css;
5071
- }
5072
- get map() {
5073
- return this.result.map;
5074
- }
5075
- get messages() {
5076
- return [];
5077
- }
5078
- get opts() {
5079
- return this.result.opts;
5080
- }
5081
- get processor() {
5082
- return this.result.processor;
5083
- }
5084
- get root() {
5085
- if (this._root) {
5086
- return this._root;
5087
- }
5088
- let root2;
5089
- let parser2 = parse;
5090
- try {
5091
- root2 = parser2(this._css, this._opts);
5092
- } catch (error) {
5093
- this.error = error;
5094
- }
5095
- if (this.error) {
5096
- throw this.error;
5097
- } else {
5098
- this._root = root2;
5099
- return root2;
5100
- }
5101
- }
5102
- get [Symbol.toStringTag]() {
5103
- return "NoWorkResult";
5104
- }
5105
5123
  }
5106
5124
  noWorkResult$1 = NoWorkResult;
5107
5125
  NoWorkResult.default = NoWorkResult;
@@ -5118,7 +5136,7 @@ function requireProcessor$1() {
5118
5136
  let Root = requireRoot$1();
5119
5137
  class Processor {
5120
5138
  constructor(plugins = []) {
5121
- this.version = "8.5.1";
5139
+ this.version = "8.5.6";
5122
5140
  this.plugins = this.normalize(plugins);
5123
5141
  }
5124
5142
  normalize(plugins) {
@@ -5391,7 +5409,7 @@ function getDefaultExportFromCjs(x) {
5391
5409
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5392
5410
  }
5393
5411
  function getAugmentedNamespace(n2) {
5394
- if (n2.__esModule) return n2;
5412
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
5395
5413
  var f2 = n2.default;
5396
5414
  if (typeof f2 == "function") {
5397
5415
  var a2 = function a3() {
@@ -5910,6 +5928,9 @@ function requireNode() {
5910
5928
  return offset;
5911
5929
  }
5912
5930
  class Node2 {
5931
+ get proxyOf() {
5932
+ return this;
5933
+ }
5913
5934
  constructor(defaults = {}) {
5914
5935
  this.raws = {};
5915
5936
  this[isClean] = false;
@@ -6028,7 +6049,7 @@ function requireNode() {
6028
6049
  let index2 = this.parent.index(this);
6029
6050
  return this.parent.nodes[index2 + 1];
6030
6051
  }
6031
- positionBy(opts) {
6052
+ positionBy(opts = {}) {
6032
6053
  let pos = this.source.start;
6033
6054
  if (opts.index) {
6034
6055
  pos = this.positionInside(opts.index);
@@ -6057,27 +6078,38 @@ function requireNode() {
6057
6078
  column += 1;
6058
6079
  }
6059
6080
  }
6060
- return { column, line };
6081
+ return { column, line, offset: end };
6061
6082
  }
6062
6083
  prev() {
6063
6084
  if (!this.parent) return void 0;
6064
6085
  let index2 = this.parent.index(this);
6065
6086
  return this.parent.nodes[index2 - 1];
6066
6087
  }
6067
- rangeBy(opts) {
6088
+ rangeBy(opts = {}) {
6089
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6068
6090
  let start = {
6069
6091
  column: this.source.start.column,
6070
- line: this.source.start.line
6092
+ line: this.source.start.line,
6093
+ offset: sourceOffset(inputString, this.source.start)
6071
6094
  };
6072
6095
  let end = this.source.end ? {
6073
6096
  column: this.source.end.column + 1,
6074
- line: this.source.end.line
6097
+ line: this.source.end.line,
6098
+ offset: typeof this.source.end.offset === "number" ? (
6099
+ // `source.end.offset` is exclusive, so we don't need to add 1
6100
+ this.source.end.offset
6101
+ ) : (
6102
+ // Since line/column in this.source.end is inclusive,
6103
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
6104
+ // So, we add 1 to convert it to exclusive.
6105
+ sourceOffset(inputString, this.source.end) + 1
6106
+ )
6075
6107
  } : {
6076
6108
  column: start.column + 1,
6077
- line: start.line
6109
+ line: start.line,
6110
+ offset: start.offset + 1
6078
6111
  };
6079
6112
  if (opts.word) {
6080
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6081
6113
  let stringRepresentation = inputString.slice(
6082
6114
  sourceOffset(inputString, this.source.start),
6083
6115
  sourceOffset(inputString, this.source.end)
@@ -6085,15 +6117,14 @@ function requireNode() {
6085
6117
  let index2 = stringRepresentation.indexOf(opts.word);
6086
6118
  if (index2 !== -1) {
6087
6119
  start = this.positionInside(index2);
6088
- end = this.positionInside(
6089
- index2 + opts.word.length
6090
- );
6120
+ end = this.positionInside(index2 + opts.word.length);
6091
6121
  }
6092
6122
  } else {
6093
6123
  if (opts.start) {
6094
6124
  start = {
6095
6125
  column: opts.start.column,
6096
- line: opts.start.line
6126
+ line: opts.start.line,
6127
+ offset: sourceOffset(inputString, opts.start)
6097
6128
  };
6098
6129
  } else if (opts.index) {
6099
6130
  start = this.positionInside(opts.index);
@@ -6101,7 +6132,8 @@ function requireNode() {
6101
6132
  if (opts.end) {
6102
6133
  end = {
6103
6134
  column: opts.end.column,
6104
- line: opts.end.line
6135
+ line: opts.end.line,
6136
+ offset: sourceOffset(inputString, opts.end)
6105
6137
  };
6106
6138
  } else if (typeof opts.endIndex === "number") {
6107
6139
  end = this.positionInside(opts.endIndex);
@@ -6110,7 +6142,11 @@ function requireNode() {
6110
6142
  }
6111
6143
  }
6112
6144
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
6113
- end = { column: start.column + 1, line: start.line };
6145
+ end = {
6146
+ column: start.column + 1,
6147
+ line: start.line,
6148
+ offset: start.offset + 1
6149
+ };
6114
6150
  }
6115
6151
  return { end, start };
6116
6152
  }
@@ -6174,6 +6210,7 @@ function requireNode() {
6174
6210
  } else if (typeof value === "object" && value.toJSON) {
6175
6211
  fixed[name] = value.toJSON(null, inputs);
6176
6212
  } else if (name === "source") {
6213
+ if (value == null) continue;
6177
6214
  let inputId = inputs.get(value.input);
6178
6215
  if (inputId == null) {
6179
6216
  inputId = inputsNextIndex;
@@ -6208,14 +6245,11 @@ function requireNode() {
6208
6245
  });
6209
6246
  return result2;
6210
6247
  }
6211
- warn(result2, text, opts) {
6248
+ warn(result2, text, opts = {}) {
6212
6249
  let data = { node: this };
6213
6250
  for (let i2 in opts) data[i2] = opts[i2];
6214
6251
  return result2.warn(text, data);
6215
6252
  }
6216
- get proxyOf() {
6217
- return this;
6218
- }
6219
6253
  }
6220
6254
  node = Node2;
6221
6255
  Node2.default = Node2;
@@ -6244,6 +6278,9 @@ function requireDeclaration() {
6244
6278
  hasRequiredDeclaration = 1;
6245
6279
  let Node2 = requireNode();
6246
6280
  class Declaration extends Node2 {
6281
+ get variable() {
6282
+ return this.prop.startsWith("--") || this.prop[0] === "$";
6283
+ }
6247
6284
  constructor(defaults) {
6248
6285
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
6249
6286
  defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
@@ -6251,9 +6288,6 @@ function requireDeclaration() {
6251
6288
  super(defaults);
6252
6289
  this.type = "decl";
6253
6290
  }
6254
- get variable() {
6255
- return this.prop.startsWith("--") || this.prop[0] === "$";
6256
- }
6257
6291
  }
6258
6292
  declaration = Declaration;
6259
6293
  Declaration.default = Declaration;
@@ -6285,6 +6319,14 @@ function requireContainer() {
6285
6319
  }
6286
6320
  }
6287
6321
  class Container extends Node2 {
6322
+ get first() {
6323
+ if (!this.proxyOf.nodes) return void 0;
6324
+ return this.proxyOf.nodes[0];
6325
+ }
6326
+ get last() {
6327
+ if (!this.proxyOf.nodes) return void 0;
6328
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6329
+ }
6288
6330
  append(...children) {
6289
6331
  for (let child of children) {
6290
6332
  let nodes = this.normalize(child, this.last);
@@ -6597,14 +6639,6 @@ function requireContainer() {
6597
6639
  }
6598
6640
  });
6599
6641
  }
6600
- get first() {
6601
- if (!this.proxyOf.nodes) return void 0;
6602
- return this.proxyOf.nodes[0];
6603
- }
6604
- get last() {
6605
- if (!this.proxyOf.nodes) return void 0;
6606
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6607
- }
6608
6642
  }
6609
6643
  Container.registerParse = (dependant) => {
6610
6644
  parse = dependant;
@@ -6854,10 +6888,25 @@ function requireInput() {
6854
6888
  let CssSyntaxError = requireCssSyntaxError();
6855
6889
  let PreviousMap = requirePreviousMap();
6856
6890
  let terminalHighlight = require$$2;
6857
- let fromOffsetCache = Symbol("fromOffsetCache");
6891
+ let lineToIndexCache = Symbol("lineToIndexCache");
6858
6892
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
6859
6893
  let pathAvailable = Boolean(resolve && isAbsolute);
6894
+ function getLineToIndex(input2) {
6895
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
6896
+ let lines = input2.css.split("\n");
6897
+ let lineToIndex = new Array(lines.length);
6898
+ let prevIndex = 0;
6899
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6900
+ lineToIndex[i2] = prevIndex;
6901
+ prevIndex += lines[i2].length + 1;
6902
+ }
6903
+ input2[lineToIndexCache] = lineToIndex;
6904
+ return lineToIndex;
6905
+ }
6860
6906
  class Input {
6907
+ get from() {
6908
+ return this.file || this.id;
6909
+ }
6861
6910
  constructor(css, opts = {}) {
6862
6911
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
6863
6912
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -6892,30 +6941,37 @@ function requireInput() {
6892
6941
  if (this.map) this.map.file = this.from;
6893
6942
  }
6894
6943
  error(message, line, column, opts = {}) {
6895
- let endColumn, endLine, result2;
6944
+ let endColumn, endLine, endOffset, offset, result2;
6896
6945
  if (line && typeof line === "object") {
6897
6946
  let start = line;
6898
6947
  let end = column;
6899
6948
  if (typeof start.offset === "number") {
6900
- let pos = this.fromOffset(start.offset);
6949
+ offset = start.offset;
6950
+ let pos = this.fromOffset(offset);
6901
6951
  line = pos.line;
6902
6952
  column = pos.col;
6903
6953
  } else {
6904
6954
  line = start.line;
6905
6955
  column = start.column;
6956
+ offset = this.fromLineAndColumn(line, column);
6906
6957
  }
6907
6958
  if (typeof end.offset === "number") {
6908
- let pos = this.fromOffset(end.offset);
6959
+ endOffset = end.offset;
6960
+ let pos = this.fromOffset(endOffset);
6909
6961
  endLine = pos.line;
6910
6962
  endColumn = pos.col;
6911
6963
  } else {
6912
6964
  endLine = end.line;
6913
6965
  endColumn = end.column;
6966
+ endOffset = this.fromLineAndColumn(end.line, end.column);
6914
6967
  }
6915
6968
  } else if (!column) {
6916
- let pos = this.fromOffset(line);
6969
+ offset = line;
6970
+ let pos = this.fromOffset(offset);
6917
6971
  line = pos.line;
6918
6972
  column = pos.col;
6973
+ } else {
6974
+ offset = this.fromLineAndColumn(line, column);
6919
6975
  }
6920
6976
  let origin = this.origin(line, column, endLine, endColumn);
6921
6977
  if (origin) {
@@ -6937,7 +6993,7 @@ function requireInput() {
6937
6993
  opts.plugin
6938
6994
  );
6939
6995
  }
6940
- result2.input = { column, endColumn, endLine, line, source: this.css };
6996
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
6941
6997
  if (this.file) {
6942
6998
  if (pathToFileURL) {
6943
6999
  result2.input.url = pathToFileURL(this.file).toString();
@@ -6946,21 +7002,14 @@ function requireInput() {
6946
7002
  }
6947
7003
  return result2;
6948
7004
  }
7005
+ fromLineAndColumn(line, column) {
7006
+ let lineToIndex = getLineToIndex(this);
7007
+ let index2 = lineToIndex[line - 1];
7008
+ return index2 + column - 1;
7009
+ }
6949
7010
  fromOffset(offset) {
6950
- let lastLine, lineToIndex;
6951
- if (!this[fromOffsetCache]) {
6952
- let lines = this.css.split("\n");
6953
- lineToIndex = new Array(lines.length);
6954
- let prevIndex = 0;
6955
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6956
- lineToIndex[i2] = prevIndex;
6957
- prevIndex += lines[i2].length + 1;
6958
- }
6959
- this[fromOffsetCache] = lineToIndex;
6960
- } else {
6961
- lineToIndex = this[fromOffsetCache];
6962
- }
6963
- lastLine = lineToIndex[lineToIndex.length - 1];
7011
+ let lineToIndex = getLineToIndex(this);
7012
+ let lastLine = lineToIndex[lineToIndex.length - 1];
6964
7013
  let min = 0;
6965
7014
  if (offset >= lastLine) {
6966
7015
  min = lineToIndex.length - 1;
@@ -7041,9 +7090,6 @@ function requireInput() {
7041
7090
  }
7042
7091
  return json;
7043
7092
  }
7044
- get from() {
7045
- return this.file || this.id;
7046
- }
7047
7093
  }
7048
7094
  input = Input;
7049
7095
  Input.default = Input;
@@ -7169,11 +7215,6 @@ function requireRule() {
7169
7215
  let Container = requireContainer();
7170
7216
  let list = requireList();
7171
7217
  class Rule extends Container {
7172
- constructor(defaults) {
7173
- super(defaults);
7174
- this.type = "rule";
7175
- if (!this.nodes) this.nodes = [];
7176
- }
7177
7218
  get selectors() {
7178
7219
  return list.comma(this.selector);
7179
7220
  }
@@ -7182,6 +7223,11 @@ function requireRule() {
7182
7223
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
7183
7224
  this.selector = values.join(sep);
7184
7225
  }
7226
+ constructor(defaults) {
7227
+ super(defaults);
7228
+ this.type = "rule";
7229
+ if (!this.nodes) this.nodes = [];
7230
+ }
7185
7231
  }
7186
7232
  rule = Rule;
7187
7233
  Rule.default = Rule;
@@ -8080,6 +8126,8 @@ function requireParser() {
8080
8126
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
8081
8127
  prev.raws.ownSemicolon = this.spaces;
8082
8128
  this.spaces = "";
8129
+ prev.source.end = this.getPosition(token[2]);
8130
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
8083
8131
  }
8084
8132
  }
8085
8133
  }
@@ -8291,7 +8339,7 @@ function requireParser() {
8291
8339
  }
8292
8340
  unknownWord(tokens) {
8293
8341
  throw this.input.error(
8294
- "Unknown word",
8342
+ "Unknown word " + tokens[0][1],
8295
8343
  { offset: tokens[0][2] },
8296
8344
  { offset: tokens[0][2] + tokens[0][1].length }
8297
8345
  );
@@ -8384,12 +8432,15 @@ function requireResult() {
8384
8432
  hasRequiredResult = 1;
8385
8433
  let Warning = requireWarning();
8386
8434
  class Result {
8435
+ get content() {
8436
+ return this.css;
8437
+ }
8387
8438
  constructor(processor2, root2, opts) {
8388
8439
  this.processor = processor2;
8389
8440
  this.messages = [];
8390
8441
  this.root = root2;
8391
8442
  this.opts = opts;
8392
- this.css = void 0;
8443
+ this.css = "";
8393
8444
  this.map = void 0;
8394
8445
  }
8395
8446
  toString() {
@@ -8408,9 +8459,6 @@ function requireResult() {
8408
8459
  warnings() {
8409
8460
  return this.messages.filter((i2) => i2.type === "warning");
8410
8461
  }
8411
- get content() {
8412
- return this.css;
8413
- }
8414
8462
  }
8415
8463
  result = Result;
8416
8464
  Result.default = Result;
@@ -8529,6 +8577,30 @@ function requireLazyResult() {
8529
8577
  }
8530
8578
  let postcss2 = {};
8531
8579
  class LazyResult {
8580
+ get content() {
8581
+ return this.stringify().content;
8582
+ }
8583
+ get css() {
8584
+ return this.stringify().css;
8585
+ }
8586
+ get map() {
8587
+ return this.stringify().map;
8588
+ }
8589
+ get messages() {
8590
+ return this.sync().messages;
8591
+ }
8592
+ get opts() {
8593
+ return this.result.opts;
8594
+ }
8595
+ get processor() {
8596
+ return this.result.processor;
8597
+ }
8598
+ get root() {
8599
+ return this.sync().root;
8600
+ }
8601
+ get [Symbol.toStringTag]() {
8602
+ return "LazyResult";
8603
+ }
8532
8604
  constructor(processor2, css, opts) {
8533
8605
  this.stringified = false;
8534
8606
  this.processed = false;
@@ -8871,30 +8943,6 @@ function requireLazyResult() {
8871
8943
  warnings() {
8872
8944
  return this.sync().warnings();
8873
8945
  }
8874
- get content() {
8875
- return this.stringify().content;
8876
- }
8877
- get css() {
8878
- return this.stringify().css;
8879
- }
8880
- get map() {
8881
- return this.stringify().map;
8882
- }
8883
- get messages() {
8884
- return this.sync().messages;
8885
- }
8886
- get opts() {
8887
- return this.result.opts;
8888
- }
8889
- get processor() {
8890
- return this.result.processor;
8891
- }
8892
- get root() {
8893
- return this.sync().root;
8894
- }
8895
- get [Symbol.toStringTag]() {
8896
- return "LazyResult";
8897
- }
8898
8946
  }
8899
8947
  LazyResult.registerPostcss = (dependant) => {
8900
8948
  postcss2 = dependant;
@@ -8916,6 +8964,45 @@ function requireNoWorkResult() {
8916
8964
  let stringify = requireStringify();
8917
8965
  let warnOnce2 = requireWarnOnce();
8918
8966
  class NoWorkResult {
8967
+ get content() {
8968
+ return this.result.css;
8969
+ }
8970
+ get css() {
8971
+ return this.result.css;
8972
+ }
8973
+ get map() {
8974
+ return this.result.map;
8975
+ }
8976
+ get messages() {
8977
+ return [];
8978
+ }
8979
+ get opts() {
8980
+ return this.result.opts;
8981
+ }
8982
+ get processor() {
8983
+ return this.result.processor;
8984
+ }
8985
+ get root() {
8986
+ if (this._root) {
8987
+ return this._root;
8988
+ }
8989
+ let root2;
8990
+ let parser2 = parse;
8991
+ try {
8992
+ root2 = parser2(this._css, this._opts);
8993
+ } catch (error) {
8994
+ this.error = error;
8995
+ }
8996
+ if (this.error) {
8997
+ throw this.error;
8998
+ } else {
8999
+ this._root = root2;
9000
+ return root2;
9001
+ }
9002
+ }
9003
+ get [Symbol.toStringTag]() {
9004
+ return "NoWorkResult";
9005
+ }
8919
9006
  constructor(processor2, css, opts) {
8920
9007
  css = css.toString();
8921
9008
  this.stringified = false;
@@ -8977,45 +9064,6 @@ function requireNoWorkResult() {
8977
9064
  warnings() {
8978
9065
  return [];
8979
9066
  }
8980
- get content() {
8981
- return this.result.css;
8982
- }
8983
- get css() {
8984
- return this.result.css;
8985
- }
8986
- get map() {
8987
- return this.result.map;
8988
- }
8989
- get messages() {
8990
- return [];
8991
- }
8992
- get opts() {
8993
- return this.result.opts;
8994
- }
8995
- get processor() {
8996
- return this.result.processor;
8997
- }
8998
- get root() {
8999
- if (this._root) {
9000
- return this._root;
9001
- }
9002
- let root2;
9003
- let parser2 = parse;
9004
- try {
9005
- root2 = parser2(this._css, this._opts);
9006
- } catch (error) {
9007
- this.error = error;
9008
- }
9009
- if (this.error) {
9010
- throw this.error;
9011
- } else {
9012
- this._root = root2;
9013
- return root2;
9014
- }
9015
- }
9016
- get [Symbol.toStringTag]() {
9017
- return "NoWorkResult";
9018
- }
9019
9067
  }
9020
9068
  noWorkResult = NoWorkResult;
9021
9069
  NoWorkResult.default = NoWorkResult;
@@ -9032,7 +9080,7 @@ function requireProcessor() {
9032
9080
  let Root = requireRoot();
9033
9081
  class Processor {
9034
9082
  constructor(plugins = []) {
9035
- this.version = "8.5.1";
9083
+ this.version = "8.5.6";
9036
9084
  this.plugins = this.normalize(plugins);
9037
9085
  }
9038
9086
  normalize(plugins) {
@@ -11213,7 +11261,11 @@ function initFontObserver({ fontCb, doc }) {
11213
11261
  const fontMap = /* @__PURE__ */ new WeakMap();
11214
11262
  const originalFontFace = win.FontFace;
11215
11263
  win.FontFace = function FontFace2(family, source, descriptors) {
11216
- const fontFace = new originalFontFace(family, source, descriptors);
11264
+ const fontFace = new originalFontFace(
11265
+ family,
11266
+ source,
11267
+ descriptors
11268
+ );
11217
11269
  fontMap.set(fontFace, {
11218
11270
  family,
11219
11271
  buffer: typeof source !== "string",
@@ -11575,13 +11627,18 @@ class IframeManager {
11575
11627
  removeLoadListener() {
11576
11628
  this.loadListener = void 0;
11577
11629
  }
11630
+ trackIframeContent(iframeEl, content) {
11631
+ const iframeId = this.mirror.getId(iframeEl);
11632
+ this.attachedIframes.set(iframeId, { element: iframeEl, content });
11633
+ return iframeId;
11634
+ }
11578
11635
  attachIframe(iframeEl, childSn) {
11579
11636
  var _a2;
11580
- this.attachedIframes.set(iframeEl, childSn);
11637
+ const iframeId = this.trackIframeContent(iframeEl, childSn);
11581
11638
  this.mutationCb({
11582
11639
  adds: [
11583
11640
  {
11584
- parentId: this.mirror.getId(iframeEl),
11641
+ parentId: iframeId,
11585
11642
  nextId: null,
11586
11643
  node: childSn
11587
11644
  }
@@ -11633,7 +11690,7 @@ class IframeManager {
11633
11690
  const rootId = e2.data.node.id;
11634
11691
  this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
11635
11692
  this.patchRootIdOnNode(e2.data.node, rootId);
11636
- this.attachedIframes.set(iframeEl, e2.data.node);
11693
+ this.trackIframeContent(iframeEl, e2.data.node);
11637
11694
  return {
11638
11695
  timestamp: e2.timestamp,
11639
11696
  type: EventType.IncrementalSnapshot,
@@ -11776,21 +11833,27 @@ class IframeManager {
11776
11833
  });
11777
11834
  }
11778
11835
  }
11836
+ removeIframeById(iframeId) {
11837
+ const entry = this.attachedIframes.get(iframeId);
11838
+ if (!entry) return;
11839
+ const win = entry.element.contentWindow;
11840
+ if (win && this.nestedIframeListeners.has(win)) {
11841
+ const handler = this.nestedIframeListeners.get(win);
11842
+ win.removeEventListener("message", handler);
11843
+ this.nestedIframeListeners.delete(win);
11844
+ }
11845
+ this.attachedIframes.delete(iframeId);
11846
+ }
11779
11847
  reattachIframes() {
11780
- this.attachedIframes.forEach((content, iframe) => {
11781
- if (!iframe.isConnected) {
11782
- this.attachedIframes.delete(iframe);
11783
- return;
11784
- }
11785
- const parentId = this.mirror.getId(iframe);
11786
- if (parentId === -1) {
11787
- this.attachedIframes.delete(iframe);
11848
+ this.attachedIframes.forEach(({ content }, iframeId) => {
11849
+ if (!this.mirror.has(iframeId)) {
11850
+ this.attachedIframes.delete(iframeId);
11788
11851
  return;
11789
11852
  }
11790
11853
  this.mutationCb({
11791
11854
  adds: [
11792
11855
  {
11793
- parentId,
11856
+ parentId: iframeId,
11794
11857
  nextId: null,
11795
11858
  node: content
11796
11859
  }
@@ -12742,6 +12805,11 @@ function record(options = {}) {
12742
12805
  }
12743
12806
  };
12744
12807
  const wrappedMutationEmit = (m) => {
12808
+ if (recordCrossOriginIframes && m.removes) {
12809
+ m.removes.forEach(({ id }) => {
12810
+ iframeManager.removeIframeById(id);
12811
+ });
12812
+ }
12745
12813
  wrappedEmit({
12746
12814
  type: EventType.IncrementalSnapshot,
12747
12815
  data: __spreadValues({
@@ -13095,7 +13163,7 @@ const { addCustomEvent } = record;
13095
13163
  const { freezePage } = record;
13096
13164
  const { takeFullSnapshot } = record;
13097
13165
  exports.record = record;
13098
- if (typeof module.exports == "object" && typeof exports == "object") {
13166
+ ;if (typeof module.exports == "object" && typeof exports == "object") {
13099
13167
  var __cp = (to, from, except, desc) => {
13100
13168
  if ((from && typeof from === "object") || typeof from === "function") {
13101
13169
  for (let key of Object.getOwnPropertyNames(from)) {