@pod-os/core 0.25.0 → 0.26.0-rc.0b98c3c.0

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
@@ -11613,348 +11613,6 @@ var require_browser_ponyfill = __commonJS({
11613
11613
  }
11614
11614
  });
11615
11615
 
11616
- // ../node_modules/short-unique-id/dist/short-unique-id.js
11617
- var require_short_unique_id = __commonJS({
11618
- "../node_modules/short-unique-id/dist/short-unique-id.js"(exports, module3) {
11619
- "use strict";
11620
- var ShortUniqueId2 = (() => {
11621
- var __defProp = Object.defineProperty;
11622
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11623
- var __getOwnPropNames = Object.getOwnPropertyNames;
11624
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11625
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11626
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11627
- var __defNormalProp = (obj, key3, value7) => key3 in obj ? __defProp(obj, key3, { enumerable: true, configurable: true, writable: true, value: value7 }) : obj[key3] = value7;
11628
- var __spreadValues = (a, b) => {
11629
- for (var prop in b || (b = {}))
11630
- if (__hasOwnProp.call(b, prop))
11631
- __defNormalProp(a, prop, b[prop]);
11632
- if (__getOwnPropSymbols)
11633
- for (var prop of __getOwnPropSymbols(b)) {
11634
- if (__propIsEnum.call(b, prop))
11635
- __defNormalProp(a, prop, b[prop]);
11636
- }
11637
- return a;
11638
- };
11639
- var __export2 = (target6, all) => {
11640
- for (var name9 in all)
11641
- __defProp(target6, name9, { get: all[name9], enumerable: true });
11642
- };
11643
- var __copyProps = (to2, from2, except, desc) => {
11644
- if (from2 && typeof from2 === "object" || typeof from2 === "function") {
11645
- for (let key3 of __getOwnPropNames(from2))
11646
- if (!__hasOwnProp.call(to2, key3) && key3 !== except)
11647
- __defProp(to2, key3, { get: () => from2[key3], enumerable: !(desc = __getOwnPropDesc(from2, key3)) || desc.enumerable });
11648
- }
11649
- return to2;
11650
- };
11651
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
11652
- var __publicField = (obj, key3, value7) => {
11653
- __defNormalProp(obj, typeof key3 !== "symbol" ? key3 + "" : key3, value7);
11654
- return value7;
11655
- };
11656
- var src_exports = {};
11657
- __export2(src_exports, {
11658
- DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
11659
- DEFAULT_UUID_LENGTH: () => DEFAULT_UUID_LENGTH,
11660
- default: () => ShortUniqueId3
11661
- });
11662
- var version6 = "5.2.0";
11663
- var DEFAULT_UUID_LENGTH = 6;
11664
- var DEFAULT_OPTIONS = {
11665
- dictionary: "alphanum",
11666
- shuffle: true,
11667
- debug: false,
11668
- length: DEFAULT_UUID_LENGTH,
11669
- counter: 0
11670
- };
11671
- var _ShortUniqueId = class _ShortUniqueId {
11672
- constructor(argOptions = {}) {
11673
- __publicField(this, "counter");
11674
- __publicField(this, "debug");
11675
- __publicField(this, "dict");
11676
- __publicField(this, "version");
11677
- __publicField(this, "dictIndex", 0);
11678
- __publicField(this, "dictRange", []);
11679
- __publicField(this, "lowerBound", 0);
11680
- __publicField(this, "upperBound", 0);
11681
- __publicField(this, "dictLength", 0);
11682
- __publicField(this, "uuidLength");
11683
- __publicField(this, "_digit_first_ascii", 48);
11684
- __publicField(this, "_digit_last_ascii", 58);
11685
- __publicField(this, "_alpha_lower_first_ascii", 97);
11686
- __publicField(this, "_alpha_lower_last_ascii", 123);
11687
- __publicField(this, "_hex_last_ascii", 103);
11688
- __publicField(this, "_alpha_upper_first_ascii", 65);
11689
- __publicField(this, "_alpha_upper_last_ascii", 91);
11690
- __publicField(this, "_number_dict_ranges", {
11691
- digits: [this._digit_first_ascii, this._digit_last_ascii]
11692
- });
11693
- __publicField(this, "_alpha_dict_ranges", {
11694
- lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
11695
- upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
11696
- });
11697
- __publicField(this, "_alpha_lower_dict_ranges", {
11698
- lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
11699
- });
11700
- __publicField(this, "_alpha_upper_dict_ranges", {
11701
- upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
11702
- });
11703
- __publicField(this, "_alphanum_dict_ranges", {
11704
- digits: [this._digit_first_ascii, this._digit_last_ascii],
11705
- lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
11706
- upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
11707
- });
11708
- __publicField(this, "_alphanum_lower_dict_ranges", {
11709
- digits: [this._digit_first_ascii, this._digit_last_ascii],
11710
- lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
11711
- });
11712
- __publicField(this, "_alphanum_upper_dict_ranges", {
11713
- digits: [this._digit_first_ascii, this._digit_last_ascii],
11714
- upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
11715
- });
11716
- __publicField(this, "_hex_dict_ranges", {
11717
- decDigits: [this._digit_first_ascii, this._digit_last_ascii],
11718
- alphaDigits: [this._alpha_lower_first_ascii, this._hex_last_ascii]
11719
- });
11720
- __publicField(this, "_dict_ranges", {
11721
- _number_dict_ranges: this._number_dict_ranges,
11722
- _alpha_dict_ranges: this._alpha_dict_ranges,
11723
- _alpha_lower_dict_ranges: this._alpha_lower_dict_ranges,
11724
- _alpha_upper_dict_ranges: this._alpha_upper_dict_ranges,
11725
- _alphanum_dict_ranges: this._alphanum_dict_ranges,
11726
- _alphanum_lower_dict_ranges: this._alphanum_lower_dict_ranges,
11727
- _alphanum_upper_dict_ranges: this._alphanum_upper_dict_ranges,
11728
- _hex_dict_ranges: this._hex_dict_ranges
11729
- });
11730
- __publicField(this, "log", (...args) => {
11731
- const finalArgs = [...args];
11732
- finalArgs[0] = `[short-unique-id] ${args[0]}`;
11733
- if (this.debug === true) {
11734
- if (typeof console !== "undefined" && console !== null) {
11735
- return console.log(...finalArgs);
11736
- }
11737
- }
11738
- });
11739
- __publicField(this, "_normalizeDictionary", (dictionary2, shuffle2) => {
11740
- let finalDict;
11741
- if (dictionary2 && Array.isArray(dictionary2) && dictionary2.length > 1) {
11742
- finalDict = dictionary2;
11743
- } else {
11744
- finalDict = [];
11745
- let i;
11746
- this.dictIndex = i = 0;
11747
- const rangesName = `_${dictionary2}_dict_ranges`;
11748
- const ranges = this._dict_ranges[rangesName];
11749
- Object.keys(ranges).forEach((rangeType) => {
11750
- const rangeTypeKey = rangeType;
11751
- this.dictRange = ranges[rangeTypeKey];
11752
- this.lowerBound = this.dictRange[0];
11753
- this.upperBound = this.dictRange[1];
11754
- for (this.dictIndex = i = this.lowerBound; this.lowerBound <= this.upperBound ? i < this.upperBound : i > this.upperBound; this.dictIndex = this.lowerBound <= this.upperBound ? i += 1 : i -= 1) {
11755
- finalDict.push(String.fromCharCode(this.dictIndex));
11756
- }
11757
- });
11758
- }
11759
- if (shuffle2) {
11760
- const PROBABILITY = 0.5;
11761
- finalDict = finalDict.sort(() => Math.random() - PROBABILITY);
11762
- }
11763
- return finalDict;
11764
- });
11765
- __publicField(this, "setDictionary", (dictionary2, shuffle2) => {
11766
- this.dict = this._normalizeDictionary(dictionary2, shuffle2);
11767
- this.dictLength = this.dict.length;
11768
- this.setCounter(0);
11769
- });
11770
- __publicField(this, "seq", () => {
11771
- return this.sequentialUUID();
11772
- });
11773
- __publicField(this, "sequentialUUID", () => {
11774
- let counterDiv;
11775
- let counterRem;
11776
- let id4 = "";
11777
- counterDiv = this.counter;
11778
- do {
11779
- counterRem = counterDiv % this.dictLength;
11780
- counterDiv = Math.trunc(counterDiv / this.dictLength);
11781
- id4 += this.dict[counterRem];
11782
- } while (counterDiv !== 0);
11783
- this.counter += 1;
11784
- return id4;
11785
- });
11786
- __publicField(this, "rnd", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
11787
- return this.randomUUID(uuidLength);
11788
- });
11789
- __publicField(this, "randomUUID", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
11790
- let id4;
11791
- let randomPartIdx;
11792
- let j;
11793
- if (uuidLength === null || typeof uuidLength === "undefined" || uuidLength < 1) {
11794
- throw new Error("Invalid UUID Length Provided");
11795
- }
11796
- const isPositive = uuidLength >= 0;
11797
- id4 = "";
11798
- for (j = 0; j < uuidLength; j += 1) {
11799
- randomPartIdx = parseInt(
11800
- (Math.random() * this.dictLength).toFixed(0),
11801
- 10
11802
- ) % this.dictLength;
11803
- id4 += this.dict[randomPartIdx];
11804
- }
11805
- return id4;
11806
- });
11807
- __publicField(this, "fmt", (format4, date6) => {
11808
- return this.formattedUUID(format4, date6);
11809
- });
11810
- __publicField(this, "formattedUUID", (format4, date6) => {
11811
- const fnMap = {
11812
- "$r": this.randomUUID,
11813
- "$s": this.sequentialUUID,
11814
- "$t": this.stamp
11815
- };
11816
- const result6 = format4.replace(
11817
- /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
11818
- (m) => {
11819
- const fn2 = m.slice(0, 2);
11820
- const len = parseInt(m.slice(2), 10);
11821
- if (fn2 === "$s") {
11822
- return fnMap[fn2]().padStart(len, "0");
11823
- }
11824
- if (fn2 === "$t" && date6) {
11825
- return fnMap[fn2](len, date6);
11826
- }
11827
- return fnMap[fn2](len);
11828
- }
11829
- );
11830
- return result6;
11831
- });
11832
- __publicField(this, "availableUUIDs", (uuidLength = this.uuidLength) => {
11833
- return parseFloat(
11834
- Math.pow([...new Set(this.dict)].length, uuidLength).toFixed(0)
11835
- );
11836
- });
11837
- __publicField(this, "approxMaxBeforeCollision", (rounds = this.availableUUIDs(this.uuidLength)) => {
11838
- return parseFloat(
11839
- Math.sqrt(Math.PI / 2 * rounds).toFixed(20)
11840
- );
11841
- });
11842
- __publicField(this, "collisionProbability", (rounds = this.availableUUIDs(this.uuidLength), uuidLength = this.uuidLength) => {
11843
- return parseFloat(
11844
- (this.approxMaxBeforeCollision(rounds) / this.availableUUIDs(uuidLength)).toFixed(20)
11845
- );
11846
- });
11847
- __publicField(this, "uniqueness", (rounds = this.availableUUIDs(this.uuidLength)) => {
11848
- const score2 = parseFloat(
11849
- (1 - this.approxMaxBeforeCollision(rounds) / rounds).toFixed(20)
11850
- );
11851
- return score2 > 1 ? 1 : score2 < 0 ? 0 : score2;
11852
- });
11853
- __publicField(this, "getVersion", () => {
11854
- return this.version;
11855
- });
11856
- __publicField(this, "stamp", (finalLength, date6) => {
11857
- const hexStamp = Math.floor(+(date6 || /* @__PURE__ */ new Date()) / 1e3).toString(16);
11858
- if (typeof finalLength === "number" && finalLength === 0) {
11859
- return hexStamp;
11860
- }
11861
- if (typeof finalLength !== "number" || finalLength < 10) {
11862
- throw new Error(
11863
- [
11864
- "Param finalLength must be a number greater than or equal to 10,",
11865
- "or 0 if you want the raw hexadecimal timestamp"
11866
- ].join("\n")
11867
- );
11868
- }
11869
- const idLength = finalLength - 9;
11870
- const rndIdx = Math.round(Math.random() * (idLength > 15 ? 15 : idLength));
11871
- const id4 = this.randomUUID(idLength);
11872
- return `${id4.substring(0, rndIdx)}${hexStamp}${id4.substring(rndIdx)}${rndIdx.toString(16)}`;
11873
- });
11874
- __publicField(this, "parseStamp", (suid, format4) => {
11875
- if (format4 && !/t0|t[1-9]\d{1,}/.test(format4)) {
11876
- throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");
11877
- }
11878
- const stamp = format4 ? format4.replace(
11879
- /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
11880
- (m) => {
11881
- const fnMap = {
11882
- "$r": (len2) => [...Array(len2)].map(() => "r").join(""),
11883
- "$s": (len2) => [...Array(len2)].map(() => "s").join(""),
11884
- "$t": (len2) => [...Array(len2)].map(() => "t").join("")
11885
- };
11886
- const fn2 = m.slice(0, 2);
11887
- const len = parseInt(m.slice(2), 10);
11888
- return fnMap[fn2](len);
11889
- }
11890
- ).replace(
11891
- /^(.*?)(t{8,})(.*)$/g,
11892
- (_m, p1, p2) => {
11893
- return suid.substring(p1.length, p1.length + p2.length);
11894
- }
11895
- ) : suid;
11896
- if (stamp.length === 8) {
11897
- return new Date(parseInt(stamp, 16) * 1e3);
11898
- }
11899
- if (stamp.length < 10) {
11900
- throw new Error("Stamp length invalid");
11901
- }
11902
- const rndIdx = parseInt(stamp.substring(stamp.length - 1), 16);
11903
- return new Date(parseInt(stamp.substring(rndIdx, rndIdx + 8), 16) * 1e3);
11904
- });
11905
- __publicField(this, "setCounter", (counter2) => {
11906
- this.counter = counter2;
11907
- });
11908
- __publicField(this, "validate", (uid4, dictionary2) => {
11909
- const finalDictionary = dictionary2 ? this._normalizeDictionary(dictionary2) : this.dict;
11910
- return uid4.split("").every((c) => finalDictionary.includes(c));
11911
- });
11912
- const options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), argOptions);
11913
- this.counter = 0;
11914
- this.debug = false;
11915
- this.dict = [];
11916
- this.version = version6;
11917
- const {
11918
- dictionary,
11919
- shuffle,
11920
- length: length3,
11921
- counter
11922
- } = options;
11923
- this.uuidLength = length3;
11924
- this.setDictionary(dictionary, shuffle);
11925
- this.setCounter(counter);
11926
- this.debug = options.debug;
11927
- this.log(this.dict);
11928
- this.log(
11929
- `Generator instantiated with Dictionary Size ${this.dictLength} and counter set to ${this.counter}`
11930
- );
11931
- this.log = this.log.bind(this);
11932
- this.setDictionary = this.setDictionary.bind(this);
11933
- this.setCounter = this.setCounter.bind(this);
11934
- this.seq = this.seq.bind(this);
11935
- this.sequentialUUID = this.sequentialUUID.bind(this);
11936
- this.rnd = this.rnd.bind(this);
11937
- this.randomUUID = this.randomUUID.bind(this);
11938
- this.fmt = this.fmt.bind(this);
11939
- this.formattedUUID = this.formattedUUID.bind(this);
11940
- this.availableUUIDs = this.availableUUIDs.bind(this);
11941
- this.approxMaxBeforeCollision = this.approxMaxBeforeCollision.bind(this);
11942
- this.collisionProbability = this.collisionProbability.bind(this);
11943
- this.uniqueness = this.uniqueness.bind(this);
11944
- this.getVersion = this.getVersion.bind(this);
11945
- this.stamp = this.stamp.bind(this);
11946
- this.parseStamp = this.parseStamp.bind(this);
11947
- return this;
11948
- }
11949
- };
11950
- __publicField(_ShortUniqueId, "default", _ShortUniqueId);
11951
- var ShortUniqueId3 = _ShortUniqueId;
11952
- return __toCommonJS(src_exports);
11953
- })();
11954
- "undefined" != typeof module3 && (module3.exports = ShortUniqueId2.default), "undefined" != typeof window && (ShortUniqueId2 = ShortUniqueId2.default);
11955
- }
11956
- });
11957
-
11958
11616
  // ../node_modules/lunr/lunr.js
