@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.
@@ -881,6 +881,7 @@ function hrefFrom(n2) {
881
881
  return n2.href;
882
882
  }
883
883
  function serializeElementNode(n2, options) {
884
+ var _a2, _b;
884
885
  const {
885
886
  doc,
886
887
  blockClass,
@@ -1054,11 +1055,13 @@ function serializeElementNode(n2, options) {
1054
1055
  }
1055
1056
  }
1056
1057
  if (needBlock) {
1057
- const { width, height } = n2.getBoundingClientRect();
1058
+ const { width, height, left, top } = n2.getBoundingClientRect();
1058
1059
  attributes = {
1059
1060
  class: attributes.class,
1060
1061
  rr_width: `${width}px`,
1061
- rr_height: `${height}px`
1062
+ rr_height: `${height}px`,
1063
+ rr_left: `${Math.floor(left + (((_a2 = doc.defaultView) == null ? void 0 : _a2.scrollX) || 0))}px`,
1064
+ rr_top: `${Math.floor(top + (((_b = doc.defaultView) == null ? void 0 : _b.scrollY) || 0))}px`
1062
1065
  };
1063
1066
  }
1064
1067
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
@@ -1429,7 +1432,7 @@ function getDefaultExportFromCjs$1(x) {
1429
1432
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1430
1433
  }
1431
1434
  function getAugmentedNamespace$1(n2) {
1432
- if (n2.__esModule) return n2;
1435
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
1433
1436
  var f2 = n2.default;
1434
1437
  if (typeof f2 == "function") {
1435
1438
  var a2 = function a3() {
@@ -1948,6 +1951,9 @@ function requireNode$1() {
1948
1951
  return offset;
1949
1952
  }
1950
1953
  class Node2 {
1954
+ get proxyOf() {
1955
+ return this;
1956
+ }
1951
1957
  constructor(defaults = {}) {
1952
1958
  this.raws = {};
1953
1959
  this[isClean] = false;
@@ -2066,7 +2072,7 @@ function requireNode$1() {
2066
2072
  let index2 = this.parent.index(this);
2067
2073
  return this.parent.nodes[index2 + 1];
2068
2074
  }
2069
- positionBy(opts) {
2075
+ positionBy(opts = {}) {
2070
2076
  let pos = this.source.start;
2071
2077
  if (opts.index) {
2072
2078
  pos = this.positionInside(opts.index);
@@ -2095,27 +2101,38 @@ function requireNode$1() {
2095
2101
  column += 1;
2096
2102
  }
2097
2103
  }
2098
- return { column, line };
2104
+ return { column, line, offset: end };
2099
2105
  }
2100
2106
  prev() {
2101
2107
  if (!this.parent) return void 0;
2102
2108
  let index2 = this.parent.index(this);
2103
2109
  return this.parent.nodes[index2 - 1];
2104
2110
  }
2105
- rangeBy(opts) {
2111
+ rangeBy(opts = {}) {
2112
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2106
2113
  let start = {
2107
2114
  column: this.source.start.column,
2108
- line: this.source.start.line
2115
+ line: this.source.start.line,
2116
+ offset: sourceOffset(inputString, this.source.start)
2109
2117
  };
2110
2118
  let end = this.source.end ? {
2111
2119
  column: this.source.end.column + 1,
2112
- line: this.source.end.line
2120
+ line: this.source.end.line,
2121
+ offset: typeof this.source.end.offset === "number" ? (
2122
+ // `source.end.offset` is exclusive, so we don't need to add 1
2123
+ this.source.end.offset
2124
+ ) : (
2125
+ // Since line/column in this.source.end is inclusive,
2126
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
2127
+ // So, we add 1 to convert it to exclusive.
2128
+ sourceOffset(inputString, this.source.end) + 1
2129
+ )
2113
2130
  } : {
2114
2131
  column: start.column + 1,
2115
- line: start.line
2132
+ line: start.line,
2133
+ offset: start.offset + 1
2116
2134
  };
2117
2135
  if (opts.word) {
2118
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2119
2136
  let stringRepresentation = inputString.slice(
2120
2137
  sourceOffset(inputString, this.source.start),
2121
2138
  sourceOffset(inputString, this.source.end)
@@ -2123,15 +2140,14 @@ function requireNode$1() {
2123
2140
  let index2 = stringRepresentation.indexOf(opts.word);
2124
2141
  if (index2 !== -1) {
2125
2142
  start = this.positionInside(index2);
2126
- end = this.positionInside(
2127
- index2 + opts.word.length
2128
- );
2143
+ end = this.positionInside(index2 + opts.word.length);
2129
2144
  }
2130
2145
  } else {
2131
2146
  if (opts.start) {
2132
2147
  start = {
2133
2148
  column: opts.start.column,
2134
- line: opts.start.line
2149
+ line: opts.start.line,
2150
+ offset: sourceOffset(inputString, opts.start)
2135
2151
  };
2136
2152
  } else if (opts.index) {
2137
2153
  start = this.positionInside(opts.index);
@@ -2139,7 +2155,8 @@ function requireNode$1() {
2139
2155
  if (opts.end) {
2140
2156
  end = {
2141
2157
  column: opts.end.column,
2142
- line: opts.end.line
2158
+ line: opts.end.line,
2159
+ offset: sourceOffset(inputString, opts.end)
2143
2160
  };
2144
2161
  } else if (typeof opts.endIndex === "number") {
2145
2162
  end = this.positionInside(opts.endIndex);
@@ -2148,7 +2165,11 @@ function requireNode$1() {
2148
2165
  }
2149
2166
  }
2150
2167
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
2151
- end = { column: start.column + 1, line: start.line };
2168
+ end = {
2169
+ column: start.column + 1,
2170
+ line: start.line,
2171
+ offset: start.offset + 1
2172
+ };
2152
2173
  }
2153
2174
  return { end, start };
2154
2175
  }
@@ -2212,6 +2233,7 @@ function requireNode$1() {
2212
2233
  } else if (typeof value === "object" && value.toJSON) {
2213
2234
  fixed[name] = value.toJSON(null, inputs);
2214
2235
  } else if (name === "source") {
2236
+ if (value == null) continue;
2215
2237
  let inputId = inputs.get(value.input);
2216
2238
  if (inputId == null) {
2217
2239
  inputId = inputsNextIndex;
@@ -2246,14 +2268,11 @@ function requireNode$1() {
2246
2268
  });
2247
2269
  return result2;
2248
2270
  }
2249
- warn(result2, text, opts) {
2271
+ warn(result2, text, opts = {}) {
2250
2272
  let data = { node: this };
2251
2273
  for (let i2 in opts) data[i2] = opts[i2];
2252
2274
  return result2.warn(text, data);
2253
2275
  }
2254
- get proxyOf() {
2255
- return this;
2256
- }
2257
2276
  }
2258
2277
  node$1 = Node2;
2259
2278
  Node2.default = Node2;
@@ -2282,6 +2301,9 @@ function requireDeclaration$1() {
2282
2301
  hasRequiredDeclaration$1 = 1;
2283
2302
  let Node2 = requireNode$1();
2284
2303
  class Declaration extends Node2 {
2304
+ get variable() {
2305
+ return this.prop.startsWith("--") || this.prop[0] === "$";
2306
+ }
2285
2307
  constructor(defaults) {
2286
2308
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2287
2309
  defaults = { ...defaults, value: String(defaults.value) };
@@ -2289,9 +2311,6 @@ function requireDeclaration$1() {
2289
2311
  super(defaults);
2290
2312
  this.type = "decl";
2291
2313
  }
2292
- get variable() {
2293
- return this.prop.startsWith("--") || this.prop[0] === "$";
2294
- }
2295
2314
  }
2296
2315
  declaration$1 = Declaration;
2297
2316
  Declaration.default = Declaration;
@@ -2323,6 +2342,14 @@ function requireContainer$1() {
2323
2342
  }
2324
2343
  }
2325
2344
  class Container extends Node2 {
2345
+ get first() {
2346
+ if (!this.proxyOf.nodes) return void 0;
2347
+ return this.proxyOf.nodes[0];
2348
+ }
2349
+ get last() {
2350
+ if (!this.proxyOf.nodes) return void 0;
2351
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
2352
+ }
2326
2353
  append(...children) {
2327
2354
  for (let child of children) {
2328
2355
  let nodes = this.normalize(child, this.last);
@@ -2635,14 +2662,6 @@ function requireContainer$1() {
2635
2662
  }
2636
2663
  });
2637
2664
  }
2638
- get first() {
2639
- if (!this.proxyOf.nodes) return void 0;
2640
- return this.proxyOf.nodes[0];
2641
- }
2642
- get last() {
2643
- if (!this.proxyOf.nodes) return void 0;
2644
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
2645
- }
2646
2665
  }
2647
2666
  Container.registerParse = (dependant) => {
2648
2667
  parse = dependant;
@@ -2892,10 +2911,25 @@ function requireInput$1() {
2892
2911
  let CssSyntaxError = requireCssSyntaxError$1();
2893
2912
  let PreviousMap = requirePreviousMap$1();
2894
2913
  let terminalHighlight = require$$2$1;
2895
- let fromOffsetCache = Symbol("fromOffsetCache");
2914
+ let lineToIndexCache = Symbol("lineToIndexCache");
2896
2915
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
2897
2916
  let pathAvailable = Boolean(resolve && isAbsolute);
2917
+ function getLineToIndex(input2) {
2918
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
2919
+ let lines = input2.css.split("\n");
2920
+ let lineToIndex = new Array(lines.length);
2921
+ let prevIndex = 0;
2922
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2923
+ lineToIndex[i2] = prevIndex;
2924
+ prevIndex += lines[i2].length + 1;
2925
+ }
2926
+ input2[lineToIndexCache] = lineToIndex;
2927
+ return lineToIndex;
2928
+ }
2898
2929
  class Input {
2930
+ get from() {
2931
+ return this.file || this.id;
2932
+ }
2899
2933
  constructor(css, opts = {}) {
2900
2934
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
2901
2935
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -2930,30 +2964,37 @@ function requireInput$1() {
2930
2964
  if (this.map) this.map.file = this.from;
2931
2965
  }
2932
2966
  error(message, line, column, opts = {}) {
2933
- let endColumn, endLine, result2;
2967
+ let endColumn, endLine, endOffset, offset, result2;
2934
2968
  if (line && typeof line === "object") {
2935
2969
  let start = line;
2936
2970
  let end = column;
2937
2971
  if (typeof start.offset === "number") {
2938
- let pos = this.fromOffset(start.offset);
2972
+ offset = start.offset;
2973
+ let pos = this.fromOffset(offset);
2939
2974
  line = pos.line;
2940
2975
  column = pos.col;
2941
2976
  } else {
2942
2977
  line = start.line;
2943
2978
  column = start.column;
2979
+ offset = this.fromLineAndColumn(line, column);
2944
2980
  }
2945
2981
  if (typeof end.offset === "number") {
2946
- let pos = this.fromOffset(end.offset);
2982
+ endOffset = end.offset;
2983
+ let pos = this.fromOffset(endOffset);
2947
2984
  endLine = pos.line;
2948
2985
  endColumn = pos.col;
2949
2986
  } else {
2950
2987
  endLine = end.line;
2951
2988
  endColumn = end.column;
2989
+ endOffset = this.fromLineAndColumn(end.line, end.column);
2952
2990
  }
2953
2991
  } else if (!column) {
2954
- let pos = this.fromOffset(line);
2992
+ offset = line;
2993
+ let pos = this.fromOffset(offset);
2955
2994
  line = pos.line;
2956
2995
  column = pos.col;
2996
+ } else {
2997
+ offset = this.fromLineAndColumn(line, column);
2957
2998
  }
2958
2999
  let origin = this.origin(line, column, endLine, endColumn);
2959
3000
  if (origin) {
@@ -2975,7 +3016,7 @@ function requireInput$1() {
2975
3016
  opts.plugin
2976
3017
  );
2977
3018
  }
2978
- result2.input = { column, endColumn, endLine, line, source: this.css };
3019
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
2979
3020
  if (this.file) {
2980
3021
  if (pathToFileURL) {
2981
3022
  result2.input.url = pathToFileURL(this.file).toString();
@@ -2984,21 +3025,14 @@ function requireInput$1() {
2984
3025
  }
2985
3026
  return result2;
2986
3027
  }
3028
+ fromLineAndColumn(line, column) {
3029
+ let lineToIndex = getLineToIndex(this);
3030
+ let index2 = lineToIndex[line - 1];
3031
+ return index2 + column - 1;
3032
+ }
2987
3033
  fromOffset(offset) {
2988
- let lastLine, lineToIndex;
2989
- if (!this[fromOffsetCache]) {
2990
- let lines = this.css.split("\n");
2991
- lineToIndex = new Array(lines.length);
2992
- let prevIndex = 0;
2993
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2994
- lineToIndex[i2] = prevIndex;
2995
- prevIndex += lines[i2].length + 1;
2996
- }
2997
- this[fromOffsetCache] = lineToIndex;
2998
- } else {
2999
- lineToIndex = this[fromOffsetCache];
3000
- }
3001
- lastLine = lineToIndex[lineToIndex.length - 1];
3034
+ let lineToIndex = getLineToIndex(this);
3035
+ let lastLine = lineToIndex[lineToIndex.length - 1];
3002
3036
  let min = 0;
3003
3037
  if (offset >= lastLine) {
3004
3038
  min = lineToIndex.length - 1;
@@ -3079,9 +3113,6 @@ function requireInput$1() {
3079
3113
  }
3080
3114
  return json;
3081
3115
  }
3082
- get from() {
3083
- return this.file || this.id;
3084
- }
3085
3116
  }
3086
3117
  input$1 = Input;
3087
3118
  Input.default = Input;
@@ -3207,11 +3238,6 @@ function requireRule$1() {
3207
3238
  let Container = requireContainer$1();
3208
3239
  let list = requireList$1();
3209
3240
  class Rule extends Container {
3210
- constructor(defaults) {
3211
- super(defaults);
3212
- this.type = "rule";
3213
- if (!this.nodes) this.nodes = [];
3214
- }
3215
3241
  get selectors() {
3216
3242
  return list.comma(this.selector);
3217
3243
  }
@@ -3220,6 +3246,11 @@ function requireRule$1() {
3220
3246
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
3221
3247
  this.selector = values.join(sep);
3222
3248
  }
3249
+ constructor(defaults) {
3250
+ super(defaults);
3251
+ this.type = "rule";
3252
+ if (!this.nodes) this.nodes = [];
3253
+ }
3223
3254
  }
3224
3255
  rule$1 = Rule;
3225
3256
  Rule.default = Rule;
@@ -4119,6 +4150,8 @@ function requireParser$1() {
4119
4150
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
4120
4151
  prev.raws.ownSemicolon = this.spaces;
4121
4152
  this.spaces = "";
4153
+ prev.source.end = this.getPosition(token[2]);
4154
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
4122
4155
  }
4123
4156
  }
4124
4157
  }
@@ -4330,7 +4363,7 @@ function requireParser$1() {
4330
4363
  }
4331
4364
  unknownWord(tokens) {
4332
4365
  throw this.input.error(
4333
- "Unknown word",
4366
+ "Unknown word " + tokens[0][1],
4334
4367
  { offset: tokens[0][2] },
4335
4368
  { offset: tokens[0][2] + tokens[0][1].length }
4336
4369
  );
@@ -4423,12 +4456,15 @@ function requireResult$1() {
4423
4456
  hasRequiredResult$1 = 1;
4424
4457
  let Warning = requireWarning$1();
4425
4458
  class Result {
4459
+ get content() {
4460
+ return this.css;
4461
+ }
4426
4462
  constructor(processor2, root2, opts) {
4427
4463
  this.processor = processor2;
4428
4464
  this.messages = [];
4429
4465
  this.root = root2;
4430
4466
  this.opts = opts;
4431
- this.css = void 0;
4467
+ this.css = "";
4432
4468
  this.map = void 0;
4433
4469
  }
4434
4470
  toString() {
@@ -4447,9 +4483,6 @@ function requireResult$1() {
4447
4483
  warnings() {
4448
4484
  return this.messages.filter((i2) => i2.type === "warning");
4449
4485
  }
4450
- get content() {
4451
- return this.css;
4452
- }
4453
4486
  }
4454
4487
  result$1 = Result;
4455
4488
  Result.default = Result;
@@ -4568,6 +4601,30 @@ function requireLazyResult$1() {
4568
4601
  }
4569
4602
  let postcss2 = {};
4570
4603
  class LazyResult {
4604
+ get content() {
4605
+ return this.stringify().content;
4606
+ }
4607
+ get css() {
4608
+ return this.stringify().css;
4609
+ }
4610
+ get map() {
4611
+ return this.stringify().map;
4612
+ }
4613
+ get messages() {
4614
+ return this.sync().messages;
4615
+ }
4616
+ get opts() {
4617
+ return this.result.opts;
4618
+ }
4619
+ get processor() {
4620
+ return this.result.processor;
4621
+ }
4622
+ get root() {
4623
+ return this.sync().root;
4624
+ }
4625
+ get [Symbol.toStringTag]() {
4626
+ return "LazyResult";
4627
+ }
4571
4628
  constructor(processor2, css, opts) {
4572
4629
  this.stringified = false;
4573
4630
  this.processed = false;
@@ -4910,30 +4967,6 @@ function requireLazyResult$1() {
4910
4967
  warnings() {
4911
4968
  return this.sync().warnings();
4912
4969
  }
4913
- get content() {
4914
- return this.stringify().content;
4915
- }
4916
- get css() {
4917
- return this.stringify().css;
4918
- }
4919
- get map() {
4920
- return this.stringify().map;
4921
- }
4922
- get messages() {
4923
- return this.sync().messages;
4924
- }
4925
- get opts() {
4926
- return this.result.opts;
4927
- }
4928
- get processor() {
4929
- return this.result.processor;
4930
- }
4931
- get root() {
4932
- return this.sync().root;
4933
- }
4934
- get [Symbol.toStringTag]() {
4935
- return "LazyResult";
4936
- }
4937
4970
  }
4938
4971
  LazyResult.registerPostcss = (dependant) => {
4939
4972
  postcss2 = dependant;
@@ -4955,6 +4988,45 @@ function requireNoWorkResult$1() {
4955
4988
  let stringify = requireStringify$1();
4956
4989
  let warnOnce2 = requireWarnOnce$1();
4957
4990
  class NoWorkResult {
4991
+ get content() {
4992
+ return this.result.css;
4993
+ }
4994
+ get css() {
4995
+ return this.result.css;
4996
+ }
4997
+ get map() {
4998
+ return this.result.map;
4999
+ }
5000
+ get messages() {
5001
+ return [];
5002
+ }
5003
+ get opts() {
5004
+ return this.result.opts;
5005
+ }
5006
+ get processor() {
5007
+ return this.result.processor;
5008
+ }
5009
+ get root() {
5010
+ if (this._root) {
5011
+ return this._root;
5012
+ }
5013
+ let root2;
5014
+ let parser2 = parse;
5015
+ try {
5016
+ root2 = parser2(this._css, this._opts);
5017
+ } catch (error) {
5018
+ this.error = error;
5019
+ }
5020
+ if (this.error) {
5021
+ throw this.error;
5022
+ } else {
5023
+ this._root = root2;
5024
+ return root2;
5025
+ }
5026
+ }
5027
+ get [Symbol.toStringTag]() {
5028
+ return "NoWorkResult";
5029
+ }
4958
5030
  constructor(processor2, css, opts) {
4959
5031
  css = css.toString();
4960
5032
  this.stringified = false;
@@ -5016,45 +5088,6 @@ function requireNoWorkResult$1() {
5016
5088
  warnings() {
5017
5089
  return [];
5018
5090
  }
5019
- get content() {
5020
- return this.result.css;
5021
- }
5022
- get css() {
5023
- return this.result.css;
5024
- }
5025
- get map() {
5026
- return this.result.map;
5027
- }
5028
- get messages() {
5029
- return [];
5030
- }
5031
- get opts() {
5032
- return this.result.opts;
5033
- }
5034
- get processor() {
5035
- return this.result.processor;
5036
- }
5037
- get root() {
5038
- if (this._root) {
5039
- return this._root;
5040
- }
5041
- let root2;
5042
- let parser2 = parse;
5043
- try {
5044
- root2 = parser2(this._css, this._opts);
5045
- } catch (error) {
5046
- this.error = error;
5047
- }
5048
- if (this.error) {
5049
- throw this.error;
5050
- } else {
5051
- this._root = root2;
5052
- return root2;
5053
- }
5054
- }
5055
- get [Symbol.toStringTag]() {
5056
- return "NoWorkResult";
5057
- }
5058
5091
  }
5059
5092
  noWorkResult$1 = NoWorkResult;
5060
5093
  NoWorkResult.default = NoWorkResult;
@@ -5071,7 +5104,7 @@ function requireProcessor$1() {
5071
5104
  let Root = requireRoot$1();
5072
5105
  class Processor {
5073
5106
  constructor(plugins = []) {
5074
- this.version = "8.5.1";
5107
+ this.version = "8.5.6";
5075
5108
  this.plugins = this.normalize(plugins);
5076
5109
  }
5077
5110
  normalize(plugins) {
@@ -5344,7 +5377,7 @@ function getDefaultExportFromCjs(x) {
5344
5377
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5345
5378
  }
5346
5379
  function getAugmentedNamespace(n2) {
5347
- if (n2.__esModule) return n2;
5380
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
5348
5381
  var f2 = n2.default;
5349
5382
  if (typeof f2 == "function") {
5350
5383
  var a2 = function a3() {
@@ -5863,6 +5896,9 @@ function requireNode() {
5863
5896
  return offset;
5864
5897
  }
5865
5898
  class Node2 {
5899
+ get proxyOf() {
5900
+ return this;
5901
+ }
5866
5902
  constructor(defaults = {}) {
5867
5903
  this.raws = {};
5868
5904
  this[isClean] = false;
@@ -5981,7 +6017,7 @@ function requireNode() {
5981
6017
  let index2 = this.parent.index(this);
5982
6018
  return this.parent.nodes[index2 + 1];
5983
6019
  }
5984
- positionBy(opts) {
6020
+ positionBy(opts = {}) {
5985
6021
  let pos = this.source.start;
5986
6022
  if (opts.index) {
5987
6023
  pos = this.positionInside(opts.index);
@@ -6010,27 +6046,38 @@ function requireNode() {
6010
6046
  column += 1;
6011
6047
  }
6012
6048
  }
6013
- return { column, line };
6049
+ return { column, line, offset: end };
6014
6050
  }
6015
6051
  prev() {
6016
6052
  if (!this.parent) return void 0;
6017
6053
  let index2 = this.parent.index(this);
6018
6054
  return this.parent.nodes[index2 - 1];
6019
6055
  }
6020
- rangeBy(opts) {
6056
+ rangeBy(opts = {}) {
6057
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6021
6058
  let start = {
6022
6059
  column: this.source.start.column,
6023
- line: this.source.start.line
6060
+ line: this.source.start.line,
6061
+ offset: sourceOffset(inputString, this.source.start)
6024
6062
  };
6025
6063
  let end = this.source.end ? {
6026
6064
  column: this.source.end.column + 1,
6027
- line: this.source.end.line
6065
+ line: this.source.end.line,
6066
+ offset: typeof this.source.end.offset === "number" ? (
6067
+ // `source.end.offset` is exclusive, so we don't need to add 1
6068
+ this.source.end.offset
6069
+ ) : (
6070
+ // Since line/column in this.source.end is inclusive,
6071
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
6072
+ // So, we add 1 to convert it to exclusive.
6073
+ sourceOffset(inputString, this.source.end) + 1
6074
+ )
6028
6075
  } : {
6029
6076
  column: start.column + 1,
6030
- line: start.line
6077
+ line: start.line,
6078
+ offset: start.offset + 1
6031
6079
  };
6032
6080
  if (opts.word) {
6033
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6034
6081
  let stringRepresentation = inputString.slice(
6035
6082
  sourceOffset(inputString, this.source.start),
6036
6083
  sourceOffset(inputString, this.source.end)
@@ -6038,15 +6085,14 @@ function requireNode() {
6038
6085
  let index2 = stringRepresentation.indexOf(opts.word);
6039
6086
  if (index2 !== -1) {
6040
6087
  start = this.positionInside(index2);
6041
- end = this.positionInside(
6042
- index2 + opts.word.length
6043
- );
6088
+ end = this.positionInside(index2 + opts.word.length);
6044
6089
  }
6045
6090
  } else {
6046
6091
  if (opts.start) {
6047
6092
  start = {
6048
6093
  column: opts.start.column,
6049
- line: opts.start.line
6094
+ line: opts.start.line,
6095
+ offset: sourceOffset(inputString, opts.start)
6050
6096
  };
6051
6097
  } else if (opts.index) {
6052
6098
  start = this.positionInside(opts.index);
@@ -6054,7 +6100,8 @@ function requireNode() {
6054
6100
  if (opts.end) {
6055
6101
  end = {
6056
6102
  column: opts.end.column,
6057
- line: opts.end.line
6103
+ line: opts.end.line,
6104
+ offset: sourceOffset(inputString, opts.end)
6058
6105
  };
6059
6106
  } else if (typeof opts.endIndex === "number") {
6060
6107
  end = this.positionInside(opts.endIndex);
@@ -6063,7 +6110,11 @@ function requireNode() {
6063
6110
  }
6064
6111
  }
6065
6112
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
6066
- end = { column: start.column + 1, line: start.line };
6113
+ end = {
6114
+ column: start.column + 1,
6115
+ line: start.line,
6116
+ offset: start.offset + 1
6117
+ };
6067
6118
  }
6068
6119
  return { end, start };
6069
6120
  }
@@ -6127,6 +6178,7 @@ function requireNode() {
6127
6178
  } else if (typeof value === "object" && value.toJSON) {
6128
6179
  fixed[name] = value.toJSON(null, inputs);
6129
6180
  } else if (name === "source") {
6181
+ if (value == null) continue;
6130
6182
  let inputId = inputs.get(value.input);
6131
6183
  if (inputId == null) {
6132
6184
  inputId = inputsNextIndex;
@@ -6161,14 +6213,11 @@ function requireNode() {
6161
6213
  });
6162
6214
  return result2;
6163
6215
  }
6164
- warn(result2, text, opts) {
6216
+ warn(result2, text, opts = {}) {
6165
6217
  let data = { node: this };
6166
6218
  for (let i2 in opts) data[i2] = opts[i2];
6167
6219
  return result2.warn(text, data);
6168
6220
  }
6169
- get proxyOf() {
6170
- return this;
6171
- }
6172
6221
  }
6173
6222
  node = Node2;
6174
6223
  Node2.default = Node2;
@@ -6197,6 +6246,9 @@ function requireDeclaration() {
6197
6246
  hasRequiredDeclaration = 1;
6198
6247
  let Node2 = requireNode();
6199
6248
  class Declaration extends Node2 {
6249
+ get variable() {
6250
+ return this.prop.startsWith("--") || this.prop[0] === "$";
6251
+ }
6200
6252
  constructor(defaults) {
6201
6253
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
6202
6254
  defaults = { ...defaults, value: String(defaults.value) };
@@ -6204,9 +6256,6 @@ function requireDeclaration() {
6204
6256
  super(defaults);
6205
6257
  this.type = "decl";
6206
6258
  }
6207
- get variable() {
6208
- return this.prop.startsWith("--") || this.prop[0] === "$";
6209
- }
6210
6259
  }
6211
6260
  declaration = Declaration;
6212
6261
  Declaration.default = Declaration;
@@ -6238,6 +6287,14 @@ function requireContainer() {
6238
6287
  }
6239
6288
  }
6240
6289
  class Container extends Node2 {
6290
+ get first() {
6291
+ if (!this.proxyOf.nodes) return void 0;
6292
+ return this.proxyOf.nodes[0];
6293
+ }
6294
+ get last() {
6295
+ if (!this.proxyOf.nodes) return void 0;
6296
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6297
+ }
6241
6298
  append(...children) {
6242
6299
  for (let child of children) {
6243
6300
  let nodes = this.normalize(child, this.last);
@@ -6550,14 +6607,6 @@ function requireContainer() {
6550
6607
  }
6551
6608
  });
6552
6609
  }
6553
- get first() {
6554
- if (!this.proxyOf.nodes) return void 0;
6555
- return this.proxyOf.nodes[0];
6556
- }
6557
- get last() {
6558
- if (!this.proxyOf.nodes) return void 0;
6559
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6560
- }
6561
6610
  }
6562
6611
  Container.registerParse = (dependant) => {
6563
6612
  parse = dependant;
@@ -6807,10 +6856,25 @@ function requireInput() {
6807
6856
  let CssSyntaxError = requireCssSyntaxError();
6808
6857
  let PreviousMap = requirePreviousMap();
6809
6858
  let terminalHighlight = require$$2;
6810
- let fromOffsetCache = Symbol("fromOffsetCache");
6859
+ let lineToIndexCache = Symbol("lineToIndexCache");
6811
6860
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
6812
6861
  let pathAvailable = Boolean(resolve && isAbsolute);
6862
+ function getLineToIndex(input2) {
6863
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
6864
+ let lines = input2.css.split("\n");
6865
+ let lineToIndex = new Array(lines.length);
6866
+ let prevIndex = 0;
6867
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6868
+ lineToIndex[i2] = prevIndex;
6869
+ prevIndex += lines[i2].length + 1;
6870
+ }
6871
+ input2[lineToIndexCache] = lineToIndex;
6872
+ return lineToIndex;
6873
+ }
6813
6874
  class Input {
6875
+ get from() {
6876
+ return this.file || this.id;
6877
+ }
6814
6878
  constructor(css, opts = {}) {
6815
6879
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
6816
6880
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -6845,30 +6909,37 @@ function requireInput() {
6845
6909
  if (this.map) this.map.file = this.from;
6846
6910
  }
6847
6911
  error(message, line, column, opts = {}) {
6848
- let endColumn, endLine, result2;
6912
+ let endColumn, endLine, endOffset, offset, result2;
6849
6913
  if (line && typeof line === "object") {
6850
6914
  let start = line;
6851
6915
  let end = column;
6852
6916
  if (typeof start.offset === "number") {
6853
- let pos = this.fromOffset(start.offset);
6917
+ offset = start.offset;
6918
+ let pos = this.fromOffset(offset);
6854
6919
  line = pos.line;
6855
6920
  column = pos.col;
6856
6921
  } else {
6857
6922
  line = start.line;
6858
6923
  column = start.column;
6924
+ offset = this.fromLineAndColumn(line, column);
6859
6925
  }
6860
6926
  if (typeof end.offset === "number") {
6861
- let pos = this.fromOffset(end.offset);
6927
+ endOffset = end.offset;
6928
+ let pos = this.fromOffset(endOffset);
6862
6929
  endLine = pos.line;
6863
6930
  endColumn = pos.col;
6864
6931
  } else {
6865
6932
  endLine = end.line;
6866
6933
  endColumn = end.column;
6934
+ endOffset = this.fromLineAndColumn(end.line, end.column);
6867
6935
  }
6868
6936
  } else if (!column) {
6869
- let pos = this.fromOffset(line);
6937
+ offset = line;
6938
+ let pos = this.fromOffset(offset);
6870
6939
  line = pos.line;
6871
6940
  column = pos.col;
6941
+ } else {
6942
+ offset = this.fromLineAndColumn(line, column);
6872
6943
  }
6873
6944
  let origin = this.origin(line, column, endLine, endColumn);
6874
6945
  if (origin) {
@@ -6890,7 +6961,7 @@ function requireInput() {
6890
6961
  opts.plugin
6891
6962
  );
6892
6963
  }
6893
- result2.input = { column, endColumn, endLine, line, source: this.css };
6964
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
6894
6965
  if (this.file) {
6895
6966
  if (pathToFileURL) {
6896
6967
  result2.input.url = pathToFileURL(this.file).toString();
@@ -6899,21 +6970,14 @@ function requireInput() {
6899
6970
  }
6900
6971
  return result2;
6901
6972
  }
6973
+ fromLineAndColumn(line, column) {
6974
+ let lineToIndex = getLineToIndex(this);
6975
+ let index2 = lineToIndex[line - 1];
6976
+ return index2 + column - 1;
6977
+ }
6902
6978
  fromOffset(offset) {
6903
- let lastLine, lineToIndex;
6904
- if (!this[fromOffsetCache]) {
6905
- let lines = this.css.split("\n");
6906
- lineToIndex = new Array(lines.length);
6907
- let prevIndex = 0;
6908
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6909
- lineToIndex[i2] = prevIndex;
6910
- prevIndex += lines[i2].length + 1;
6911
- }
6912
- this[fromOffsetCache] = lineToIndex;
6913
- } else {
6914
- lineToIndex = this[fromOffsetCache];
6915
- }
6916
- lastLine = lineToIndex[lineToIndex.length - 1];
6979
+ let lineToIndex = getLineToIndex(this);
6980
+ let lastLine = lineToIndex[lineToIndex.length - 1];
6917
6981
  let min = 0;
6918
6982
  if (offset >= lastLine) {
6919
6983
  min = lineToIndex.length - 1;
@@ -6994,9 +7058,6 @@ function requireInput() {
6994
7058
  }
6995
7059
  return json;
6996
7060
  }
6997
- get from() {
6998
- return this.file || this.id;
6999
- }
7000
7061
  }
7001
7062
  input = Input;
7002
7063
  Input.default = Input;
@@ -7122,11 +7183,6 @@ function requireRule() {
7122
7183
  let Container = requireContainer();
7123
7184
  let list = requireList();
7124
7185
  class Rule extends Container {
7125
- constructor(defaults) {
7126
- super(defaults);
7127
- this.type = "rule";
7128
- if (!this.nodes) this.nodes = [];
7129
- }
7130
7186
  get selectors() {
7131
7187
  return list.comma(this.selector);
7132
7188
  }
@@ -7135,6 +7191,11 @@ function requireRule() {
7135
7191
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
7136
7192
  this.selector = values.join(sep);
7137
7193
  }
7194
+ constructor(defaults) {
7195
+ super(defaults);
7196
+ this.type = "rule";
7197
+ if (!this.nodes) this.nodes = [];
7198
+ }
7138
7199
  }
7139
7200
  rule = Rule;
7140
7201
  Rule.default = Rule;
@@ -8034,6 +8095,8 @@ function requireParser() {
8034
8095
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
8035
8096
  prev.raws.ownSemicolon = this.spaces;
8036
8097
  this.spaces = "";
8098
+ prev.source.end = this.getPosition(token[2]);
8099
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
8037
8100
  }
8038
8101
  }
8039
8102
  }
@@ -8245,7 +8308,7 @@ function requireParser() {
8245
8308
  }
8246
8309
  unknownWord(tokens) {
8247
8310
  throw this.input.error(
8248
- "Unknown word",
8311
+ "Unknown word " + tokens[0][1],
8249
8312
  { offset: tokens[0][2] },
8250
8313
  { offset: tokens[0][2] + tokens[0][1].length }
8251
8314
  );
@@ -8338,12 +8401,15 @@ function requireResult() {
8338
8401
  hasRequiredResult = 1;
8339
8402
  let Warning = requireWarning();
8340
8403
  class Result {
8404
+ get content() {
8405
+ return this.css;
8406
+ }
8341
8407
  constructor(processor2, root2, opts) {
8342
8408
  this.processor = processor2;
8343
8409
  this.messages = [];
8344
8410
  this.root = root2;
8345
8411
  this.opts = opts;
8346
- this.css = void 0;
8412
+ this.css = "";
8347
8413
  this.map = void 0;
8348
8414
  }
8349
8415
  toString() {
@@ -8362,9 +8428,6 @@ function requireResult() {
8362
8428
  warnings() {
8363
8429
  return this.messages.filter((i2) => i2.type === "warning");
8364
8430
  }
8365
- get content() {
8366
- return this.css;
8367
- }
8368
8431
  }
8369
8432
  result = Result;
8370
8433
  Result.default = Result;
@@ -8483,6 +8546,30 @@ function requireLazyResult() {
8483
8546
  }
8484
8547
  let postcss2 = {};
8485
8548
  class LazyResult {
8549
+ get content() {
8550
+ return this.stringify().content;
8551
+ }
8552
+ get css() {
8553
+ return this.stringify().css;
8554
+ }
8555
+ get map() {
8556
+ return this.stringify().map;
8557
+ }
8558
+ get messages() {
8559
+ return this.sync().messages;
8560
+ }
8561
+ get opts() {
8562
+ return this.result.opts;
8563
+ }
8564
+ get processor() {
8565
+ return this.result.processor;
8566
+ }
8567
+ get root() {
8568
+ return this.sync().root;
8569
+ }
8570
+ get [Symbol.toStringTag]() {
8571
+ return "LazyResult";
8572
+ }
8486
8573
  constructor(processor2, css, opts) {
8487
8574
  this.stringified = false;
8488
8575
  this.processed = false;
@@ -8825,30 +8912,6 @@ function requireLazyResult() {
8825
8912
  warnings() {
8826
8913
  return this.sync().warnings();
8827
8914
  }
8828
- get content() {
8829
- return this.stringify().content;
8830
- }
8831
- get css() {
8832
- return this.stringify().css;
8833
- }
8834
- get map() {
8835
- return this.stringify().map;
8836
- }
8837
- get messages() {
8838
- return this.sync().messages;
8839
- }
8840
- get opts() {
8841
- return this.result.opts;
8842
- }
8843
- get processor() {
8844
- return this.result.processor;
8845
- }
8846
- get root() {
8847
- return this.sync().root;
8848
- }
8849
- get [Symbol.toStringTag]() {
8850
- return "LazyResult";
8851
- }
8852
8915
  }
8853
8916
  LazyResult.registerPostcss = (dependant) => {
8854
8917
  postcss2 = dependant;
@@ -8870,6 +8933,45 @@ function requireNoWorkResult() {
8870
8933
  let stringify = requireStringify();
8871
8934
  let warnOnce2 = requireWarnOnce();
8872
8935
  class NoWorkResult {
8936
+ get content() {
8937
+ return this.result.css;
8938
+ }
8939
+ get css() {
8940
+ return this.result.css;
8941
+ }
8942
+ get map() {
8943
+ return this.result.map;
8944
+ }
8945
+ get messages() {
8946
+ return [];
8947
+ }
8948
+ get opts() {
8949
+ return this.result.opts;
8950
+ }
8951
+ get processor() {
8952
+ return this.result.processor;
8953
+ }
8954
+ get root() {
8955
+ if (this._root) {
8956
+ return this._root;
8957
+ }
8958
+ let root2;
8959
+ let parser2 = parse;
8960
+ try {
8961
+ root2 = parser2(this._css, this._opts);
8962
+ } catch (error) {
8963
+ this.error = error;
8964
+ }
8965
+ if (this.error) {
8966
+ throw this.error;
8967
+ } else {
8968
+ this._root = root2;
8969
+ return root2;
8970
+ }
8971
+ }
8972
+ get [Symbol.toStringTag]() {
8973
+ return "NoWorkResult";
8974
+ }
8873
8975
  constructor(processor2, css, opts) {
8874
8976
  css = css.toString();
8875
8977
  this.stringified = false;
@@ -8931,45 +9033,6 @@ function requireNoWorkResult() {
8931
9033
  warnings() {
8932
9034
  return [];
8933
9035
  }
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
- }
8973
9036
  }
8974
9037
  noWorkResult = NoWorkResult;
8975
9038
  NoWorkResult.default = NoWorkResult;
@@ -8986,7 +9049,7 @@ function requireProcessor() {
8986
9049
  let Root = requireRoot();
8987
9050
  class Processor {
8988
9051
  constructor(plugins = []) {
8989
- this.version = "8.5.1";
9052
+ this.version = "8.5.6";
8990
9053
  this.plugins = this.normalize(plugins);
8991
9054
  }
8992
9055
  normalize(plugins) {
@@ -10401,7 +10464,7 @@ const callbackWrapper = (cb) => {
10401
10464
  if (!errorHandler) {
10402
10465
  return cb;
10403
10466
  }
10404
- const rrwebWrapped = (...rest) => {
10467
+ const rrwebWrapped = ((...rest) => {
10405
10468
  try {
10406
10469
  return cb(...rest);
10407
10470
  } catch (error) {
@@ -10410,7 +10473,7 @@ const callbackWrapper = (cb) => {
10410
10473
  }
10411
10474
  throw error;
10412
10475
  }
10413
- };
10476
+ });
10414
10477
  return rrwebWrapped;
10415
10478
  };
10416
10479
  const mutationBuffers = [];
@@ -11168,7 +11231,11 @@ function initFontObserver({ fontCb, doc }) {
11168
11231
  const fontMap = /* @__PURE__ */ new WeakMap();
11169
11232
  const originalFontFace = win.FontFace;
11170
11233
  win.FontFace = function FontFace2(family, source, descriptors) {
11171
- const fontFace = new originalFontFace(family, source, descriptors);
11234
+ const fontFace = new originalFontFace(
11235
+ family,
11236
+ source,
11237
+ descriptors
11238
+ );
11172
11239
  fontMap.set(fontFace, {
11173
11240
  family,
11174
11241
  buffer: typeof source !== "string",
@@ -11530,13 +11597,18 @@ class IframeManager {
11530
11597
  removeLoadListener() {
11531
11598
  this.loadListener = void 0;
11532
11599
  }
11600
+ trackIframeContent(iframeEl, content) {
11601
+ const iframeId = this.mirror.getId(iframeEl);
11602
+ this.attachedIframes.set(iframeId, { element: iframeEl, content });
11603
+ return iframeId;
11604
+ }
11533
11605
  attachIframe(iframeEl, childSn) {
11534
11606
  var _a2;
11535
- this.attachedIframes.set(iframeEl, childSn);
11607
+ const iframeId = this.trackIframeContent(iframeEl, childSn);
11536
11608
  this.mutationCb({
11537
11609
  adds: [
11538
11610
  {
11539
- parentId: this.mirror.getId(iframeEl),
11611
+ parentId: iframeId,
11540
11612
  nextId: null,
11541
11613
  node: childSn
11542
11614
  }
@@ -11588,7 +11660,7 @@ class IframeManager {
11588
11660
  const rootId = e2.data.node.id;
11589
11661
  this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
11590
11662
  this.patchRootIdOnNode(e2.data.node, rootId);
11591
- this.attachedIframes.set(iframeEl, e2.data.node);
11663
+ this.trackIframeContent(iframeEl, e2.data.node);
11592
11664
  return {
11593
11665
  timestamp: e2.timestamp,
11594
11666
  type: EventType.IncrementalSnapshot,
@@ -11731,21 +11803,27 @@ class IframeManager {
11731
11803
  });
11732
11804
  }
11733
11805
  }
11806
+ removeIframeById(iframeId) {
11807
+ const entry = this.attachedIframes.get(iframeId);
11808
+ if (!entry) return;
11809
+ const win = entry.element.contentWindow;
11810
+ if (win && this.nestedIframeListeners.has(win)) {
11811
+ const handler = this.nestedIframeListeners.get(win);
11812
+ win.removeEventListener("message", handler);
11813
+ this.nestedIframeListeners.delete(win);
11814
+ }
11815
+ this.attachedIframes.delete(iframeId);
11816
+ }
11734
11817
  reattachIframes() {
11735
- this.attachedIframes.forEach((content, iframe) => {
11736
- if (!iframe.isConnected) {
11737
- this.attachedIframes.delete(iframe);
11738
- return;
11739
- }
11740
- const parentId = this.mirror.getId(iframe);
11741
- if (parentId === -1) {
11742
- this.attachedIframes.delete(iframe);
11818
+ this.attachedIframes.forEach(({ content }, iframeId) => {
11819
+ if (!this.mirror.has(iframeId)) {
11820
+ this.attachedIframes.delete(iframeId);
11743
11821
  return;
11744
11822
  }
11745
11823
  this.mutationCb({
11746
11824
  adds: [
11747
11825
  {
11748
- parentId,
11826
+ parentId: iframeId,
11749
11827
  nextId: null,
11750
11828
  node: content
11751
11829
  }
@@ -12700,6 +12778,11 @@ function record(options = {}) {
12700
12778
  }
12701
12779
  };
12702
12780
  const wrappedMutationEmit = (m) => {
12781
+ if (recordCrossOriginIframes && m.removes) {
12782
+ m.removes.forEach(({ id }) => {
12783
+ iframeManager.removeIframeById(id);
12784
+ });
12785
+ }
12703
12786
  wrappedEmit({
12704
12787
  type: EventType.IncrementalSnapshot,
12705
12788
  data: {
@@ -13059,9 +13142,9 @@ record.takeFullSnapshot = (isCheckout) => {
13059
13142
  };
13060
13143
  record.mirror = mirror;
13061
13144
  var n;
13062
- !function(t2) {
13145
+ !(function(t2) {
13063
13146
  t2[t2.NotStarted = 0] = "NotStarted", t2[t2.Running = 1] = "Running", t2[t2.Stopped = 2] = "Stopped";
13064
- }(n || (n = {}));
13147
+ })(n || (n = {}));
13065
13148
  const { addCustomEvent } = record;
13066
13149
  const { freezePage } = record;
13067
13150
  const { takeFullSnapshot } = record;