@arbetsformedlingen/yrkesvaljaren 2.2.0 → 2.3.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/README.md +20 -2
- package/dist/cjs/digi-service-job-selector.cjs.entry.js +85 -35
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{types-DdzCbiye.js → types-B3W1Y40Q.js} +5 -4
- package/dist/collection/components/job-selector/job-selector-controller.js +20 -6
- package/dist/collection/components/job-selector/job-selector.js +66 -30
- package/dist/collection/components/job-selector/logic/adapter.utils.js +5 -4
- package/dist/components/digi-service-job-selector.js +1 -1
- package/dist/components/types.js +1 -1
- package/dist/esm/digi-service-job-selector.entry.js +85 -35
- package/dist/esm/index.js +2 -2
- package/dist/esm/{types-DVos4HHS.js → types-D9zmn-JR.js} +5 -4
- package/dist/types/components/job-selector/job-selector-controller.d.ts +10 -1
- package/dist/types/components/job-selector/job-selector.d.ts +3 -0
- package/dist/types/components/job-selector/logic/adapter.utils.d.ts +1 -1
- package/dist/types/components/job-selector/types.d.ts +17 -2
- package/dist/types/components.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/yrkesvaljaren/index.esm.js +1 -1
- package/dist/yrkesvaljaren/{p-DVos4HHS.js → p-D9zmn-JR.js} +1 -1
- package/dist/yrkesvaljaren/p-c2eb633a.entry.js +1 -0
- package/dist/yrkesvaljaren/yrkesvaljaren.esm.js +1 -1
- package/package.json +1 -1
- package/dist/yrkesvaljaren/p-0f19a308.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as getElement, r as registerInstance, c as createEvent, h, F as Fragment } from './index-vJ-tamti.js';
|
|
2
|
-
import { l as log, g as getRegisteredTaxonomy, T as TaxonomySearchEngine, D as DEBOUNCE_TIME, L as LabelFormatter, s as segmentsToHtml, i as isSameSearchResult, M as MAX_RESULTS, a as TaxonomyAdapter, b as isTaxonomyRegistration, P as PLACEHOLDER_TEXT, c as MIN_INPUT_LENGTH, I as InvalidSelectionError, r as registerTaxonomy, d as styleParentheticalText } from './types-
|
|
2
|
+
import { l as log, g as getRegisteredTaxonomy, T as TaxonomySearchEngine, D as DEBOUNCE_TIME, L as LabelFormatter, s as segmentsToHtml, i as isSameSearchResult, M as MAX_RESULTS, a as TaxonomyAdapter, b as isTaxonomyRegistration, P as PLACEHOLDER_TEXT, c as MIN_INPUT_LENGTH, I as InvalidSelectionError, r as registerTaxonomy, d as styleParentheticalText } from './types-D9zmn-JR.js';
|
|
3
3
|
import { A as AfValidationMessage } from './af-validation-message-DMoOu-0k.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -811,6 +811,7 @@ class JobSelectorController {
|
|
|
811
811
|
}
|
|
812
812
|
setSelection(selection) {
|
|
813
813
|
const invalidIds = [];
|
|
814
|
+
let invalidReference;
|
|
814
815
|
const selectedItems = selection.map((item) => {
|
|
815
816
|
if (item.id !== null) {
|
|
816
817
|
const matchingItems = this.taxonomyData.filter((taxonomy) => taxonomy.id === item.id);
|
|
@@ -818,18 +819,22 @@ class JobSelectorController {
|
|
|
818
819
|
invalidIds.push(item.id);
|
|
819
820
|
return undefined;
|
|
820
821
|
}
|
|
822
|
+
const relatedId = item.related?.id;
|
|
821
823
|
let taxonomyItem;
|
|
822
|
-
if (
|
|
823
|
-
taxonomyItem = matchingItems.find((taxonomy) => taxonomy.occupation_name_id ===
|
|
824
|
-
if (!taxonomyItem && matchingItems.length === 1) {
|
|
824
|
+
if (relatedId) {
|
|
825
|
+
taxonomyItem = matchingItems.find((taxonomy) => taxonomy.occupation_name_id === relatedId);
|
|
826
|
+
if (!taxonomyItem && !item.exact && matchingItems.length === 1) {
|
|
825
827
|
taxonomyItem = matchingItems[0];
|
|
826
828
|
}
|
|
827
829
|
}
|
|
828
|
-
else {
|
|
830
|
+
else if (!item.exact || matchingItems.length === 1) {
|
|
829
831
|
taxonomyItem = matchingItems[0];
|
|
830
832
|
}
|
|
831
833
|
if (!taxonomyItem) {
|
|
832
834
|
invalidIds.push(item.id);
|
|
835
|
+
if (item.exact) {
|
|
836
|
+
invalidReference ??= item;
|
|
837
|
+
}
|
|
833
838
|
return undefined;
|
|
834
839
|
}
|
|
835
840
|
return this.toSearchResult(taxonomyItem);
|
|
@@ -837,9 +842,18 @@ class JobSelectorController {
|
|
|
837
842
|
return this.createManualInputItem(item.preferred_label);
|
|
838
843
|
});
|
|
839
844
|
if (invalidIds.length > 0) {
|
|
840
|
-
return
|
|
845
|
+
return invalidReference
|
|
846
|
+
? { ok: false, invalidIds, reference: invalidReference }
|
|
847
|
+
: { ok: false, invalidIds };
|
|
841
848
|
}
|
|
842
849
|
const resolvedItems = selectedItems;
|
|
850
|
+
// Kontrollera taxonomival efter uppslagning så att två referenser till samma rad avvisas.
|
|
851
|
+
// Fritext valideras separat och får ha samma text som ett taxonomival.
|
|
852
|
+
const taxonomyItems = resolvedItems.filter((item) => item.id);
|
|
853
|
+
const hasDuplicate = taxonomyItems.some((item, index) => taxonomyItems.findIndex((other) => isSameSearchResult(other, item)) !== index);
|
|
854
|
+
if (hasDuplicate) {
|
|
855
|
+
return { ok: false, invalidIds: [], duplicate: true };
|
|
856
|
+
}
|
|
843
857
|
const commonState = this.getCommonState();
|
|
844
858
|
if (this.config.enableMultiple) {
|
|
845
859
|
this.updateState({
|
|
@@ -955,7 +969,7 @@ class JobSelectorController {
|
|
|
955
969
|
};
|
|
956
970
|
}
|
|
957
971
|
toPublicSelection(item) {
|
|
958
|
-
return TaxonomyAdapter.toPublicSelection(item);
|
|
972
|
+
return TaxonomyAdapter.toPublicSelection(item, (id) => this.taxonomyData.find((row) => row.id === id && row.type === 'occupation-name')?.preferred_label?.trim());
|
|
959
973
|
}
|
|
960
974
|
createManualInputItem(value) {
|
|
961
975
|
return {
|
|
@@ -1045,6 +1059,9 @@ const jobSelectorCss = () => `:host{--digi--grayscale-0:#ffffff;--digi--grayscal
|
|
|
1045
1059
|
log.setLevel(log.levels.SILENT);
|
|
1046
1060
|
}
|
|
1047
1061
|
const CONCEPT_ID_PATTERN = /^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{4}_[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{3}_[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{3}$/;
|
|
1062
|
+
function taxonomySelectionKey(id, relatedId) {
|
|
1063
|
+
return JSON.stringify([id, relatedId ?? null]);
|
|
1064
|
+
}
|
|
1048
1065
|
const JobSelector = class {
|
|
1049
1066
|
get hostElement() { return getElement(this); }
|
|
1050
1067
|
internals;
|
|
@@ -1165,6 +1182,10 @@ const JobSelector = class {
|
|
|
1165
1182
|
}
|
|
1166
1183
|
const selection = [];
|
|
1167
1184
|
const taxonomyIds = [];
|
|
1185
|
+
// Unikhet avgörs av taxonomi-id + related.id, samma regel som vid manuellt val.
|
|
1186
|
+
// En jobbtitel kan höra till flera yrkesbenämningar, t.ex. Butiksmedarbetare
|
|
1187
|
+
// (Kassapersonal) och Butiksmedarbetare (Butikssäljare), och båda är giltiga val.
|
|
1188
|
+
const selectionKeys = [];
|
|
1168
1189
|
const manualLabels = [];
|
|
1169
1190
|
for (const item of values) {
|
|
1170
1191
|
if (typeof item === 'string') {
|
|
@@ -1174,6 +1195,7 @@ const JobSelector = class {
|
|
|
1174
1195
|
}
|
|
1175
1196
|
if (CONCEPT_ID_PATTERN.test(value)) {
|
|
1176
1197
|
taxonomyIds.push(value);
|
|
1198
|
+
selectionKeys.push(taxonomySelectionKey(value));
|
|
1177
1199
|
selection.push({ id: value });
|
|
1178
1200
|
}
|
|
1179
1201
|
else {
|
|
@@ -1191,32 +1213,29 @@ const JobSelector = class {
|
|
|
1191
1213
|
const candidateItem = item;
|
|
1192
1214
|
if (typeof candidateItem.id === 'string') {
|
|
1193
1215
|
const id = candidateItem.id.trim();
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
&& candidateItem.type !== 'occupation-name')
|
|
1216
|
+
const exact = candidateItem.type === undefined && candidateItem.preferred_label === undefined;
|
|
1217
|
+
if (!id || (!exact && ((candidateItem.type !== 'job-title' && candidateItem.type !== 'occupation-name')
|
|
1197
1218
|
|| typeof candidateItem.preferred_label !== 'string'
|
|
1198
|
-
|| !candidateItem.preferred_label.trim()) {
|
|
1219
|
+
|| !candidateItem.preferred_label.trim()))) {
|
|
1199
1220
|
return { ok: false, reason: 'invalid-input' };
|
|
1200
1221
|
}
|
|
1201
|
-
let
|
|
1222
|
+
let relatedId;
|
|
1202
1223
|
if (candidateItem.related !== undefined) {
|
|
1203
1224
|
const related = candidateItem.related;
|
|
1204
1225
|
if (!related
|
|
1205
|
-
|| related
|
|
1226
|
+
|| typeof related !== 'object'
|
|
1206
1227
|
|| typeof related.id !== 'string'
|
|
1207
1228
|
|| !related.id.trim()
|
|
1208
|
-
||
|
|
1209
|
-
|
|
1229
|
+
|| (!exact && (related.type !== 'occupation-name'
|
|
1230
|
+
|| typeof related.preferred_label !== 'string'
|
|
1231
|
+
|| !related.preferred_label.trim()))) {
|
|
1210
1232
|
return { ok: false, reason: 'invalid-input' };
|
|
1211
1233
|
}
|
|
1212
|
-
|
|
1213
|
-
type: 'occupation-name',
|
|
1214
|
-
id: related.id.trim(),
|
|
1215
|
-
preferred_label: related.preferred_label.trim(),
|
|
1216
|
-
};
|
|
1234
|
+
relatedId = related.id.trim();
|
|
1217
1235
|
}
|
|
1218
1236
|
taxonomyIds.push(id);
|
|
1219
|
-
|
|
1237
|
+
selectionKeys.push(taxonomySelectionKey(id, relatedId));
|
|
1238
|
+
selection.push({ id, related: relatedId ? { id: relatedId } : undefined, exact });
|
|
1220
1239
|
}
|
|
1221
1240
|
else if (candidateItem.id === null && candidateItem.type === 'manual-input') {
|
|
1222
1241
|
if (typeof candidateItem.preferred_label !== 'string' || !candidateItem.preferred_label.trim()) {
|
|
@@ -1236,7 +1255,7 @@ const JobSelector = class {
|
|
|
1236
1255
|
if (!this.enableMultiple && selection.length > 1) {
|
|
1237
1256
|
return { ok: false, reason: 'multiple-disabled' };
|
|
1238
1257
|
}
|
|
1239
|
-
if (new Set(
|
|
1258
|
+
if (new Set(selectionKeys).size !== selectionKeys.length) {
|
|
1240
1259
|
return { ok: false, reason: 'duplicate-taxonomy-id' };
|
|
1241
1260
|
}
|
|
1242
1261
|
if (new Set(manualLabels).size !== manualLabels.length) {
|
|
@@ -1251,11 +1270,17 @@ const JobSelector = class {
|
|
|
1251
1270
|
describeSelectionRejection(rejection) {
|
|
1252
1271
|
switch (rejection.reason) {
|
|
1253
1272
|
case 'invalid-input':
|
|
1254
|
-
return 'setSelection accepterar en sträng, en
|
|
1273
|
+
return 'setSelection accepterar en sträng, en array med strängar eller en array med valobjekt eller referenser som { id, related: { id } }.';
|
|
1274
|
+
case 'invalid-reference': {
|
|
1275
|
+
const { id, related } = rejection.reference;
|
|
1276
|
+
return related
|
|
1277
|
+
? `Yrkesbenämningen ${related.id} hör inte till valet ${id} i den laddade yrkesdatan.`
|
|
1278
|
+
: `Jobbtiteln ${id} hör till flera yrkesbenämningar. Ange yrkesbenämningens id i related.id.`;
|
|
1279
|
+
}
|
|
1255
1280
|
case 'data-unavailable':
|
|
1256
1281
|
return 'setSelection kan inte användas eftersom yrkesdata inte kunde laddas.';
|
|
1257
1282
|
case 'duplicate-taxonomy-id':
|
|
1258
|
-
return 'selection får inte innehålla
|
|
1283
|
+
return 'selection får inte innehålla samma yrke två gånger (samma taxonomi-id och related.id).';
|
|
1259
1284
|
case 'duplicate-manual-label':
|
|
1260
1285
|
return 'selection får inte innehålla dubbla manuella labels.';
|
|
1261
1286
|
case 'multiple-disabled':
|
|
@@ -1286,8 +1311,19 @@ const JobSelector = class {
|
|
|
1286
1311
|
this.updateValidity(false);
|
|
1287
1312
|
return new InvalidSelectionError(message, this.errorCodeForRejection(rejection.reason), rejection.invalidIds);
|
|
1288
1313
|
}
|
|
1289
|
-
syncAcceptedSelection(selection) {
|
|
1314
|
+
syncAcceptedSelection(selection, references) {
|
|
1290
1315
|
const nextSelection = this.cloneSelection(selection);
|
|
1316
|
+
// Behåll exakt matchning även när användaren ändrar andra val i listan.
|
|
1317
|
+
this.exactSelectionKeys = new Set(nextSelection.flatMap((item, index) => {
|
|
1318
|
+
if (item.id === null)
|
|
1319
|
+
return [];
|
|
1320
|
+
const key = taxonomySelectionKey(item.id, item.related?.id);
|
|
1321
|
+
const reference = references?.[index];
|
|
1322
|
+
const exact = reference
|
|
1323
|
+
? reference.id !== null && reference.exact
|
|
1324
|
+
: this.exactSelectionKeys.has(key);
|
|
1325
|
+
return exact ? [key] : [];
|
|
1326
|
+
}));
|
|
1291
1327
|
this.lastAcceptedSelection = nextSelection;
|
|
1292
1328
|
if (this.activeErrorType === 'invalidInput') {
|
|
1293
1329
|
const hasAcceptedSelection = nextSelection.length > 0;
|
|
@@ -1308,11 +1344,20 @@ const JobSelector = class {
|
|
|
1308
1344
|
}
|
|
1309
1345
|
const result = this.controller.setSelection(validation.selection);
|
|
1310
1346
|
if (!result.ok) {
|
|
1311
|
-
throw this.
|
|
1347
|
+
throw this.rejectSelectionResolution(candidate, result);
|
|
1312
1348
|
}
|
|
1313
|
-
this.syncAcceptedSelection(result.selection);
|
|
1349
|
+
this.syncAcceptedSelection(result.selection, validation.selection);
|
|
1314
1350
|
return this.cloneSelection(result.selection);
|
|
1315
1351
|
}
|
|
1352
|
+
rejectSelectionResolution(candidate, result) {
|
|
1353
|
+
if (result.duplicate) {
|
|
1354
|
+
return this.rejectSelection(candidate, { ok: false, reason: 'duplicate-taxonomy-id' });
|
|
1355
|
+
}
|
|
1356
|
+
if (result.reference) {
|
|
1357
|
+
return this.rejectSelection(candidate, { ok: false, reason: 'invalid-reference', reference: result.reference });
|
|
1358
|
+
}
|
|
1359
|
+
return this.rejectSelection(candidate, { ok: false, reason: 'unknown-id', invalidIds: result.invalidIds });
|
|
1360
|
+
}
|
|
1316
1361
|
watchRequired(newValue) {
|
|
1317
1362
|
this.controller.updateConfig({ required: newValue });
|
|
1318
1363
|
}
|
|
@@ -1381,20 +1426,24 @@ const JobSelector = class {
|
|
|
1381
1426
|
controller;
|
|
1382
1427
|
validJobIds = new Set();
|
|
1383
1428
|
lastAcceptedSelection = [];
|
|
1429
|
+
exactSelectionKeys = new Set();
|
|
1384
1430
|
restoreAcceptedSelectionAfterDataUpdate() {
|
|
1385
1431
|
if (this.lastAcceptedSelection.length === 0) {
|
|
1386
1432
|
return;
|
|
1387
1433
|
}
|
|
1388
|
-
const
|
|
1434
|
+
const references = this.lastAcceptedSelection.map((item) => item.id === null
|
|
1435
|
+
? item
|
|
1436
|
+
: {
|
|
1437
|
+
id: item.id,
|
|
1438
|
+
related: item.related,
|
|
1439
|
+
exact: this.exactSelectionKeys.has(taxonomySelectionKey(item.id, item.related?.id)),
|
|
1440
|
+
});
|
|
1441
|
+
const result = this.controller.setSelection(references);
|
|
1389
1442
|
if (result.ok) {
|
|
1390
|
-
this.syncAcceptedSelection(result.selection);
|
|
1443
|
+
this.syncAcceptedSelection(result.selection, references);
|
|
1391
1444
|
return;
|
|
1392
1445
|
}
|
|
1393
|
-
this.
|
|
1394
|
-
ok: false,
|
|
1395
|
-
reason: 'unknown-id',
|
|
1396
|
-
invalidIds: result.invalidIds,
|
|
1397
|
-
});
|
|
1446
|
+
this.rejectSelectionResolution(this.lastAcceptedSelection, result);
|
|
1398
1447
|
}
|
|
1399
1448
|
// --- LIVSCYKEL-METODER ---
|
|
1400
1449
|
async componentWillLoad() {
|
|
@@ -1657,6 +1706,7 @@ const JobSelector = class {
|
|
|
1657
1706
|
/**
|
|
1658
1707
|
* Sätter ett programatiskt val och returnerar YV:s normaliserade, rika selection.
|
|
1659
1708
|
* Strängar som matchar Concept ID-formatet tolkas som taxonomi-id:n; övriga som fritext.
|
|
1709
|
+
* Sparade referenser som { id, related: { id } } slås upp i den laddade yrkesdatan.
|
|
1660
1710
|
*/
|
|
1661
1711
|
async setSelection(input) {
|
|
1662
1712
|
return this.applySelection(input);
|
|
@@ -1883,7 +1933,7 @@ const JobSelector = class {
|
|
|
1883
1933
|
};
|
|
1884
1934
|
// Pass external error message if present and we are not in loading/error state
|
|
1885
1935
|
// (This logic is now moved to _mapStateToSelectorState to respect validation state)
|
|
1886
|
-
return (h("div", { key: '
|
|
1936
|
+
return (h("div", { key: 'd2042c1c0e5e76d8dfeedd2691de20d6fcf49c27', class: "job-selector-wrapper" }, this.state.status === 'error' ? (h("div", { class: "error-message" }, h(AfValidationMessage, { variant: "error", role: "alert" }, this.state.message || 'Ett fel uppstod.'))) : (h(Fragment, null, h("core-selector", { id: this.componentId, componentId: this.componentId, state: selectorState, config: config, label: this.label, labelDescription: this.labelDescription, size: this.size, afFocused: this.afFocused }), this.suggestionState && this.suggestionState.status !== 'pii-blocked' && (h("div", { key: "yv-suggestion-box", class: "yv-suggestion-box", role: "region", "aria-label": "F\u00F6resl\u00E5 saknat yrke" }, this.suggestionState.status === 'form' ? (h("div", { class: "yv-suggestion-form" }, h("div", { class: "yv-suggestion-title", id: `${this.componentId}-suggestion-title` }, "Motivera varf\u00F6r \"", h("strong", null, this.suggestionState.term), "\" b\u00F6r l\u00E4ggas till som yrke (frivilligt):"), h("div", { class: "yv-motivation-container" }, h("div", { class: "yv-motivation-field-wrapper" }, h("textarea", { id: `${this.componentId}-suggestion-motivation-input`, "aria-labelledby": `${this.componentId}-suggestion-title`, "aria-describedby": this.suggestionState.piiError
|
|
1887
1937
|
? `${this.componentId}-motivation-pii-error ${this.componentId}-motivation-counter`
|
|
1888
1938
|
: `${this.componentId}-motivation-counter`, "aria-invalid": this.suggestionState.piiError ? 'true' : 'false', class: "yv-motivation-input", value: this.suggestionState.motivation, maxLength: 160, rows: 2, ref: (el) => {
|
|
1889
1939
|
if (el) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerTaxonomy } from './types-
|
|
2
|
-
export { I as InvalidSelectionError, T as TaxonomySearchEngine } from './types-
|
|
1
|
+
import { r as registerTaxonomy } from './types-D9zmn-JR.js';
|
|
2
|
+
export { I as InvalidSelectionError, T as TaxonomySearchEngine } from './types-D9zmn-JR.js';
|
|
3
3
|
|
|
4
4
|
if (typeof window !== 'undefined') {
|
|
5
5
|
window.registerTaxonomy = registerTaxonomy;
|
|
@@ -2482,7 +2482,7 @@ const TaxonomyAdapter = {
|
|
|
2482
2482
|
};
|
|
2483
2483
|
},
|
|
2484
2484
|
/** Maps an internal item to the public event format */
|
|
2485
|
-
toPublicSelection(item) {
|
|
2485
|
+
toPublicSelection(item, findOccupationLabel) {
|
|
2486
2486
|
const id = item.id || '';
|
|
2487
2487
|
const preferredLabel = item.preferred_label || item.rawLabel || '';
|
|
2488
2488
|
if (!id) {
|
|
@@ -2504,12 +2504,13 @@ const TaxonomyAdapter = {
|
|
|
2504
2504
|
selection.ssyk_code_2012 = item.ssyk_code_2012;
|
|
2505
2505
|
}
|
|
2506
2506
|
const occupationId = item.occupation_name_id || item.occupationId;
|
|
2507
|
-
|
|
2508
|
-
|
|
2507
|
+
if (item.type === 'job-title' && occupationId) {
|
|
2508
|
+
const occupationLabel = item.occupation_name_preferred_label?.trim()
|
|
2509
|
+
|| item.occupationLabel?.trim();
|
|
2509
2510
|
selection.related = {
|
|
2510
2511
|
type: 'occupation-name',
|
|
2511
2512
|
id: occupationId,
|
|
2512
|
-
preferred_label: occupationLabel,
|
|
2513
|
+
preferred_label: occupationLabel || findOccupationLabel?.(occupationId) || occupationId,
|
|
2513
2514
|
};
|
|
2514
2515
|
}
|
|
2515
2516
|
return selection;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentState, TaxonomyItem, SearchResult, JobSelectionItem, JobSelectionReference } from './types';
|
|
1
|
+
import { ComponentState, TaxonomyItem, SearchResult, JobSelectionItem, JobSelectionReference, JobSelectionReferenceInput } from './types';
|
|
2
2
|
export interface ControllerCallbacks {
|
|
3
3
|
onStateChange: (state: ComponentState) => void;
|
|
4
4
|
onEmitSelection: (selection: JobSelectionItem | JobSelectionItem[]) => void;
|
|
@@ -29,6 +29,15 @@ export type SetSelectionResult = {
|
|
|
29
29
|
} | {
|
|
30
30
|
ok: false;
|
|
31
31
|
invalidIds: string[];
|
|
32
|
+
duplicate?: false;
|
|
33
|
+
reference?: JobSelectionReferenceInput;
|
|
34
|
+
}
|
|
35
|
+
/** Två poster pekar på samma yrke, dvs. samma taxonomi-id och samma related-yrke. */
|
|
36
|
+
| {
|
|
37
|
+
ok: false;
|
|
38
|
+
invalidIds: [];
|
|
39
|
+
duplicate: true;
|
|
40
|
+
reference?: never;
|
|
32
41
|
};
|
|
33
42
|
export declare class JobSelectorController {
|
|
34
43
|
private callbacks;
|
|
@@ -78,6 +78,7 @@ export declare class JobSelector {
|
|
|
78
78
|
private rejectSelection;
|
|
79
79
|
private syncAcceptedSelection;
|
|
80
80
|
private applySelection;
|
|
81
|
+
private rejectSelectionResolution;
|
|
81
82
|
watchRequired(newValue: boolean): void;
|
|
82
83
|
watchManualInputOrFeedback(): void;
|
|
83
84
|
watchHistory(newValue: boolean): void;
|
|
@@ -109,6 +110,7 @@ export declare class JobSelector {
|
|
|
109
110
|
private controller;
|
|
110
111
|
private validJobIds;
|
|
111
112
|
private lastAcceptedSelection;
|
|
113
|
+
private exactSelectionKeys;
|
|
112
114
|
private restoreAcceptedSelectionAfterDataUpdate;
|
|
113
115
|
componentWillLoad(): Promise<void>;
|
|
114
116
|
componentDidLoad(): void;
|
|
@@ -139,6 +141,7 @@ export declare class JobSelector {
|
|
|
139
141
|
/**
|
|
140
142
|
* Sätter ett programatiskt val och returnerar YV:s normaliserade, rika selection.
|
|
141
143
|
* Strängar som matchar Concept ID-formatet tolkas som taxonomi-id:n; övriga som fritext.
|
|
144
|
+
* Sparade referenser som { id, related: { id } } slås upp i den laddade yrkesdatan.
|
|
142
145
|
*/
|
|
143
146
|
setSelection(input: JobSelectionInput): Promise<JobSelectionItem[]>;
|
|
144
147
|
setFocus(): Promise<void>;
|
|
@@ -8,5 +8,5 @@ export declare const TaxonomyAdapter: {
|
|
|
8
8
|
/** Maps a GenericItem back to our internal SearchResult format */
|
|
9
9
|
fromGenericItem(item: GenericItem<JobSelectorMetadata>): Partial<SearchResult>;
|
|
10
10
|
/** Maps an internal item to the public event format */
|
|
11
|
-
toPublicSelection(item: SearchResult | Partial<SearchResult
|
|
11
|
+
toPublicSelection(item: SearchResult | Partial<SearchResult>, findOccupationLabel?: (id: string) => string | undefined): JobSelectionItem;
|
|
12
12
|
};
|
|
@@ -94,9 +94,24 @@ export type JobSelectionItem = {
|
|
|
94
94
|
id: null;
|
|
95
95
|
preferred_label: string;
|
|
96
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Referens till ett sparat taxonomival. Etiketter hämtas från den laddade yrkesdatan.
|
|
99
|
+
* Ange related.id när jobbtiteln hör till flera yrkesbenämningar.
|
|
100
|
+
*/
|
|
101
|
+
export interface JobSelectionReferenceInput {
|
|
102
|
+
id: string;
|
|
103
|
+
related?: {
|
|
104
|
+
id: string;
|
|
105
|
+
};
|
|
106
|
+
type?: never;
|
|
107
|
+
preferred_label?: never;
|
|
108
|
+
}
|
|
97
109
|
export type JobSelectionReference = {
|
|
98
110
|
id: string;
|
|
99
|
-
related?:
|
|
111
|
+
related?: {
|
|
112
|
+
id: string;
|
|
113
|
+
};
|
|
114
|
+
exact?: boolean;
|
|
100
115
|
} | Extract<JobSelectionItem, {
|
|
101
116
|
type: 'manual-input';
|
|
102
117
|
}>;
|
|
@@ -112,7 +127,7 @@ export type JobSuggestionState = {
|
|
|
112
127
|
/** Motiveringen innehåller personuppgifter och kan inte skickas. */
|
|
113
128
|
piiError?: boolean;
|
|
114
129
|
} | null;
|
|
115
|
-
export type JobSelectionInput = string | string[] | JobSelectionItem
|
|
130
|
+
export type JobSelectionInput = string | string[] | Array<JobSelectionItem | JobSelectionReferenceInput>;
|
|
116
131
|
export type InvalidSelectionErrorCode = 'unknown-id' | 'invalid-input' | 'manual-input-disabled' | 'multiple-disabled';
|
|
117
132
|
export declare class InvalidSelectionError extends Error {
|
|
118
133
|
readonly code: InvalidSelectionErrorCode;
|
|
@@ -91,7 +91,7 @@ export namespace Components {
|
|
|
91
91
|
"required": boolean;
|
|
92
92
|
"setFocus": () => Promise<void>;
|
|
93
93
|
/**
|
|
94
|
-
* Sätter ett programatiskt val och returnerar YV:s normaliserade, rika selection. Strängar som matchar Concept ID-formatet tolkas som taxonomi-id:n; övriga som fritext.
|
|
94
|
+
* Sätter ett programatiskt val och returnerar YV:s normaliserade, rika selection. Strängar som matchar Concept ID-formatet tolkas som taxonomi-id:n; övriga som fritext. Sparade referenser som { id, related: { id } } slås upp i den laddade yrkesdatan.
|
|
95
95
|
*/
|
|
96
96
|
"setSelection": (input: JobSelectionInput) => Promise<JobSelectionItem[]>;
|
|
97
97
|
/**
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { registerTaxonomy } from './components/job-selector/taxonomy-registry';
|
|
|
2
2
|
export { registerTaxonomy };
|
|
3
3
|
export { TaxonomySearchEngine } from './components/job-selector/logic/search.engine';
|
|
4
4
|
export { InvalidSelectionError } from './components/job-selector/types';
|
|
5
|
-
export type { TaxonomyItem, SearchResult, RawTaxonomyDataResponse, JobSelectionItem, JobSelectionInput, InvalidSelectionErrorCode, JobSuggestionEvent, } from './components/job-selector/types';
|
|
5
|
+
export type { TaxonomyItem, SearchResult, RawTaxonomyDataResponse, JobSelectionItem, JobSelectionInput, JobSelectionReferenceInput, InvalidSelectionErrorCode, JobSuggestionEvent, } from './components/job-selector/types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o}from"./p-
|
|
1
|
+
import{r as o}from"./p-D9zmn-JR.js";export{I as InvalidSelectionError,T as TaxonomySearchEngine}from"./p-D9zmn-JR.js";"undefined"!=typeof window&&(window.registerTaxonomy=o);export{o as registerTaxonomy}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,n,i,r={exports:{}},s=t((e||(e=1,n=r.exports,i=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function o(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function u(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(){for(var n=this.getLevel(),r=0;r<i.length;r++){var s=i[r];this[s]=r<n?t:this.methodFactory(s,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function h(t){return function(){typeof console!==e&&(c.call(this),this[t].apply(this,arguments))}}function a(i,r,s){return function(i){return"debug"===i&&(i="log"),typeof console!==e&&("trace"===i&&n?u:void 0!==console[i]?o(console,i):void 0!==console.log?o(console,"log"):t)}(i)||h.apply(this,arguments)}function l(t,n){var o,u,h,l=this,f="loglevel";function d(){var t;if(typeof window!==e&&f){try{t=window.localStorage[f]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(f),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===l.levels[t]&&(t=void 0),t}}function g(t){var e=t;if("string"==typeof e&&void 0!==l.levels[e.toUpperCase()]&&(e=l.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=l.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?f+=":"+t:"symbol"==typeof t&&(f=void 0),l.name=t,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=n||a,l.getLevel=function(){return null!=h?h:null!=u?u:o},l.setLevel=function(t,n){return h=g(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&f){try{return void(window.localStorage[f]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"="+n+";"}catch(t){}}}(h),c.call(l)},l.setDefaultLevel=function(t){u=g(t),d()||l.setLevel(t,!1)},l.resetLevel=function(){h=null,function(){if(typeof window!==e&&f){try{window.localStorage.removeItem(f)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),c.call(l)},l.enableAll=function(t){l.setLevel(l.levels.TRACE,t)},l.disableAll=function(t){l.setLevel(l.levels.SILENT,t)},l.rebuild=function(){if(s!==l&&(o=g(s.getLevel())),c.call(l),s===l)for(var t in r)r[t].rebuild()},o=g(s?s.getLevel():"WARN");var A=d();null!=A&&(h=g(A)),c.call(l)}(s=new l).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new l(t,s.methodFactory)),e};var f=typeof window!==e?window.log:void 0;return s.noConflict=function(){return typeof window!==e&&window.log===s&&(window.log=f),s},s.getLoggers=function(){return r},s.default=s,s},r.exports?r.exports=i():n.log=i()),r.exports));let o=[],u=null;function c(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function h(t){return"string"==typeof t&&t.trim().length>0}function a(t){return void 0===t||"string"==typeof t}function l(t){return!(!c(t)||!Array.isArray(t.data)||0===t.data.length)&&t.data.every((t=>function(t){return!!c(t)&&h(t.id)&&("job-title"===t.type||"occupation-name"===t.type)&&h(t.preferred_label)&&a(t.ssyk_level_4_id)&&a(t.ssyk_code_2012)&&a(t.occupation_name_id)&&a(t.occupation_name_preferred_label)&&(void 0===t.weight||"number"==typeof t.weight&&Number.isFinite(t.weight))&&(void 0===t.search_aliases||Array.isArray(t.search_aliases)&&t.search_aliases.every((t=>"string"==typeof t)))}(t)))}function f(t){if(!l(t))return void s.error("[TaxonomyRegistry] Felaktigt format på taxonomidata vid registrering.");o=function(t){const e=new Map;return t.filter((t=>{const n="job-title"===t.type?t.occupation_name_id??"":"",i=e.get(t.id)??new Set;return!i.has(n)&&(i.add(n),e.set(t.id,i),!0)}))}(t.data).map((t=>({...t})));const e=c(t.metadata)?t.metadata.labour_market_taxonomy_version:void 0;u=void 0!==e?String(e):void 0!==t.taxonomyVersion?String(t.taxonomyVersion):"unknown",s.debug(`[TaxonomyRegistry] Taxonomi version ${u} registrerades med ${o.length} yrken.`)}function d(){return 0===o.length&&s.warn("[TaxonomyRegistry] Ingen taxonomi är registrerad ännu! Anropa registerTaxonomy(data) först."),o}function g(t){return Array.isArray?Array.isArray(t):"[object Array]"===m(t)}function A(t){return null==t?"":function(t){if("string"==typeof t)return t;if("bigint"==typeof t)return t.toString();const e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}function p(t){return"string"==typeof t}function y(t){return"number"==typeof t}function C(t){return"object"==typeof t}function v(t){return null!=t}function w(t){return!t.trim().length}function m(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const M="Invalid doc index: must be a non-negative integer within the bounds of the docs array",F=Object.prototype.hasOwnProperty;var D=class{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{const n=B(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function B(t){let e=null,n=null,i=null,r=1,s=null;if(p(t)||g(t))i=t,e=E(t),n=x(t);else{if(!F.call(t,"name"))throw new Error("Missing name property in key");const o=t.name;if(i=o,F.call(t,"weight")&&void 0!==t.weight&&(r=t.weight,r<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(x(o)));e=E(o),n=x(o),s=t.getFn??null}return{path:e,id:n,weight:r,src:i,getFn:s}}function E(t){return g(t)?t:t.split(".")}function x(t){return g(t)?t.join("."):t}const b=Object.freeze({isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:function(t,e){const n=[];let i=!1;const r=(t,e,s,o)=>{if(v(t))if(e[s]){const u=t[e[s]];if(!v(u))return;if(s===e.length-1&&(p(u)||y(u)||function(t){return!0===t||!1===t||function(t){return C(t)&&null!==t}(t)&&"[object Boolean]"==m(t)}(u)||"bigint"==typeof u))n.push(void 0!==o?{v:A(u),i:o}:A(u));else if(g(u)){i=!0;for(let t=0,n=u.length;t<n;t+=1)r(u[t],e,s+1,t)}else e.length&&r(u,e,s+1,o)}else n.push(void 0!==o?{v:t,i:o}:t)};return r(t,p(e)?e.split("."):e,0),i?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1});var k=class{constructor({getFn:t=b.getFn,fieldNormWeight:e=b.fieldNormWeight}={}){this.norm=function(t=1,e=3){const n=new Map,i=Math.pow(10,e);return{get(e){let r=0,s=!1;for(let t=0;t<e.length;t++)(o=e.charCodeAt(t))>=9&&o<=13||32===o||160===o?s=!1:s||(r++,s=!0);var o;if(0===r&&(r=1),n.has(r))return n.get(r);const u=Math.round(i/Math.pow(r,.5*t))/i;return n.set(r,u),u},clear(){n.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const t=this.docs.length;this.records=new Array(t);let e=0;if(p(this.docs[0]))for(let n=0;n<t;n++){const t=this._createStringRecord(this.docs[n],n);t&&(this.records[e++]=t)}else for(let n=0;n<t;n++)this.records[e++]=this._createObjectRecord(this.docs[n],n);this.records.length=e,this.norm.clear()}add(t,e){if(!Number.isInteger(e)||e<0)throw new Error(M);if(p(t)){const n=this._createStringRecord(t,e);return n&&this.records.push(n),n}const n=this._createObjectRecord(t,e);return this.records.push(n),n}removeAt(t){if(!Number.isInteger(t)||t<0)throw new Error(M);for(let e=0,n=this.records.length;e<n;e+=1)if(this.records[e].i===t){this.records.splice(e,1);break}for(let e=0,n=this.records.length;e<n;e+=1)this.records[e].i>t&&(this.records[e].i-=1)}removeAll(t){const e=new Set;for(const n of t)Number.isInteger(n)&&n>=0&&e.add(n);if(0===e.size)return;this.records=this.records.filter((t=>!e.has(t.i)));const n=Array.from(e).sort(((t,e)=>t-e));for(const t of this.records){let e=0,i=n.length;for(;e<i;){const r=e+i>>>1;n[r]<t.i?e=r+1:i=r}t.i-=e}}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_createStringRecord(t,e){return!v(t)||w(t)?null:{v:t,i:e,n:this.norm.get(t)}}_createObjectRecord(t,e){const n={i:e,$:{}};for(let e=0,i=this.keys.length;e<i;e++){const i=this.keys[e],r=i.getFn?i.getFn(t):this.getFn(t,i.path);if(v(r))if(g(r)){const t=[];for(let e=0,n=r.length;e<n;e+=1){const n=r[e];if(v(n))if(p(n)){if(!w(n)){const i={v:n,i:e,n:this.norm.get(n)};t.push(i)}}else if(v(n.v)){const e=p(n.v)?n.v:A(n.v);if(!w(e)){const i={v:e,i:n.i,n:this.norm.get(e)};t.push(i)}}}n.$[e]=t}else if(p(r)&&!w(r)){const t={v:r,n:this.norm.get(r)};n.$[e]=t}}return n}toJSON(){return{keys:this.keys.map((({getFn:t,...e})=>e)),records:this.records}}};function S(t,e,{getFn:n=b.getFn,fieldNormWeight:i=b.fieldNormWeight}={}){const r=new k({getFn:n,fieldNormWeight:i});return r.setKeys(t.map(B)),r.setSources(e),r.create(),r}function $(t){const e={};for(let n=0,i=t.length;n<i;n+=1){const r=t.charAt(n);e[r]=(e[r]||0)|1<<i-n-1}return e}function N(t){if(t.length<=1)return t;t.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]));const e=[t[0]];for(let n=1,i=t.length;n<i;n+=1){const i=e[e.length-1],r=t[n];r[0]<=i[1]+1?i[1]=Math.max(i[1],r[1]):e.push(r)}return e}const L={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},I=new RegExp("["+Object.keys(L).join("")+"]","g"),R="function"==typeof String.prototype.normalize?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(I,(t=>L[t])):t=>t;var _=class{constructor(t,{location:e=b.location,threshold:n=b.threshold,distance:i=b.distance,includeMatches:r=b.includeMatches,findAllMatches:s=b.findAllMatches,minMatchCharLength:o=b.minMatchCharLength,isCaseSensitive:u=b.isCaseSensitive,ignoreDiacritics:c=b.ignoreDiacritics,ignoreLocation:h=b.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:u,ignoreDiacritics:c,ignoreLocation:h},t=u?t:t.toLowerCase(),t=c?R(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:$(t),startIndex:e})},l=this.pattern.length;if(l>32){let t=0;const e=l%32,n=l-e;for(;t<n;)a(this.pattern.substr(t,32),t),t+=32;if(e){const t=l-32;a(this.pattern.substr(t),t)}}else a(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=e?t:t.toLowerCase(),t=n?R(t):t,this.pattern===t){if(t.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};const e={isMatch:!0,score:0};return i&&(e.indices=[[0,t.length-1]]),e}const{location:r,distance:s,threshold:o,findAllMatches:u,minMatchCharLength:c,ignoreLocation:h}=this.options,a=[];let l=0,f=!1;this.chunks.forEach((({pattern:e,alphabet:n,startIndex:d})=>{const{isMatch:g,score:A,indices:p}=function(t,e,n,{location:i=b.location,distance:r=b.distance,threshold:s=b.threshold,findAllMatches:o=b.findAllMatches,minMatchCharLength:u=b.minMatchCharLength,includeMatches:c=b.includeMatches,ignoreLocation:h=b.ignoreLocation}={}){if(e.length>32)throw new Error("Pattern length exceeds max of 32.");const a=e.length,l=t.length,f=Math.max(0,Math.min(i,l));let d=s,g=f;const A=(t,e)=>{const n=t/a;if(h)return n;const i=Math.abs(f-e);return r?n+i/r:i?1:n},p=u>1||c,y=p?Array(l):[];let C;for(;(C=t.indexOf(e,g))>-1;){const t=A(0,C);if(d=Math.min(t,d),g=C+a,p){let t=0;for(;t<a;)y[C+t]=1,t+=1}}g=-1;let v=[],w=1,m=0,M=a+l;const F=1<<a-1;for(let e=0;e<a;e+=1){let i=0,r=M;for(;i<r;)A(e,f+r)<=d?i=r:M=r,r=Math.floor((M-i)/2+i);M=r;let s=Math.max(1,f-r+1);const u=o?l:Math.min(f+r,l)+a,c=Array(u+2);c[u+1]=(1<<e)-1;for(let i=u;i>=s;i-=1){const r=i-1;if(c[i]=(c[i+1]<<1|1)&n[t[r]],e&&(c[i]|=(v[i+1]|v[i])<<1|1|v[i+1]),c[i]&F&&(w=A(e,r),w<=d)){if(d=w,g=r,m=e,g<=f)break;s=Math.max(1,2*f-g)}}if(A(e+1,f)>d)break;v=c}if(p&&g>=0){const e=Math.min(l-1,g+a-1+m);for(let i=g;i<=e;i+=1)n[t[i]]&&(y[i]=1)}const D={isMatch:g>=0,score:Math.max(.001,w)};if(p){const t=function(t=[],e=b.minMatchCharLength){const n=[];let i=-1,r=-1,s=0;for(let o=t.length;s<o;s+=1){const o=t[s];o&&-1===i?i=s:o||-1===i||(r=s-1,r-i+1>=e&&n.push([i,r]),i=-1)}return t[s-1]&&s-i>=e&&n.push([i,s-1]),n}(y,u);t.length?c&&(D.indices=t):D.isMatch=!1}return D}(t,e,n,{location:r+d,distance:s,threshold:o,findAllMatches:u,minMatchCharLength:c,includeMatches:i,ignoreLocation:h});g&&(f=!0),l+=A,g&&p&&a.push(...p)}));const d={isMatch:f,score:f?l/this.chunks.length:1};return f&&i&&(d.indices=N(a)),d}};const j=new Set(["fuzzy","include"]),T=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:t=>({type:"exact",search(e){const n=e===t;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:t=>({type:"include",search(e){let n,i=0;const r=[],s=t.length;for(;(n=e.indexOf(t,i))>-1;)i=n+s,r.push([n,i-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:t=>({type:"prefix-exact",search(e){const n=e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:t=>({type:"inverse-prefix-exact",search(e){const n=!e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:t=>({type:"inverse-suffix-exact",search(e){const n=!e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:t=>({type:"suffix-exact",search(e){const n=e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[e.length-t.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:t=>({type:"inverse-exact",search(e){const n=-1===e.indexOf(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(t,e={})=>{const n=new _(t,{location:e.location??b.location,threshold:e.threshold??b.threshold,distance:e.distance??b.distance,includeMatches:e.includeMatches??b.includeMatches,findAllMatches:e.findAllMatches??b.findAllMatches,minMatchCharLength:e.minMatchCharLength??b.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??b.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??b.ignoreDiacritics,ignoreLocation:e.ignoreLocation??b.ignoreLocation});return{type:"fuzzy",search:t=>n.searchIn(t)}}}],z=T.length;function O(t,e){const n=t.match(e);return n?n[1]:null}const W=[];function U(...t){W.push(...t)}function G(t,e){for(let n=0,i=W.length;n<i;n+=1){const i=W[n];if(i.condition(t,e))return new i(t,e)}return new _(t,e)}const J="$and",P="$path",K=t=>!(!t[J]&&!t.$or),Y=t=>({[J]:Object.keys(t).map((e=>({[e]:t[e]})))});function H(t,e,{auto:n=!0}={}){const i=t=>{if(p(t)){const i={keyId:null,pattern:t};return n&&(i.searcher=G(t,e)),i}const r=Object.keys(t),s=(t=>!!t[P])(t);if(!s&&r.length>1&&!K(t))return i(Y(t));if((t=>!g(t)&&C(t)&&!K(t))(t)){const i=s?t[P]:r[0],o=s?t.$val:t[i];if(!p(o))throw new Error((t=>`Invalid value for key ${t}`)(i));const u={keyId:x(i),pattern:o};return n&&(u.searcher=G(o,e)),u}const o={children:[],operator:r[0]};return r.forEach((e=>{const n=t[e];g(n)&&n.forEach((t=>{o.children.push(i(t))}))})),o};return K(t)||(t=Y(t)),i(t)}function q(t,{ignoreFieldNorm:e=b.ignoreFieldNorm}){let n=1;return t.forEach((({key:t,norm:i,score:r})=>{const s=t?t.weight:null;n*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(e?1:i))})),n}var V=class{constructor(t,e){this.limit=t,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):this.comparator(t,this.heap[0])<0&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(t){const e=this.heap;for(;t>0;){const n=t-1>>1;if(this.comparator(e[t],e[n])<=0)break;const i=e[t];e[t]=e[n],e[n]=i,t=n}}_sinkDown(t){const e=this.heap,n=e.length;let i=t;do{const r=2*(t=i)+1,s=2*t+2;if(r<n&&this.comparator(e[r],e[i])>0&&(i=r),s<n&&this.comparator(e[s],e[i])>0&&(i=s),i!==t){const n=e[t];e[t]=e[i],e[i]=n}}while(i!==t)}};const Q=/[\p{L}\p{M}\p{N}_]+/gu,X=new WeakSet;function Z({isCaseSensitive:t=!1,ignoreDiacritics:e=!1,tokenize:n}={}){const i=function(t){if("function"==typeof t){let e=!1;return n=>{const i=t(n);if(!e&&(e=!0,!Array.isArray(i)||i.some((t=>"string"!=typeof t))))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(i)?"array containing non-strings":typeof i}.`);return i}}return t instanceof RegExp?(t.global||X.has(e=t)||(X.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`)),e=>e.match(t)||[]):t=>t.match(Q)||[];var e}(n);return{tokenize:n=>(t||(n=n.toLowerCase()),e&&(n=R(n)),i(n))}}function tt(t,e,n,i){const r=i.tokenize(e);if(!r.length)return;t.fieldCount++,t.docFieldCount.set(n,(t.docFieldCount.get(n)||0)+1);const s=new Set(r);let o=t.docTermFieldHits.get(n);o||(o=new Map,t.docTermFieldHits.set(n,o));for(const e of s)o.set(e,(o.get(e)||0)+1),t.df.set(e,(t.df.get(e)||0)+1)}function et(t,e,n,i){const{i:r,v:s,$:o}=e;if(void 0===s){if(o)for(let e=0;e<n;e++){const n=o[e];if(n)if(Array.isArray(n))for(const e of n)tt(t,e.v,r,i);else tt(t,n.v,r,i)}}else tt(t,s,r,i)}function nt(t,e){const n=t.docFieldCount.get(e);if(void 0===n)return;t.fieldCount-=n,t.docFieldCount.delete(e);const i=t.docTermFieldHits.get(e);if(i){for(const[e,n]of i){const i=(t.df.get(e)||0)-n;i<=0?t.df.delete(e):t.df.set(e,i)}t.docTermFieldHits.delete(e)}}function it(t,e){if(0===e.length)return;const n=Array.from(new Set(e)).sort(((t,e)=>t-e));for(const e of n)nt(t,e);const i=t=>{let e=0,i=n.length;for(;e<i;){const r=e+i>>>1;n[r]<t?e=r+1:i=r}return t-e},r=n[0],s=new Map;for(const[e,n]of t.docFieldCount)s.set(e>r?i(e):e,n);t.docFieldCount=s;const o=new Map;for(const[e,n]of t.docTermFieldHits)o.set(e>r?i(e):e,n);t.docTermFieldHits=o}var rt=class{constructor(t,e,n){this.options={...b,...e},this._keyStore=new D(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=G(t,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof k))throw new Error("Incorrect 'index' type");if(this._myIndex=e||S(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=function(t,e,n){const i={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const r of t)et(i,r,e,n);return i}(this._myIndex.records,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}add(t){if(!v(t))return;this._docs.push(t);const e=this._myIndex.add(t,this._docs.length-1);if(this._invertedIndex&&e){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});!function(t,e,n,i){et(t,e,n,i)}(this._invertedIndex,e,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}remove(t=()=>!1){const e=[],n=[];for(let i=0,r=this._docs.length;i<r;i+=1)t(this._docs[i],i)&&(e.push(this._docs[i]),n.push(i));if(n.length){this._invertedIndex&&it(this._invertedIndex,n);const t=new Set(n);this._docs=this._docs.filter(((e,n)=>!t.has(n))),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return e}removeAt(t){if(!Number.isInteger(t)||t<0||t>=this._docs.length)throw new Error(M);this._invertedIndex&&it(this._invertedIndex,[t]);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map((t=>this._keyStore.get(t.id)||t))}search(t,e){const{limit:n=-1}=e||{},{includeMatches:i,includeScore:r,shouldSort:s,sortFn:o,ignoreFieldNorm:u}=this.options;if(p(t)&&!t.trim()){let t=this._docs.map(((t,e)=>({item:t,refIndex:e})));return y(n)&&n>-1&&(t=t.slice(0,n)),t}const c=s&&y(n)&&n>0&&p(t),h=o,a=(t,e)=>h(t,e)||t.idx-e.idx;let l;if(c){const e=new V(n,a);p(this._docs[0])?this._searchStringList(t,{heap:e,ignoreFieldNorm:u}):this._searchObjectList(t,{heap:e,ignoreFieldNorm:u}),l=e.extractSorted()}else l=p(t)?p(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),function(t,{ignoreFieldNorm:e=b.ignoreFieldNorm}){t.forEach((t=>{t.score=q(t.matches,{ignoreFieldNorm:e})}))}(l,{ignoreFieldNorm:u}),s&&l.sort(p(t)?a:h),y(n)&&n>-1&&(l=l.slice(0,n));return function(t,e,{includeMatches:n=b.includeMatches,includeScore:i=b.includeScore}={}){return t.map((t=>{const{idx:r}=t,s={item:e[r],refIndex:r};return n&&(s.matches=function(t){const e=[];return t.matches.forEach((t=>{if(!v(t.indices)||!t.indices.length)return;const n={indices:t.indices,value:t.value};t.key&&(n.key=t.key.id),t.idx>-1&&(n.refIndex=t.idx),e.push(n)})),e}(t)),i&&(s.score=t.score),s}))}(l,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(t,{heap:e,ignoreFieldNorm:n}={}){const i=this._getSearcher(t),r=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:s}=this._myIndex,o=e?null:[];return s.forEach((({v:t,i:s,n:u})=>{if(!v(t))return;const c=i.searchIn(t);if(c.isMatch){const i={score:c.score,value:t,norm:u,indices:c.indices};r&&(i.matchedMask=c.matchedMask,i.matchedTerms=c.matchedTerms,i.termCount=c.termCount);const h=[i];if(!r||this._coversAllTokens(h)){const i={item:t,idx:s,matches:h};e?(i.score=q(i.matches,{ignoreFieldNorm:n}),e.insert(i)):o.push(i)}}})),o}_searchLogical(t){const e=H(t,this.options),n=this._normalizedKeys(),i=(t,e,r)=>{if(!("children"in t)){const{keyId:i,searcher:s}=t;let o;return null===i?(o=[],n.forEach(((t,n)=>{o.push(...this._findMatches({key:t,value:e[n],searcher:s}))}))):o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(e,i),searcher:s}),o&&o.length?[{idx:r,item:e,matches:o}]:[]}const{children:s,operator:o}=t,u=[];for(let t=0,n=s.length;t<n;t+=1){const n=i(s[t],e,r);if(n.length)u.push(...n);else if(o===J)return[]}return u},r=this._myIndex.records,s=new Map,o=[];return r.forEach((({$:t,i:n})=>{if(v(t)){const r=i(e,t,n);r.length&&(s.has(n)||(s.set(n,{idx:n,item:t,matches:[]}),o.push(s.get(n))),r.forEach((({matches:t})=>{s.get(n).matches.push(...t)})))}})),o}_searchObjectList(t,{heap:e,ignoreFieldNorm:n}={}){const i=this._getSearcher(t),r=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:s}=this._myIndex,o=this._normalizedKeys(),u=e?null:[];return s.forEach((({$:t,i:s})=>{if(!v(t))return;const c=[];let h=!1,a=!1;if(o.forEach(((e,n)=>{const r=this._findMatches({key:e,value:t[n],searcher:i});r.length?(c.push(...r),r[0].hasInverse&&(a=!0)):h=!0})),(!a||!h)&&c.length&&(!r||this._coversAllTokens(c))){const i={idx:s,item:t,matches:c};e?(i.score=q(i.matches,{ignoreFieldNorm:n}),e.insert(i)):u.push(i)}})),u}_findMatches({key:t,value:e,searcher:n}){if(!v(e))return[];const i=[];if(g(e))e.forEach((({v:e,i:r,n:s})=>{if(!v(e))return;const o=n.searchIn(e);if(o.isMatch){const n={score:o.score,key:t,value:e,idx:r,norm:s,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),i.push(n)}}));else{const{v:r,n:s}=e,o=n.searchIn(r);if(o.isMatch){const e={score:o.score,key:t,value:r,norm:s,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(e.matchedMask=o.matchedMask,e.matchedTerms=o.matchedTerms,e.termCount=o.termCount),i.push(e)}}return i}_coversAllTokens(t){const e=t.length?t[0].termCount:void 0;if(void 0===e)return!0;if(e<=31){let n=0;for(let e=0;e<t.length;e++)n|=t[e].matchedMask||0;return n===2**e-1}const n=new Set;for(let e=0;e<t.length;e++){const i=t[e].matchedTerms;if(i)for(const t of i)n.add(t)}return n.size===e}};rt.version="7.5.0",rt.createIndex=S,rt.parseIndex=function(t,{getFn:e=b.getFn,fieldNormWeight:n=b.fieldNormWeight}={}){const{keys:i,records:r}=t,s=new k({getFn:e,fieldNormWeight:n});return s.setKeys(i),s.setIndexRecords(r),s},rt.config=b,rt.match=function(t,e,n){if(n&&n.useTokenSearch)throw new Error("Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.");return G(t,{...b,...n}).searchIn(e)},rt.parseQuery=H,U(class{constructor(t,{isCaseSensitive:e=b.isCaseSensitive,ignoreDiacritics:n=b.ignoreDiacritics,includeMatches:i=b.includeMatches,minMatchCharLength:r=b.minMatchCharLength,ignoreLocation:s=b.ignoreLocation,findAllMatches:o=b.findAllMatches,location:u=b.location,threshold:c=b.threshold,distance:h=b.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:r,findAllMatches:o,ignoreLocation:s,location:u,threshold:c,distance:h},t=e?t:t.toLowerCase(),t=n?R(t):t,this.pattern=t,this.query=function(t,e={}){return t.replace(/\\\|/g,"\0").split("|").map((t=>{const n=function(t){const e=[],n=t.length;let i=0;for(;i<n;){for(;i<n&&" "===t[i];)i++;if(i>=n)break;let r=i;for(;r<n&&" "!==t[r]&&'"'!==t[r];)r++;if(r<n&&'"'===t[r]){for(r++;r<n;){if('"'===t[r]){const e=r+1;if(e>=n||" "===t[e]){r++;break}if("$"===t[e]&&(e+1>=n||" "===t[e+1])){r+=2;break}}r++}e.push(t.substring(i,r)),i=r}else{for(;r<n&&" "!==t[r];)r++;e.push(t.substring(i,r)),i=r}}return e}(t.replace(/\u0000/g,"|").trim()).filter((t=>t&&!!t.trim())),i=[];for(let t=0,r=n.length;t<r;t+=1){const r=n[t];let s=!1,o=-1;for(;!s&&++o<z;){const t=T[o],n=O(r,t.multiRegex);n&&(i.push(t.create(n,e)),s=!0)}if(!s)for(o=-1;++o<z;){const t=T[o],n=O(r,t.singleRegex);if(n){i.push(t.create(n,e));break}}}return i}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:r}=this.options;t=i?t:t.toLowerCase(),t=r?R(t):t;let s=0;const o=[];let u=0,c=!1;for(let i=0,r=e.length;i<r;i+=1){const r=e[i];o.length=0,s=0,c=!1;for(let e=0,i=r.length;e<i;e+=1){const i=r[e],{isMatch:h,indices:a,score:l}=i.search(t);if(!h){u=0,s=0,o.length=0,c=!1;break}s+=1,u+=l,i.type.startsWith("inverse")&&(c=!0),n&&(j.has(i.type)?o.push(...a):o.push(a))}if(s){const t={isMatch:!0,score:u/s};return c&&(t.hasInverse=!0),n&&(t.indices=N(o)),t}}return{isMatch:!1,score:1}}}),U(class{static condition(t,e){return e.useTokenSearch}constructor(t,e){this.options=e,this.analyzer=Z({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});const n=this.analyzer.tokenize(t),{df:i,fieldCount:r}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(const t of n){this.termSearchers.push(new _(t,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const n=i.get(t)||0,s=Math.log(1+(r-n+.5)/(n+.5));this.idfWeights.push(s)}this.combineAll="all"===e.tokenMatch,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let n=0,i=0,r=0,s=0;const o=this.combineAll&&!this.useMask?new Set:null;for(let u=0;u<this.termSearchers.length;u++){const c=this.termSearchers[u].searchIn(t),h=this.idfWeights[u];i+=h,c.isMatch&&(r++,n+=h*(1-c.score),c.indices&&e.push(...c.indices),this.combineAll&&(this.useMask?s|=1<<u:o.add(u)))}if(0===r)return{isMatch:!1,score:1};const u={isMatch:!0,score:Math.max(.001,i>0?1-n/i:0)};return this.options.includeMatches&&e.length&&(u.indices=N(e)),this.combineAll&&(this.useMask?u.matchedMask=s:u.matchedTerms=o,u.termCount=this.numTerms),u}}),rt.use=function(...t){t.forEach((t=>U(t)))};var st=rt;const ot=1,ut=100,ct=20,ht={keys:["preferred_label"],includeScore:!0,ignoreDiacritics:!0,ignoreFieldNorm:!0,threshold:.6,minMatchCharLength:1,ignoreLocation:!0,distance:100},at="T.ex. målare, florist, kock",lt={format:(t,e,n)=>{const i=function(t,e){if(!t)return[];if(!e||0===e.trim().length)return[{text:t,isMatch:!1}];const n=t.toLowerCase(),i=e.toLowerCase().split(/\s+/).filter((t=>t.length>0)),r=new Set;if(i.forEach((t=>{let e=0;for(;-1!==(e=n.indexOf(t,e));){for(let n=0;n<t.length;n++)r.add(e+n);e+=t.length}})),0===r.size&&i.forEach((e=>{const n=function(t,e){const n=t.toLowerCase(),i=e.length;let r=99,s=-1,o=0;const u=Math.max(3,i-2),c=Math.min(n.length,i+2);for(let t=0;t<=n.length-u;t++)for(let i=u;i<=c&&t+i<=n.length;i++){const u=ft(e,n.slice(t,t+i));u<r&&(r=u,s=t,o=i)}return r<=Math.max(2,Math.floor(.25*i))&&-1!==s?{start:s,length:o}:null}(t,e);if(n)for(let t=0;t<n.length;t++)r.add(n.start+t)})),0===r.size)return[{text:t,isMatch:!1}];const s=[];let o="",u=r.has(0);for(let e=0;e<t.length;e++){const n=r.has(e);n!==u?(o.length>0&&s.push({text:o,isMatch:u}),o=t[e],u=n):o+=t[e]}return o.length>0&&s.push({text:o,isMatch:u}),s}(t,e);return n?[...i,{text:" ",isMatch:!1},{text:`(${n})`,isMetadata:!0}]:i}};function ft(t,e){const n=t.length,i=e.length,r=Array.from({length:n+1},(()=>new Array(i+1).fill(0)));for(let t=0;t<=n;t++)r[t][0]=t;for(let t=0;t<=i;t++)r[0][t]=t;for(let s=1;s<=n;s++)for(let n=1;n<=i;n++)r[s][n]=t[s-1]===e[n-1]?r[s-1][n-1]:1+Math.min(r[s-1][n],r[s][n-1],r[s-1][n-1]);return r[n][i]}s.setLevel(s.levels.DEBUG);const dt=t=>t?t.toLowerCase().trim():"";function gt(t,e){return t.id&&e.id?t.id===e.id&&(t.occupationId??t.occupation_name_id??"")===(e.occupationId??e.occupation_name_id??""):t.rawLabel===e.rawLabel}function At(t){return t.sort(((t,e)=>{const n=t.score??0,i=e.score??0;if(n!==i)return i-n;const r=t.weight??0,s=e.weight??0;return r!==s?s-r:t.displayLabel.localeCompare(e.displayLabel,"sv")}))}function pt(t){return t.map((t=>t.isMatch?`<strong>${t.text}</strong>`:t.isMetadata?`<span class="occupation-variant-label">${t.text}</span>`:t.text)).join("")}const yt=t=>t?t.replace(/ (\([^)]+\))/g,' <span class="occupation-variant-label">$1</span>'):"";function Ct(t,e,n){return t===e?1:n.length>1?n.every((e=>t.includes(e)))?.98:null:t.startsWith(e)?.99:t.includes(e)?.95:null}function vt(t,e){const n=t.length,i=e.length,r=Array.from({length:n+1},(()=>new Array(i+1).fill(0)));for(let t=0;t<=n;t++)r[t][0]=t;for(let t=0;t<=i;t++)r[0][t]=t;for(let s=1;s<=n;s++)for(let n=1;n<=i;n++)r[s][n]=t[s-1]===e[n-1]?r[s-1][n-1]:1+Math.min(r[s-1][n],r[s][n-1],r[s-1][n-1]);return r[n][i]}function wt(t,e){const n=t.toLowerCase().trim(),i=e.toLowerCase().trim();return i.includes(" ")?vt(n,i)<=Math.max(2,Math.floor(.25*n.length))&&Math.abs(n.length-i.length)<=2:null!==function(t,e){const n=t.toLowerCase(),i=e.length;let r=99;const s=Math.max(3,i-2),o=Math.min(n.length,i+2);for(let t=0;t<=n.length-s;t++)for(let i=s;i<=o&&t+i<=n.length;i++){const s=vt(e,n.slice(t,t+i));s<r&&(r=s)}return r<=Math.max(2,Math.floor(.25*i))?r:null}(i,n)}function mt(t,e){return(t.search_aliases??[]).some((t=>dt(t)===e))}function Mt(t,e,n){const i=function(t){return t.occupation_name_preferred_label?`${t.preferred_label||""} (${t.occupation_name_preferred_label})`:t.preferred_label||""}(t),r=lt.format(t.preferred_label||"",e,t.occupation_name_preferred_label);return{id:t.id,type:t.type,preferred_label:t.preferred_label||"",rawLabel:t.preferred_label||"",displayLabel:i,highlightedLabel:pt(r),displaySegments:r,weight:t.weight??0,score:n,occupationId:t.occupation_name_id,occupationLabel:t.occupation_name_preferred_label,ssyk_level_4_id:t.ssyk_level_4_id,ssyk_code_2012:t.ssyk_code_2012}}function Ft(t){return"job-title"===t.type?`${t.id}|${t.occupation_name_id??""}`:t.id}function Dt(t,e,n,i){if(!n)return[];if(!e||!Array.isArray(e))return s.warn("[searchConcepts] Ogiltig items array."),[];if(!t||t.length<1)return[];const r=dt(t),o=r.split(" ").filter((t=>t.length>0)),u=[],c=new Set;for(const n of e){const e=Ct(dt(n.preferred_label),r,o),i=mt(n,r)?1:e;null!==i&&(u.push(Mt(n,t,i)),c.add(Ft(n)))}if(u.length>0)return At(u).slice(0,i);if(n){const e=n.search(r);if(0===e.length)return[];const s=e[0].score??1,o=[];let u=!1;for(const n of e){const e=Ft(n.item);if(c.has(e))continue;const i=n.score??1,h=1-i;if(h<.4)continue;if(i>s+.12)continue;const a=dt(n.item.preferred_label),l=n.item.weight??0,f=wt(r,a);f&&i<=.25&&(u=!0);let d=.7*h+.1*l;f&&(d+=.12);const g=Math.min(.84,Math.max(.4,d));o.push(Mt(n.item,t,g)),c.add(e)}const h=At(o);if(0===h.length)return[];const a=u?Math.min(5,i):Math.min(3,i);return h.slice(0,a)}return[]}const Bt={toGenericItem:t=>({id:t.id,label:t.preferred_label||"",description:t.occupation_name_preferred_label,metadata:{original:t,type:t.type,ssyk_level_4_id:t.ssyk_level_4_id,weight:t.weight}}),searchResultToGenericItem(t,e){const n=lt.format(t.preferred_label||"",e,t.occupation_name_preferred_label);return{id:t.id,label:t.preferred_label||"",displaySegments:n,highlightedLabel:pt(n),metadata:{original:t,ssyk_level_4_id:t.ssyk_level_4_id,weight:t.weight}}},fromGenericItem:t=>({id:t.id,preferred_label:t.label,weight:t.metadata?.weight,...t.metadata?.original}),toPublicSelection(t){const e=t.id||"",n=t.preferred_label||t.rawLabel||"";if(!e)return{type:"manual-input",id:null,preferred_label:n};if("job-title"!==t.type&&"occupation-name"!==t.type)throw new Error(`Ogiltig intern yrkestyp för ${e}: ${t.type}`);const i={type:t.type,id:e,preferred_label:n};t.ssyk_code_2012&&(i.ssyk_code_2012=t.ssyk_code_2012);const r=t.occupation_name_id||t.occupationId,s=t.occupation_name_preferred_label||t.occupationLabel;return"job-title"===t.type&&r&&s&&(i.related={type:"occupation-name",id:r,preferred_label:s}),i}};class Et{fuseInstance=null;items=[];constructor(t){this.items=t,this.fuseInstance=new st(t,ht)}search(t,e=20){return this.fuseInstance?Dt(t,this.items,this.fuseInstance,e).map((t=>Bt.toPublicSelection(t))):[]}searchAsGeneric(t,e=20){return this.fuseInstance?Dt(t,this.items,this.fuseInstance,e).map((t=>({id:t.id,label:t.displayLabel,description:t.occupationLabel,group:"job-title"===t.type?"Yrke":"Yrkesgrupp",metadata:{originalResult:t,highlightedLabel:t.highlightedLabel,score:t.score,weight:t.weight}}))):[]}updateData(t){this.items=t,this.fuseInstance=new st(t,ht)}}class xt extends Error{code;invalidIds;constructor(t,e,n){super(t),this.name="InvalidSelectionError",this.code=e,this.invalidIds=n}}export{ut as D,xt as I,lt as L,ct as M,at as P,Et as T,Bt as a,l as b,ot as c,yt as d,d as g,gt as i,s as l,f as r,pt as s}
|
|
1
|
+
function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,n,i,r={exports:{}},s=t((e||(e=1,n=r.exports,i=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function o(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function u(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(){for(var n=this.getLevel(),r=0;r<i.length;r++){var s=i[r];this[s]=r<n?t:this.methodFactory(s,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function h(t){return function(){typeof console!==e&&(c.call(this),this[t].apply(this,arguments))}}function a(i,r,s){return function(i){return"debug"===i&&(i="log"),typeof console!==e&&("trace"===i&&n?u:void 0!==console[i]?o(console,i):void 0!==console.log?o(console,"log"):t)}(i)||h.apply(this,arguments)}function l(t,n){var o,u,h,l=this,f="loglevel";function d(){var t;if(typeof window!==e&&f){try{t=window.localStorage[f]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(f),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===l.levels[t]&&(t=void 0),t}}function g(t){var e=t;if("string"==typeof e&&void 0!==l.levels[e.toUpperCase()]&&(e=l.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=l.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?f+=":"+t:"symbol"==typeof t&&(f=void 0),l.name=t,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=n||a,l.getLevel=function(){return null!=h?h:null!=u?u:o},l.setLevel=function(t,n){return h=g(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&f){try{return void(window.localStorage[f]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"="+n+";"}catch(t){}}}(h),c.call(l)},l.setDefaultLevel=function(t){u=g(t),d()||l.setLevel(t,!1)},l.resetLevel=function(){h=null,function(){if(typeof window!==e&&f){try{window.localStorage.removeItem(f)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),c.call(l)},l.enableAll=function(t){l.setLevel(l.levels.TRACE,t)},l.disableAll=function(t){l.setLevel(l.levels.SILENT,t)},l.rebuild=function(){if(s!==l&&(o=g(s.getLevel())),c.call(l),s===l)for(var t in r)r[t].rebuild()},o=g(s?s.getLevel():"WARN");var A=d();null!=A&&(h=g(A)),c.call(l)}(s=new l).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new l(t,s.methodFactory)),e};var f=typeof window!==e?window.log:void 0;return s.noConflict=function(){return typeof window!==e&&window.log===s&&(window.log=f),s},s.getLoggers=function(){return r},s.default=s,s},r.exports?r.exports=i():n.log=i()),r.exports));let o=[],u=null;function c(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function h(t){return"string"==typeof t&&t.trim().length>0}function a(t){return void 0===t||"string"==typeof t}function l(t){return!(!c(t)||!Array.isArray(t.data)||0===t.data.length)&&t.data.every((t=>function(t){return!!c(t)&&h(t.id)&&("job-title"===t.type||"occupation-name"===t.type)&&h(t.preferred_label)&&a(t.ssyk_level_4_id)&&a(t.ssyk_code_2012)&&a(t.occupation_name_id)&&a(t.occupation_name_preferred_label)&&(void 0===t.weight||"number"==typeof t.weight&&Number.isFinite(t.weight))&&(void 0===t.search_aliases||Array.isArray(t.search_aliases)&&t.search_aliases.every((t=>"string"==typeof t)))}(t)))}function f(t){if(!l(t))return void s.error("[TaxonomyRegistry] Felaktigt format på taxonomidata vid registrering.");o=function(t){const e=new Map;return t.filter((t=>{const n="job-title"===t.type?t.occupation_name_id??"":"",i=e.get(t.id)??new Set;return!i.has(n)&&(i.add(n),e.set(t.id,i),!0)}))}(t.data).map((t=>({...t})));const e=c(t.metadata)?t.metadata.labour_market_taxonomy_version:void 0;u=void 0!==e?String(e):void 0!==t.taxonomyVersion?String(t.taxonomyVersion):"unknown",s.debug(`[TaxonomyRegistry] Taxonomi version ${u} registrerades med ${o.length} yrken.`)}function d(){return 0===o.length&&s.warn("[TaxonomyRegistry] Ingen taxonomi är registrerad ännu! Anropa registerTaxonomy(data) först."),o}function g(t){return Array.isArray?Array.isArray(t):"[object Array]"===m(t)}function A(t){return null==t?"":function(t){if("string"==typeof t)return t;if("bigint"==typeof t)return t.toString();const e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}function p(t){return"string"==typeof t}function y(t){return"number"==typeof t}function C(t){return"object"==typeof t}function v(t){return null!=t}function w(t){return!t.trim().length}function m(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const M="Invalid doc index: must be a non-negative integer within the bounds of the docs array",F=Object.prototype.hasOwnProperty;var D=class{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{const n=B(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function B(t){let e=null,n=null,i=null,r=1,s=null;if(p(t)||g(t))i=t,e=E(t),n=x(t);else{if(!F.call(t,"name"))throw new Error("Missing name property in key");const o=t.name;if(i=o,F.call(t,"weight")&&void 0!==t.weight&&(r=t.weight,r<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(x(o)));e=E(o),n=x(o),s=t.getFn??null}return{path:e,id:n,weight:r,src:i,getFn:s}}function E(t){return g(t)?t:t.split(".")}function x(t){return g(t)?t.join("."):t}const b=Object.freeze({isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:function(t,e){const n=[];let i=!1;const r=(t,e,s,o)=>{if(v(t))if(e[s]){const u=t[e[s]];if(!v(u))return;if(s===e.length-1&&(p(u)||y(u)||function(t){return!0===t||!1===t||function(t){return C(t)&&null!==t}(t)&&"[object Boolean]"==m(t)}(u)||"bigint"==typeof u))n.push(void 0!==o?{v:A(u),i:o}:A(u));else if(g(u)){i=!0;for(let t=0,n=u.length;t<n;t+=1)r(u[t],e,s+1,t)}else e.length&&r(u,e,s+1,o)}else n.push(void 0!==o?{v:t,i:o}:t)};return r(t,p(e)?e.split("."):e,0),i?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1});var k=class{constructor({getFn:t=b.getFn,fieldNormWeight:e=b.fieldNormWeight}={}){this.norm=function(t=1,e=3){const n=new Map,i=Math.pow(10,e);return{get(e){let r=0,s=!1;for(let t=0;t<e.length;t++)(o=e.charCodeAt(t))>=9&&o<=13||32===o||160===o?s=!1:s||(r++,s=!0);var o;if(0===r&&(r=1),n.has(r))return n.get(r);const u=Math.round(i/Math.pow(r,.5*t))/i;return n.set(r,u),u},clear(){n.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const t=this.docs.length;this.records=new Array(t);let e=0;if(p(this.docs[0]))for(let n=0;n<t;n++){const t=this._createStringRecord(this.docs[n],n);t&&(this.records[e++]=t)}else for(let n=0;n<t;n++)this.records[e++]=this._createObjectRecord(this.docs[n],n);this.records.length=e,this.norm.clear()}add(t,e){if(!Number.isInteger(e)||e<0)throw new Error(M);if(p(t)){const n=this._createStringRecord(t,e);return n&&this.records.push(n),n}const n=this._createObjectRecord(t,e);return this.records.push(n),n}removeAt(t){if(!Number.isInteger(t)||t<0)throw new Error(M);for(let e=0,n=this.records.length;e<n;e+=1)if(this.records[e].i===t){this.records.splice(e,1);break}for(let e=0,n=this.records.length;e<n;e+=1)this.records[e].i>t&&(this.records[e].i-=1)}removeAll(t){const e=new Set;for(const n of t)Number.isInteger(n)&&n>=0&&e.add(n);if(0===e.size)return;this.records=this.records.filter((t=>!e.has(t.i)));const n=Array.from(e).sort(((t,e)=>t-e));for(const t of this.records){let e=0,i=n.length;for(;e<i;){const r=e+i>>>1;n[r]<t.i?e=r+1:i=r}t.i-=e}}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_createStringRecord(t,e){return!v(t)||w(t)?null:{v:t,i:e,n:this.norm.get(t)}}_createObjectRecord(t,e){const n={i:e,$:{}};for(let e=0,i=this.keys.length;e<i;e++){const i=this.keys[e],r=i.getFn?i.getFn(t):this.getFn(t,i.path);if(v(r))if(g(r)){const t=[];for(let e=0,n=r.length;e<n;e+=1){const n=r[e];if(v(n))if(p(n)){if(!w(n)){const i={v:n,i:e,n:this.norm.get(n)};t.push(i)}}else if(v(n.v)){const e=p(n.v)?n.v:A(n.v);if(!w(e)){const i={v:e,i:n.i,n:this.norm.get(e)};t.push(i)}}}n.$[e]=t}else if(p(r)&&!w(r)){const t={v:r,n:this.norm.get(r)};n.$[e]=t}}return n}toJSON(){return{keys:this.keys.map((({getFn:t,...e})=>e)),records:this.records}}};function S(t,e,{getFn:n=b.getFn,fieldNormWeight:i=b.fieldNormWeight}={}){const r=new k({getFn:n,fieldNormWeight:i});return r.setKeys(t.map(B)),r.setSources(e),r.create(),r}function $(t){const e={};for(let n=0,i=t.length;n<i;n+=1){const r=t.charAt(n);e[r]=(e[r]||0)|1<<i-n-1}return e}function N(t){if(t.length<=1)return t;t.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]));const e=[t[0]];for(let n=1,i=t.length;n<i;n+=1){const i=e[e.length-1],r=t[n];r[0]<=i[1]+1?i[1]=Math.max(i[1],r[1]):e.push(r)}return e}const L={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},I=new RegExp("["+Object.keys(L).join("")+"]","g"),R="function"==typeof String.prototype.normalize?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(I,(t=>L[t])):t=>t;var _=class{constructor(t,{location:e=b.location,threshold:n=b.threshold,distance:i=b.distance,includeMatches:r=b.includeMatches,findAllMatches:s=b.findAllMatches,minMatchCharLength:o=b.minMatchCharLength,isCaseSensitive:u=b.isCaseSensitive,ignoreDiacritics:c=b.ignoreDiacritics,ignoreLocation:h=b.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:u,ignoreDiacritics:c,ignoreLocation:h},t=u?t:t.toLowerCase(),t=c?R(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:$(t),startIndex:e})},l=this.pattern.length;if(l>32){let t=0;const e=l%32,n=l-e;for(;t<n;)a(this.pattern.substr(t,32),t),t+=32;if(e){const t=l-32;a(this.pattern.substr(t),t)}}else a(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=e?t:t.toLowerCase(),t=n?R(t):t,this.pattern===t){if(t.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};const e={isMatch:!0,score:0};return i&&(e.indices=[[0,t.length-1]]),e}const{location:r,distance:s,threshold:o,findAllMatches:u,minMatchCharLength:c,ignoreLocation:h}=this.options,a=[];let l=0,f=!1;this.chunks.forEach((({pattern:e,alphabet:n,startIndex:d})=>{const{isMatch:g,score:A,indices:p}=function(t,e,n,{location:i=b.location,distance:r=b.distance,threshold:s=b.threshold,findAllMatches:o=b.findAllMatches,minMatchCharLength:u=b.minMatchCharLength,includeMatches:c=b.includeMatches,ignoreLocation:h=b.ignoreLocation}={}){if(e.length>32)throw new Error("Pattern length exceeds max of 32.");const a=e.length,l=t.length,f=Math.max(0,Math.min(i,l));let d=s,g=f;const A=(t,e)=>{const n=t/a;if(h)return n;const i=Math.abs(f-e);return r?n+i/r:i?1:n},p=u>1||c,y=p?Array(l):[];let C;for(;(C=t.indexOf(e,g))>-1;){const t=A(0,C);if(d=Math.min(t,d),g=C+a,p){let t=0;for(;t<a;)y[C+t]=1,t+=1}}g=-1;let v=[],w=1,m=0,M=a+l;const F=1<<a-1;for(let e=0;e<a;e+=1){let i=0,r=M;for(;i<r;)A(e,f+r)<=d?i=r:M=r,r=Math.floor((M-i)/2+i);M=r;let s=Math.max(1,f-r+1);const u=o?l:Math.min(f+r,l)+a,c=Array(u+2);c[u+1]=(1<<e)-1;for(let i=u;i>=s;i-=1){const r=i-1;if(c[i]=(c[i+1]<<1|1)&n[t[r]],e&&(c[i]|=(v[i+1]|v[i])<<1|1|v[i+1]),c[i]&F&&(w=A(e,r),w<=d)){if(d=w,g=r,m=e,g<=f)break;s=Math.max(1,2*f-g)}}if(A(e+1,f)>d)break;v=c}if(p&&g>=0){const e=Math.min(l-1,g+a-1+m);for(let i=g;i<=e;i+=1)n[t[i]]&&(y[i]=1)}const D={isMatch:g>=0,score:Math.max(.001,w)};if(p){const t=function(t=[],e=b.minMatchCharLength){const n=[];let i=-1,r=-1,s=0;for(let o=t.length;s<o;s+=1){const o=t[s];o&&-1===i?i=s:o||-1===i||(r=s-1,r-i+1>=e&&n.push([i,r]),i=-1)}return t[s-1]&&s-i>=e&&n.push([i,s-1]),n}(y,u);t.length?c&&(D.indices=t):D.isMatch=!1}return D}(t,e,n,{location:r+d,distance:s,threshold:o,findAllMatches:u,minMatchCharLength:c,includeMatches:i,ignoreLocation:h});g&&(f=!0),l+=A,g&&p&&a.push(...p)}));const d={isMatch:f,score:f?l/this.chunks.length:1};return f&&i&&(d.indices=N(a)),d}};const j=new Set(["fuzzy","include"]),T=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:t=>({type:"exact",search(e){const n=e===t;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:t=>({type:"include",search(e){let n,i=0;const r=[],s=t.length;for(;(n=e.indexOf(t,i))>-1;)i=n+s,r.push([n,i-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:t=>({type:"prefix-exact",search(e){const n=e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:t=>({type:"inverse-prefix-exact",search(e){const n=!e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:t=>({type:"inverse-suffix-exact",search(e){const n=!e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:t=>({type:"suffix-exact",search(e){const n=e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[e.length-t.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:t=>({type:"inverse-exact",search(e){const n=-1===e.indexOf(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(t,e={})=>{const n=new _(t,{location:e.location??b.location,threshold:e.threshold??b.threshold,distance:e.distance??b.distance,includeMatches:e.includeMatches??b.includeMatches,findAllMatches:e.findAllMatches??b.findAllMatches,minMatchCharLength:e.minMatchCharLength??b.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??b.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??b.ignoreDiacritics,ignoreLocation:e.ignoreLocation??b.ignoreLocation});return{type:"fuzzy",search:t=>n.searchIn(t)}}}],z=T.length;function O(t,e){const n=t.match(e);return n?n[1]:null}const W=[];function U(...t){W.push(...t)}function G(t,e){for(let n=0,i=W.length;n<i;n+=1){const i=W[n];if(i.condition(t,e))return new i(t,e)}return new _(t,e)}const J="$and",P="$path",K=t=>!(!t[J]&&!t.$or),Y=t=>({[J]:Object.keys(t).map((e=>({[e]:t[e]})))});function H(t,e,{auto:n=!0}={}){const i=t=>{if(p(t)){const i={keyId:null,pattern:t};return n&&(i.searcher=G(t,e)),i}const r=Object.keys(t),s=(t=>!!t[P])(t);if(!s&&r.length>1&&!K(t))return i(Y(t));if((t=>!g(t)&&C(t)&&!K(t))(t)){const i=s?t[P]:r[0],o=s?t.$val:t[i];if(!p(o))throw new Error((t=>`Invalid value for key ${t}`)(i));const u={keyId:x(i),pattern:o};return n&&(u.searcher=G(o,e)),u}const o={children:[],operator:r[0]};return r.forEach((e=>{const n=t[e];g(n)&&n.forEach((t=>{o.children.push(i(t))}))})),o};return K(t)||(t=Y(t)),i(t)}function q(t,{ignoreFieldNorm:e=b.ignoreFieldNorm}){let n=1;return t.forEach((({key:t,norm:i,score:r})=>{const s=t?t.weight:null;n*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(e?1:i))})),n}var V=class{constructor(t,e){this.limit=t,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):this.comparator(t,this.heap[0])<0&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(t){const e=this.heap;for(;t>0;){const n=t-1>>1;if(this.comparator(e[t],e[n])<=0)break;const i=e[t];e[t]=e[n],e[n]=i,t=n}}_sinkDown(t){const e=this.heap,n=e.length;let i=t;do{const r=2*(t=i)+1,s=2*t+2;if(r<n&&this.comparator(e[r],e[i])>0&&(i=r),s<n&&this.comparator(e[s],e[i])>0&&(i=s),i!==t){const n=e[t];e[t]=e[i],e[i]=n}}while(i!==t)}};const Q=/[\p{L}\p{M}\p{N}_]+/gu,X=new WeakSet;function Z({isCaseSensitive:t=!1,ignoreDiacritics:e=!1,tokenize:n}={}){const i=function(t){if("function"==typeof t){let e=!1;return n=>{const i=t(n);if(!e&&(e=!0,!Array.isArray(i)||i.some((t=>"string"!=typeof t))))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(i)?"array containing non-strings":typeof i}.`);return i}}return t instanceof RegExp?(t.global||X.has(e=t)||(X.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`)),e=>e.match(t)||[]):t=>t.match(Q)||[];var e}(n);return{tokenize:n=>(t||(n=n.toLowerCase()),e&&(n=R(n)),i(n))}}function tt(t,e,n,i){const r=i.tokenize(e);if(!r.length)return;t.fieldCount++,t.docFieldCount.set(n,(t.docFieldCount.get(n)||0)+1);const s=new Set(r);let o=t.docTermFieldHits.get(n);o||(o=new Map,t.docTermFieldHits.set(n,o));for(const e of s)o.set(e,(o.get(e)||0)+1),t.df.set(e,(t.df.get(e)||0)+1)}function et(t,e,n,i){const{i:r,v:s,$:o}=e;if(void 0===s){if(o)for(let e=0;e<n;e++){const n=o[e];if(n)if(Array.isArray(n))for(const e of n)tt(t,e.v,r,i);else tt(t,n.v,r,i)}}else tt(t,s,r,i)}function nt(t,e){const n=t.docFieldCount.get(e);if(void 0===n)return;t.fieldCount-=n,t.docFieldCount.delete(e);const i=t.docTermFieldHits.get(e);if(i){for(const[e,n]of i){const i=(t.df.get(e)||0)-n;i<=0?t.df.delete(e):t.df.set(e,i)}t.docTermFieldHits.delete(e)}}function it(t,e){if(0===e.length)return;const n=Array.from(new Set(e)).sort(((t,e)=>t-e));for(const e of n)nt(t,e);const i=t=>{let e=0,i=n.length;for(;e<i;){const r=e+i>>>1;n[r]<t?e=r+1:i=r}return t-e},r=n[0],s=new Map;for(const[e,n]of t.docFieldCount)s.set(e>r?i(e):e,n);t.docFieldCount=s;const o=new Map;for(const[e,n]of t.docTermFieldHits)o.set(e>r?i(e):e,n);t.docTermFieldHits=o}var rt=class{constructor(t,e,n){this.options={...b,...e},this._keyStore=new D(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=G(t,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof k))throw new Error("Incorrect 'index' type");if(this._myIndex=e||S(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=function(t,e,n){const i={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const r of t)et(i,r,e,n);return i}(this._myIndex.records,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}add(t){if(!v(t))return;this._docs.push(t);const e=this._myIndex.add(t,this._docs.length-1);if(this._invertedIndex&&e){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});!function(t,e,n,i){et(t,e,n,i)}(this._invertedIndex,e,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}remove(t=()=>!1){const e=[],n=[];for(let i=0,r=this._docs.length;i<r;i+=1)t(this._docs[i],i)&&(e.push(this._docs[i]),n.push(i));if(n.length){this._invertedIndex&&it(this._invertedIndex,n);const t=new Set(n);this._docs=this._docs.filter(((e,n)=>!t.has(n))),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return e}removeAt(t){if(!Number.isInteger(t)||t<0||t>=this._docs.length)throw new Error(M);this._invertedIndex&&it(this._invertedIndex,[t]);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map((t=>this._keyStore.get(t.id)||t))}search(t,e){const{limit:n=-1}=e||{},{includeMatches:i,includeScore:r,shouldSort:s,sortFn:o,ignoreFieldNorm:u}=this.options;if(p(t)&&!t.trim()){let t=this._docs.map(((t,e)=>({item:t,refIndex:e})));return y(n)&&n>-1&&(t=t.slice(0,n)),t}const c=s&&y(n)&&n>0&&p(t),h=o,a=(t,e)=>h(t,e)||t.idx-e.idx;let l;if(c){const e=new V(n,a);p(this._docs[0])?this._searchStringList(t,{heap:e,ignoreFieldNorm:u}):this._searchObjectList(t,{heap:e,ignoreFieldNorm:u}),l=e.extractSorted()}else l=p(t)?p(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),function(t,{ignoreFieldNorm:e=b.ignoreFieldNorm}){t.forEach((t=>{t.score=q(t.matches,{ignoreFieldNorm:e})}))}(l,{ignoreFieldNorm:u}),s&&l.sort(p(t)?a:h),y(n)&&n>-1&&(l=l.slice(0,n));return function(t,e,{includeMatches:n=b.includeMatches,includeScore:i=b.includeScore}={}){return t.map((t=>{const{idx:r}=t,s={item:e[r],refIndex:r};return n&&(s.matches=function(t){const e=[];return t.matches.forEach((t=>{if(!v(t.indices)||!t.indices.length)return;const n={indices:t.indices,value:t.value};t.key&&(n.key=t.key.id),t.idx>-1&&(n.refIndex=t.idx),e.push(n)})),e}(t)),i&&(s.score=t.score),s}))}(l,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(t,{heap:e,ignoreFieldNorm:n}={}){const i=this._getSearcher(t),r=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:s}=this._myIndex,o=e?null:[];return s.forEach((({v:t,i:s,n:u})=>{if(!v(t))return;const c=i.searchIn(t);if(c.isMatch){const i={score:c.score,value:t,norm:u,indices:c.indices};r&&(i.matchedMask=c.matchedMask,i.matchedTerms=c.matchedTerms,i.termCount=c.termCount);const h=[i];if(!r||this._coversAllTokens(h)){const i={item:t,idx:s,matches:h};e?(i.score=q(i.matches,{ignoreFieldNorm:n}),e.insert(i)):o.push(i)}}})),o}_searchLogical(t){const e=H(t,this.options),n=this._normalizedKeys(),i=(t,e,r)=>{if(!("children"in t)){const{keyId:i,searcher:s}=t;let o;return null===i?(o=[],n.forEach(((t,n)=>{o.push(...this._findMatches({key:t,value:e[n],searcher:s}))}))):o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(e,i),searcher:s}),o&&o.length?[{idx:r,item:e,matches:o}]:[]}const{children:s,operator:o}=t,u=[];for(let t=0,n=s.length;t<n;t+=1){const n=i(s[t],e,r);if(n.length)u.push(...n);else if(o===J)return[]}return u},r=this._myIndex.records,s=new Map,o=[];return r.forEach((({$:t,i:n})=>{if(v(t)){const r=i(e,t,n);r.length&&(s.has(n)||(s.set(n,{idx:n,item:t,matches:[]}),o.push(s.get(n))),r.forEach((({matches:t})=>{s.get(n).matches.push(...t)})))}})),o}_searchObjectList(t,{heap:e,ignoreFieldNorm:n}={}){const i=this._getSearcher(t),r=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:s}=this._myIndex,o=this._normalizedKeys(),u=e?null:[];return s.forEach((({$:t,i:s})=>{if(!v(t))return;const c=[];let h=!1,a=!1;if(o.forEach(((e,n)=>{const r=this._findMatches({key:e,value:t[n],searcher:i});r.length?(c.push(...r),r[0].hasInverse&&(a=!0)):h=!0})),(!a||!h)&&c.length&&(!r||this._coversAllTokens(c))){const i={idx:s,item:t,matches:c};e?(i.score=q(i.matches,{ignoreFieldNorm:n}),e.insert(i)):u.push(i)}})),u}_findMatches({key:t,value:e,searcher:n}){if(!v(e))return[];const i=[];if(g(e))e.forEach((({v:e,i:r,n:s})=>{if(!v(e))return;const o=n.searchIn(e);if(o.isMatch){const n={score:o.score,key:t,value:e,idx:r,norm:s,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),i.push(n)}}));else{const{v:r,n:s}=e,o=n.searchIn(r);if(o.isMatch){const e={score:o.score,key:t,value:r,norm:s,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(e.matchedMask=o.matchedMask,e.matchedTerms=o.matchedTerms,e.termCount=o.termCount),i.push(e)}}return i}_coversAllTokens(t){const e=t.length?t[0].termCount:void 0;if(void 0===e)return!0;if(e<=31){let n=0;for(let e=0;e<t.length;e++)n|=t[e].matchedMask||0;return n===2**e-1}const n=new Set;for(let e=0;e<t.length;e++){const i=t[e].matchedTerms;if(i)for(const t of i)n.add(t)}return n.size===e}};rt.version="7.5.0",rt.createIndex=S,rt.parseIndex=function(t,{getFn:e=b.getFn,fieldNormWeight:n=b.fieldNormWeight}={}){const{keys:i,records:r}=t,s=new k({getFn:e,fieldNormWeight:n});return s.setKeys(i),s.setIndexRecords(r),s},rt.config=b,rt.match=function(t,e,n){if(n&&n.useTokenSearch)throw new Error("Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.");return G(t,{...b,...n}).searchIn(e)},rt.parseQuery=H,U(class{constructor(t,{isCaseSensitive:e=b.isCaseSensitive,ignoreDiacritics:n=b.ignoreDiacritics,includeMatches:i=b.includeMatches,minMatchCharLength:r=b.minMatchCharLength,ignoreLocation:s=b.ignoreLocation,findAllMatches:o=b.findAllMatches,location:u=b.location,threshold:c=b.threshold,distance:h=b.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:r,findAllMatches:o,ignoreLocation:s,location:u,threshold:c,distance:h},t=e?t:t.toLowerCase(),t=n?R(t):t,this.pattern=t,this.query=function(t,e={}){return t.replace(/\\\|/g,"\0").split("|").map((t=>{const n=function(t){const e=[],n=t.length;let i=0;for(;i<n;){for(;i<n&&" "===t[i];)i++;if(i>=n)break;let r=i;for(;r<n&&" "!==t[r]&&'"'!==t[r];)r++;if(r<n&&'"'===t[r]){for(r++;r<n;){if('"'===t[r]){const e=r+1;if(e>=n||" "===t[e]){r++;break}if("$"===t[e]&&(e+1>=n||" "===t[e+1])){r+=2;break}}r++}e.push(t.substring(i,r)),i=r}else{for(;r<n&&" "!==t[r];)r++;e.push(t.substring(i,r)),i=r}}return e}(t.replace(/\u0000/g,"|").trim()).filter((t=>t&&!!t.trim())),i=[];for(let t=0,r=n.length;t<r;t+=1){const r=n[t];let s=!1,o=-1;for(;!s&&++o<z;){const t=T[o],n=O(r,t.multiRegex);n&&(i.push(t.create(n,e)),s=!0)}if(!s)for(o=-1;++o<z;){const t=T[o],n=O(r,t.singleRegex);if(n){i.push(t.create(n,e));break}}}return i}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:r}=this.options;t=i?t:t.toLowerCase(),t=r?R(t):t;let s=0;const o=[];let u=0,c=!1;for(let i=0,r=e.length;i<r;i+=1){const r=e[i];o.length=0,s=0,c=!1;for(let e=0,i=r.length;e<i;e+=1){const i=r[e],{isMatch:h,indices:a,score:l}=i.search(t);if(!h){u=0,s=0,o.length=0,c=!1;break}s+=1,u+=l,i.type.startsWith("inverse")&&(c=!0),n&&(j.has(i.type)?o.push(...a):o.push(a))}if(s){const t={isMatch:!0,score:u/s};return c&&(t.hasInverse=!0),n&&(t.indices=N(o)),t}}return{isMatch:!1,score:1}}}),U(class{static condition(t,e){return e.useTokenSearch}constructor(t,e){this.options=e,this.analyzer=Z({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});const n=this.analyzer.tokenize(t),{df:i,fieldCount:r}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(const t of n){this.termSearchers.push(new _(t,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const n=i.get(t)||0,s=Math.log(1+(r-n+.5)/(n+.5));this.idfWeights.push(s)}this.combineAll="all"===e.tokenMatch,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let n=0,i=0,r=0,s=0;const o=this.combineAll&&!this.useMask?new Set:null;for(let u=0;u<this.termSearchers.length;u++){const c=this.termSearchers[u].searchIn(t),h=this.idfWeights[u];i+=h,c.isMatch&&(r++,n+=h*(1-c.score),c.indices&&e.push(...c.indices),this.combineAll&&(this.useMask?s|=1<<u:o.add(u)))}if(0===r)return{isMatch:!1,score:1};const u={isMatch:!0,score:Math.max(.001,i>0?1-n/i:0)};return this.options.includeMatches&&e.length&&(u.indices=N(e)),this.combineAll&&(this.useMask?u.matchedMask=s:u.matchedTerms=o,u.termCount=this.numTerms),u}}),rt.use=function(...t){t.forEach((t=>U(t)))};var st=rt;const ot=1,ut=100,ct=20,ht={keys:["preferred_label"],includeScore:!0,ignoreDiacritics:!0,ignoreFieldNorm:!0,threshold:.6,minMatchCharLength:1,ignoreLocation:!0,distance:100},at="T.ex. målare, florist, kock",lt={format:(t,e,n)=>{const i=function(t,e){if(!t)return[];if(!e||0===e.trim().length)return[{text:t,isMatch:!1}];const n=t.toLowerCase(),i=e.toLowerCase().split(/\s+/).filter((t=>t.length>0)),r=new Set;if(i.forEach((t=>{let e=0;for(;-1!==(e=n.indexOf(t,e));){for(let n=0;n<t.length;n++)r.add(e+n);e+=t.length}})),0===r.size&&i.forEach((e=>{const n=function(t,e){const n=t.toLowerCase(),i=e.length;let r=99,s=-1,o=0;const u=Math.max(3,i-2),c=Math.min(n.length,i+2);for(let t=0;t<=n.length-u;t++)for(let i=u;i<=c&&t+i<=n.length;i++){const u=ft(e,n.slice(t,t+i));u<r&&(r=u,s=t,o=i)}return r<=Math.max(2,Math.floor(.25*i))&&-1!==s?{start:s,length:o}:null}(t,e);if(n)for(let t=0;t<n.length;t++)r.add(n.start+t)})),0===r.size)return[{text:t,isMatch:!1}];const s=[];let o="",u=r.has(0);for(let e=0;e<t.length;e++){const n=r.has(e);n!==u?(o.length>0&&s.push({text:o,isMatch:u}),o=t[e],u=n):o+=t[e]}return o.length>0&&s.push({text:o,isMatch:u}),s}(t,e);return n?[...i,{text:" ",isMatch:!1},{text:`(${n})`,isMetadata:!0}]:i}};function ft(t,e){const n=t.length,i=e.length,r=Array.from({length:n+1},(()=>new Array(i+1).fill(0)));for(let t=0;t<=n;t++)r[t][0]=t;for(let t=0;t<=i;t++)r[0][t]=t;for(let s=1;s<=n;s++)for(let n=1;n<=i;n++)r[s][n]=t[s-1]===e[n-1]?r[s-1][n-1]:1+Math.min(r[s-1][n],r[s][n-1],r[s-1][n-1]);return r[n][i]}s.setLevel(s.levels.DEBUG);const dt=t=>t?t.toLowerCase().trim():"";function gt(t,e){return t.id&&e.id?t.id===e.id&&(t.occupationId??t.occupation_name_id??"")===(e.occupationId??e.occupation_name_id??""):t.rawLabel===e.rawLabel}function At(t){return t.sort(((t,e)=>{const n=t.score??0,i=e.score??0;if(n!==i)return i-n;const r=t.weight??0,s=e.weight??0;return r!==s?s-r:t.displayLabel.localeCompare(e.displayLabel,"sv")}))}function pt(t){return t.map((t=>t.isMatch?`<strong>${t.text}</strong>`:t.isMetadata?`<span class="occupation-variant-label">${t.text}</span>`:t.text)).join("")}const yt=t=>t?t.replace(/ (\([^)]+\))/g,' <span class="occupation-variant-label">$1</span>'):"";function Ct(t,e,n){return t===e?1:n.length>1?n.every((e=>t.includes(e)))?.98:null:t.startsWith(e)?.99:t.includes(e)?.95:null}function vt(t,e){const n=t.length,i=e.length,r=Array.from({length:n+1},(()=>new Array(i+1).fill(0)));for(let t=0;t<=n;t++)r[t][0]=t;for(let t=0;t<=i;t++)r[0][t]=t;for(let s=1;s<=n;s++)for(let n=1;n<=i;n++)r[s][n]=t[s-1]===e[n-1]?r[s-1][n-1]:1+Math.min(r[s-1][n],r[s][n-1],r[s-1][n-1]);return r[n][i]}function wt(t,e){const n=t.toLowerCase().trim(),i=e.toLowerCase().trim();return i.includes(" ")?vt(n,i)<=Math.max(2,Math.floor(.25*n.length))&&Math.abs(n.length-i.length)<=2:null!==function(t,e){const n=t.toLowerCase(),i=e.length;let r=99;const s=Math.max(3,i-2),o=Math.min(n.length,i+2);for(let t=0;t<=n.length-s;t++)for(let i=s;i<=o&&t+i<=n.length;i++){const s=vt(e,n.slice(t,t+i));s<r&&(r=s)}return r<=Math.max(2,Math.floor(.25*i))?r:null}(i,n)}function mt(t,e){return(t.search_aliases??[]).some((t=>dt(t)===e))}function Mt(t,e,n){const i=function(t){return t.occupation_name_preferred_label?`${t.preferred_label||""} (${t.occupation_name_preferred_label})`:t.preferred_label||""}(t),r=lt.format(t.preferred_label||"",e,t.occupation_name_preferred_label);return{id:t.id,type:t.type,preferred_label:t.preferred_label||"",rawLabel:t.preferred_label||"",displayLabel:i,highlightedLabel:pt(r),displaySegments:r,weight:t.weight??0,score:n,occupationId:t.occupation_name_id,occupationLabel:t.occupation_name_preferred_label,ssyk_level_4_id:t.ssyk_level_4_id,ssyk_code_2012:t.ssyk_code_2012}}function Ft(t){return"job-title"===t.type?`${t.id}|${t.occupation_name_id??""}`:t.id}function Dt(t,e,n,i){if(!n)return[];if(!e||!Array.isArray(e))return s.warn("[searchConcepts] Ogiltig items array."),[];if(!t||t.length<1)return[];const r=dt(t),o=r.split(" ").filter((t=>t.length>0)),u=[],c=new Set;for(const n of e){const e=Ct(dt(n.preferred_label),r,o),i=mt(n,r)?1:e;null!==i&&(u.push(Mt(n,t,i)),c.add(Ft(n)))}if(u.length>0)return At(u).slice(0,i);if(n){const e=n.search(r);if(0===e.length)return[];const s=e[0].score??1,o=[];let u=!1;for(const n of e){const e=Ft(n.item);if(c.has(e))continue;const i=n.score??1,h=1-i;if(h<.4)continue;if(i>s+.12)continue;const a=dt(n.item.preferred_label),l=n.item.weight??0,f=wt(r,a);f&&i<=.25&&(u=!0);let d=.7*h+.1*l;f&&(d+=.12);const g=Math.min(.84,Math.max(.4,d));o.push(Mt(n.item,t,g)),c.add(e)}const h=At(o);if(0===h.length)return[];const a=u?Math.min(5,i):Math.min(3,i);return h.slice(0,a)}return[]}const Bt={toGenericItem:t=>({id:t.id,label:t.preferred_label||"",description:t.occupation_name_preferred_label,metadata:{original:t,type:t.type,ssyk_level_4_id:t.ssyk_level_4_id,weight:t.weight}}),searchResultToGenericItem(t,e){const n=lt.format(t.preferred_label||"",e,t.occupation_name_preferred_label);return{id:t.id,label:t.preferred_label||"",displaySegments:n,highlightedLabel:pt(n),metadata:{original:t,ssyk_level_4_id:t.ssyk_level_4_id,weight:t.weight}}},fromGenericItem:t=>({id:t.id,preferred_label:t.label,weight:t.metadata?.weight,...t.metadata?.original}),toPublicSelection(t,e){const n=t.id||"",i=t.preferred_label||t.rawLabel||"";if(!n)return{type:"manual-input",id:null,preferred_label:i};if("job-title"!==t.type&&"occupation-name"!==t.type)throw new Error(`Ogiltig intern yrkestyp för ${n}: ${t.type}`);const r={type:t.type,id:n,preferred_label:i};t.ssyk_code_2012&&(r.ssyk_code_2012=t.ssyk_code_2012);const s=t.occupation_name_id||t.occupationId;if("job-title"===t.type&&s){const n=t.occupation_name_preferred_label?.trim()||t.occupationLabel?.trim();r.related={type:"occupation-name",id:s,preferred_label:n||e?.(s)||s}}return r}};class Et{fuseInstance=null;items=[];constructor(t){this.items=t,this.fuseInstance=new st(t,ht)}search(t,e=20){return this.fuseInstance?Dt(t,this.items,this.fuseInstance,e).map((t=>Bt.toPublicSelection(t))):[]}searchAsGeneric(t,e=20){return this.fuseInstance?Dt(t,this.items,this.fuseInstance,e).map((t=>({id:t.id,label:t.displayLabel,description:t.occupationLabel,group:"job-title"===t.type?"Yrke":"Yrkesgrupp",metadata:{originalResult:t,highlightedLabel:t.highlightedLabel,score:t.score,weight:t.weight}}))):[]}updateData(t){this.items=t,this.fuseInstance=new st(t,ht)}}class xt extends Error{code;invalidIds;constructor(t,e,n){super(t),this.name="InvalidSelectionError",this.code=e,this.invalidIds=n}}export{ut as D,xt as I,lt as L,ct as M,at as P,Et as T,Bt as a,l as b,ot as c,yt as d,d as g,gt as i,s as l,f as r,pt as s}
|