11959
11617
  var require_lunr = __commonJS({
11960
11618
  "../node_modules/lunr/lunr.js"(exports, module3) {
@@ -13686,6 +13344,348 @@ var require_lunr = __commonJS({
13686
13344
  }
13687
13345
  });
13688
13346
 
13347
+ // ../node_modules/short-unique-id/dist/short-unique-id.js
13348
+ var require_short_unique_id = __commonJS({
13349
+ "../node_modules/short-unique-id/dist/short-unique-id.js"(exports, module3) {
13350
+ "use strict";
13351
+ var ShortUniqueId2 = (() => {
13352
+ var __defProp = Object.defineProperty;
13353
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13354
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13355
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
13356
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13357
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
13358
+ var __defNormalProp = (obj, key3, value7) => key3 in obj ? __defProp(obj, key3, { enumerable: true, configurable: true, writable: true, value: value7 }) : obj[key3] = value7;
13359
+ var __spreadValues = (a, b) => {
13360
+ for (var prop in b || (b = {}))
13361
+ if (__hasOwnProp.call(b, prop))
13362
+ __defNormalProp(a, prop, b[prop]);
13363
+ if (__getOwnPropSymbols)
13364
+ for (var prop of __getOwnPropSymbols(b)) {
13365
+ if (__propIsEnum.call(b, prop))
13366
+ __defNormalProp(a, prop, b[prop]);
13367
+ }
13368
+ return a;
13369
+ };
13370
+ var __export2 = (target6, all) => {
13371
+ for (var name9 in all)
13372
+ __defProp(target6, name9, { get: all[name9], enumerable: true });
13373
+ };
13374
+ var __copyProps = (to2, from2, except, desc) => {
13375
+ if (from2 && typeof from2 === "object" || typeof from2 === "function") {
13376
+ for (let key3 of __getOwnPropNames(from2))
13377
+ if (!__hasOwnProp.call(to2, key3) && key3 !== except)
13378
+ __defProp(to2, key3, { get: () => from2[key3], enumerable: !(desc = __getOwnPropDesc(from2, key3)) || desc.enumerable });
13379
+ }
13380
+ return to2;
13381
+ };
13382
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
13383
+ var __publicField = (obj, key3, value7) => {
13384
+ __defNormalProp(obj, typeof key3 !== "symbol" ? key3 + "" : key3, value7);
13385
+ return value7;
13386
+ };
13387
+ var src_exports = {};
13388
+ __export2(src_exports, {
13389
+ DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
13390
+ DEFAULT_UUID_LENGTH: () => DEFAULT_UUID_LENGTH,
13391
+ default: () => ShortUniqueId3
13392
+ });
13393
+ var version6 = "5.2.0";
13394
+ var DEFAULT_UUID_LENGTH = 6;
13395
+ var DEFAULT_OPTIONS = {
13396
+ dictionary: "alphanum",
13397
+ shuffle: true,
13398
+ debug: false,
13399
+ length: DEFAULT_UUID_LENGTH,
13400
+ counter: 0
13401
+ };
13402
+ var _ShortUniqueId = class _ShortUniqueId {
13403
+ constructor(argOptions = {}) {
13404
+ __publicField(this, "counter");
13405
+ __publicField(this, "debug");
13406
+ __publicField(this, "dict");
13407
+ __publicField(this, "version");
13408
+ __publicField(this, "dictIndex", 0);
13409
+ __publicField(this, "dictRange", []);
13410
+ __publicField(this, "lowerBound", 0);
13411
+ __publicField(this, "upperBound", 0);
13412
+ __publicField(this, "dictLength", 0);
13413
+ __publicField(this, "uuidLength");
13414
+ __publicField(this, "_digit_first_ascii", 48);
13415
+ __publicField(this, "_digit_last_ascii", 58);
13416
+ __publicField(this, "_alpha_lower_first_ascii", 97);
13417
+ __publicField(this, "_alpha_lower_last_ascii", 123);
13418
+ __publicField(this, "_hex_last_ascii", 103);
13419
+ __publicField(this, "_alpha_upper_first_ascii", 65);
13420
+ __publicField(this, "_alpha_upper_last_ascii", 91);
13421
+ __publicField(this, "_number_dict_ranges", {
13422
+ digits: [this._digit_first_ascii, this._digit_last_ascii]
13423
+ });
13424
+ __publicField(this, "_alpha_dict_ranges", {
13425
+ lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
13426
+ upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
13427
+ });
13428
+ __publicField(this, "_alpha_lower_dict_ranges", {
13429
+ lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
13430
+ });
13431
+ __publicField(this, "_alpha_upper_dict_ranges", {
13432
+ upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
13433
+ });
13434
+ __publicField(this, "_alphanum_dict_ranges", {
13435
+ digits: [this._digit_first_ascii, this._digit_last_ascii],
13436
+ lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
13437
+ upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
13438
+ });
13439
+ __publicField(this, "_alphanum_lower_dict_ranges", {
13440
+ digits: [this._digit_first_ascii, this._digit_last_ascii],
13441
+ lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
13442
+ });
13443
+ __publicField(this, "_alphanum_upper_dict_ranges", {
13444
+ digits: [this._digit_first_ascii, this._digit_last_ascii],
13445
+ upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
13446
+ });
13447
+ __publicField(this, "_hex_dict_ranges", {
13448
+ decDigits: [this._digit_first_ascii, this._digit_last_ascii],
13449
+ alphaDigits: [this._alpha_lower_first_ascii, this._hex_last_ascii]
13450
+ });
13451
+ __publicField(this, "_dict_ranges", {
13452
+ _number_dict_ranges: this._number_dict_ranges,
13453
+ _alpha_dict_ranges: this._alpha_dict_ranges,
13454
+ _alpha_lower_dict_ranges: this._alpha_lower_dict_ranges,
13455
+ _alpha_upper_dict_ranges: this._alpha_upper_dict_ranges,
13456
+ _alphanum_dict_ranges: this._alphanum_dict_ranges,
13457
+ _alphanum_lower_dict_ranges: this._alphanum_lower_dict_ranges,
13458
+ _alphanum_upper_dict_ranges: this._alphanum_upper_dict_ranges,
13459
+ _hex_dict_ranges: this._hex_dict_ranges
13460
+ });
13461
+ __publicField(this, "log", (...args) => {
13462
+ const finalArgs = [...args];
13463
+ finalArgs[0] = `[short-unique-id] ${args[0]}`;
13464
+ if (this.debug === true) {
13465
+ if (typeof console !== "undefined" && console !== null) {
13466
+ return console.log(...finalArgs);
13467
+ }
13468
+ }
13469
+ });
13470
+ __publicField(this, "_normalizeDictionary", (dictionary2, shuffle2) => {
13471
+ let finalDict;
13472
+ if (dictionary2 && Array.isArray(dictionary2) && dictionary2.length > 1) {
13473
+ finalDict = dictionary2;
13474
+ } else {
13475
+ finalDict = [];
13476
+ let i;
13477
+ this.dictIndex = i = 0;
13478
+ const rangesName = `_${dictionary2}_dict_ranges`;
13479
+ const ranges = this._dict_ranges[rangesName];
13480
+ Object.keys(ranges).forEach((rangeType) => {
13481
+ const rangeTypeKey = rangeType;
13482
+ this.dictRange = ranges[rangeTypeKey];
13483
+ this.lowerBound = this.dictRange[0];
13484
+ this.upperBound = this.dictRange[1];
13485
+ for (this.dictIndex = i = this.lowerBound; this.lowerBound <= this.upperBound ? i < this.upperBound : i > this.upperBound; this.dictIndex = this.lowerBound <= this.upperBound ? i += 1 : i -= 1) {
13486
+ finalDict.push(String.fromCharCode(this.dictIndex));
13487
+ }
13488
+ });
13489
+ }
13490
+ if (shuffle2) {
13491
+ const PROBABILITY = 0.5;
13492
+ finalDict = finalDict.sort(() => Math.random() - PROBABILITY);
13493
+ }
13494
+ return finalDict;
13495
+ });
13496
+ __publicField(this, "setDictionary", (dictionary2, shuffle2) => {
13497
+ this.dict = this._normalizeDictionary(dictionary2, shuffle2);
13498
+ this.dictLength = this.dict.length;
13499
+ this.setCounter(0);
13500
+ });
13501
+ __publicField(this, "seq", () => {
13502
+ return this.sequentialUUID();
13503
+ });
13504
+ __publicField(this, "sequentialUUID", () => {
13505
+ let counterDiv;
13506
+ let counterRem;
13507
+ let id4 = "";
13508
+ counterDiv = this.counter;
13509
+ do {
13510
+ counterRem = counterDiv % this.dictLength;
13511
+ counterDiv = Math.trunc(counterDiv / this.dictLength);
13512
+ id4 += this.dict[counterRem];
13513
+ } while (counterDiv !== 0);
13514
+ this.counter += 1;
13515
+ return id4;
13516
+ });
13517
+ __publicField(this, "rnd", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
13518
+ return this.randomUUID(uuidLength);
13519
+ });
13520
+ __publicField(this, "randomUUID", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
13521
+ let id4;
13522
+ let randomPartIdx;
13523
+ let j;
13524
+ if (uuidLength === null || typeof uuidLength === "undefined" || uuidLength < 1) {
13525
+ throw new Error("Invalid UUID Length Provided");
13526
+ }
13527
+ const isPositive = uuidLength >= 0;
13528
+ id4 = "";
13529
+ for (j = 0; j < uuidLength; j += 1) {
13530
+ randomPartIdx = parseInt(
13531
+ (Math.random() * this.dictLength).toFixed(0),
13532
+ 10
13533
+ ) % this.dictLength;
13534
+ id4 += this.dict[randomPartIdx];
13535
+ }
13536
+ return id4;
13537
+ });
13538
+ __publicField(this, "fmt", (format4, date6) => {
13539
+ return this.formattedUUID(format4, date6);
13540
+ });
13541
+ __publicField(this, "formattedUUID", (format4, date6) => {
13542
+ const fnMap = {
13543
+ "$r": this.randomUUID,
13544
+ "$s": this.sequentialUUID,
13545
+ "$t": this.stamp
13546
+ };
13547
+ const result6 = format4.replace(
13548
+ /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
13549
+ (m) => {
13550
+ const fn2 = m.slice(0, 2);
13551
+ const len = parseInt(m.slice(2), 10);
13552
+ if (fn2 === "$s") {
13553
+ return fnMap[fn2]().padStart(len, "0");
13554
+ }
13555
+ if (fn2 === "$t" && date6) {
13556
+ return fnMap[fn2](len, date6);
13557
+ }
13558
+ return fnMap[fn2](len);
13559
+ }
13560
+ );
13561
+ return result6;
13562
+ });
13563
+ __publicField(this, "availableUUIDs", (uuidLength = this.uuidLength) => {
13564
+ return parseFloat(
13565
+ Math.pow([...new Set(this.dict)].length, uuidLength).toFixed(0)
13566
+ );
13567
+ });
13568
+ __publicField(this, "approxMaxBeforeCollision", (rounds = this.availableUUIDs(this.uuidLength)) => {
13569
+ return parseFloat(
13570
+ Math.sqrt(Math.PI / 2 * rounds).toFixed(20)
13571
+ );
13572
+ });
13573
+ __publicField(this, "collisionProbability", (rounds = this.availableUUIDs(this.uuidLength), uuidLength = this.uuidLength) => {
13574
+ return parseFloat(
13575
+ (this.approxMaxBeforeCollision(rounds) / this.availableUUIDs(uuidLength)).toFixed(20)
13576
+ );
13577
+ });
13578
+ __publicField(this, "uniqueness", (rounds = this.availableUUIDs(this.uuidLength)) => {
13579
+ const score2 = parseFloat(
13580
+ (1 - this.approxMaxBeforeCollision(rounds) / rounds).toFixed(20)
13581
+ );
13582
+ return score2 > 1 ? 1 : score2 < 0 ? 0 : score2;
13583
+ });
13584
+ __publicField(this, "getVersion", () => {
13585
+ return this.version;
13586
+ });
13587
+ __publicField(this, "stamp", (finalLength, date6) => {
13588
+ const hexStamp = Math.floor(+(date6 || /* @__PURE__ */ new Date()) / 1e3).toString(16);
13589
+ if (typeof finalLength === "number" && finalLength === 0) {
13590
+ return hexStamp;
13591
+ }
13592
+ if (typeof finalLength !== "number" || finalLength < 10) {
13593
+ throw new Error(
13594
+ [
13595
+ "Param finalLength must be a number greater than or equal to 10,",
13596
+ "or 0 if you want the raw hexadecimal timestamp"
13597
+ ].join("\n")
13598
+ );
13599
+ }
13600
+ const idLength = finalLength - 9;
13601
+ const rndIdx = Math.round(Math.random() * (idLength > 15 ? 15 : idLength));
13602
+ const id4 = this.randomUUID(idLength);
13603
+ return `${id4.substring(0, rndIdx)}${hexStamp}${id4.substring(rndIdx)}${rndIdx.toString(16)}`;
13604
+ });
13605
+ __publicField(this, "parseStamp", (suid, format4) => {
13606
+ if (format4 && !/t0|t[1-9]\d{1,}/.test(format4)) {
13607
+ throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");
13608
+ }
13609
+ const stamp = format4 ? format4.replace(
13610
+ /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
13611
+ (m) => {
13612
+ const fnMap = {
13613
+ "$r": (len2) => [...Array(len2)].map(() => "r").join(""),
13614
+ "$s": (len2) => [...Array(len2)].map(() => "s").join(""),
13615
+ "$t": (len2) => [...Array(len2)].map(() => "t").join("")
13616
+ };
13617
+ const fn2 = m.slice(0, 2);
13618
+ const len = parseInt(m.slice(2), 10);
13619
+ return fnMap[fn2](len);
13620
+ }
13621
+ ).replace(
13622
+ /^(.*?)(t{8,})(.*)$/g,
13623
+ (_m, p1, p2) => {
13624
+ return suid.substring(p1.length, p1.length + p2.length);
13625
+ }
13626
+ ) : suid;
13627
+ if (stamp.length === 8) {
13628
+ return new Date(parseInt(stamp, 16) * 1e3);
13629
+ }
13630
+ if (stamp.length < 10) {
13631
+ throw new Error("Stamp length invalid");
13632
+ }
13633
+ const rndIdx = parseInt(stamp.substring(stamp.length - 1), 16);
13634
+ return new Date(parseInt(stamp.substring(rndIdx, rndIdx + 8), 16) * 1e3);
13635
+ });
13636
+ __publicField(this, "setCounter", (counter2) => {
13637
+ this.counter = counter2;
13638
+ });
13639
+ __publicField(this, "validate", (uid4, dictionary2) => {
13640
+ const finalDictionary = dictionary2 ? this._normalizeDictionary(dictionary2) : this.dict;
13641
+ return uid4.split("").every((c) => finalDictionary.includes(c));
13642
+ });
13643
+ const options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), argOptions);
13644
+ this.counter = 0;
13645
+ this.debug = false;
13646
+ this.dict = [];
13647
+ this.version = version6;
13648
+ const {
13649
+ dictionary,
13650
+ shuffle,
13651
+ length: length3,
13652
+ counter
13653
+ } = options;
13654
+ this.uuidLength = length3;
13655
+ this.setDictionary(dictionary, shuffle);
13656
+ this.setCounter(counter);
13657
+ this.debug = options.debug;
13658
+ this.log(this.dict);
13659
+ this.log(
13660
+ `Generator instantiated with Dictionary Size ${this.dictLength} and counter set to ${this.counter}`
13661
+ );
13662
+ this.log = this.log.bind(this);
13663
+ this.setDictionary = this.setDictionary.bind(this);
13664
+ this.setCounter = this.setCounter.bind(this);
13665
+ this.seq = this.seq.bind(this);
13666
+ this.sequentialUUID = this.sequentialUUID.bind(this);
13667
+ this.rnd = this.rnd.bind(this);
13668
+ this.randomUUID = this.randomUUID.bind(this);
13669
+ this.fmt = this.fmt.bind(this);
13670
+ this.formattedUUID = this.formattedUUID.bind(this);
13671
+ this.availableUUIDs = this.availableUUIDs.bind(this);
13672
+ this.approxMaxBeforeCollision = this.approxMaxBeforeCollision.bind(this);
13673
+ this.collisionProbability = this.collisionProbability.bind(this);
13674
+ this.uniqueness = this.uniqueness.bind(this);
13675
+ this.getVersion = this.getVersion.bind(this);
13676
+ this.stamp = this.stamp.bind(this);
13677
+ this.parseStamp = this.parseStamp.bind(this);
13678
+ return this;
13679
+ }
13680
+ };
13681
+ __publicField(_ShortUniqueId, "default", _ShortUniqueId);
13682
+ var ShortUniqueId3 = _ShortUniqueId;
13683
+ return __toCommonJS(src_exports);
13684
+ })();
13685
+ "undefined" != typeof module3 && (module3.exports = ShortUniqueId2.default), "undefined" != typeof window && (ShortUniqueId2 = ShortUniqueId2.default);
13686
+ }
13687
+ });
13688
+
13689
13689
  // ../node_modules/slugify/slugify.js
