@dan-uni/dan-any 1.3.7 → 1.3.8

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.
@@ -11461,7 +11461,7 @@ __webpack_require__.d(platform_namespaceObject, {
11461
11461
  PlatformVideoSource: ()=>platform_PlatformVideoSource,
11462
11462
  PlatformVideoSources: ()=>PlatformVideoSources
11463
11463
  });
11464
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
11464
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.8","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
11465
11465
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
11466
11466
  const decimalToHex = (n)=>color_pad(n.toString(16));
11467
11467
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -13240,12 +13240,15 @@ class UniPool {
13240
13240
  }
13241
13241
  toBiliXML(options) {
13242
13242
  const genCID = (id)=>{
13243
- const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
13244
- if (UniID.domain === platform_PlatformVideoSource.Bilibili) {
13245
- const cid = UniID.id.replaceAll(`def_${platform_PlatformVideoSource.Bilibili}+`, '');
13246
- if (cid) return cid;
13243
+ if (!id) return options?.cid || id_gen_UniID.fromNull().toString();
13244
+ {
13245
+ const UniID = id_gen_UniID.fromString(id);
13246
+ if (UniID.domain === platform_PlatformVideoSource.Bilibili) {
13247
+ const cid = UniID.id.replaceAll(`def_${platform_PlatformVideoSource.Bilibili}+`, '');
13248
+ if (cid) return cid;
13249
+ }
13250
+ return options?.cid || id;
13247
13251
  }
13248
- return !options?.cid || id;
13249
13252
  };
13250
13253
  if (options?.avoidSenderIDWithAt) {
13251
13254
  const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform_PlatformVideoSource.Bilibili}`));
@@ -39,7 +39,7 @@ __webpack_require__.d(platform_namespaceObject, {
39
39
  PlatformVideoSource: ()=>platform_PlatformVideoSource,
40
40
  PlatformVideoSources: ()=>PlatformVideoSources
41
41
  });
42
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
42
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.8","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
43
43
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
44
44
  const decimalToHex = (n)=>color_pad(n.toString(16));
45
45
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -1815,12 +1815,15 @@ class UniPool {
1815
1815
  }
1816
1816
  toBiliXML(options) {
1817
1817
  const genCID = (id)=>{
1818
- const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
1819
- if (UniID.domain === platform_PlatformVideoSource.Bilibili) {
1820
- const cid = UniID.id.replaceAll(`def_${platform_PlatformVideoSource.Bilibili}+`, '');
1821
- if (cid) return cid;
1818
+ if (!id) return options?.cid || id_gen_UniID.fromNull().toString();
1819
+ {
1820
+ const UniID = id_gen_UniID.fromString(id);
1821
+ if (UniID.domain === platform_PlatformVideoSource.Bilibili) {
1822
+ const cid = UniID.id.replaceAll(`def_${platform_PlatformVideoSource.Bilibili}+`, '');
1823
+ if (cid) return cid;
1824
+ }
1825
+ return options?.cid || id;
1822
1826
  }
1823
- return !options?.cid || id;
1824
1827
  };
1825
1828
  if (options?.avoidSenderIDWithAt) {
1826
1829
  const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform_PlatformVideoSource.Bilibili}`));
@@ -21770,7 +21770,7 @@ and limitations under the License.
21770
21770
  function timestamp_timestampMs(timestamp) {
21771
21771
  return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
21772
21772
  }
21773
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
21773
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.8","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
21774
21774
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
21775
21775
  const decimalToHex = (n)=>color_pad(n.toString(16));
21776
21776
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -25728,12 +25728,15 @@ and limitations under the License.
25728
25728
  }
25729
25729
  toBiliXML(options) {
25730
25730
  const genCID = (id)=>{
25731
- const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
25732
- if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
25733
- const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
25734
- if (cid) return cid;
25731
+ if (!id) return options?.cid || id_gen_UniID.fromNull().toString();
25732
+ {
25733
+ const UniID = id_gen_UniID.fromString(id);
25734
+ if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
25735
+ const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
25736
+ if (cid) return cid;
25737
+ }
25738
+ return options?.cid || id;
25735
25739
  }
25736
- return !options?.cid || id;
25737
25740
  };
