@esposter/shared 2.36.0 → 2.37.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -122,6 +122,9 @@ let MentionType = /* @__PURE__ */ function(MentionType) {
122
122
  }({});
123
123
  const MAX_READ_LIMIT = 1e3;
124
124
  const SITE_NAME = "Esposter";
125
+ const KIBIBYTE = 1024;
126
+ const MEGABYTE = KIBIBYTE ** 2;
127
+ const GIBIBYTE = MEGABYTE * KIBIBYTE;
125
128
  const RoutePath = {
126
129
  About: "/about",
127
130
  Achievements: "/achievements",
@@ -145,13 +148,16 @@ const RoutePath = {
145
148
  PostCreate: "/post/create",
146
149
  PostUpdate: (id) => `/post/update/${id}`,
147
150
  PrivacyPolicy: "/privacy-policy",
148
- Resource: (id) => `/resources/${id}`,
149
- ResourceItems: (id) => `/resources/${id}/items`,
150
- Resources: "/resources",
151
- ResourcesAll: "/resources/all",
152
- ResourcesCreate: "/resources/create",
153
- ResourcesCreateType: (type) => `/resources/create/${type}`,
154
- ResourcesRecycleBin: "/resources/recycle-bin",
151
+ Resource: (id) => `/resource-explorer/${id}`,
152
+ ResourceExplorer: "/resource-explorer",
153
+ ResourceExplorerAll: "/resource-explorer/all",
154
+ ResourceExplorerCreate: "/resource-explorer/create",
155
+ ResourceExplorerCreateType: (type) => `/resource-explorer/create/${type}`,
156
+ ResourceExplorerFavorites: "/resource-explorer/favorites",
157
+ ResourceExplorerRecents: "/resource-explorer/recents",
158
+ ResourceExplorerRecycleBin: "/resource-explorer/recycle-bin",
159
+ ResourceExplorerTags: "/resource-explorer/tags",
160
+ ResourceItems: (id) => `/resource-explorer/${id}/items`,
155
161
  User: (id) => `/user/${id}`,
156
162
  UserSettings: "/user/settings",
157
163
  View: (type, id) => `/view/${type}/${id}`
@@ -5545,10 +5551,10 @@ parse.NodeType = NodeType;
5545
5551
  const getMentions = (message) => parse(message).querySelectorAll(`span[${MENTION_TYPE_ATTRIBUTE}='${MENTION_TYPE}']`);
5546
5552
  const BROADCAST_MENTION_IDS = /* @__PURE__ */ new Set([MENTION_EVERYONE_ID, MENTION_HERE_ID]);
5547
5553
  const classifyMentions = (message) => {
5548
- const mentions = getMentions(message).map((m) => ({
5549
- id: m.getAttribute(MENTION_ID_ATTRIBUTE),
5550
- type: m.getAttribute(MENTION_ITEM_TYPE_ATTRIBUTE)
5551
- })).filter((m) => Boolean(m.id));
5554
+ const mentions = getMentions(message).map((mention) => ({
5555
+ id: mention.getAttribute(MENTION_ID_ATTRIBUTE),
5556
+ type: mention.getAttribute(MENTION_ITEM_TYPE_ATTRIBUTE)
5557
+ })).filter((mention) => Boolean(mention.id));
5552
5558
  return {
5553
5559
  broadcastIds: mentions.filter(({ id }) => BROADCAST_MENTION_IDS.has(id)).map(({ id }) => id),
5554
5560
  regularUserIds: mentions.filter(({ id, type }) => !BROADCAST_MENTION_IDS.has(id) && type !== "role").map(({ id }) => id),
@@ -6411,15 +6417,16 @@ var init_Tokenizer = __esmMin((() => {
6411
6417
  if (c === CharCodes.ExclamationMark) {
6412
6418
  this.state = State.BeforeDeclaration;
6413
6419
  this.sectionStart = this.index + 1;
6414
- } else if (c === CharCodes.Questionmark) if (this.xmlMode) {
6415
- this.state = State.InProcessingInstruction;
6416
- this.sequenceIndex = 0;
6417
- this.sectionStart = this.index + 1;
6418
- } else {
6419
- this.state = State.InSpecialComment;
6420
- this.sectionStart = this.index;
6421
- }
6422
- else if (this.isTagStartChar(c)) {
6420
+ } else if (c === CharCodes.Questionmark) {
6421
+ if (this.xmlMode) {
6422
+ this.state = State.InProcessingInstruction;
6423
+ this.sequenceIndex = 0;
6424
+ this.sectionStart = this.index + 1;
6425
+ } else {
6426
+ this.state = State.InSpecialComment;
6427
+ this.sectionStart = this.index;
6428
+ }
6429
+ } else if (this.isTagStartChar(c)) {
6423
6430
  this.sectionStart = this.index;
6424
6431
  const special = this.xmlMode || this.cbs.isInForeignContext?.() ? void 0 : specialStartSequences.get(c | 32);
6425
6432
  if (special === void 0) this.state = State.InTagName;
@@ -6444,11 +6451,12 @@ var init_Tokenizer = __esmMin((() => {
6444
6451
  }
6445
6452
  }
6446
6453
  stateBeforeClosingTagName(c) {
6447
- if (isWhitespace(c)) if (this.xmlMode) {} else {
6448
- this.state = State.InSpecialComment;
6449
- this.sectionStart = this.index;
6450
- }
6451
- else if (c === CharCodes.Gt) {
6454
+ if (isWhitespace(c)) {
6455
+ if (this.xmlMode) {} else {
6456
+ this.state = State.InSpecialComment;
6457
+ this.sectionStart = this.index;
6458
+ }
6459
+ } else if (c === CharCodes.Gt) {
6452
6460
  this.state = State.Text;
6453
6461
  if (!this.xmlMode) this.sectionStart = this.index + 1;
6454
6462
  } else {
@@ -6787,13 +6795,14 @@ var init_Tokenizer = __esmMin((() => {
6787
6795
  }
6788
6796
  handleTrailingCommentLikeData(endIndex) {
6789
6797
  if (this.state !== State.InCommentLike) return false;
6790
- if (this.currentSequence === Sequences.CdataEnd) if (this.xmlMode) {
6791
- if (this.sectionStart < endIndex) this.cbs.oncdata(this.sectionStart, endIndex, 0);
6798
+ if (this.currentSequence === Sequences.CdataEnd) {
6799
+ if (this.xmlMode) {
6800
+ if (this.sectionStart < endIndex) this.cbs.oncdata(this.sectionStart, endIndex, 0);
6801
+ } else {
6802
+ const cdataStart = this.sectionStart - Sequences.Cdata.length - 1;
6803
+ this.cbs.oncomment(cdataStart, endIndex, 0);
6804
+ }
6792
6805
  } else {
6793
- const cdataStart = this.sectionStart - Sequences.Cdata.length - 1;
6794
- this.cbs.oncomment(cdataStart, endIndex, 0);
6795
- }
6796
- else {
6797
6806
  const offset = this.xmlMode ? 0 : Math.min(this.sequenceIndex, Sequences.CommentEnd.length - 1);
6798
6807
  this.cbs.oncomment(this.sectionStart, endIndex, offset);
6799
6808
  }
@@ -9141,39 +9150,43 @@ var require_parse_srcset = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
9141
9150
  state = "in descriptor";
9142
9151
  while (true) {
9143
9152
  c = input.charAt(pos);
9144
- if (state === "in descriptor") if (isSpace(c)) {
9145
- if (currentDescriptor) {
9153
+ if (state === "in descriptor") {
9154
+ if (isSpace(c)) {
9155
+ if (currentDescriptor) {
9156
+ descriptors.push(currentDescriptor);
9157
+ currentDescriptor = "";
9158
+ state = "after descriptor";
9159
+ }
9160
+ } else if (c === ",") {
9161
+ pos += 1;
9162
+ if (currentDescriptor) descriptors.push(currentDescriptor);
9163
+ parseDescriptors();
9164
+ return;
9165
+ } else if (c === "(") {
9166
+ currentDescriptor = currentDescriptor + c;
9167
+ state = "in parens";
9168
+ } else if (c === "") {
9169
+ if (currentDescriptor) descriptors.push(currentDescriptor);
9170
+ parseDescriptors();
9171
+ return;
9172
+ } else currentDescriptor = currentDescriptor + c;
9173
+ } else if (state === "in parens") {
9174
+ if (c === ")") {
9175
+ currentDescriptor = currentDescriptor + c;
9176
+ state = "in descriptor";
9177
+ } else if (c === "") {
9146
9178
  descriptors.push(currentDescriptor);
9147
- currentDescriptor = "";
9148
- state = "after descriptor";
9179
+ parseDescriptors();
9180
+ return;
9181
+ } else currentDescriptor = currentDescriptor + c;
9182
+ } else if (state === "after descriptor") {
9183
+ if (isSpace(c)) {} else if (c === "") {
9184
+ parseDescriptors();
9185
+ return;
9186
+ } else {
9187
+ state = "in descriptor";
9188
+ pos -= 1;
9149
9189
  }
9150
- } else if (c === ",") {
9151
- pos += 1;
9152
- if (currentDescriptor) descriptors.push(currentDescriptor);
9153
- parseDescriptors();
9154
- return;
9155
- } else if (c === "(") {
9156
- currentDescriptor = currentDescriptor + c;
9157
- state = "in parens";
9158
- } else if (c === "") {
9159
- if (currentDescriptor) descriptors.push(currentDescriptor);
9160
- parseDescriptors();
9161
- return;
9162
- } else currentDescriptor = currentDescriptor + c;
9163
- else if (state === "in parens") if (c === ")") {
9164
- currentDescriptor = currentDescriptor + c;
9165
- state = "in descriptor";
9166
- } else if (c === "") {
9167
- descriptors.push(currentDescriptor);
9168
- parseDescriptors();
9169
- return;
9170
- } else currentDescriptor = currentDescriptor + c;
9171
- else if (state === "after descriptor") if (isSpace(c)) {} else if (c === "") {
9172
- parseDescriptors();
9173
- return;
9174
- } else {
9175
- state = "in descriptor";
9176
- pos -= 1;
9177
9190
  }
9178
9191
  pos += 1;
9179
9192
  }
@@ -9278,14 +9291,16 @@ var require_css_syntax_error = /* @__PURE__ */ __commonJSMin$1(((exports, module
9278
9291
  if (file) this.file = file;
9279
9292
  if (source) this.source = source;
9280
9293
  if (plugin) this.plugin = plugin;
9281
- if (typeof line !== "undefined" && typeof column !== "undefined") if (typeof line === "number") {
9282
- this.line = line;
9283
- this.column = column;
9284
- } else {
9285
- this.line = line.line;
9286
- this.column = line.column;
9287
- this.endLine = column.line;
9288
- this.endColumn = column.column;
9294
+ if (typeof line !== "undefined" && typeof column !== "undefined") {
9295
+ if (typeof line === "number") {
9296
+ this.line = line;
9297
+ this.column = column;
9298
+ } else {
9299
+ this.line = line.line;
9300
+ this.column = line.column;
9301
+ this.endLine = column.line;
9302
+ this.endColumn = column.column;
9303
+ }
9289
9304
  }
9290
9305
  this.setMessage();
9291
9306
  if (Error.captureStackTrace) Error.captureStackTrace(this, CssSyntaxError);
@@ -9975,21 +9990,23 @@ var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
9975
9990
  fixed[name] = fixedArray;
9976
9991
  for (let i = 0; i < value.length; i++) {
9977
9992
  let item = value[i];
9978
- if (typeof item === "object" && item.toJSON) if (item.toJSON === Node.prototype.toJSON) queue.push([
9979
- item,
9980
- fixedArray,
9981
- i
9982
- ]);
9983
- else fixedArray[i] = item.toJSON(null, inputs);
9984
- else fixedArray[i] = item;
9993
+ if (typeof item === "object" && item.toJSON) {
9994
+ if (item.toJSON === Node.prototype.toJSON) queue.push([
9995
+ item,
9996
+ fixedArray,
9997
+ i
9998
+ ]);
9999
+ else fixedArray[i] = item.toJSON(null, inputs);
10000
+ } else fixedArray[i] = item;
9985
10001
  }
9986
- } else if (typeof value === "object" && value.toJSON) if (value.toJSON === Node.prototype.toJSON) queue.push([
9987
- value,
9988
- fixed,
9989
- name
9990
- ]);
9991
- else fixed[name] = value.toJSON(null, inputs);
9992
- else if (name === "source") {
10002
+ } else if (typeof value === "object" && value.toJSON) {
10003
+ if (value.toJSON === Node.prototype.toJSON) queue.push([
10004
+ value,
10005
+ fixed,
10006
+ name
10007
+ ]);
10008
+ else fixed[name] = value.toJSON(null, inputs);
10009
+ } else if (name === "source") {
9993
10010
  if (value == null) continue;
9994
10011
  let inputId = inputs.get(value.input);
9995
10012
  if (inputId == null) {
@@ -10460,9 +10477,16 @@ var require_non_secure = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10460
10477
  }));
10461
10478
  var require_lib = /* @__PURE__ */ __commonJSMin$1((() => {}));
10462
10479
  var require_previous_map = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10463
- let { existsSync, readFileSync } = require_lib();
10480
+ let { existsSync, readFileSync, realpathSync } = require_lib();
10464
10481
  let { dirname, isAbsolute, join, relative, sep } = require_lib();
10465
10482
  let { SourceMapConsumer, SourceMapGenerator } = require_lib();
10483
+ function realPath(path) {
10484
+ try {
10485
+ return realpathSync(path);
10486
+ } catch {
10487
+ return path;
10488
+ }
10489
+ }
10466
10490
  function fromBase64(str) {
10467
10491
  if (Buffer) return Buffer.from(str, "base64").toString();
10468
10492
  else
@@ -10514,7 +10538,7 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
10514
10538
  if (!trusted && !this.unsafeMap) {
10515
10539
  if (!/\.map$/i.test(path)) return void 0;
10516
10540
  if (!cssFile) return void 0;
10517
- let rel = relative(dirname(cssFile), path);
10541
+ let rel = relative(realPath(dirname(cssFile)), realPath(path));
10518
10542
  if (rel === ".." || rel.startsWith(".." + sep) || isAbsolute(rel)) return;
10519
10543
  }
10520
10544
  this.root = dirname(path);
@@ -10525,19 +10549,20 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
10525
10549
  }
10526
10550
  loadMap(file, prev) {
10527
10551
  if (prev === false) return false;
10528
- if (prev) if (typeof prev === "string") return prev;
10529
- else if (typeof prev === "function") {
10530
- let prevPath = prev(file);
10531
- if (prevPath) {
10532
- let map = this.loadFile(prevPath, file, true);
10533
- if (!map) throw new Error("Unable to load previous source map: " + prevPath.toString());
10534
- return map;
10535
- }
10536
- } else if (prev instanceof SourceMapConsumer) return SourceMapGenerator.fromSourceMap(prev).toString();
10537
- else if (prev instanceof SourceMapGenerator) return prev.toString();
10538
- else if (this.isMap(prev)) return JSON.stringify(prev);
10539
- else throw new Error("Unsupported previous source map format: " + prev.toString());
10540
- else if (this.inline) return this.decodeInline(this.annotation);
10552
+ if (prev) {
10553
+ if (typeof prev === "string") return prev;
10554
+ else if (typeof prev === "function") {
10555
+ let prevPath = prev(file);
10556
+ if (prevPath) {
10557
+ let map = this.loadFile(prevPath, file, true);
10558
+ if (!map) throw new Error("Unable to load previous source map: " + prevPath.toString());
10559
+ return map;
10560
+ }
10561
+ } else if (prev instanceof SourceMapConsumer) return SourceMapGenerator.fromSourceMap(prev).toString();
10562
+ else if (prev instanceof SourceMapGenerator) return prev.toString();
10563
+ else if (this.isMap(prev)) return JSON.stringify(prev);
10564
+ else throw new Error("Unsupported previous source map format: " + prev.toString());
10565
+ } else if (this.inline) return this.decodeInline(this.annotation);
10541
10566
  else if (this.annotation) {
10542
10567
  let map = this.annotation;
10543
10568
  if (file) map = join(dirname(file), map);
@@ -10598,8 +10623,10 @@ var require_input = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10598
10623
  } else this.hasBOM = false;
10599
10624
  this.document = this.css;
10600
10625
  if (opts.document) this.document = opts.document.toString();
10601
- if (opts.from) if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) this.file = opts.from;
10602
- else this.file = resolve(opts.from);
10626
+ if (opts.from) {
10627
+ if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) this.file = opts.from;
10628
+ else this.file = resolve(opts.from);
10629
+ }
10603
10630
  if (pathAvailable && sourceMapAvailable) {
10604
10631
  let map = new PreviousMap(this.css, opts);
10605
10632
  if (map.text) {
@@ -10728,10 +10755,12 @@ var require_input = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10728
10755
  line: from.line,
10729
10756
  url: fromUrl.toString()
10730
10757
  };
10731
- if (fromUrl.protocol === "file:") if (fileURLToPath) result.file = fileURLToPath(fromUrl);
10732
- else
10758
+ if (fromUrl.protocol === "file:") {
10759
+ if (fileURLToPath) result.file = fileURLToPath(fromUrl);
10760
+ else
10733
10761
  /* c8 ignore next 2 */
10734
- throw new Error(`file: protocol is not available in this PostCSS build`);
10762
+ throw new Error(`file: protocol is not available in this PostCSS build`);
10763
+ }
10735
10764
  let source = consumer.sourceContentFor(from.source);
10736
10765
  if (source) result.source = source;
10737
10766
  return result;
@@ -10770,9 +10799,10 @@ var require_root = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10770
10799
  for (let node of Array.isArray(child) ? child : [child]) if (node && typeof node === "object" && !node.parent && node.raws && typeof node.raws.before !== "undefined") keepBefore.add(node.raws);
10771
10800
  let nodes = super.normalize(child);
10772
10801
  if (sample) {
10773
- if (type === "prepend") if (this.nodes.length > 1) sample.raws.before = this.nodes[1].raws.before;
10774
- else delete sample.raws.before;
10775
- else if (this.first !== sample) {
10802
+ if (type === "prepend") {
10803
+ if (this.nodes.length > 1) sample.raws.before = this.nodes[1].raws.before;
10804
+ else delete sample.raws.before;
10805
+ } else if (this.first !== sample) {
10776
10806
  for (let node of nodes) if (!keepBefore.has(node.raws)) node.raws.before = sample.raws.before;
10777
10807
  }
10778
10808
  }
@@ -10810,7 +10840,7 @@ var require_list = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10810
10840
  ]);
10811
10841
  },
10812
10842
  split(string, separators, last) {
10813
- if (!string) return [];
10843
+ if (typeof string !== "string") return [];
10814
10844
  let array = [];
10815
10845
  let current = "";
10816
10846
  let split = false;
@@ -11091,20 +11121,22 @@ var require_map_generator = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
11091
11121
  } else column += str.length;
11092
11122
  if (node && type !== "start") {
11093
11123
  let p = node.parent || { raws: {} };
11094
- if (!(node.type === "decl" || node.type === "atrule" && !node.nodes) || node !== p.last || p.raws.semicolon) if (node.source && node.source.end) {
11095
- mapping.source = this.sourcePath(node);
11096
- mapping.original.line = node.source.end.line;
11097
- mapping.original.column = node.source.end.column - 1;
11098
- mapping.generated.line = line;
11099
- mapping.generated.column = column - 2;
11100
- this.map.addMapping(mapping);
11101
- } else {
11102
- mapping.source = noSource;
11103
- mapping.original.line = 1;
11104
- mapping.original.column = 0;
11105
- mapping.generated.line = line;
11106
- mapping.generated.column = column - 1;
11107
- this.map.addMapping(mapping);
11124
+ if (!(node.type === "decl" || node.type === "atrule" && !node.nodes) || node !== p.last || p.raws.semicolon) {
11125
+ if (node.source && node.source.end) {
11126
+ mapping.source = this.sourcePath(node);
11127
+ mapping.original.line = node.source.end.line;
11128
+ mapping.original.column = node.source.end.column - 1;
11129
+ mapping.generated.line = line;
11130
+ mapping.generated.column = column - 2;
11131
+ this.map.addMapping(mapping);
11132
+ } else {
11133
+ mapping.source = noSource;
11134
+ mapping.original.line = 1;
11135
+ mapping.original.column = 0;
11136
+ mapping.generated.line = line;
11137
+ mapping.generated.column = column - 1;
11138
+ this.map.addMapping(mapping);
11139
+ }
11108
11140
  }
11109
11141
  }
11110
11142
  });
@@ -11295,10 +11327,12 @@ var require_tokenize = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11295
11327
  do {
11296
11328
  escaped = false;
11297
11329
  next = css.indexOf(")", next + 1);
11298
- if (next === -1) if (ignore || ignoreUnclosed) {
11299
- next = pos;
11300
- break;
11301
- } else unclosed("bracket");
11330
+ if (next === -1) {
11331
+ if (ignore || ignoreUnclosed) {
11332
+ next = pos;
11333
+ break;
11334
+ } else unclosed("bracket");
11335
+ }
11302
11336
  escapePos = next;
11303
11337
  while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
11304
11338
  escapePos -= 1;
@@ -11345,10 +11379,12 @@ var require_tokenize = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11345
11379
  do {
11346
11380
  escaped = false;
11347
11381
  next = css.indexOf(quote, next + 1);
11348
- if (next === -1) if (ignore || ignoreUnclosed) {
11349
- next = pos + 1;
11350
- break;
11351
- } else unclosed("string");
11382
+ if (next === -1) {
11383
+ if (ignore || ignoreUnclosed) {
11384
+ next = pos + 1;
11385
+ break;
11386
+ } else unclosed("string");
11387
+ }
11352
11388
  escapePos = next;
11353
11389
  while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
11354
11390
  escapePos -= 1;
@@ -11401,8 +11437,10 @@ var require_tokenize = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11401
11437
  break;
11402
11438
  default: if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
11403
11439
  next = css.indexOf("*/", pos + 2) + 1;
11404
- if (next === 0) if (ignore || ignoreUnclosed) next = css.length;
11405
- else unclosed("comment");
11440
+ if (next === 0) {
11441
+ if (ignore || ignoreUnclosed) next = css.length;
11442
+ else unclosed("comment");
11443
+ }
11406
11444
  currentToken = [
11407
11445
  "comment",
11408
11446
  css.slice(pos, next + 1),
@@ -11497,28 +11535,29 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11497
11535
  if (type === "(" || type === "[") brackets.push(type === "(" ? ")" : "]");
11498
11536
  else if (type === "{" && brackets.length > 0) brackets.push("}");
11499
11537
  else if (type === brackets[brackets.length - 1]) brackets.pop();
11500
- if (brackets.length === 0) if (type === ";") {
11501
- node.source.end = this.getPosition(token[2]);
11502
- node.source.end.offset++;
11503
- this.semicolon = true;
11504
- break;
11505
- } else if (type === "{") {
11506
- open = true;
11507
- break;
11508
- } else if (type === "}") {
11509
- if (params.length > 0) {
11510
- shift = params.length - 1;
11511
- prev = params[shift];
11512
- while (prev && prev[0] === "space") prev = params[--shift];
11513
- if (prev) {
11514
- node.source.end = this.getPosition(prev[3] || prev[2]);
11515
- node.source.end.offset++;
11538
+ if (brackets.length === 0) {
11539
+ if (type === ";") {
11540
+ node.source.end = this.getPosition(token[2]);
11541
+ node.source.end.offset++;
11542
+ this.semicolon = true;
11543
+ break;
11544
+ } else if (type === "{") {
11545
+ open = true;
11546
+ break;
11547
+ } else if (type === "}") {
11548
+ if (params.length > 0) {
11549
+ shift = params.length - 1;
11550
+ prev = params[shift];
11551
+ while (prev && prev[0] === "space") prev = params[--shift];
11552
+ if (prev) {
11553
+ node.source.end = this.getPosition(prev[3] || prev[2]);
11554
+ node.source.end.offset++;
11555
+ }
11516
11556
  }
11517
- }
11518
- this.end(token);
11519
- break;
11557
+ this.end(token);
11558
+ break;
11559
+ } else params.push(token);
11520
11560
  } else params.push(token);
11521
- else params.push(token);
11522
11561
  if (this.tokenizer.endOfFile()) {
11523
11562
  last = true;
11524
11563
  break;
@@ -11566,9 +11605,11 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11566
11605
  type = token[0];
11567
11606
  if (type === "(") brackets += 1;
11568
11607
  if (type === ")") brackets -= 1;
11569
- if (brackets === 0 && type === ":") if (!prev) this.doubleColon(token);
11570
- else if (prev[0] === "word" && prev[1] === "progid") continue;
11571
- else return i;
11608
+ if (brackets === 0 && type === ":") {
11609
+ if (!prev) this.doubleColon(token);
11610
+ else if (prev[0] === "word" && prev[1] === "progid") continue;
11611
+ else return i;
11612
+ }
11572
11613
  prev = token;
11573
11614
  }
11574
11615
  return false;
@@ -11746,11 +11787,12 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11746
11787
  if (!bracket) bracket = token;
11747
11788
  brackets.push("}");
11748
11789
  } else if (brackets.length === 0) {
11749
- if (type === ";") if (colon) {
11750
- this.decl(tokens, customProperty);
11751
- return;
11752
- } else break;
11753
- else if (type === "{") {
11790
+ if (type === ";") {
11791
+ if (colon) {
11792
+ this.decl(tokens, customProperty);
11793
+ return;
11794
+ } else break;
11795
+ } else if (type === "{") {
11754
11796
  this.rule(tokens);
11755
11797
  return;
11756
11798
  } else if (type === "}") {
@@ -11817,9 +11859,10 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11817
11859
  else if (type === "comment") {
11818
11860
  prev = tokens[i - 1] ? tokens[i - 1][0] : "empty";
11819
11861
  next = tokens[i + 1] ? tokens[i + 1][0] : "empty";
11820
- if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) if (value.slice(-1) === ",") clean = false;
11821
- else value += token[1];
11822
- else clean = false;
11862
+ if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
11863
+ if (value.slice(-1) === ",") clean = false;
11864
+ else value += token[1];
11865
+ } else clean = false;
11823
11866
  } else value += token[1];
11824
11867
  }
11825
11868
  if (!clean) {
@@ -12302,8 +12345,10 @@ var require_lazy_result = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
12302
12345
  root[isClean] = true;
12303
12346
  this.walkSync(root);
12304
12347
  }
12305
- if (this.listeners.OnceExit) if (root.type === "document") for (let subRoot of root.nodes) this.visitSync(this.listeners.OnceExit, subRoot);
12306
- else this.visitSync(this.listeners.OnceExit, root);
12348
+ if (this.listeners.OnceExit) {
12349
+ if (root.type === "document") for (let subRoot of root.nodes) this.visitSync(this.listeners.OnceExit, subRoot);
12350
+ else this.visitSync(this.listeners.OnceExit, root);
12351
+ }
12307
12352
  }
12308
12353
  return this.result;
12309
12354
  }
@@ -12552,7 +12597,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
12552
12597
  let Root = require_root();
12553
12598
  var Processor = class {
12554
12599
  constructor(plugins = []) {
12555
- this.version = "8.5.25";
12600
+ this.version = "8.5.26";
12556
12601
  this.plugins = this.normalize(plugins);
12557
12602
  }
12558
12603
  normalize(plugins) {
@@ -12995,8 +13040,10 @@ var require_launder = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
12995
13040
  return tag.toLowerCase();
12996
13041
  };
12997
13042
  self.string = function(s, def) {
12998
- if (typeof s !== "string") if (typeof s === "number" || typeof s === "boolean") s += "";
12999
- else s = "";
13043
+ if (typeof s !== "string") {
13044
+ if (typeof s === "number" || typeof s === "boolean") s += "";
13045
+ else s = "";
13046
+ }
13000
13047
  s = s.trim();
13001
13048
  if (def !== void 0) {
13002
13049
  if (s === "") s = def;
@@ -13214,6 +13261,14 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13214
13261
  "embed"
13215
13262
  ];
13216
13263
  const vulnerableTags = ["script", "style"];
13264
+ const svgAnimationTags = [
13265
+ "animate",
13266
+ "animatecolor",
13267
+ "animatemotion",
13268
+ "animatetransform",
13269
+ "set"
13270
+ ];
13271
+ const alwaysUrlAttributes = ["href"];
13217
13272
  function each(obj, cb) {
13218
13273
  if (obj) Object.keys(obj).forEach(function(key) {
13219
13274
  cb(obj[key], key);
@@ -13362,7 +13417,7 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13362
13417
  transformMap[depth] = transformedTag.tagName;
13363
13418
  }
13364
13419
  }
13365
- if (!tagAllowed(name) || options.disallowedTagsMode === "recursiveEscape" && !isEmptyObject(skipMap) || options.nestingLimit != null && depth >= options.nestingLimit) {
13420
+ if (!tagAllowed(name) || animatesUrlAttribute(name, attribs) || options.disallowedTagsMode === "recursiveEscape" && !isEmptyObject(skipMap) || options.nestingLimit != null && depth >= options.nestingLimit) {
13366
13421
  skip = true;
13367
13422
  skipMap[depth] = true;
13368
13423
  if (options.disallowedTagsMode === "discard" || options.disallowedTagsMode === "completelyDiscard") {
@@ -13410,8 +13465,10 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13410
13465
  let newValue = "";
13411
13466
  if (o.multiple === true) {
13412
13467
  const splitStrArray = value.split(" ");
13413
- for (const s of splitStrArray) if (o.values.indexOf(s) !== -1) if (newValue === "") newValue = s;
13414
- else newValue += " " + s;
13468
+ for (const s of splitStrArray) if (o.values.indexOf(s) !== -1) {
13469
+ if (newValue === "") newValue = s;
13470
+ else newValue += " " + s;
13471
+ }
13415
13472
  } else if (o.values.indexOf(value) >= 0) newValue = value;
13416
13473
  value = newValue;
13417
13474
  }
@@ -13548,9 +13605,10 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13548
13605
  }
13549
13606
  if (options.disallowedTagsMode === "completelyDiscard" && !tagAllowed(tag)) text = "";
13550
13607
  else if (tag && tagAllowed(tag) && (options.disallowedTagsMode === "discard" || options.disallowedTagsMode === "completelyDiscard") && (tag === "script" || tag === "style")) result += text;
13551
- else if (tag && tagAllowed(tag) && (options.disallowedTagsMode === "discard" || options.disallowedTagsMode === "completelyDiscard") && (tag === "textarea" || tag === "xmp")) if (tag === "xmp") result += text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
13552
- else result += escapeHtml(text, false);
13553
- else if (!addedText) {
13608
+ else if (tag && tagAllowed(tag) && (options.disallowedTagsMode === "discard" || options.disallowedTagsMode === "completelyDiscard") && (tag === "textarea" || tag === "xmp")) {
13609
+ if (tag === "xmp") result += text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
13610
+ else result += escapeHtml(text, false);
13611
+ } else if (!addedText) {
13554
13612
  const escaped = escapeHtml(text, false);
13555
13613
  if (options.textFilter) result += options.textFilter(escaped, tag);
13556
13614
  else result += escaped;
@@ -13656,6 +13714,16 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13656
13714
  allowProtocolRelative: options.allowProtocolRelative
13657
13715
  });
13658
13716
  }
13717
+ function animatesUrlAttribute(name, attribs) {
13718
+ if (svgAnimationTags.indexOf(name.toLowerCase()) === -1) return false;
13719
+ const schemeCheckedAttributes = options.allowedSchemesAppliedToAttributes || [];
13720
+ return Object.keys(attribs || {}).some(function(attributeName) {
13721
+ if (attributeName.toLowerCase() !== "attributename") return false;
13722
+ const target = (attribs[attributeName] || "").trim().toLowerCase();
13723
+ const localName = target.slice(target.lastIndexOf(":") + 1);
13724
+ return alwaysUrlAttributes.indexOf(localName) !== -1 || schemeCheckedAttributes.indexOf(target) !== -1 || schemeCheckedAttributes.indexOf(localName) !== -1;
13725
+ });
13726
+ }
13659
13727
  function parseUrl(value) {
13660
13728
  value = value.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/, "$1//");
13661
13729
  if (value.startsWith("relative:")) throw new Error("relative: exploit attempt");
@@ -14081,6 +14149,17 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
14081
14149
  };
14082
14150
  };
14083
14151
  })))(), 1);
14152
+ const appendStyle = (style, declarations) => style ? `${style}; ${declarations}` : declarations;
14153
+ const transformCellAlign = (tagName, attribs) => {
14154
+ if (attribs.align) {
14155
+ attribs.style = appendStyle(attribs.style, `text-align:${attribs.align}`);
14156
+ delete attribs.align;
14157
+ }
14158
+ return {
14159
+ attribs,
14160
+ tagName
14161
+ };
14162
+ };
14084
14163
  const sanitizeHtml = (...[html, options]) => (0, import_sanitize_html.default)(html, {
14085
14164
  ...options,
14086
14165
  allowedAttributes: {
@@ -14094,30 +14173,12 @@ const sanitizeHtml = (...[html, options]) => (0, import_sanitize_html.default)(h
14094
14173
  table: (tagName, attribs) => ({
14095
14174
  attribs: {
14096
14175
  ...attribs,
14097
- style: `${attribs.style ? `${attribs.style}; ` : ""}width:100%; border-collapse: collapse;`
14176
+ style: appendStyle(attribs.style, "width:100%; border-collapse: collapse;")
14098
14177
  },
14099
14178
  tagName
14100
14179
  }),
14101
- td: (tagName, attribs) => {
14102
- if (attribs.align) {
14103
- attribs.style = `${attribs.style ? `${attribs.style}; ` : ""}text-align:${attribs.align}`;
14104
- delete attribs.align;
14105
- }
14106
- return {
14107
- attribs,
14108
- tagName
14109
- };
14110
- },
14111
- th: (tagName, attribs) => {
14112
- if (attribs.align) {
14113
- attribs.style = `${attribs.style ? `${attribs.style}; ` : ""}text-align:${attribs.align}`;
14114
- delete attribs.align;
14115
- }
14116
- return {
14117
- attribs,
14118
- tagName
14119
- };
14120
- }
14180
+ td: transformCellAlign,
14181
+ th: transformCellAlign
14121
14182
  }
14122
14183
  });
14123
14184
  const sanitizeTextHtml = (html) => sanitizeHtml(html, {
@@ -14201,19 +14262,12 @@ const checkIsPlainObject = (data) => {
14201
14262
  const ISO_DATE_REGEX = /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2}(?:\.{0,1}\d*))(?:Z|(?<sign>\+|-)(?<offset>[\d|:]*))?$/u;
14202
14263
  const MS_AJAX_DATE_REGEX = /^\/Date\((?<timestamp>-?\d+(?:[-+]\d+)?)\)[/\\]$/u;
14203
14264
  const jsonDateParse = (text) => JSON.parse(text, (_key, value) => {
14204
- let parsedValue = value;
14205
- if (typeof value === "string") {
14206
- let a = ISO_DATE_REGEX.exec(value);
14207
- if (a) parsedValue = new Date(value);
14208
- else {
14209
- a = MS_AJAX_DATE_REGEX.exec(value);
14210
- if (a) {
14211
- const b = takeOne(a, 1).split(/[-+,.]/u);
14212
- parsedValue = new Date(b[0] ? Number(b[0]) : 0 - Number(b[1]));
14213
- }
14214
- }
14215
- }
14216
- return parsedValue;
14265
+ if (typeof value !== "string") return value;
14266
+ else if (ISO_DATE_REGEX.test(value)) return new Date(value);
14267
+ const msAjaxDateMatch = MS_AJAX_DATE_REGEX.exec(value);
14268
+ if (!msAjaxDateMatch) return value;
14269
+ const timestampParts = takeOne(msAjaxDateMatch, 1).split(/[-+,.]/u);
14270
+ return new Date(timestampParts[0] ? Number(timestampParts[0]) : 0 - Number(timestampParts[1]));
14217
14271
  });
14218
14272
  const mergeObjectsStrict = (...objects) => Object.assign({}, ...objects);
14219
14273
  const settleAll = async (tasks, concurrencyLimit = tasks.length) => {
@@ -14238,6 +14292,7 @@ const EncodedSubDelimiterMap = {
14238
14292
  "*": "%2A"
14239
14293
  };
14240
14294
  const encodeUrlSubDelimiters = (value) => Object.entries(EncodedSubDelimiterMap).reduce((encoded, [subDelimiter, encodedSubDelimiter]) => encoded.replaceAll(subDelimiter, encodedSubDelimiter), value);
14295
+ const getDecodedUriComponent = (value, fallback) => getResult(() => decodeURIComponent(value)).unwrapOr(fallback);
14241
14296
  const normalizeString = (value) => value?.trim() ?? "";
14242
14297
  const createNormalizedStringSchema = (maxLength, schema = z.string()) => schema.transform(normalizeString).pipe(z.string().max(maxLength));
14243
14298
  const streamToText = async (readable) => {
@@ -14247,11 +14302,11 @@ const streamToText = async (readable) => {
14247
14302
  return data;
14248
14303
  };
14249
14304
  const toKebabCase = (string) => string.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/gu)?.map((x) => x.toLowerCase()).join("-") ?? "";
14250
- const SUFFIX = "...\"";
14305
+ const SUFFIX = "...";
14251
14306
  const truncate = (string, length) => {
14252
14307
  if (string.length <= length) return string;
14253
- if (length < 4) return string.slice(0, length);
14254
- return `${string.slice(0, length - 4)}${SUFFIX}`;
14308
+ if (length < 3) return string.slice(0, length);
14309
+ return `${string.slice(0, length - 3)}${SUFFIX}`;
14255
14310
  };
14256
14311
  const uncapitalize = (string) => `${string.charAt(0).toLowerCase()}${string.slice(1)}`;
14257
14312
  const hrtime = (previousHrTime) => {
@@ -14281,4 +14336,4 @@ const exhaustiveGuard = (value) => {
14281
14336
  const createUniqueArraySchema = (schema, key) => schema.array().refine((array) => new Set(key === void 0 ? array : array.map((item) => item[key])).size === array.length, "Array items must be unique");
14282
14337
  const UUIDV4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/iu;
14283
14338
  const uuidValidateV4 = (uuid) => UUIDV4_REGEX.test(uuid);
14284
- export { AllSpecialValues, ForbiddenError, ID_SEPARATOR, InvalidOperationError, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, MAX_READ_LIMIT, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MentionType, NotFoundError, NotInitializedError, Operation, RoutePath, SITE_NAME, Serializable, UUIDV4_REGEX, UUID_LENGTH, WordFilteredError, applyItemMetadataMixin, capitalize, checkIsPlainObject, chunk, chunkBySerializedSize, classifyMentions, createExponentialBackoff, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, encodeUrlSubDelimiters, exhaustiveGuard, getIsServer, getMentions, getOrCreate, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeTextHtml, settleAll, sleep, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };
14339
+ export { AllSpecialValues, ForbiddenError, GIBIBYTE, ID_SEPARATOR, InvalidOperationError, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, KIBIBYTE, MAX_READ_LIMIT, MEGABYTE, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MentionType, NotFoundError, NotInitializedError, Operation, RoutePath, SITE_NAME, Serializable, UUIDV4_REGEX, UUID_LENGTH, WordFilteredError, applyItemMetadataMixin, capitalize, checkIsPlainObject, chunk, chunkBySerializedSize, classifyMentions, createExponentialBackoff, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, encodeUrlSubDelimiters, exhaustiveGuard, getDecodedUriComponent, getIsServer, getMentions, getOrCreate, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeTextHtml, settleAll, sleep, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };