@posthog/rrweb-record 0.0.33 → 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.
@@ -879,6 +879,7 @@ function hrefFrom(n2) {
879
879
  return n2.href;
880
880
  }
881
881
  function serializeElementNode(n2, options) {
882
+ var _a2, _b;
882
883
  const {
883
884
  doc,
884
885
  blockClass,
@@ -1052,11 +1053,13 @@ function serializeElementNode(n2, options) {
1052
1053
  }
1053
1054
  }
1054
1055
  if (needBlock) {
1055
- const { width, height } = n2.getBoundingClientRect();
1056
+ const { width, height, left, top } = n2.getBoundingClientRect();
1056
1057
  attributes = {
1057
1058
  class: attributes.class,
1058
1059
  rr_width: `${width}px`,
1059
- rr_height: `${height}px`
1060
+ rr_height: `${height}px`,
1061
+ rr_left: `${Math.floor(left + (((_a2 = doc.defaultView) == null ? void 0 : _a2.scrollX) || 0))}px`,
1062
+ rr_top: `${Math.floor(top + (((_b = doc.defaultView) == null ? void 0 : _b.scrollY) || 0))}px`
1060
1063
  };
1061
1064
  }
1062
1065
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
@@ -1427,7 +1430,7 @@ function getDefaultExportFromCjs$1(x) {
1427
1430
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1428
1431
  }
1429
1432
  function getAugmentedNamespace$1(n2) {
1430
- if (n2.__esModule) return n2;
1433
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
1431
1434
  var f2 = n2.default;
1432
1435
  if (typeof f2 == "function") {
1433
1436
  var a2 = function a3() {
@@ -1946,6 +1949,9 @@ function requireNode$1() {
1946
1949
  return offset;
1947
1950
  }
1948
1951
  class Node2 {
1952
+ get proxyOf() {
1953
+ return this;
1954
+ }
1949
1955
  constructor(defaults = {}) {
1950
1956
  this.raws = {};
1951
1957
  this[isClean] = false;
@@ -2064,7 +2070,7 @@ function requireNode$1() {
2064
2070
  let index2 = this.parent.index(this);
2065
2071
  return this.parent.nodes[index2 + 1];
2066
2072
  }
2067
- positionBy(opts) {
2073
+ positionBy(opts = {}) {
2068
2074
  let pos = this.source.start;
2069
2075
  if (opts.index) {
2070
2076
  pos = this.positionInside(opts.index);
@@ -2093,27 +2099,38 @@ function requireNode$1() {
2093
2099
  column += 1;
2094
2100
  }
2095
2101
  }
2096
- return { column, line };
2102
+ return { column, line, offset: end };
2097
2103
  }
2098
2104
  prev() {
2099
2105
  if (!this.parent) return void 0;
2100
2106
  let index2 = this.parent.index(this);
2101
2107
  return this.parent.nodes[index2 - 1];
2102
2108
  }
2103
- rangeBy(opts) {
2109
+ rangeBy(opts = {}) {
2110
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2104
2111
  let start = {
2105
2112
  column: this.source.start.column,
2106
- line: this.source.start.line
2113
+ line: this.source.start.line,
2114
+ offset: sourceOffset(inputString, this.source.start)
2107
2115
  };
2108
2116
  let end = this.source.end ? {
2109
2117
  column: this.source.end.column + 1,
2110
- line: this.source.end.line
2118
+ line: this.source.end.line,
2119
+ offset: typeof this.source.end.offset === "number" ? (
2120
+ // `source.end.offset` is exclusive, so we don't need to add 1
2121
+ this.source.end.offset
2122
+ ) : (
2123
+ // Since line/column in this.source.end is inclusive,
2124
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
2125
+ // So, we add 1 to convert it to exclusive.
2126
+ sourceOffset(inputString, this.source.end) + 1
2127
+ )
2111
2128
  } : {
2112
2129
  column: start.column + 1,
2113
- line: start.line
2130
+ line: start.line,
2131
+ offset: start.offset + 1
2114
2132
  };
2115
2133
  if (opts.word) {
2116
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2117
2134
  let stringRepresentation = inputString.slice(
2118
2135
  sourceOffset(inputString, this.source.start),
2119
2136
  sourceOffset(inputString, this.source.end)
@@ -2121,15 +2138,14 @@ function requireNode$1() {
2121
2138
  let index2 = stringRepresentation.indexOf(opts.word);
2122
2139
  if (index2 !== -1) {
2123
2140
  start = this.positionInside(index2);
2124
- end = this.positionInside(
2125
- index2 + opts.word.length
2126
- );
2141
+ end = this.positionInside(index2 + opts.word.length);
2127
2142
  }
2128
2143
  } else {
2129
2144
  if (opts.start) {
2130
2145
  start = {
2131
2146
  column: opts.start.column,
2132
- line: opts.start.line
2147
+ line: opts.start.line,
2148
+ offset: sourceOffset(inputString, opts.start)
2133
2149
  };
2134
2150
  } else if (opts.index) {
2135
2151
  start = this.positionInside(opts.index);
@@ -2137,7 +2153,8 @@ function requireNode$1() {
2137
2153
  if (opts.end) {
2138
2154
  end = {
2139
2155
  column: opts.end.column,
2140
- line: opts.end.line
2156
+ line: opts.end.line,
2157
+ offset: sourceOffset(inputString, opts.end)
2141
2158
  };
2142
2159
  } else if (typeof opts.endIndex === "number") {
2143
2160
  end = this.positionInside(opts.endIndex);
@@ -2146,7 +2163,11 @@ function requireNode$1() {
2146
2163
  }
2147
2164
  }
2148
2165
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
2149
- end = { column: start.column + 1, line: start.line };
2166
+ end = {
2167
+ column: start.column + 1,
2168
+ line: start.line,
2169
+ offset: start.offset + 1
2170
+ };
2150
2171
  }
2151
2172
  return { end, start };
2152
2173
  }
@@ -2210,6 +2231,7 @@ function requireNode$1() {
2210
2231
  } else if (typeof value === "object" && value.toJSON) {
2211
2232
  fixed[name] = value.toJSON(null, inputs);
2212
2233
  } else if (name === "source") {
2234
+ if (value == null) continue;
2213
2235
  let inputId = inputs.get(value.input);
2214
2236
  if (inputId == null) {
2215
2237
  inputId = inputsNextIndex;
@@ -2244,14 +2266,11 @@ function requireNode$1() {
2244
2266
  });
2245
2267
  return result2;
2246
2268
  }
2247
- warn(result2, text, opts) {
2269
+ warn(result2, text, opts = {}) {
2248
2270
  let data = { node: this };
2249
2271
  for (let i2 in opts) data[i2] = opts[i2];
2250
2272
  return result2.warn(text, data);
2251
2273
  }
2252
- get proxyOf() {
2253
- return this;
2254
- }
2255
2274
  }
2256
2275
  node$1 = Node2;
2257
2276
  Node2.default = Node2;
@@ -2280,6 +2299,9 @@ function requireDeclaration$1() {
2280
2299
  hasRequiredDeclaration$1 = 1;
2281
2300
  let Node2 = requireNode$1();
2282
2301
  class Declaration extends Node2 {
2302
+ get variable() {
2303
+ return this.prop.startsWith("--") || this.prop[0] === "$";
2304
+ }
2283
2305
  constructor(defaults) {
2284
2306
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2285
2307
  defaults = { ...defaults, value: String(defaults.value) };
@@ -2287,9 +2309,6 @@ function requireDeclaration$1() {
2287
2309
  super(defaults);
2288
2310
  this.type = "decl";
2289
2311
  }
2290
- get variable() {
2291
- return this.prop.startsWith("--") || this.prop[0] === "$";
2292
- }
2293
2312
  }
2294
2313
  declaration$1 = Declaration;
2295
2314
  Declaration.default = Declaration;
@@ -2321,6 +2340,14 @@ function requireContainer$1() {
2321
2340
  }
2322
2341
  }
2323
2342
  class Container extends Node2 {
2343
+ get first() {
2344
+ if (!this.proxyOf.nodes) return void 0;
2345
+ return this.proxyOf.nodes[0];
2346
+ }
2347
+ get last() {
2348
+ if (!this.proxyOf.nodes) return void 0;
2349
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
2350
+ }
2324
2351
  append(...children) {
2325
2352
  for (let child of children) {
2326
2353
  let nodes = this.normalize(child, this.last);
@@ -2633,14 +2660,6 @@ function requireContainer$1() {
2633
2660
  }
2634
2661
  });
2635
2662
  }
2636
- get first() {
2637
- if (!this.proxyOf.nodes) return void 0;
2638
- return this.proxyOf.nodes[0];
2639
- }
2640
- get last() {
2641
- if (!this.proxyOf.nodes) return void 0;
2642
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
2643
- }
2644
2663
  }
2645
2664
  Container.registerParse = (dependant) => {
2646
2665
  parse = dependant;
@@ -2890,10 +2909,25 @@ function requireInput$1() {
2890
2909
  let CssSyntaxError = requireCssSyntaxError$1();
2891
2910
  let PreviousMap = requirePreviousMap$1();
2892
2911
  let terminalHighlight = require$$2$1;
2893
- let fromOffsetCache = Symbol("fromOffsetCache");
2912
+ let lineToIndexCache = Symbol("lineToIndexCache");
2894
2913
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
2895
2914
  let pathAvailable = Boolean(resolve && isAbsolute);
2915
+ function getLineToIndex(input2) {
2916
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
2917
+ let lines = input2.css.split("\n");
2918
+ let lineToIndex = new Array(lines.length);
2919
+ let prevIndex = 0;
2920
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2921
+ lineToIndex[i2] = prevIndex;
2922
+ prevIndex += lines[i2].length + 1;
2923
+ }
2924
+ input2[lineToIndexCache] = lineToIndex;
2925
+ return lineToIndex;
2926
+ }
2896
2927
  class Input {
2928
+ get from() {
2929
+ return this.file || this.id;
2930
+ }
2897
2931
  constructor(css, opts = {}) {
2898
2932
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
2899
2933
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -2928,30 +2962,37 @@ function requireInput$1() {
2928
2962
  if (this.map) this.map.file = this.from;
2929
2963
  }
2930
2964
  error(message, line, column, opts = {}) {
2931
- let endColumn, endLine, result2;
2965
+ let endColumn, endLine, endOffset, offset, result2;
2932
2966
  if (line && typeof line === "object") {
2933
2967
  let start = line;
2934
2968
  let end = column;
2935
2969
  if (typeof start.offset === "number") {
2936
- let pos = this.fromOffset(start.offset);
2970
+ offset = start.offset;
2971
+ let pos = this.fromOffset(offset);
2937
2972
  line = pos.line;
2938
2973
  column = pos.col;
2939
2974
  } else {
2940
2975
  line = start.line;
2941
2976
  column = start.column;
2977
+ offset = this.fromLineAndColumn(line, column);
2942
2978
  }
2943
2979
  if (typeof end.offset === "number") {
2944
- let pos = this.fromOffset(end.offset);
2980
+ endOffset = end.offset;
2981
+ let pos = this.fromOffset(endOffset);
2945
2982
  endLine = pos.line;
2946
2983
  endColumn = pos.col;
2947
2984
  } else {
2948
2985
  endLine = end.line;
2949
2986
  endColumn = end.column;
2987
+ endOffset = this.fromLineAndColumn(end.line, end.column);
2950
2988
  }
2951
2989
  } else if (!column) {
2952
- let pos = this.fromOffset(line);
2990
+ offset = line;
2991
+ let pos = this.fromOffset(offset);
2953
2992
  line = pos.line;
2954
2993
  column = pos.col;
2994
+ } else {
2995
+ offset = this.fromLineAndColumn(line, column);
2955
2996
  }
2956
2997
  let origin = this.origin(line, column, endLine, endColumn);
2957
2998
  if (origin) {
@@ -2973,7 +3014,7 @@ function requireInput$1() {
2973
3014
  opts.plugin
2974
3015
  );
2975
3016
  }
2976
- result2.input = { column, endColumn, endLine, line, source: this.css };
3017
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
2977
3018
  if (this.file) {
2978
3019
  if (pathToFileURL) {
2979
3020
  result2.input.url = pathToFileURL(this.file).toString();
@@ -2982,21 +3023,14 @@ function requireInput$1() {
2982
3023
  }
2983
3024
  return result2;
2984
3025
  }
3026
+ fromLineAndColumn(line, column) {
3027
+ let lineToIndex = getLineToIndex(this);
3028
+ let index2 = lineToIndex[line - 1];
3029
+ return index2 + column - 1;
3030
+ }
2985
3031
  fromOffset(offset) {
2986
- let lastLine, lineToIndex;
2987
- if (!this[fromOffsetCache]) {
2988
- let lines = this.css.split("\n");
2989
- lineToIndex = new Array(lines.length);
2990
- let prevIndex = 0;
2991
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2992
- lineToIndex[i2] = prevIndex;
2993
- prevIndex += lines[i2].length + 1;
2994
- }
2995
- this[fromOffsetCache] = lineToIndex;
2996
- } else {
2997
- lineToIndex = this[fromOffsetCache];
2998
- }
2999
- lastLine = lineToIndex[lineToIndex.length - 1];
3032
+ let lineToIndex = getLineToIndex(this);
3033
+ let lastLine = lineToIndex[lineToIndex.length - 1];
3000
3034
  let min = 0;
3001
3035
  if (offset >= lastLine) {
3002
3036
  min = lineToIndex.length - 1;
@@ -3077,9 +3111,6 @@ function requireInput$1() {
3077
3111
  }
3078
3112
  return json;
3079
3113
  }
3080
- get from() {
3081
- return this.file || this.id;
3082
- }
3083
3114
  }
3084
3115
  input$1 = Input;
3085
3116
  Input.default = Input;
@@ -3205,11 +3236,6 @@ function requireRule$1() {
3205
3236
  let Container = requireContainer$1();
3206
3237
  let list = requireList$1();
3207
3238
  class Rule extends Container {
3208
- constructor(defaults) {
3209
- super(defaults);
3210
- this.type = "rule";
3211
- if (!this.nodes) this.nodes = [];
3212
- }
3213
3239
  get selectors() {
3214
3240
  return list.comma(this.selector);
3215
3241
  }
@@ -3218,6 +3244,11 @@ function requireRule$1() {
3218
3244
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
3219
3245
  this.selector = values.join(sep);
3220
3246
  }
3247
+ constructor(defaults) {
3248
+ super(defaults);
3249
+ this.type = "rule";
3250
+ if (!this.nodes) this.nodes = [];
3251
+ }
3221
3252
  }
3222
3253
  rule$1 = Rule;
3223
3254
  Rule.default = Rule;
@@ -4117,6 +4148,8 @@ function requireParser$1() {
4117
4148
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
4118
4149
  prev.raws.ownSemicolon = this.spaces;
4119
4150
  this.spaces = "";
4151
+ prev.source.end = this.getPosition(token[2]);
4152
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
4120
4153
  }
4121
4154
  }
4122
4155
  }
@@ -4328,7 +4361,7 @@ function requireParser$1() {
4328
4361
  }
4329
4362
  unknownWord(tokens) {
4330
4363
  throw this.input.error(
4331
- "Unknown word",
4364
+ "Unknown word " + tokens[0][1],
4332
4365
  { offset: tokens[0][2] },
4333
4366
  { offset: tokens[0][2] + tokens[0][1].length }
4334
4367
  );
@@ -4421,12 +4454,15 @@ function requireResult$1() {
4421
4454
  hasRequiredResult$1 = 1;
4422
4455
  let Warning = requireWarning$1();
4423
4456
  class Result {
4457
+ get content() {
4458
+ return this.css;
4459
+ }
4424
4460
  constructor(processor2, root2, opts) {
4425
4461
  this.processor = processor2;
4426
4462
  this.messages = [];
4427
4463
  this.root = root2;
4428
4464
  this.opts = opts;
4429
- this.css = void 0;
4465
+ this.css = "";
4430
4466
  this.map = void 0;
4431
4467
  }
4432
4468
  toString() {
@@ -4445,9 +4481,6 @@ function requireResult$1() {
4445
4481
  warnings() {
4446
4482
  return this.messages.filter((i2) => i2.type === "warning");
4447
4483
  }
4448
- get content() {
4449
- return this.css;
4450
- }
4451
4484
  }
4452
4485
  result$1 = Result;
4453
4486
  Result.default = Result;
@@ -4566,6 +4599,30 @@ function requireLazyResult$1() {
4566
4599
  }
4567
4600
  let postcss2 = {};
4568
4601
  class LazyResult {
4602
+ get content() {
4603
+ return this.stringify().content;
4604
+ }
4605
+ get css() {
4606
+ return this.stringify().css;
4607
+ }
4608
+ get map() {
4609
+ return this.stringify().map;
4610
+ }
4611
+ get messages() {
4612
+ return this.sync().messages;
4613
+ }
4614
+ get opts() {
4615
+ return this.result.opts;
4616
+ }
4617
+ get processor() {
4618
+ return this.result.processor;
4619
+ }
4620
+ get root() {
4621
+ return this.sync().root;
4622
+ }
4623
+ get [Symbol.toStringTag]() {
4624
+ return "LazyResult";
4625
+ }
4569
4626
  constructor(processor2, css, opts) {
4570
4627
  this.stringified = false;
4571
4628
  this.processed = false;
@@ -4908,30 +4965,6 @@ function requireLazyResult$1() {
4908
4965
  warnings() {
4909
4966
  return this.sync().warnings();
4910
4967
  }
4911
- get content() {
4912
- return this.stringify().content;
4913
- }
4914
- get css() {
4915
- return this.stringify().css;
4916
- }
4917
- get map() {
4918
- return this.stringify().map;
4919
- }
4920
- get messages() {
4921
- return this.sync().messages;
4922
- }
4923
- get opts() {
4924
- return this.result.opts;
4925
- }
4926
- get processor() {
4927
- return this.result.processor;
4928
- }
4929
- get root() {
4930
- return this.sync().root;
4931
- }
4932
- get [Symbol.toStringTag]() {
4933
- return "LazyResult";
4934
- }
4935
4968
  }
4936
4969
  LazyResult.registerPostcss = (dependant) => {
4937
4970
  postcss2 = dependant;
@@ -4953,6 +4986,45 @@ function requireNoWorkResult$1() {
4953
4986
  let stringify = requireStringify$1();
4954
4987
  let warnOnce2 = requireWarnOnce$1();
4955
4988
  class NoWorkResult {
4989
+ get content() {
4990
+ return this.result.css;
4991
+ }
4992
+ get css() {
4993
+ return this.result.css;
4994
+ }
4995
+ get map() {
4996
+ return this.result.map;
4997
+ }
4998
+ get messages() {
4999
+ return [];
5000
+ }
5001
+ get opts() {
5002
+ return this.result.opts;
5003
+ }
5004
+ get processor() {
5005
+ return this.result.processor;
5006
+ }
5007
+ get root() {
5008
+ if (this._root) {
5009
+ return this._root;
5010
+ }
5011
+ let root2;
5012
+ let parser2 = parse;
5013
+ try {
5014
+ root2 = parser2(this._css, this._opts);
5015
+ } catch (error) {
5016
+ this.error = error;
5017
+ }
5018
+ if (this.error) {
5019
+ throw this.error;
5020
+ } else {
5021
+ this._root = root2;
5022
+ return root2;
5023
+ }
5024
+ }
5025
+ get [Symbol.toStringTag]() {
5026
+ return "NoWorkResult";
5027
+ }
4956
5028
  constructor(processor2, css, opts) {
4957
5029
  css = css.toString();
4958
5030
  this.stringified = false;
@@ -5014,45 +5086,6 @@ function requireNoWorkResult$1() {
5014
5086
  warnings() {
5015
5087
  return [];
5016
5088
  }
5017
- get content() {
5018
- return this.result.css;
5019
- }
5020
- get css() {
5021
- return this.result.css;
5022
- }
5023
- get map() {
5024
- return this.result.map;
5025
- }
5026
- get messages() {
5027
- return [];
5028
- }
5029
- get opts() {
5030
- return this.result.opts;
5031
- }
5032
- get processor() {
5033
- return this.result.processor;
5034
- }
5035
- get root() {
5036
- if (this._root) {
5037
- return this._root;
5038
- }
5039
- let root2;
5040
- let parser2 = parse;
5041
- try {
5042
- root2 = parser2(this._css, this._opts);
5043
- } catch (error) {
5044
- this.error = error;
5045
- }
5046
- if (this.error) {
5047
- throw this.error;
5048
- } else {
5049
- this._root = root2;
5050
- return root2;
5051
- }
5052
- }
5053
- get [Symbol.toStringTag]() {
5054
- return "NoWorkResult";
5055
- }
5056
5089
  }
5057
5090
  noWorkResult$1 = NoWorkResult;
5058
5091
  NoWorkResult.default = NoWorkResult;
@@ -5069,7 +5102,7 @@ function requireProcessor$1() {
5069
5102
  let Root = requireRoot$1();
5070
5103
  class Processor {
5071
5104
  constructor(plugins = []) {
5072
- this.version = "8.5.1";
5105
+ this.version = "8.5.6";
5073
5106
  this.plugins = this.normalize(plugins);
5074
5107
  }
5075
5108
  normalize(plugins) {
@@ -5342,7 +5375,7 @@ function getDefaultExportFromCjs(x) {
5342
5375
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5343
5376
  }
5344
5377
  function getAugmentedNamespace(n2) {
5345
- if (n2.__esModule) return n2;
5378
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
5346
5379
  var f2 = n2.default;
5347
5380
  if (typeof f2 == "function") {
5348
5381
  var a2 = function a3() {
@@ -5861,6 +5894,9 @@ function requireNode() {
5861
5894
  return offset;
5862
5895
  }
5863
5896
  class Node2 {
5897
+ get proxyOf() {
5898
+ return this;
5899
+ }
5864
5900
  constructor(defaults = {}) {
5865
5901
  this.raws = {};
5866
5902
  this[isClean] = false;
@@ -5979,7 +6015,7 @@ function requireNode() {
5979
6015
  let index2 = this.parent.index(this);
5980
6016
  return this.parent.nodes[index2 + 1];
5981
6017
  }
5982
- positionBy(opts) {
6018
+ positionBy(opts = {}) {
5983
6019
  let pos = this.source.start;
5984
6020
  if (opts.index) {
5985
6021
  pos = this.positionInside(opts.index);
@@ -6008,27 +6044,38 @@ function requireNode() {
6008
6044
  column += 1;
6009
6045
  }
6010
6046
  }
6011
- return { column, line };
6047
+ return { column, line, offset: end };
6012
6048
  }
6013
6049
  prev() {
6014
6050
  if (!this.parent) return void 0;
6015
6051
  let index2 = this.parent.index(this);
6016
6052
  return this.parent.nodes[index2 - 1];
6017
6053
  }
6018
- rangeBy(opts) {
6054
+ rangeBy(opts = {}) {
6055
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6019
6056
  let start = {
6020
6057
  column: this.source.start.column,
6021
- line: this.source.start.line
6058
+ line: this.source.start.line,
6059
+ offset: sourceOffset(inputString, this.source.start)
6022
6060
  };
6023
6061
  let end = this.source.end ? {
6024
6062
  column: this.source.end.column + 1,
6025
- line: this.source.end.line
6063
+ line: this.source.end.line,
6064
+ offset: typeof this.source.end.offset === "number" ? (
6065
+ // `source.end.offset` is exclusive, so we don't need to add 1
6066
+ this.source.end.offset
6067
+ ) : (
6068
+ // Since line/column in this.source.end is inclusive,
6069
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
6070
+ // So, we add 1 to convert it to exclusive.
6071
+ sourceOffset(inputString, this.source.end) + 1
6072
+ )
6026
6073
  } : {
6027
6074
  column: start.column + 1,
6028
- line: start.line
6075
+ line: start.line,
6076
+ offset: start.offset + 1
6029
6077
  };
6030
6078
  if (opts.word) {
6031
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6032
6079
  let stringRepresentation = inputString.slice(
6033
6080
  sourceOffset(inputString, this.source.start),
6034
6081
  sourceOffset(inputString, this.source.end)
@@ -6036,15 +6083,14 @@ function requireNode() {
6036
6083
  let index2 = stringRepresentation.indexOf(opts.word);
6037
6084
  if (index2 !== -1) {
6038
6085
  start = this.positionInside(index2);
6039
- end = this.positionInside(
6040
- index2 + opts.word.length
6041
- );
6086
+ end = this.positionInside(index2 + opts.word.length);
6042
6087
  }
6043
6088
  } else {
6044
6089
  if (opts.start) {
6045
6090
  start = {
6046
6091
  column: opts.start.column,
6047
- line: opts.start.line
6092
+ line: opts.start.line,
6093
+ offset: sourceOffset(inputString, opts.start)
6048
6094
  };
6049
6095
  } else if (opts.index) {
6050
6096
  start = this.positionInside(opts.index);
@@ -6052,7 +6098,8 @@ function requireNode() {
6052
6098
  if (opts.end) {
6053
6099
  end = {
6054
6100
  column: opts.end.column,
6055
- line: opts.end.line
6101
+ line: opts.end.line,
6102
+ offset: sourceOffset(inputString, opts.end)
6056
6103
  };
6057
6104
  } else if (typeof opts.endIndex === "number") {
6058
6105
  end = this.positionInside(opts.endIndex);
@@ -6061,7 +6108,11 @@ function requireNode() {
6061
6108
  }
6062
6109
  }
6063
6110
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
6064
- end = { column: start.column + 1, line: start.line };
6111
+ end = {
6112
+ column: start.column + 1,
6113
+ line: start.line,
6114
+ offset: start.offset + 1
6115
+ };
6065
6116
  }
6066
6117
  return { end, start };
6067
6118
  }
@@ -6125,6 +6176,7 @@ function requireNode() {
6125
6176
  } else if (typeof value === "object" && value.toJSON) {
6126
6177
  fixed[name] = value.toJSON(null, inputs);
6127
6178
  } else if (name === "source") {
6179
+ if (value == null) continue;
6128
6180
  let inputId = inputs.get(value.input);
6129
6181
  if (inputId == null) {
6130
6182
  inputId = inputsNextIndex;
@@ -6159,14 +6211,11 @@ function requireNode() {
6159
6211
  });
6160
6212
  return result2;
6161
6213
  }
6162
- warn(result2, text, opts) {
6214
+ warn(result2, text, opts = {}) {
6163
6215
  let data = { node: this };
6164
6216
  for (let i2 in opts) data[i2] = opts[i2];
6165
6217
  return result2.warn(text, data);
6166
6218
  }
6167
- get proxyOf() {
6168
- return this;
6169
- }
6170
6219
  }
6171
6220
  node = Node2;
6172
6221
  Node2.default = Node2;
@@ -6195,6 +6244,9 @@ function requireDeclaration() {
6195
6244
  hasRequiredDeclaration = 1;
6196
6245
  let Node2 = requireNode();
6197
6246
  class Declaration extends Node2 {
6247
+ get variable() {
6248
+ return this.prop.startsWith("--") || this.prop[0] === "$";
6249
+ }
6198
6250
  constructor(defaults) {
6199
6251
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
6200
6252
  defaults = { ...defaults, value: String(defaults.value) };
@@ -6202,9 +6254,6 @@ function requireDeclaration() {
6202
6254
  super(defaults);
6203
6255
  this.type = "decl";
6204
6256
  }
6205
- get variable() {
6206
- return this.prop.startsWith("--") || this.prop[0] === "$";
6207
- }
6208
6257
  }
6209
6258
  declaration = Declaration;
6210
6259
  Declaration.default = Declaration;
@@ -6236,6 +6285,14 @@ function requireContainer() {
6236
6285
  }
6237
6286
  }
6238
6287
  class Container extends Node2 {
6288
+ get first() {
6289
+ if (!this.proxyOf.nodes) return void 0;
6290
+ return this.proxyOf.nodes[0];
6291
+ }
6292
+ get last() {
6293
+ if (!this.proxyOf.nodes) return void 0;
6294
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6295
+ }
6239
6296
  append(...children) {
6240
6297
  for (let child of children) {
6241
6298
  let nodes = this.normalize(child, this.last);
@@ -6548,14 +6605,6 @@ function requireContainer() {
6548
6605
  }
6549
6606
  });
6550
6607
  }
6551
- get first() {
6552
- if (!this.proxyOf.nodes) return void 0;
6553
- return this.proxyOf.nodes[0];
6554
- }
6555
- get last() {
6556
- if (!this.proxyOf.nodes) return void 0;
6557
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6558
- }
6559
6608
  }
6560
6609
  Container.registerParse = (dependant) => {
6561
6610
  parse = dependant;
@@ -6805,10 +6854,25 @@ function requireInput() {
6805
6854
  let CssSyntaxError = requireCssSyntaxError();
6806
6855
  let PreviousMap = requirePreviousMap();
6807
6856
  let terminalHighlight = require$$2;
6808
- let fromOffsetCache = Symbol("fromOffsetCache");
6857
+ let lineToIndexCache = Symbol("lineToIndexCache");
6809
6858
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
6810
6859
  let pathAvailable = Boolean(resolve && isAbsolute);
6860
+ function getLineToIndex(input2) {
6861
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
6862
+ let lines = input2.css.split("\n");
6863
+ let lineToIndex = new Array(lines.length);
6864
+ let prevIndex = 0;
6865
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6866
+ lineToIndex[i2] = prevIndex;
6867
+ prevIndex += lines[i2].length + 1;
6868
+ }
6869
+ input2[lineToIndexCache] = lineToIndex;
6870
+ return lineToIndex;
6871
+ }
6811
6872
  class Input {
6873
+ get from() {
6874
+ return this.file || this.id;
6875
+ }
6812
6876
  constructor(css, opts = {}) {
6813
6877
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
6814
6878
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -6843,30 +6907,37 @@ function requireInput() {
6843
6907
  if (this.map) this.map.file = this.from;
6844
6908
  }
6845
6909
  error(message, line, column, opts = {}) {
6846
- let endColumn, endLine, result2;
6910
+ let endColumn, endLine, endOffset, offset, result2;
6847
6911
  if (line && typeof line === "object") {
6848
6912
  let start = line;
6849
6913
  let end = column;
6850
6914
  if (typeof start.offset === "number") {
6851
- let pos = this.fromOffset(start.offset);
6915
+ offset = start.offset;
6916
+ let pos = this.fromOffset(offset);
6852
6917
  line = pos.line;
6853
6918
  column = pos.col;
6854
6919
  } else {
6855
6920
  line = start.line;
6856
6921
  column = start.column;
6922
+ offset = this.fromLineAndColumn(line, column);
6857
6923
  }
6858
6924
  if (typeof end.offset === "number") {
6859
- let pos = this.fromOffset(end.offset);
6925
+ endOffset = end.offset;
6926
+ let pos = this.fromOffset(endOffset);
6860
6927
  endLine = pos.line;
6861
6928
  endColumn = pos.col;
6862
6929
  } else {
6863
6930
  endLine = end.line;
6864
6931
  endColumn = end.column;
6932
+ endOffset = this.fromLineAndColumn(end.line, end.column);
6865
6933
  }
6866
6934
  } else if (!column) {
6867
- let pos = this.fromOffset(line);
6935
+ offset = line;
6936
+ let pos = this.fromOffset(offset);
6868
6937
  line = pos.line;
6869
6938
  column = pos.col;
6939
+ } else {
6940
+ offset = this.fromLineAndColumn(line, column);
6870
6941
  }
6871
6942
  let origin = this.origin(line, column, endLine, endColumn);
6872
6943
  if (origin) {
@@ -6888,7 +6959,7 @@ function requireInput() {
6888
6959
  opts.plugin
6889
6960
  );
6890
6961
  }
6891
- result2.input = { column, endColumn, endLine, line, source: this.css };
6962
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
6892
6963
  if (this.file) {
6893
6964
  if (pathToFileURL) {
6894
6965
  result2.input.url = pathToFileURL(this.file).toString();
@@ -6897,21 +6968,14 @@ function requireInput() {
6897
6968
  }
6898
6969
  return result2;
6899
6970
  }
6971
+ fromLineAndColumn(line, column) {
6972
+ let lineToIndex = getLineToIndex(this);
6973
+ let index2 = lineToIndex[line - 1];
6974
+ return index2 + column - 1;
6975
+ }
6900
6976
  fromOffset(offset) {
6901
- let lastLine, lineToIndex;
6902
- if (!this[fromOffsetCache]) {
6903
- let lines = this.css.split("\n");
6904
- lineToIndex = new Array(lines.length);
6905
- let prevIndex = 0;
6906
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6907
- lineToIndex[i2] = prevIndex;
6908
- prevIndex += lines[i2].length + 1;
6909
- }
6910
- this[fromOffsetCache] = lineToIndex;
6911
- } else {
6912
- lineToIndex = this[fromOffsetCache];
6913
- }
6914
- lastLine = lineToIndex[lineToIndex.length - 1];
6977
+ let lineToIndex = getLineToIndex(this);
6978
+ let lastLine = lineToIndex[lineToIndex.length - 1];
6915
6979
  let min = 0;
6916
6980
  if (offset >= lastLine) {
6917
6981
  min = lineToIndex.length - 1;
@@ -6992,9 +7056,6 @@ function requireInput() {
6992
7056
  }
6993
7057
  return json;
6994
7058
  }
6995
- get from() {
6996
- return this.file || this.id;
6997
- }
6998
7059
  }
6999
7060
  input = Input;
7000
7061
  Input.default = Input;
@@ -7120,11 +7181,6 @@ function requireRule() {
7120
7181
  let Container = requireContainer();
7121
7182
  let list = requireList();
7122
7183
  class Rule extends Container {
7123
- constructor(defaults) {
7124
- super(defaults);
7125
- this.type = "rule";
7126
- if (!this.nodes) this.nodes = [];
7127
- }
7128
7184
  get selectors() {
7129
7185
  return list.comma(this.selector);
7130
7186
  }
@@ -7133,6 +7189,11 @@ function requireRule() {
7133
7189
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
7134
7190
  this.selector = values.join(sep);
7135
7191
  }
7192
+ constructor(defaults) {
7193
+ super(defaults);
7194
+ this.type = "rule";
7195
+ if (!this.nodes) this.nodes = [];
7196
+ }
7136
7197
  }
7137
7198
  rule = Rule;
7138
7199
  Rule.default = Rule;
@@ -8032,6 +8093,8 @@ function requireParser() {
8032
8093
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
8033
8094
  prev.raws.ownSemicolon = this.spaces;
8034
8095
  this.spaces = "";
8096
+ prev.source.end = this.getPosition(token[2]);
8097
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
8035
8098
  }
8036
8099
  }
8037
8100
  }
@@ -8243,7 +8306,7 @@ function requireParser() {
8243
8306
  }
8244
8307
  unknownWord(tokens) {
8245
8308
  throw this.input.error(
8246
- "Unknown word",
8309
+ "Unknown word " + tokens[0][1],
8247
8310
  { offset: tokens[0][2] },
8248
8311
  { offset: tokens[0][2] + tokens[0][1].length }
8249
8312
  );
@@ -8336,12 +8399,15 @@ function requireResult() {
8336
8399
  hasRequiredResult = 1;
8337
8400
  let Warning = requireWarning();
8338
8401
  class Result {
8402
+ get content() {
8403
+ return this.css;
8404
+ }
8339
8405
  constructor(processor2, root2, opts) {
8340
8406
  this.processor = processor2;
8341
8407
  this.messages = [];
8342
8408
  this.root = root2;
8343
8409
  this.opts = opts;
8344
- this.css = void 0;
8410
+ this.css = "";
8345
8411
  this.map = void 0;
8346
8412
  }
8347
8413
  toString() {
@@ -8360,9 +8426,6 @@ function requireResult() {
8360
8426
  warnings() {
8361
8427
  return this.messages.filter((i2) => i2.type === "warning");
8362
8428
  }
8363
- get content() {
8364
- return this.css;
8365
- }
8366
8429
  }
8367
8430
  result = Result;
8368
8431
  Result.default = Result;
@@ -8481,6 +8544,30 @@ function requireLazyResult() {
8481
8544
  }
8482
8545
  let postcss2 = {};
8483
8546
  class LazyResult {
8547
+ get content() {
8548
+ return this.stringify().content;
8549
+ }
8550
+ get css() {
8551
+ return this.stringify().css;
8552
+ }
8553
+ get map() {
8554
+ return this.stringify().map;
8555
+ }
8556
+ get messages() {
8557
+ return this.sync().messages;
8558
+ }
8559
+ get opts() {
8560
+ return this.result.opts;
8561
+ }
8562
+ get processor() {
8563
+ return this.result.processor;
8564
+ }
8565
+ get root() {
8566
+ return this.sync().root;
8567
+ }
8568
+ get [Symbol.toStringTag]() {
8569
+ return "LazyResult";
8570
+ }
8484
8571
  constructor(processor2, css, opts) {
8485
8572
  this.stringified = false;
8486
8573
  this.processed = false;
@@ -8823,30 +8910,6 @@ function requireLazyResult() {
8823
8910
  warnings() {
8824
8911
  return this.sync().warnings();
8825
8912
  }
8826
- get content() {
8827
- return this.stringify().content;
8828
- }
8829
- get css() {
8830
- return this.stringify().css;
8831
- }
8832
- get map() {
8833
- return this.stringify().map;
8834
- }
8835
- get messages() {
8836
- return this.sync().messages;
8837
- }
8838
- get opts() {
8839
- return this.result.opts;
8840
- }
8841
- get processor() {
8842
- return this.result.processor;
8843
- }
8844
- get root() {
8845
- return this.sync().root;
8846
- }
8847
- get [Symbol.toStringTag]() {
8848
- return "LazyResult";
8849
- }
8850
8913
  }
8851
8914
  LazyResult.registerPostcss = (dependant) => {
8852
8915
  postcss2 = dependant;
@@ -8868,6 +8931,45 @@ function requireNoWorkResult() {
8868
8931
  let stringify = requireStringify();
8869
8932
  let warnOnce2 = requireWarnOnce();
8870
8933
  class NoWorkResult {
8934
+ get content() {
8935
+ return this.result.css;
8936
+ }
8937
+ get css() {
8938
+ return this.result.css;
8939
+ }
8940
+ get map() {
8941
+ return this.result.map;
8942
+ }
8943
+ get messages() {
8944
+ return [];
8945
+ }
8946
+ get opts() {
8947
+ return this.result.opts;
8948
+ }
8949
+ get processor() {
8950
+ return this.result.processor;
8951
+ }
8952
+ get root() {
8953
+ if (this._root) {
8954
+ return this._root;
8955
+ }
8956
+ let root2;
8957
+ let parser2 = parse;
8958
+ try {
8959
+ root2 = parser2(this._css, this._opts);
8960
+ } catch (error) {
8961
+ this.error = error;
8962
+ }
8963
+ if (this.error) {
8964
+ throw this.error;
8965
+ } else {
8966
+ this._root = root2;
8967
+ return root2;
8968
+ }
8969
+ }
8970
+ get [Symbol.toStringTag]() {
8971
+ return "NoWorkResult";
8972
+ }
8871
8973
  constructor(processor2, css, opts) {
8872
8974
  css = css.toString();
8873
8975
  this.stringified = false;
@@ -8929,45 +9031,6 @@ function requireNoWorkResult() {
8929
9031
  warnings() {
8930
9032
  return [];
8931
9033
  }
8932
- get content() {
8933
- return this.result.css;
8934
- }
8935
- get css() {
8936
- return this.result.css;
8937
- }
8938
- get map() {
8939
- return this.result.map;
8940
- }
8941
- get messages() {
8942
- return [];
8943
- }
8944
- get opts() {
8945
- return this.result.opts;
8946
- }
8947
- get processor() {
8948
- return this.result.processor;
8949
- }
8950
- get root() {
8951
- if (this._root) {
8952
- return this._root;
8953
- }
8954
- let root2;
8955
- let parser2 = parse;
8956
- try {
8957
- root2 = parser2(this._css, this._opts);
8958
- } catch (error) {
8959
- this.error = error;
8960
- }
8961
- if (this.error) {
8962
- throw this.error;
8963
- } else {
8964
- this._root = root2;
8965
- return root2;
8966
- }
8967
- }
8968
- get [Symbol.toStringTag]() {
8969
- return "NoWorkResult";
8970
- }
8971
9034
  }
8972
9035
  noWorkResult = NoWorkResult;
8973
9036
  NoWorkResult.default = NoWorkResult;
@@ -8984,7 +9047,7 @@ function requireProcessor() {
8984
9047
  let Root = requireRoot();
8985
9048
  class Processor {
8986
9049
  constructor(plugins = []) {
8987
- this.version = "8.5.1";
9050
+ this.version = "8.5.6";
8988
9051
  this.plugins = this.normalize(plugins);
8989
9052
  }
8990
9053
  normalize(plugins) {
@@ -10399,7 +10462,7 @@ const callbackWrapper = (cb) => {
10399
10462
  if (!errorHandler) {
10400
10463
  return cb;
10401
10464
  }
10402
- const rrwebWrapped = (...rest) => {
10465
+ const rrwebWrapped = ((...rest) => {
10403
10466
  try {
10404
10467
  return cb(...rest);
10405
10468
  } catch (error) {
@@ -10408,7 +10471,7 @@ const callbackWrapper = (cb) => {
10408
10471
  }
10409
10472
  throw error;
10410
10473
  }
10411
- };
10474
+ });
10412
10475
  return rrwebWrapped;
10413
10476
  };
10414
10477
  const mutationBuffers = [];
@@ -11166,7 +11229,11 @@ function initFontObserver({ fontCb, doc }) {
11166
11229
  const fontMap = /* @__PURE__ */ new WeakMap();
11167
11230
  const originalFontFace = win.FontFace;
11168
11231
  win.FontFace = function FontFace2(family, source, descriptors) {
11169
- const fontFace = new originalFontFace(family, source, descriptors);
11232
+ const fontFace = new originalFontFace(
11233
+ family,
11234
+ source,
11235
+ descriptors
11236
+ );
11170
11237
  fontMap.set(fontFace, {
11171
11238
  family,
11172
11239
  buffer: typeof source !== "string",
@@ -11528,13 +11595,18 @@ class IframeManager {
11528
11595
  removeLoadListener() {
11529
11596
  this.loadListener = void 0;
11530
11597
  }
11598
+ trackIframeContent(iframeEl, content) {
11599
+ const iframeId = this.mirror.getId(iframeEl);
11600
+ this.attachedIframes.set(iframeId, { element: iframeEl, content });
11601
+ return iframeId;
11602
+ }
11531
11603
  attachIframe(iframeEl, childSn) {
11532
11604
  var _a2;
11533
- this.attachedIframes.set(iframeEl, childSn);
11605
+ const iframeId = this.trackIframeContent(iframeEl, childSn);
11534
11606
  this.mutationCb({
11535
11607
  adds: [
11536
11608
  {
11537
- parentId: this.mirror.getId(iframeEl),
11609
+ parentId: iframeId,
11538
11610
  nextId: null,
11539
11611
  node: childSn
11540
11612
  }
@@ -11586,7 +11658,7 @@ class IframeManager {
11586
11658
  const rootId = e2.data.node.id;
11587
11659
  this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
11588
11660
  this.patchRootIdOnNode(e2.data.node, rootId);
11589
- this.attachedIframes.set(iframeEl, e2.data.node);
11661
+ this.trackIframeContent(iframeEl, e2.data.node);
11590
11662
  return {
11591
11663
  timestamp: e2.timestamp,
11592
11664
  type: EventType.IncrementalSnapshot,
@@ -11729,21 +11801,27 @@ class IframeManager {
11729
11801
  });
11730
11802
  }
11731
11803
  }
11804
+ removeIframeById(iframeId) {
11805
+ const entry = this.attachedIframes.get(iframeId);
11806
+ if (!entry) return;
11807
+ const win = entry.element.contentWindow;
11808
+ if (win && this.nestedIframeListeners.has(win)) {
11809
+ const handler = this.nestedIframeListeners.get(win);
11810
+ win.removeEventListener("message", handler);
11811
+ this.nestedIframeListeners.delete(win);
11812
+ }
11813
+ this.attachedIframes.delete(iframeId);
11814
+ }
11732
11815
  reattachIframes() {
11733
- this.attachedIframes.forEach((content, iframe) => {
11734
- if (!iframe.isConnected) {
11735
- this.attachedIframes.delete(iframe);
11736
- return;
11737
- }
11738
- const parentId = this.mirror.getId(iframe);
11739
- if (parentId === -1) {
11740
- this.attachedIframes.delete(iframe);
11816
+ this.attachedIframes.forEach(({ content }, iframeId) => {
11817
+ if (!this.mirror.has(iframeId)) {
11818
+ this.attachedIframes.delete(iframeId);
11741
11819
  return;
11742
11820
  }
11743
11821
  this.mutationCb({
11744
11822
  adds: [
11745
11823
  {
11746
- parentId,
11824
+ parentId: iframeId,
11747
11825
  nextId: null,
11748
11826
  node: content
11749
11827
  }
@@ -12698,6 +12776,11 @@ function record(options = {}) {
12698
12776
  }
12699
12777
  };
12700
12778
  const wrappedMutationEmit = (m) => {
12779
+ if (recordCrossOriginIframes && m.removes) {
12780
+ m.removes.forEach(({ id }) => {
12781
+ iframeManager.removeIframeById(id);
12782
+ });
12783
+ }
12701
12784
  wrappedEmit({
12702
12785
  type: EventType.IncrementalSnapshot,
12703
12786
  data: {
@@ -13057,9 +13140,9 @@ record.takeFullSnapshot = (isCheckout) => {
13057
13140
  };
13058
13141
  record.mirror = mirror;
13059
13142
  var n;
13060
- !function(t2) {
13143
+ !(function(t2) {
13061
13144
  t2[t2.NotStarted = 0] = "NotStarted", t2[t2.Running = 1] = "Running", t2[t2.Stopped = 2] = "Stopped";
13062
- }(n || (n = {}));
13145
+ })(n || (n = {}));
13063
13146
  const { addCustomEvent } = record;
13064
13147
  const { freezePage } = record;
13065
13148
  const { takeFullSnapshot } = record;