13690
13690
  var require_slugify = __commonJS({
13691
13691
  "../node_modules/slugify/slugify.js"(exports, module3) {
@@ -27841,8 +27841,8 @@ var Thing = class {
27841
27841
  * Retrieves a list of RDF types for this thing.
27842
27842
  */
27843
27843
  types() {
27844
- const uriMap = this.store.findTypeURIs(namedNode(this.uri));
27845
- return Object.keys(uriMap).map((uri6) => ({
27844
+ const uris = this.store.findTypes(this.uri);
27845
+ return uris.map((uri6) => ({
27846
27846
  uri: uri6,
27847
27847
  label: labelForType(uri6)
27848
27848
  }));
@@ -27999,6 +27999,203 @@ var PictureGateway = class {
27999
27999
  }
28000
28000
  };
28001
28001
 
28002
+ // src/profile/WebIdProfile.ts
28003
+ var WebIdProfile = class extends Thing {
28004
+ constructor(webId, store, editable = false) {
28005
+ super(webId, store, editable);
28006
+ this.webId = webId;
28007
+ this.store = store;
28008
+ this.editable = editable;
28009
+ this.profileQuery = this.store.profileQuery(this.webId);
28010
+ }
28011
+ /**
28012
+ * Returns the URI of the preferences document
28013
+ */
28014
+ getPreferencesFile() {
28015
+ return this.profileQuery.queryPreferencesFile()?.value;
28016
+ }
28017
+ /**
28018
+ * Returns the URI of the public type index document
28019
+ * @since 0.24.0
28020
+ */
28021
+ getPublicTypeIndex() {
28022
+ return this.profileQuery.queryPublicTypeIndex()?.value;
28023
+ }
28024
+ /**
28025
+ * Returns the URI of the private type index document
28026
+ * @since 0.24.0
28027
+ */
28028
+ getPrivateTypeIndex() {
28029
+ const preferences = this.profileQuery.queryPreferencesFile();
28030
+ if (!preferences) return void 0;
28031
+ const query4 = this.store.preferencesQuery(this.webId, preferences);
28032
+ return query4.queryPrivateTypeIndex()?.value;
28033
+ }
28034
+ /**
28035
+ * Returns the URIs of the private label indexes
28036
+ */
28037
+ getPrivateLabelIndexes() {
28038
+ const profileNodes = this.store.each(
28039
+ namedNode(this.webId),
28040
+ namedNode("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
28041
+ void 0,
28042
+ namedNode(this.webId).doc()
28043
+ );
28044
+ const preferences = this.getPreferencesFile();
28045
+ if (preferences) {
28046
+ const preferencesNodes = this.store.each(
28047
+ namedNode(this.webId),
28048
+ namedNode("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
28049
+ void 0,
28050
+ namedNode(preferences)
28051
+ );
28052
+ return [...profileNodes, ...preferencesNodes].map((it) => it.value);
28053
+ } else {
28054
+ return profileNodes.map((it) => it.value);
28055
+ }
28056
+ }
28057
+ };
28058
+
28059
+ // src/profile/ProfileGateway.ts
28060
+ var ProfileGateway = class {
28061
+ constructor(store) {
28062
+ this.store = store;
28063
+ }
28064
+ /**
28065
+ * Fetches the profile for the given WebID and all linked documents
28066
+ * @since 0.24.0
28067
+ * @param webId The WebID to fetch the profile for
28068
+ * @returns {Promise<WebIdProfile>} The fetched profile
28069
+ */
28070
+ async fetchProfile(webId) {
28071
+ await this.store.fetch(webId);
28072
+ const profile2 = this.store.get(webId).assume(WebIdProfile);
28073
+ const preferences = profile2.getPreferencesFile();
28074
+ if (preferences) {
28075
+ try {
28076
+ await this.store.fetch(preferences);
28077
+ } catch (error4) {
28078
+ console.warn(`Failed to fetch preferences file ${preferences}:`, error4);
28079
+ }
28080
+ }
28081
+ const publicTypeIndex2 = profile2.getPublicTypeIndex();
28082
+ const privateTypeIndex2 = profile2.getPrivateTypeIndex();
28083
+ await this.store.fetchAll(
28084
+ [privateTypeIndex2, publicTypeIndex2].filter((it) => it !== void 0)
28085
+ );
28086
+ return profile2;
28087
+ }
28088
+ };
28089
+
28090
+ // src/search/SearchIndex.ts
28091
+ var import_lunr = __toESM(require_lunr(), 1);
28092
+ var SearchIndex = class {
28093
+ constructor(labelIndexes) {
28094
+ this.labelIndexes = labelIndexes;
28095
+ this.index = this.rebuild().index;
28096
+ }
28097
+ /**
28098
+ * Recreates the search index with the current data from all label indexes
28099
+ */
28100
+ rebuild() {
28101
+ const labelIndexes = this.labelIndexes;
28102
+ this.index = (0, import_lunr.default)(function() {
28103
+ this.ref("uri");
28104
+ this.field("uri");
28105
+ this.field("label");
28106
+ this.metadataWhitelist = ["position"];
28107
+ const items2 = labelIndexes.flatMap((it) => it.getIndexedItems());
28108
+ items2.forEach((item4) => {
28109
+ this.add({
28110
+ uri: item4.uri,
28111
+ label: item4.label
28112
+ });
28113
+ });
28114
+ });
28115
+ return this;
28116
+ }
28117
+ /**
28118
+ * Search the index for a given term. It finds partial matches, but will rank exact matches higher.
28119
+ *
28120
+ * The rank order is:
28121
+ *
28122
+ * 1. exact matches
28123
+ * 2. prefix matches
28124
+ * 3. suffix matches
28125
+ * 4. any matches inside a literal
28126
+ *
28127
+ * @param term The (partial) term to search for
28128
+ * @param maxResults The maximum number of results to return (defaults to 10)
28129
+ */
28130
+ search(term3, maxResults = 10) {
28131
+ const escapedTerm = term3.replace(/[~^+:]/g, (x) => `\\${x}`);
28132
+ return this.index.search(
28133
+ `${escapedTerm}^100 ${escapedTerm}*^20 *${escapedTerm}^10 *${escapedTerm}*^5`
28134
+ ).slice(0, maxResults);
28135
+ }
28136
+ /**
28137
+ * Remove all data from the search index.
28138
+ */
28139
+ clear() {
28140
+ this.index = (0, import_lunr.default)(() => {
28141
+ });
28142
+ }
28143
+ };
28144
+
28145
+ // src/rdf-document/RdfDocument.ts
28146
+ var RdfDocument = class extends Thing {
28147
+ constructor(uri6, store, editable = false) {
28148
+ super(uri6, store, editable);
28149
+ this.uri = uri6;
28150
+ this.store = store;
28151
+ this.editable = editable;
28152
+ }
28153
+ subjects() {
28154
+ const matches = this.store.statementsMatching(
28155
+ null,
28156
+ null,
28157
+ null,
28158
+ namedNode(this.uri)
28159
+ );
28160
+ const uris = matches.filter((match) => isNamedNode(match.subject)).map((match) => match.subject.value);
28161
+ const uniqueUris = new Set(uris);
28162
+ uniqueUris.delete(this.uri);
28163
+ return [...uniqueUris].map((uri6) => ({
28164
+ uri: uri6
28165
+ }));
28166
+ }
28167
+ };
28168
+
28169
+ // src/search/LabelIndex.ts
28170
+ var LabelIndex = class extends RdfDocument {
28171
+ constructor(uri6, store, editable = false) {
28172
+ super(uri6, store, editable);
28173
+ this.uri = uri6;
28174
+ this.store = store;
28175
+ this.editable = editable;
28176
+ }
28177
+ /**
28178
+ * Returns the URIs and labels for all the things listed in the document.
28179
+ */
28180
+ getIndexedItems() {
28181
+ const matches = this.store.statementsMatching(
28182
+ null,
28183
+ rdfs("label"),
28184
+ null,
28185
+ namedNode(this.uri)
28186
+ );
28187
+ return matches.map((it) => {
28188
+ return {
28189
+ uri: it.subject.value,
28190
+ label: it.object.value
28191
+ };
28192
+ });
28193
+ }
28194
+ contains(uri6) {
28195
+ return this.store.holds(namedNode(uri6), rdfs("label"), null, namedNode(this.uri));
28196
+ }
28197
+ };
28198
+
28002
28199
  // node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js
28003
28200
  async function executeUpdate(fetcher2, updater, operation3) {
28004
28201
  await updater.updateMany(operation3.deletions, operation3.insertions);
@@ -28070,207 +28267,6 @@ var ProfileQuery = class {
28070
28267
  var import_short_unique_id = __toESM(require_short_unique_id(), 1);
28071
28268
  var uid = new import_short_unique_id.default({ length: 10 });
28072
28269
 
28073
- // src/profile/WebIdProfile.ts
28074
- var WebIdProfile = class extends Thing {
28075
- constructor(webId, store, editable = false) {
28076
- super(webId, store, editable);
28077
- this.webId = webId;
28078
- this.store = store;
28079
- this.editable = editable;
28080
- this.profileQuery = new ProfileQuery(namedNode(this.webId), this.store);
28081
- }
28082
- /**
28083
- * Returns the URI of the preferences document
28084
- */
28085
- getPreferencesFile() {
28086
- return this.profileQuery.queryPreferencesFile()?.value;
28087
- }
28088
- /**
28089
- * Returns the URI of the public type index document
28090
- * @since 0.24.0
28091
- */
28092
- getPublicTypeIndex() {
28093
- return this.profileQuery.queryPublicTypeIndex()?.value;
28094
- }
28095
- /**
28096
- * Returns the URI of the private type index document
28097
- * @since 0.24.0
28098
- */
28099
- getPrivateTypeIndex() {
28100
- const preferences = this.profileQuery.queryPreferencesFile();
28101
- if (!preferences) return void 0;
28102
- const query4 = new PreferencesQuery(
28103
- this.store,
28104
- namedNode(this.webId),
28105
- preferences
28106
- );
28107
- return query4.queryPrivateTypeIndex()?.value;
28108
- }
28109
- /**
28110
- * Returns the URIs of the private label indexes
28111
- */
28112
- getPrivateLabelIndexes() {
28113
- const profileNodes = this.store.each(
28114
- namedNode(this.webId),
28115
- namedNode("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
28116
- void 0,
28117
- namedNode(this.webId).doc()
28118
- );
28119
- const preferences = this.getPreferencesFile();
28120
- if (preferences) {
28121
- const preferencesNodes = this.store.each(
28122
- namedNode(this.webId),
28123
- namedNode("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
28124
- void 0,
28125
- namedNode(preferences)
28126
- );
28127
- return [...profileNodes, ...preferencesNodes].map((it) => it.value);
28128
- } else {
28129
- return profileNodes.map((it) => it.value);
28130
- }
28131
- }
28132
- };
28133
-
28134
- // src/profile/ProfileGateway.ts
28135
- var ProfileGateway = class {
28136
- constructor(store) {
28137
- this.store = store;
28138
- }
28139
- /**
28140
- * Fetches the profile for the given WebID and all linked documents
28141
- * @since 0.24.0
28142
- * @param webId The WebID to fetch the profile for
28143
- * @returns {Promise<WebIdProfile>} The fetched profile
28144
- */
28145
- async fetchProfile(webId) {
28146
- await this.store.fetch(webId);
28147
- const profile2 = this.store.get(webId).assume(WebIdProfile);
28148
- const preferences = profile2.getPreferencesFile();
28149
- if (preferences) {
28150
- try {
28151
- await this.store.fetch(preferences);
28152
- } catch (error4) {
28153
- console.warn(`Failed to fetch preferences file ${preferences}:`, error4);
28154
- }
28155
- }
28156
- const publicTypeIndex2 = profile2.getPublicTypeIndex();
28157
- const privateTypeIndex2 = profile2.getPrivateTypeIndex();
28158
- await this.store.fetchAll(
28159
- [privateTypeIndex2, publicTypeIndex2].filter((it) => it !== void 0)
28160
- );
28161
- return profile2;
28162
- }
28163
- };
28164
-
28165
- // src/search/SearchIndex.ts
28166
- var import_lunr = __toESM(require_lunr(), 1);
28167
- var SearchIndex = class {
28168
- constructor(labelIndexes) {
28169
- this.labelIndexes = labelIndexes;
28170
- this.index = this.rebuild().index;
28171
- }
28172
- /**
28173
- * Recreates the search index with the current data from all label indexes
28174
- */
28175
- rebuild() {
28176
- const labelIndexes = this.labelIndexes;
28177
- this.index = (0, import_lunr.default)(function() {
28178
- this.ref("uri");
28179
- this.field("uri");
28180
- this.field("label");
28181
- this.metadataWhitelist = ["position"];
28182
- const items2 = labelIndexes.flatMap((it) => it.getIndexedItems());
28183
- items2.forEach((item4) => {
28184
- this.add({
28185
- uri: item4.uri,
28186
- label: item4.label
28187
- });
28188
- });
28189
- });
28190
- return this;
28191
- }
28192
- /**
28193
- * Search the index for a given term. It finds partial matches, but will rank exact matches higher.
28194
- *
28195
- * The rank order is:
28196
- *
28197
- * 1. exact matches
28198
- * 2. prefix matches
28199
- * 3. suffix matches
28200
- * 4. any matches inside a literal
28201
- *
28202
- * @param term The (partial) term to search for
28203
- * @param maxResults The maximum number of results to return (defaults to 10)
28204
- */
28205
- search(term3, maxResults = 10) {
28206
- const escapedTerm = term3.replace(/[~^+:]/g, (x) => `\\${x}`);
28207
- return this.index.search(
28208
- `${escapedTerm}^100 ${escapedTerm}*^20 *${escapedTerm}^10 *${escapedTerm}*^5`
28209
- ).slice(0, maxResults);
28210
- }
28211
- /**
28212
- * Remove all data from the search index.
28213
- */
28214
- clear() {
28215
- this.index = (0, import_lunr.default)(() => {
28216
- });
28217
- }
28218
- };
28219
-
28220
- // src/rdf-document/RdfDocument.ts
28221
- var RdfDocument = class extends Thing {
28222
- constructor(uri6, store, editable = false) {
28223
- super(uri6, store, editable);
28224
- this.uri = uri6;
28225
- this.store = store;
28226
- this.editable = editable;
28227
- }
28228
- subjects() {
28229
- const matches = this.store.statementsMatching(
28230
- null,
28231
- null,
28232
- null,
28233
- namedNode(this.uri)
28234
- );
28235
- const uris = matches.filter((match) => isNamedNode(match.subject)).map((match) => match.subject.value);
28236
- const uniqueUris = new Set(uris);
28237
- uniqueUris.delete(this.uri);
28238
- return [...uniqueUris].map((uri6) => ({
28239
- uri: uri6
28240
- }));
28241
- }
28242
- };
28243
-
28244
- // src/search/LabelIndex.ts
28245
- var LabelIndex = class extends RdfDocument {
28246
- constructor(uri6, store, editable = false) {
28247
- super(uri6, store, editable);
28248
- this.uri = uri6;
28249
- this.store = store;
28250
- this.editable = editable;
28251
- }
28252
- /**
28253
- * Returns the URIs and labels for all the things listed in the document.
28254
- */
28255
- getIndexedItems() {
28256
- const matches = this.store.statementsMatching(
28257
- null,
28258
- rdfs("label"),
28259
- null,
28260
- namedNode(this.uri)
28261
- );
28262
- return matches.map((it) => {
28263
- return {
28264
- uri: it.subject.value,
28265
- label: it.object.value
28266
- };
28267
- });
28268
- }
28269
- contains(uri6) {
28270
- return this.store.holds(namedNode(uri6), rdfs("label"), null, namedNode(this.uri));
28271
- }
28272
- };
28273
-
28274
28270
  // src/search/createDefaultLabelIndex.ts
28275
28271
  function createDefaultLabelIndex(profile2) {
28276
28272
  const webId = namedNode(profile2.webId);
@@ -28471,7 +28467,7 @@ var Store = class {
28471
28467
  */
28472
28468
  get(uri6) {
28473
28469
  const editable = !!this.updater.editable(uri6);
28474
- return new Thing(uri6, this.internalStore, editable);
28470
+ return new Thing(uri6, this, editable);
28475
28471
  }
28476
28472
  /**
28477
28473
  * Adds a new value to the property of the given thing
@@ -28554,6 +28550,139 @@ var Store = class {
28554
28550
  distinctUntilChanged((prev2, curr) => prev2.length == curr.length)
28555
28551
  );
28556
28552
  }
28553
+ /**
28554
+ * Finds types of the given resource
28555
+ *
28556
+ * @param {string|NamedNode|BlankNode} uri String or RDF/JS object
28557
+ * @returns {string[]} An array of URIs of types
28558
+ */
28559
+ findTypes(uri6) {
28560
+ if (typeof uri6 === "string") uri6 = namedNode(uri6);
28561
+ return Object.keys(this.internalStore.findTypeURIs(uri6));
28562
+ }
28563
+ /**
28564
+ * Determines whether the store includes a certain quad pattern, returning true or false as appropriate.
28565
+ *
28566
+ * @param {Quad_Subject|null|undefined} subject
28567
+ * @param {Quad_Predicate|null|undefined} predicate
28568
+ * @param {Quad_Object|null|undefined} object
28569
+ * @param {Quad_Graph|null|undefined} graph
28570
+ * @returns {boolean} Whether the store includes the quad pattern
28571
+ */
28572
+ holds(subject8, predicate4, object8, graph3) {
28573
+ return this.internalStore.holds(subject8, predicate4, object8, graph3);
28574
+ }
28575
+ /**
28576
+ * Statements matching the provided quad pattern
28577
+ *
28578
+ * @param {Quad_Subject|null|undefined} subject
28579
+ * @param {Quad_Predicate|null|undefined} predicate
28580
+ * @param {Quad_Object|null|undefined} object
28581
+ * @param {Quad_Graph|null|undefined} graph
28582
+ * @returns {Quad[]} Array of statements
28583
+ */
28584
+ statementsMatching(subject8, predicate4, object8, graph3) {
28585
+ return this.internalStore.statementsMatching(
28586
+ subject8,
28587
+ predicate4,
28588
+ object8,
28589
+ graph3
28590
+ );
28591
+ }
28592
+ /**
28593
+ * RDF/JS terms matching the first wildcard in the provided quad pattern
28594
+ *
28595
+ * @param {Quad_Subject|null|undefined} subject
28596
+ * @param {Quad_Predicate|null|undefined} predicate
28597
+ * @param {Quad_Object|null|undefined} object
28598
+ * @param {Quad_Graph|null|undefined} graph
28599
+ * @returns {Term[]} Array of terms
28600
+ */
28601
+ each(subject8, predicate4, object8, graph3) {
28602
+ const statements = this.statementsMatching(
28603
+ subject8,
28604
+ predicate4,
28605
+ object8,
28606
+ graph3
28607
+ );
28608
+ if (!subject8) {
28609
+ return statements.map((statement2) => statement2.subject);
28610
+ } else if (!predicate4) {
28611
+ return statements.map((statement2) => statement2.predicate);
28612
+ } else if (!object8) {
28613
+ return statements.map((statement2) => statement2.object);
28614
+ } else if (!graph3) {
28615
+ return statements.map((statement2) => statement2.graph);
28616
+ }
28617
+ throw new Error("No wildcard specified");
28618
+ }
28619
+ /**
28620
+ * Any one RDF/JS term matching the first wildcard in the provided quad pattern
28621
+ *
28622
+ * @param {Quad_Subject|null|undefined} subject
28623
+ * @param {Quad_Predicate|null|undefined} predicate
28624
+ * @param {Quad_Object|null|undefined} object
28625
+ * @param {Quad_Graph|null|undefined} graph
28626
+ * @returns {Term | null} RDF/JS term
28627
+ */
28628
+ any(subject8, predicate4, object8, graph3) {
28629
+ const justOne = true;
28630
+ const statements = this.internalStore.statementsMatching(
28631
+ subject8,
28632
+ predicate4,
28633
+ object8,
28634
+ graph3,
28635
+ justOne
28636
+ );
28637
+ if (statements.length == 0) return null;
28638
+ if (!subject8) {
28639
+ return statements[0].subject;
28640
+ } else if (!predicate4) {
28641
+ return statements[0].predicate;
28642
+ } else if (!object8) {
28643
+ return statements[0].object;
28644
+ } else if (!graph3) {
28645
+ return statements[0].graph;
28646
+ }
28647
+ throw new Error("No wildcard specified");
28648
+ }
28649
+ /**
28650
+ * Value of any one RDF/JS term matching the first wildcard in the provided quad pattern
28651
+ *
28652
+ * @param {Quad_Subject|null|undefined} subject
28653
+ * @param {Quad_Predicate|null|undefined} predicate
28654
+ * @param {Quad_Object|null|undefined} object
28655
+ * @param {Quad_Graph|null|undefined} graph
28656
+ * @returns {string | undefined} value of RDF/JS term
28657
+ */
28658
+ anyValue(subject8, predicate4, object8, graph3) {
28659
+ return this.any(subject8, predicate4, object8, graph3)?.value;
28660
+ }
28661
+ /**
28662
+ * Create a query to fetch information from a user's preferences file
28663
+ *
28664
+ * @param webId
28665
+ * @param preferencesDoc
28666
+ * @returns {PreferencesQuery} PreferencesQuery instance. See [@solid-data-modules/rdflib-utils
28667
+ ](https://solid-contrib.github.io/data-modules/rdflib-utils/classes/index.PreferencesQuery.html)
28668
+ */
28669
+ preferencesQuery(webId, preferencesDoc) {
28670
+ if (typeof webId === "string") webId = namedNode(webId);
28671
+ if (typeof preferencesDoc === "string")
28672
+ preferencesDoc = namedNode(preferencesDoc);
28673
+ return new PreferencesQuery(this.internalStore, webId, preferencesDoc);
28674
+ }
28675
+ /**
28676
+ * Create a query to fetch information from a user's profile document
28677
+ *
28678
+ * @param webId
28679
+ * @returns {ProfileQuery} ProfileQuery instance. See [@solid-data-modules/rdflib-utils
28680
+ ](https://solid-contrib.github.io/data-modules/rdflib-utils/classes/index.ProfileQuery.html)
28681
+ */
28682
+ profileQuery(webId) {
28683
+ if (typeof webId === "string") webId = namedNode(webId);
28684
+ return new ProfileQuery(webId, this.internalStore);
28685
+ }
28557
28686
  };
28558
28687
 
28559
28688
  // ../node_modules/rdf-namespaces/dist/index.es.js
@@ -38493,7 +38622,7 @@ var langString = "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString";
38493
38622
  var PlainLiteral = "http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral";
38494
38623
  var type4 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
38495
38624
  var Property2 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property";
38496
- var Statement2 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement";
38625
+ var Statement3 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement";
38497
38626
  var subject5 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject";
38498
38627
  var predicate = "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate";
38499
38628
  var object3 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#object";
@@ -38515,7 +38644,7 @@ var rdfImport = /* @__PURE__ */ Object.freeze({
38515
38644
  PlainLiteral,
38516
38645
  type: type4,
38517
38646
  Property: Property2,
38518
- Statement: Statement2,
38647
+ Statement: Statement3,
38519
38648
  subject: subject5,
38520
38649
  predicate,
38521
38650
  object: object3,
@@ -39392,7 +39521,7 @@ var SportsTeam = "http://schema.org/SportsTeam";
39392
39521
  var SpreadsheetDigitalDocument = "http://schema.org/SpreadsheetDigitalDocument";
39393
39522
  var StadiumOrArena = "http://schema.org/StadiumOrArena";
39394
39523
  var State = "http://schema.org/State";
39395
- var Statement3 = "http://schema.org/Statement";
39524
+ var Statement4 = "http://schema.org/Statement";
39396
39525
  var StatisticalPopulation = "http://schema.org/StatisticalPopulation";
39397
39526
  var StatisticalVariable = "http://schema.org/StatisticalVariable";
39398
39527
  var StatusEnumeration = "http://schema.org/StatusEnumeration";
@@ -41831,7 +41960,7 @@ var schemaImport = /* @__PURE__ */ Object.freeze({
41831
41960
  SpreadsheetDigitalDocument,
41832
41961
  StadiumOrArena,
41833
41962
  State,
41834
- Statement: Statement3,
41963
+ Statement: Statement4,
41835
41964
  StatisticalPopulation,
41836
41965
  StatisticalVariable,
41837
41966
  StatusEnumeration,
@@ -44272,7 +44401,7 @@ var SportsTeam2 = "https://schema.org/SportsTeam";
44272
44401
  var SpreadsheetDigitalDocument2 = "https://schema.org/SpreadsheetDigitalDocument";
44273
44402
  var StadiumOrArena2 = "https://schema.org/StadiumOrArena";
44274
44403
  var State2 = "https://schema.org/State";
44275
- var Statement4 = "https://schema.org/Statement";
44404
+ var Statement5 = "https://schema.org/Statement";
44276
44405
  var StatisticalPopulation2 = "https://schema.org/StatisticalPopulation";
44277
44406
  var StatisticalVariable2 = "https://schema.org/StatisticalVariable";
44278
44407
  var StatusEnumeration2 = "https://schema.org/StatusEnumeration";
@@ -46711,7 +46840,7 @@ var schema_httpsImport = /* @__PURE__ */ Object.freeze({
46711
46840
  SpreadsheetDigitalDocument: SpreadsheetDigitalDocument2,
46712
46841
  StadiumOrArena: StadiumOrArena2,
46713
46842
  State: State2,
46714
- Statement: Statement4,
46843
+ Statement: Statement5,
46715
46844
  StatisticalPopulation: StatisticalPopulation2,
46716
46845
  StatisticalVariable: StatisticalVariable2,
46717
46846
  StatusEnumeration: StatusEnumeration2,
@@ -49890,6 +50019,181 @@ async function loadModule(moduleName, store) {
49890
50019
  return store.loadModule(module3);
49891
50020
  }
49892
50021
 
50022
+ // ../node_modules/url-template/lib/url-template.js
50023
+ function encodeReserved(str) {
50024
+ return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part3) {
50025
+ if (!/%[0-9A-Fa-f]/.test(part3)) {
50026
+ part3 = encodeURI(part3).replace(/%5B/g, "[").replace(/%5D/g, "]");
50027
+ }
50028
+ return part3;
50029
+ }).join("");
50030
+ }
50031
+ function encodeUnreserved(str) {
50032
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
50033
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
50034
+ });
50035
+ }
50036
+ function encodeValue(operator2, value7, key3) {
50037
+ value7 = operator2 === "+" || operator2 === "#" ? encodeReserved(value7) : encodeUnreserved(value7);
50038
+ if (key3) {
50039
+ return encodeUnreserved(key3) + "=" + value7;
50040
+ } else {
50041
+ return value7;
50042
+ }
50043
+ }
50044
+ function isDefined(value7) {
50045
+ return value7 !== void 0 && value7 !== null;
50046
+ }
50047
+ function isKeyOperator(operator2) {
50048
+ return operator2 === ";" || operator2 === "&" || operator2 === "?";
50049
+ }
50050
+ function getValues(context4, operator2, key3, modifier2) {
50051
+ var value7 = context4[key3], result6 = [];
50052
+ if (isDefined(value7) && value7 !== "") {
50053
+ if (typeof value7 === "string" || typeof value7 === "number" || typeof value7 === "boolean") {
50054
+ value7 = value7.toString();
50055
+ if (modifier2 && modifier2 !== "*") {
50056
+ value7 = value7.substring(0, parseInt(modifier2, 10));
50057
+ }
50058
+ result6.push(encodeValue(operator2, value7, isKeyOperator(operator2) ? key3 : null));
50059
+ } else {
50060
+ if (modifier2 === "*") {
50061
+ if (Array.isArray(value7)) {
50062
+ value7.filter(isDefined).forEach(function(value8) {
50063
+ result6.push(encodeValue(operator2, value8, isKeyOperator(operator2) ? key3 : null));
50064
+ });
50065
+ } else {
50066
+ Object.keys(value7).forEach(function(k) {
50067
+ if (isDefined(value7[k])) {
50068
+ result6.push(encodeValue(operator2, value7[k], k));
50069
+ }
50070
+ });
50071
+ }
50072
+ } else {
50073
+ var tmp = [];
50074
+ if (Array.isArray(value7)) {
50075
+ value7.filter(isDefined).forEach(function(value8) {
50076
+ tmp.push(encodeValue(operator2, value8));
50077
+ });
50078
+ } else {
50079
+ Object.keys(value7).forEach(function(k) {
50080
+ if (isDefined(value7[k])) {
50081
+ tmp.push(encodeUnreserved(k));
50082
+ tmp.push(encodeValue(operator2, value7[k].toString()));
50083
+ }
50084
+ });
50085
+ }
50086
+ if (isKeyOperator(operator2)) {
50087
+ result6.push(encodeUnreserved(key3) + "=" + tmp.join(","));
50088
+ } else if (tmp.length !== 0) {
50089
+ result6.push(tmp.join(","));
50090
+ }
50091
+ }
50092
+ }
50093
+ } else {
50094
+ if (operator2 === ";") {
50095
+ if (isDefined(value7)) {
50096
+ result6.push(encodeUnreserved(key3));
50097
+ }
50098
+ } else if (value7 === "" && (operator2 === "&" || operator2 === "?")) {
50099
+ result6.push(encodeUnreserved(key3) + "=");
50100
+ } else if (value7 === "") {
50101
+ result6.push("");
50102
+ }
50103
+ }
50104
+ return result6;
50105
+ }
50106
+ function parseTemplate(template3) {
50107
+ var operators = ["+", "#", ".", "/", ";", "?", "&"];
50108
+ return {
50109
+ expand: function(context4) {
50110
+ return template3.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function(_, expression4, literal4) {
50111
+ if (expression4) {
50112
+ var operator2 = null, values2 = [];
50113
+ if (operators.indexOf(expression4.charAt(0)) !== -1) {
50114
+ operator2 = expression4.charAt(0);
50115
+ expression4 = expression4.substr(1);
50116
+ }
50117
+ expression4.split(/,/g).forEach(function(variable5) {
50118
+ var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable5);
50119
+ values2.push.apply(values2, getValues(context4, operator2, tmp[1], tmp[2] || tmp[3]));
50120
+ });
50121
+ if (operator2 && operator2 !== "+") {
50122
+ var separator = ",";
50123
+ if (operator2 === "?") {
50124
+ separator = "&";
50125
+ } else if (operator2 !== "#") {
50126
+ separator = operator2;
50127
+ }
50128
+ return (values2.length !== 0 ? operator2 : "") + values2.join(separator);
50129
+ } else {
50130
+ return values2.join(",");
50131
+ }
50132
+ } else {
50133
+ return encodeReserved(literal4);
50134
+ }
50135
+ });
50136
+ }
50137
+ };
50138
+ }
50139
+
50140
+ // src/open-with/apps.ts
50141
+ var APPS = {
50142
+ DATA_BROWSER: {
50143
+ name: "Data Browser (SolidOS)",
50144
+ urlTemplate: parseTemplate(
50145
+ "https://solidos.github.io/mashlib/dist/browse.html{?uri}"
50146
+ )
50147
+ },
50148
+ PENNY: {
50149
+ name: "Penny",
50150
+ urlTemplate: parseTemplate(
50151
+ "https://penny.vincenttunru.com/explore/?url={uri}"
50152
+ )
50153
+ },
50154
+ SOLID_FILE_MANAGER: {
50155
+ name: "Solid File Manager",
50156
+ urlTemplate: parseTemplate(
50157
+ "https://otto-aa.github.io/solid-filemanager/?url={uri}"
50158
+ )
50159
+ },
50160
+ UMAI: {
50161
+ name: "Umai",
50162
+ urlTemplate: parseTemplate(
50163
+ "https://umai.noeldemartin.com/viewer?url={uri}"
50164
+ )
50165
+ },
50166
+ DOKIELI: {
50167
+ name: "dokieli",
50168
+ urlTemplate: parseTemplate("https://dokie.li/#open={uri}")
50169
+ },
50170
+ DOKIELI_GRAPH: {
50171
+ name: "dokieli Graph",
50172
+ urlTemplate: parseTemplate("https://dokie.li/#graph={uri}")
50173
+ },
50174
+ POD_OS_CONTACTS: {
50175
+ name: "PodOS Contacts",
50176
+ urlTemplate: parseTemplate(
50177
+ "https://contacts.pod-os.org/address-book{?uri}"
50178
+ )
50179
+ }
50180
+ };
50181
+
50182
+ // src/open-with/proposeAppsFor.ts
50183
+ var appRegistrations = {
50184
+ "http://www.w3.org/ns/ldp#Container": [APPS.SOLID_FILE_MANAGER],
50185
+ "http://schema.org/Recipe": [APPS.UMAI],
50186
+ "https://schema.org/Recipe": [APPS.UMAI],
50187
+ "http://www.w3.org/2007/ont/link#RDFDocument": [APPS.DOKIELI_GRAPH],
50188
+ "http://www.w3.org/ns/iana/media-types/text/html#Resource": [APPS.DOKIELI],
50189
+ "http://www.w3.org/2006/vcard/ns#AddressBook": [APPS.POD_OS_CONTACTS]
50190
+ };
50191
+ function proposeAppsFor(thing) {
50192
+ const apps = [APPS.DATA_BROWSER, APPS.PENNY];
50193
+ const appsForType = thing.types().flatMap((it) => appRegistrations[it.uri]).filter((it) => it !== void 0);
50194
+ return [...apps, ...appsForType];
50195
+ }
50196
+
49893
50197
  // src/authentication/index.ts
49894
50198
  var AnonymousSession = class {
49895
50199
  constructor() {
@@ -50100,6 +50404,14 @@ var PodOS = class {
50100
50404
  attachments() {
50101
50405
  return this.attachmentGateway;
50102
50406
  }
50407
+ /**
50408
+ * Propose matching apps to open a thing
50409
+ * @param thing - The thing to open
50410
+ * @returns An array of apps that can open the thing. The array is empty if no apps are found.
50411
+ */
50412
+ proposeAppsFor(thing) {
50413
+ return proposeAppsFor(thing);
50414
+ }
50103
50415
  };
50104
50416
  export {
50105
50417
  AnonymousSession,
@@ -50128,7 +50440,8 @@ export {
50128
50440
  httpProblem,
50129
50441
  labelFromUri,
50130
50442
  listKnownTerms,
50131
- networkProblem
50443
+ networkProblem,
50444
+ proposeAppsFor
50132
50445
  };
50133
50446
  /*! Bundled license information:
50134
50447