25738
25741
  if (options?.avoidSenderIDWithAt) {
25739
25742
  const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform.PlatformVideoSource.Bilibili}`));
@@ -21060,7 +21060,7 @@
21060
21060
  function timestamp_timestampMs(timestamp) {
21061
21061
  return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
21062
21062
  }
21063
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
21063
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.8","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
21064
21064
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
21065
21065
  const decimalToHex = (n)=>color_pad(n.toString(16));
21066
21066
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -24984,12 +24984,15 @@
24984
24984
  }
24985
24985
  toBiliXML(options) {
24986
24986
  const genCID = (id)=>{
24987
- const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
24988
- if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
24989
- const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
24990
- if (cid) return cid;
24987
+ if (!id) return options?.cid || id_gen_UniID.fromNull().toString();
24988
+ {
24989
+ const UniID = id_gen_UniID.fromString(id);
24990
+ if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
24991
+ const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
24992
+ if (cid) return cid;
24993
+ }
24994
+ return options?.cid || id;
24991
24995
  }
24992
- return !options?.cid || id;
24993
24996
  };
24994
24997
  if (options?.avoidSenderIDWithAt) {
24995
24998
  const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform.PlatformVideoSource.Bilibili}`));
@@ -21060,7 +21060,7 @@
21060
21060
  function timestamp_timestampMs(timestamp) {
21061
21061
  return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
21062
21062
  }
21063
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
21063
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.8","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
21064
21064
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
21065
21065
  const decimalToHex = (n)=>color_pad(n.toString(16));
21066
21066
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -24984,12 +24984,15 @@
24984
24984
  }
24985
24985
  toBiliXML(options) {
24986
24986
  const genCID = (id)=>{
24987
- const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
24988
- if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
24989
- const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
24990
- if (cid) return cid;
24987
+ if (!id) return options?.cid || id_gen_UniID.fromNull().toString();
24988
+ {
24989
+ const UniID = id_gen_UniID.fromString(id);
24990
+ if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
24991
+ const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
24992
+ if (cid) return cid;
24993
+ }
24994
+ return options?.cid || id;
24991
24995
  }
24992
- return !options?.cid || id;
24993
24996
  };
24994
24997
  if (options?.avoidSenderIDWithAt) {
24995
24998
  const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform.PlatformVideoSource.Bilibili}`));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dan-uni/dan-any",
3
3
  "type": "module",
4
- "version": "1.3.7",
4
+ "version": "1.3.8",
5
5
  "description": "A danmaku transformer lib, supporting danmaku from different platforms.",
6
6
  "author": "rinne",
7
7
  "license": "LGPL-3.0-or-later",
package/src/index.ts CHANGED
@@ -866,16 +866,17 @@ export class UniPool {
866
866
  avoidSenderIDWithAt?: boolean
867
867
  }): string {
868
868
  const genCID = (id?: string) => {
869
- const UniID = id ? ID.fromString(id) : ID.fromNull()
870
- if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
871
- const cid = UniID.id.replaceAll(
872
- `def_${platform.PlatformVideoSource.Bilibili}+`,
873
- '',
874
- )
875
-
876
- if (cid) return cid
877
- }
878
- return !options?.cid || id
869
+ if (id) {
870
+ const UniID = ID.fromString(id)
871
+ if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
872
+ const cid = UniID.id.replaceAll(
873
+ `def_${platform.PlatformVideoSource.Bilibili}+`,
874
+ '',
875
+ )
876
+ if (cid) return cid
877
+ }
878
+ return options?.cid || id
879
+ } else return options?.cid || ID.fromNull().toString()
879
880
  }
880
881
  if (options?.avoidSenderIDWithAt) {
881
882
  const ok = this.dans.every((d) =>