contacts-pane 3.0.2 → 3.0.3

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.
Files changed (45) hide show
  1. package/README.md +53 -1
  2. package/dist/contactsPane.js +6487 -763
  3. package/dist/contactsPane.js.map +1 -1
  4. package/dist/contactsPane.min.js +2 -0
  5. package/dist/contactsPane.min.js.map +1 -0
  6. package/dist/styles/contactsPane.css +602 -0
  7. package/dist/styles/contactsRDFFormsEnforced.css +513 -0
  8. package/dist/styles/groupMembership.css +115 -0
  9. package/dist/styles/individual.css +12 -0
  10. package/dist/styles/localUtils.css +49 -0
  11. package/dist/styles/mugshotGallery.css +17 -0
  12. package/dist/styles/toolsPane.css +43 -0
  13. package/dist/styles/utilities.css +69 -0
  14. package/dist/styles/webidControl.css +90 -0
  15. package/package.json +23 -17
  16. package/dist/autocompleteBar.d.ts +0 -3
  17. package/dist/autocompleteBar.d.ts.map +0 -1
  18. package/dist/autocompleteBar.js +0 -90
  19. package/dist/autocompleteBar.js.map +0 -1
  20. package/dist/autocompleteField.d.ts +0 -20
  21. package/dist/autocompleteField.d.ts.map +0 -1
  22. package/dist/autocompleteField.js +0 -165
  23. package/dist/autocompleteField.js.map +0 -1
  24. package/dist/autocompletePicker.d.ts +0 -15
  25. package/dist/autocompletePicker.d.ts.map +0 -1
  26. package/dist/autocompletePicker.js +0 -253
  27. package/dist/autocompletePicker.js.map +0 -1
  28. package/dist/contactLogic.js +0 -223
  29. package/dist/contactLogic.js.map +0 -1
  30. package/dist/groupMembershipControl.js +0 -107
  31. package/dist/groupMembershipControl.js.map +0 -1
  32. package/dist/individual.js +0 -115
  33. package/dist/individual.js.map +0 -1
  34. package/dist/mintNewAddressBook.js +0 -145
  35. package/dist/mintNewAddressBook.js.map +0 -1
  36. package/dist/mugshotGallery.js +0 -264
  37. package/dist/mugshotGallery.js.map +0 -1
  38. package/dist/publicData.d.ts +0 -82
  39. package/dist/publicData.d.ts.map +0 -1
  40. package/dist/publicData.js +0 -421
  41. package/dist/publicData.js.map +0 -1
  42. package/dist/toolsPane.js +0 -671
  43. package/dist/toolsPane.js.map +0 -1
  44. package/dist/webidControl.js +0 -320
  45. package/dist/webidControl.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"autocompletePicker.d.ts","sourceRoot":"","sources":["../src/autocompletePicker.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAGlC,OAAO,EACwD,eAAe,EAC7E,MAAM,cAAc,CAAA;AAqBrB,KAAK,mBAAmB,GAAG;IACzB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,EAAE,eAAe,CAAA;CAC7B,CAAA;AAED,UAAU,SAAS;IACjB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C;AAGD,wBAAsB,kBAAkB,CAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAC,mBAAmB,EAAE,0CAA0C;AAClI,QAAQ,EAAE,SAAS,2BAsNpB"}
@@ -1,253 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.renderAutoComplete = renderAutoComplete;
7
- var _solidLogic = require("solid-logic");
8
- var _solidUi = require("solid-ui");
9
- var _publicData = require("./publicData");
10
- /* Create and edit data using public data
11
- **
12
- ** organization conveys many distinct types of thing.
13
- **
14
- */
15
-
16
- const AUTOCOMPLETE_THRESHOLD = 4; // don't check until this many characters typed
17
- const AUTOCOMPLETE_ROWS = 20; // 20?
18
- const AUTOCOMPLETE_ROWS_STRETCH = 40;
19
- const AUTOCOMPLETE_DEBOUNCE_MS = 300;
20
-
21
- // const autocompleteRowStyle = 'border: 0.2em solid straw;' // @@ white
22
-
23
- /*
24
- Autocomplete happens in four phases:
25
- 1. The search string is too small to bother
26
- 2. The search string is big enough, and we have not loaded the array
27
- 3. The search string is big enough, and we have loaded array up to the limit
28
- Display them and wait for more user input
29
- 4. The search string is big enough, and we have loaded array NOT to the limit
30
- but including all matches. No more fetches.
31
- If user gets more precise, wait for them to select one - or reduce to a single
32
- 5. Optionally waiting for accept button to be pressed
33
- */
34
-
35
- // The core of the autocomplete UI
36
- async function renderAutoComplete(dom, options,
37
- // subject:NamedNode, predicate:NamedNode,
38
- callback) {
39
- function complain(message) {
40
- const errorRow = table.appendChild(dom.createElement('tr'));
41
- console.log(message);
42
- errorRow.appendChild(_solidUi.widgets.errorMessageBlock(dom, message, 'pink'));
43
- _solidUi.style.setStyle(errorRow, 'autocompleteRowStyle');
44
- errorRow.style.padding = '1em';
45
- }
46
- /*
47
- function remove (ele?: HTMLElement) {
48
- if (ele && ele.parentNode) {
49
- ele.parentNode.removeChild(ele)
50
- }
51
- }
52
- */
53
- function finish(object, name) {
54
- console.log('Auto complete: finish! ' + object);
55
- // remove(options.cancelButton)
56
- // remove(options.acceptButton)
57
- // remove(div)
58
- callback(object, name);
59
- }
60
- async function gotIt(object, name) {
61
- if (options.acceptButton) {
62
- options.acceptButton.disabled = false;
63
- searchInput.value = name; // complete it
64
- foundName = name;
65
- foundObject = object;
66
- console.log('Auto complete: name: ' + name);
67
- console.log('Auto complete: waiting for accept ' + object);
68
- return;
69
- }
70
- finish(object, name);
71
- }
72
- async function acceptButtonHandler(_event) {
73
- if (searchInput.value === foundName) {
74
- // still
75
- finish(foundObject, foundName);
76
- } else {
77
- options.acceptButton.disabled = true;
78
- }
79
- }
80
-
81
- /*
82
- async function cancelButtonHandler (_event) {
83
- console.log('Auto complete: Canceled by user! ')
84
- div.innerHTML = '' // Clear out the table
85
- }
86
- */
87
-
88
- function nameMatch(filter, candidate) {
89
- const parts = filter.split(' '); // Each name part must be somewhere
90
- for (let j = 0; j < parts.length; j++) {
91
- const word = parts[j];
92
- if (candidate.toLowerCase().indexOf(word) < 0) return false;
93
- }
94
- return true;
95
- }
96
-
97
- /*
98
- function cancelText (_event) {
99
- searchInput.value = ''
100
- if (options.acceptButton) {
101
- (options.acceptButton as any).disabled = true // start again
102
- }
103
- _candidatesLoaded = false
104
- }
105
- */
106
-
107
- function thinOut(filter) {
108
- let hits = 0;
109
- let pick = null;
110
- let pickedName = '';
111
- for (let j = table.children.length - 1; j > 0; j--) {
112
- // backwards as we are removing rows
113
- const row = table.children[j];
114
- if (nameMatch(filter, row.textContent)) {
115
- hits += 1;
116
- pick = row.getAttribute('subject');
117
- pickedName = row.textContent;
118
- row.style.display = '';
119
- row.style.color = 'blue'; // @@ chose color
120
- } else {
121
- ;
122
- row.style.display = 'none';
123
- }
124
- }
125
- if (hits === 1 && pick) {
126
- // Maybe require green confirmation button be clicked?
127
- console.log(` auto complete elimination: "${filter}" -> "${pickedName}"`);
128
- gotIt(_solidLogic.store.sym(pick), pickedName); // uri, name
129
- }
130
- }
131
- function clearList() {
132
- while (table.children.length > 1 && table.lastChild) {
133
- table.removeChild(table.lastChild);
134
- }
135
- }
136
- async function inputEventHHandler(_event) {
137
- if (runningTimeout) {
138
- clearTimeout(runningTimeout);
139
- }
140
- setTimeout(refreshList, AUTOCOMPLETE_DEBOUNCE_MS);
141
- }
142
- async function refreshList() {
143
- if (inputEventHandlerLock) {
144
- console.log(`Ignoring "${searchInput.value}" because of lock `);
145
- return;
146
- }
147
- inputEventHandlerLock = true;
148
- const languagePrefs = await (0, _publicData.getPreferredLanguages)();
149
- const filter = searchInput.value.trim().toLowerCase();
150
- if (filter.length < AUTOCOMPLETE_THRESHOLD) {
151
- // too small
152
- clearList();
153
- candidatesLoaded = false;
154
- numberOfRows = AUTOCOMPLETE_ROWS;
155
- } else {
156
- if (allDisplayed && lastFilter && filter.startsWith(lastFilter)) {
157
- thinOut(filter); // reversible?
158
- inputEventHandlerLock = false;
159
- return;
160
- }
161
- let bindings;
162
- try {
163
- bindings = await (0, _publicData.queryPublicDataByName)(filter, OrgClass, options.queryParams);
164
- // bindings = await queryDbpedia(sparql)
165
- } catch (err) {
166
- complain('Error querying db of organizations: ' + err);
167
- inputEventHandlerLock = false;
168
- return;
169
- }
170
- candidatesLoaded = true;
171
- const loadedEnough = bindings.length < _publicData.AUTOCOMPLETE_LIMIT;
172
- if (loadedEnough) {
173
- lastFilter = filter;
174
- } else {
175
- lastFilter = null;
176
- }
177
- clearList();
178
- const slimmed = (0, _publicData.filterByLanguage)(bindings, languagePrefs);
179
- if (loadedEnough && slimmed.length <= AUTOCOMPLETE_ROWS_STRETCH) {
180
- numberOfRows = slimmed.length; // stretch if it means we get all items
181
- }
182
- allDisplayed = loadedEnough && slimmed.length <= numberOfRows;
183
- console.log(` Filter:"${filter}" bindings: ${bindings.length}, slimmed to ${slimmed.length}; rows: ${numberOfRows}, Enough? ${loadedEnough}, All displayed? ${allDisplayed}`);
184
- slimmed.slice(0, numberOfRows).forEach(binding => {
185
- const row = table.appendChild(dom.createElement('tr'));
186
- _solidUi.style.setStyle(row, 'autocompleteRowStyle');
187
- const uri = binding.subject.value;
188
- const name = binding.name?.value;
189
- row.setAttribute('style', 'padding: 0.3em;');
190
- row.setAttribute('subject', uri);
191
- row.style.color = allDisplayed ? '#080' : '#000'; // green means 'you should find it here'
192
- row.textContent = name || '';
193
- row.addEventListener('click', async _event => {
194
- console.log(' click row textContent: ' + row.textContent);
195
- console.log(' click name: ' + name);
196
- gotIt(_solidLogic.store.sym(uri), name || '');
197
- });
198
- });
199
- }
200
- inputEventHandlerLock = false;
201
- } // refreshList
202
-
203
- /* sparqlForSearch
204
- *
205
- * name -- e.g., "mass"
206
- * theType -- e.g., <http://umbel.org/umbel/rc/EducationalOrganization>
207
- */
208
- /*
209
- function sparqlForSearch (name:string, theType:NamedNode):string {
210
- const clean = name.replace(/\W/g, '') // Remove non alphanum so as to protect regexp
211
- const sparql = `select distinct ?subject, ?name where {
212
- ?subject a <${theType.uri}>; rdfs:label ?name
213
- FILTER regex(?name, "${clean}", "i")
214
- } LIMIT ${AUTOCOMPLETE_LIMIT}`
215
- return sparql
216
- }
217
- */
218
- const OrgClass = options.class; // kb.sym('http://umbel.org/umbel/rc/EducationalOrganization') // @@@ other
219
- if (options.acceptButton) {
220
- options.acceptButton.addEventListener('click', acceptButtonHandler, false);
221
- }
222
- if (options.cancelButton) {
223
- // options.cancelButton.addEventListener('click', cancelButtonHandler, false)
224
- }
225
-
226
- // @ts-ignore
227
- let candidatesLoaded = false;
228
- const runningTimeout = null;
229
- let inputEventHandlerLock = false;
230
- let allDisplayed = false;
231
- var lastFilter = null;
232
- var numberOfRows = AUTOCOMPLETE_ROWS;
233
- const div = dom.createElement('div');
234
- var foundName = null; // once found accepted string must match this
235
- var foundObject = null;
236
- var table = div.appendChild(dom.createElement('table'));
237
- table.setAttribute('style', 'max-width: 30em; margin: 0.5em;');
238
- const head = table.appendChild(dom.createElement('tr'));
239
- _solidUi.style.setStyle(head, 'autocompleteRowStyle');
240
- const cell = head.appendChild(dom.createElement('td'));
241
- const searchInput = cell.appendChild(dom.createElement('input'));
242
- searchInput.setAttribute('type', 'text');
243
- const searchInputStyle = _solidUi.style.searchInputStyle || 'border: 0.1em solid #444; border-radius: 0.5em; width: 100%; font-size: 100%; padding: 0.1em 0.6em'; // @
244
- searchInput.setAttribute('style', searchInputStyle);
245
- searchInput.addEventListener('keyup', function (event) {
246
- if (event.keyCode === 13) {
247
- acceptButtonHandler(event);
248
- }
249
- }, false);
250
- searchInput.addEventListener('input', inputEventHHandler);
251
- return div;
252
- } // renderAutoComplete22q1
253
- //# sourceMappingURL=autocompletePicker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"autocompletePicker.js","names":["_solidLogic","require","_solidUi","_publicData","AUTOCOMPLETE_THRESHOLD","AUTOCOMPLETE_ROWS","AUTOCOMPLETE_ROWS_STRETCH","AUTOCOMPLETE_DEBOUNCE_MS","renderAutoComplete","dom","options","callback","complain","message","errorRow","table","appendChild","createElement","console","log","widgets","errorMessageBlock","style","setStyle","padding","finish","object","name","gotIt","acceptButton","disabled","searchInput","value","foundName","foundObject","acceptButtonHandler","_event","nameMatch","filter","candidate","parts","split","j","length","word","toLowerCase","indexOf","thinOut","hits","pick","pickedName","children","row","textContent","getAttribute","display","color","store","sym","clearList","lastChild","removeChild","inputEventHHandler","runningTimeout","clearTimeout","setTimeout","refreshList","inputEventHandlerLock","languagePrefs","getPreferredLanguages","trim","candidatesLoaded","numberOfRows","allDisplayed","lastFilter","startsWith","bindings","queryPublicDataByName","OrgClass","queryParams","err","loadedEnough","AUTOCOMPLETE_LIMIT","slimmed","filterByLanguage","slice","forEach","binding","uri","subject","setAttribute","addEventListener","class","cancelButton","div","head","cell","searchInputStyle","event","keyCode"],"sources":["../src/autocompletePicker.ts"],"sourcesContent":["/* Create and edit data using public data\n**\n** organization conveys many distinct types of thing.\n**\n*/\nimport { NamedNode } from 'rdflib'\nimport { store } from 'solid-logic'\nimport { style, widgets } from 'solid-ui'\nimport {\n AUTOCOMPLETE_LIMIT, filterByLanguage, getPreferredLanguages, QueryParameters, queryPublicDataByName\n} from './publicData'\n\nconst AUTOCOMPLETE_THRESHOLD = 4 // don't check until this many characters typed\nconst AUTOCOMPLETE_ROWS = 20 // 20?\nconst AUTOCOMPLETE_ROWS_STRETCH = 40\nconst AUTOCOMPLETE_DEBOUNCE_MS = 300\n\n// const autocompleteRowStyle = 'border: 0.2em solid straw;' // @@ white\n\n/*\nAutocomplete happens in four phases:\n 1. The search string is too small to bother\n 2. The search string is big enough, and we have not loaded the array\n 3. The search string is big enough, and we have loaded array up to the limit\n Display them and wait for more user input\n 4. The search string is big enough, and we have loaded array NOT to the limit\n but including all matches. No more fetches.\n If user gets more precise, wait for them to select one - or reduce to a single\n 5. Optionally waiting for accept button to be pressed\n*/\n\ntype AutocompleteOptions = {\n cancelButton?: HTMLElement,\n acceptButton?: HTMLElement,\n class: NamedNode,\n queryParams: QueryParameters\n}\n\ninterface Callback1 {\n (subject: NamedNode, name: string): void;\n}\n\n// The core of the autocomplete UI\nexport async function renderAutoComplete (dom: HTMLDocument, options:AutocompleteOptions, // subject:NamedNode, predicate:NamedNode,\n callback: Callback1) {\n function complain (message) {\n const errorRow = table.appendChild(dom.createElement('tr'))\n console.log(message)\n errorRow.appendChild(widgets.errorMessageBlock(dom, message, 'pink'))\n style.setStyle(errorRow, 'autocompleteRowStyle')\n errorRow.style.padding = '1em'\n }\n /*\n function remove (ele?: HTMLElement) {\n if (ele && ele.parentNode) {\n ele.parentNode.removeChild(ele)\n }\n }\n */\n function finish (object, name) {\n console.log('Auto complete: finish! ' + object)\n // remove(options.cancelButton)\n // remove(options.acceptButton)\n // remove(div)\n callback(object, name)\n }\n async function gotIt (object:NamedNode, name:string) {\n if (options.acceptButton) {\n (options.acceptButton as any).disabled = false\n searchInput.value = name // complete it\n foundName = name\n foundObject = object\n console.log('Auto complete: name: ' + name)\n console.log('Auto complete: waiting for accept ' + object)\n return\n }\n finish(object, name)\n }\n\n async function acceptButtonHandler (_event) {\n if (searchInput.value === foundName) { // still\n finish(foundObject, foundName)\n } else {\n (options.acceptButton as any).disabled = true\n }\n }\n\n /*\n async function cancelButtonHandler (_event) {\n console.log('Auto complete: Canceled by user! ')\n div.innerHTML = '' // Clear out the table\n }\n */\n\n function nameMatch (filter:string, candidate: string):boolean {\n const parts = filter.split(' ') // Each name part must be somewhere\n for (let j = 0; j < parts.length; j++) {\n const word = parts[j]\n if (candidate.toLowerCase().indexOf(word) < 0) return false\n }\n return true\n }\n\n /*\n function cancelText (_event) {\n searchInput.value = ''\n if (options.acceptButton) {\n (options.acceptButton as any).disabled = true // start again\n }\n _candidatesLoaded = false\n }\n */\n\n function thinOut (filter) {\n let hits = 0\n let pick: string | null = null; let pickedName = ''\n for (let j = table.children.length - 1; j > 0; j--) { // backwards as we are removing rows\n const row = table.children[j]\n if (nameMatch(filter, row.textContent)) {\n hits += 1\n pick = row.getAttribute('subject')\n pickedName = row.textContent\n ;(row as any).style.display = ''\n ;(row as any).style.color = 'blue' // @@ chose color\n } else {\n ;(row as any).style.display = 'none'\n }\n }\n if (hits === 1 && pick) { // Maybe require green confirmation button be clicked?\n console.log(` auto complete elimination: \"${filter}\" -> \"${pickedName}\"`)\n gotIt(store.sym(pick), pickedName) // uri, name\n }\n }\n\n function clearList () {\n while (table.children.length > 1 && table.lastChild) {\n table.removeChild(table.lastChild)\n }\n }\n\n async function inputEventHHandler (_event) {\n if (runningTimeout) {\n clearTimeout(runningTimeout)\n }\n setTimeout(refreshList, AUTOCOMPLETE_DEBOUNCE_MS)\n }\n\n async function refreshList () {\n if (inputEventHandlerLock) {\n console.log(`Ignoring \"${searchInput.value}\" because of lock `)\n return\n }\n inputEventHandlerLock = true\n const languagePrefs = await getPreferredLanguages()\n const filter = searchInput.value.trim().toLowerCase()\n if (filter.length < AUTOCOMPLETE_THRESHOLD) { // too small\n clearList()\n candidatesLoaded = false\n numberOfRows = AUTOCOMPLETE_ROWS\n } else {\n if (allDisplayed && lastFilter && filter.startsWith(lastFilter)) {\n thinOut(filter) // reversible?\n inputEventHandlerLock = false\n return\n }\n let bindings\n try {\n bindings = await queryPublicDataByName(filter, OrgClass, options.queryParams)\n // bindings = await queryDbpedia(sparql)\n } catch (err) {\n complain('Error querying db of organizations: ' + err)\n inputEventHandlerLock = false\n return\n }\n candidatesLoaded = true\n const loadedEnough = bindings.length < AUTOCOMPLETE_LIMIT\n if (loadedEnough) {\n lastFilter = filter\n } else {\n lastFilter = null\n }\n clearList()\n const slimmed = filterByLanguage(bindings, languagePrefs)\n if (loadedEnough && slimmed.length <= AUTOCOMPLETE_ROWS_STRETCH) {\n numberOfRows = slimmed.length // stretch if it means we get all items\n }\n allDisplayed = loadedEnough && slimmed.length <= numberOfRows\n console.log(` Filter:\"${filter}\" bindings: ${bindings.length}, slimmed to ${slimmed.length}; rows: ${numberOfRows}, Enough? ${loadedEnough}, All displayed? ${allDisplayed}`)\n slimmed.slice(0, numberOfRows).forEach(binding => {\n const row = table.appendChild(dom.createElement('tr'))\n style.setStyle(row, 'autocompleteRowStyle')\n const uri = binding.subject.value\n const name = binding.name?.value\n row.setAttribute('style', 'padding: 0.3em;')\n row.setAttribute('subject', uri)\n row.style.color = allDisplayed ? '#080' : '#000' // green means 'you should find it here'\n row.textContent = name || ''\n row.addEventListener('click', async _event => {\n console.log(' click row textContent: ' + row.textContent)\n console.log(' click name: ' + name)\n gotIt(store.sym(uri), name || '')\n })\n })\n }\n inputEventHandlerLock = false\n } // refreshList\n\n /* sparqlForSearch\n*\n* name -- e.g., \"mass\"\n* theType -- e.g., <http://umbel.org/umbel/rc/EducationalOrganization>\n*/\n /*\n function sparqlForSearch (name:string, theType:NamedNode):string {\n const clean = name.replace(/\\W/g, '') // Remove non alphanum so as to protect regexp\n const sparql = `select distinct ?subject, ?name where {\n ?subject a <${theType.uri}>; rdfs:label ?name\n FILTER regex(?name, \"${clean}\", \"i\")\n } LIMIT ${AUTOCOMPLETE_LIMIT}`\n return sparql\n }\n*/\n const OrgClass = options.class // kb.sym('http://umbel.org/umbel/rc/EducationalOrganization') // @@@ other\n if (options.acceptButton) {\n options.acceptButton.addEventListener('click', acceptButtonHandler, false)\n }\n if (options.cancelButton) {\n // options.cancelButton.addEventListener('click', cancelButtonHandler, false)\n }\n\n // @ts-ignore\n let candidatesLoaded = false\n const runningTimeout = null\n let inputEventHandlerLock = false\n let allDisplayed = false\n var lastFilter: string | null = null\n var numberOfRows = AUTOCOMPLETE_ROWS\n const div = dom.createElement('div')\n var foundName: string | null = null // once found accepted string must match this\n var foundObject: NamedNode | null = null\n var table = div.appendChild(dom.createElement('table'))\n table.setAttribute('style', 'max-width: 30em; margin: 0.5em;')\n const head = table.appendChild(dom.createElement('tr'))\n style.setStyle(head, 'autocompleteRowStyle')\n const cell = head.appendChild(dom.createElement('td'))\n const searchInput = cell.appendChild(dom.createElement('input'))\n searchInput.setAttribute('type', 'text')\n const searchInputStyle = style.searchInputStyle ||\n 'border: 0.1em solid #444; border-radius: 0.5em; width: 100%; font-size: 100%; padding: 0.1em 0.6em' // @\n searchInput.setAttribute('style', searchInputStyle)\n searchInput.addEventListener('keyup', function (event) {\n if (event.keyCode === 13) {\n acceptButtonHandler(event)\n }\n }, false)\n\n searchInput.addEventListener('input', inputEventHHandler)\n return div\n} // renderAutoComplete22q1\n"],"mappings":";;;;;;AAMA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AARA;AACA;AACA;AACA;AACA;;AAQA,MAAMG,sBAAsB,GAAG,CAAC,EAAC;AACjC,MAAMC,iBAAiB,GAAG,EAAE,EAAC;AAC7B,MAAMC,yBAAyB,GAAG,EAAE;AACpC,MAAMC,wBAAwB,GAAG,GAAG;;AAEpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACO,eAAeC,kBAAkBA,CAAEC,GAAiB,EAAEC,OAA2B;AAAE;AACxFC,QAAmB,EAAE;EACrB,SAASC,QAAQA,CAAEC,OAAO,EAAE;IAC1B,MAAMC,QAAQ,GAAGC,KAAK,CAACC,WAAW,CAACP,GAAG,CAACQ,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3DC,OAAO,CAACC,GAAG,CAACN,OAAO,CAAC;IACpBC,QAAQ,CAACE,WAAW,CAACI,gBAAO,CAACC,iBAAiB,CAACZ,GAAG,EAAEI,OAAO,EAAE,MAAM,CAAC,CAAC;IACrES,cAAK,CAACC,QAAQ,CAACT,QAAQ,EAAE,sBAAsB,CAAC;IAChDA,QAAQ,CAACQ,KAAK,CAACE,OAAO,GAAG,KAAK;EAChC;EACA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,SAASC,MAAMA,CAAEC,MAAM,EAAEC,IAAI,EAAE;IAC7BT,OAAO,CAACC,GAAG,CAAC,yBAAyB,GAAGO,MAAM,CAAC;IAC/C;IACA;IACA;IACAf,QAAQ,CAACe,MAAM,EAAEC,IAAI,CAAC;EACxB;EACA,eAAeC,KAAKA,CAAEF,MAAg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AC;EAChEc,WAAW,CAAC2D,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;EACxC,MAAMO,gBAAgB,GAAG3E,cAAK,CAAC2E,gBAAgB,IAC7C,oGAAoG,EAAC;EACvGlE,WAAW,CAAC2D,YAAY,CAAC,OAAO,EAAEO,gBAAgB,CAAC;EACnDlE,WAAW,CAAC4D,gBAAgB,CAAC,OAAO,EAAE,UAAUO,KAAK,EAAE;IACrD,IAAIA,KAAK,CAACC,OAAO,KAAK,EAAE,EAAE;MACxBhE,mBAAmB,CAAC+D,KAAK,CAAC;IAC5B;EACF,CAAC,EAAE,KAAK,CAAC;EAETnE,WAAW,CAAC4D,gBAAgB,CAAC,OAAO,EAAE7B,kBAAkB,CAAC;EACzD,OAAOgC,GAAG;AACZ,CAAC,CAAC","ignoreList":[]}
@@ -1,223 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.addPersonToGroup = addPersonToGroup;
7
- exports.getDataModelIssues = getDataModelIssues;
8
- exports.getSameAs = getSameAs;
9
- exports.groupMembers = groupMembers;
10
- exports.isLocal = isLocal;
11
- exports.sanitizeToAlpha = sanitizeToAlpha;
12
- exports.saveNewContact = saveNewContact;
13
- exports.saveNewGroup = saveNewGroup;
14
- exports.updateMany = updateMany;
15
- var UI = _interopRequireWildcard(require("solid-ui"));
16
- var $rdf = _interopRequireWildcard(require("rdflib"));
17
- var _solidLogic = require("solid-logic");
18
- var _webidControl = require("./webidControl");
19
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
20
- // Logic for solid contacts
21
-
22
- const ns = UI.ns;
23
- const utils = UI.utils;
24
- const kb = _solidLogic.store;
25
- const updater = kb.updater;
26
-
27
- /** Perform updates on more than one document @@ Move to rdflib!
28
- */
29
- async function updateMany(deletions, insertions = []) {
30
- const docs = deletions.concat(insertions).map(st => st.why);
31
- const uniqueDocs = [];
32
- docs.forEach(doc => {
33
- if (!uniqueDocs.find(uniqueDoc => uniqueDoc.equals(doc))) uniqueDocs.push(doc);
34
- });
35
- const updates = uniqueDocs.map(doc => kb.updater.update(deletions.filter(st => st.why.sameTerm(doc)), insertions.filter(st => st.why.sameTerm(doc))));
36
- return Promise.all(updates);
37
- }
38
-
39
- /** Add a new person to the web data
40
- *
41
- * adds them to the given groups as well.
42
- * @returns {NamedNode} the person
43
- */
44
- async function saveNewContact(book, name, selectedGroups, klass) {
45
- await kb.fetcher.load(book.doc());
46
- const nameEmailIndex = kb.any(book, ns.vcard('nameEmailIndex'));
47
- const uuid = utils.genUuid();
48
- const person = kb.sym(book.dir().uri + 'Person/' + uuid + '/index.ttl#this');
49
- const doc = person.doc();
50
-
51
- // Set of statements to different files
52
- const agenda = [
53
- // Patch the main index to add the person
54
- $rdf.st(person, ns.vcard('inAddressBook'), book, nameEmailIndex),
55
- // The people index
56
- $rdf.st(person, ns.vcard('fn'), name, nameEmailIndex),
57
- // The new person file
58
- $rdf.st(person, ns.vcard('fn'), name, doc), $rdf.st(person, ns.rdf('type'), klass, doc), $rdf.st(doc, ns.dct('created'), new Date(), doc) // Note when created - useful for triaging later
59
- // Note this is propert of the file -- not when the person was created!
60
- ];
61
- for (const gu in selectedGroups) {
62
- const g = kb.sym(gu);
63
- const gd = g.doc();
64
- agenda.push($rdf.st(g, ns.vcard('hasMember'), person, gd), $rdf.st(person, ns.vcard('fn'), name, gd));
65
- }
66
- try {
67
- await updater.updateMany([], agenda); // @@ in future, updater.updateMany
68
- } catch (e) {
69
- console.error('Error: can\'t update ' + person + ' as new contact:' + e);
70
- throw new Error('Updating new contact: ' + e);
71
- }
72
- return person;
73
- }
74
- function sanitizeToAlpha(name) {
75
- // https://mathiasbynens.be/notes/es6-unicode-regex
76
- const n2 = name.replace(/\W/gu, '_'); // Anything which is not a unicode word characeter
77
- return n2.replace(/_+/g, '_'); // https://www.regular-expressions.info/shorthand.html
78
- }
79
-
80
- /** Write new group to web
81
- * Creates an empty new group file and adds it to the index
82
- * @returns group
83
- */
84
- async function saveNewGroup(book, name) {
85
- await kb.fetcher.load(book.doc());
86
- const gix = kb.any(book, ns.vcard('groupIndex'));
87
- const gname = sanitizeToAlpha(name);
88
- const group = kb.sym(book.dir().uri + 'Group/' + gname + '.ttl#this');
89
- const doc = group.doc();
90
- // console.log(' New group will be: ' + group + '\n')
91
- try {
92
- await kb.fetcher.load(gix);
93
- } catch (err) {
94
- throw new Error('Error loading group index!' + gix.uri + ': ' + err);
95
- }
96
- if (kb.holds(book, ns.vcard('includesGroup'), group, gix)) {
97
- return group; // Already exists
98
- }
99
- const insertTriples = [$rdf.st(book, ns.vcard('includesGroup'), group, gix), $rdf.st(group, ns.rdf('type'), ns.vcard('Group'), gix), $rdf.st(group, ns.vcard('fn'), name, gix)];
100
- try {
101
- await updater.update([], insertTriples);
102
- } catch (e) {
103
- throw new Error('Could not update group index ' + e); // fail
104
- }
105
- const triples = [$rdf.st(book, ns.vcard('includesGroup'), group, doc),
106
- // Pointer back to book
107
- $rdf.st(group, ns.rdf('type'), ns.vcard('Group'), doc), $rdf.st(group, ns.vcard('fn'), name, doc)];
108
- try {
109
- await updater.update([], triples);
110
- } catch (err) {
111
- throw new Error('Could not update group file: ' + err); // fail
112
- }
113
- return group;
114
- }
115
- async function addPersonToGroup(thing, group) {
116
- const toBeFetched = [thing.doc(), group.doc()];
117
- try {
118
- await kb.fetcher.load(toBeFetched);
119
- } catch (e) {
120
- throw new Error('addPersonToGroup: ' + e);
121
- }
122
- const types = kb.findTypeURIs(thing);
123
- // for (const ty in types) {
124
- // console.log(' drop object type includes: ' + ty) // @@ Allow email addresses and phone numbers to be dropped?
125
- // }
126
- if (!(ns.vcard('Individual').uri in types || ns.vcard('Organization').uri in types)) {
127
- return alert(`Can't add ${thing} to a group: it has to be an individual or another group.`);
128
- }
129
- const pname = kb.any(thing, ns.vcard('fn'));
130
- const gname = kb.any(group, ns.vcard('fn'));
131
- if (!pname) {
132
- return alert('No vcard name known for ' + thing);
133
- }
134
- const already = kb.holds(thing, ns.vcard('fn'), null, group.doc());
135
- if (already) {
136
- return alert('ALREADY added ' + pname + ' to group ' + gname);
137
- }
138
- const message = 'Add ' + pname + ' to group ' + gname + '?';
139
- if (!confirm(message)) return;
140
- const ins = [$rdf.st(thing, ns.vcard('fn'), pname, group.doc())];
141
- // find person webIDs and insert in vcard:hasMember
142
- const webIDs = (0, _webidControl.getPersonas)(kb, thing).map(webid => webid.value);
143
- if (webIDs.length) {
144
- webIDs.forEach(webid => {
145
- ins.push($rdf.st(kb.sym(webid), ns.owl('sameAs'), thing, group.doc()));
146
- ins.push($rdf.st(group, ns.vcard('hasMember'), kb.sym(webid), group.doc()));
147
- });
148
- } else {
149
- ins.push($rdf.st(group, ns.vcard('hasMember'), thing, group.doc()));
150
- }
151
- try {
152
- await updater.update([], ins);
153
- // to allow refresh of card groupList
154
- kb.fetcher.unload(group.doc());
155
- await kb.fetcher.load(group.doc());
156
- } catch (e) {
157
- throw new Error(`Error adding ${pname} to group ${gname}:` + e);
158
- }
159
- return thing;
160
- }
161
-
162
- /**
163
- * Find persons member of a group
164
- */
165
-
166
- function groupMembers(kb, group) {
167
- const a = kb.each(group, ns.vcard('hasMember'), null, group.doc());
168
- let b = [];
169
- a.forEach(item => {
170
- /* const contacts = kb.each(item, ns.owl('sameAs'), null, group.doc())
171
- if (contacts.length) {
172
- if (!kb.any(contacts[0], ns.vard('fn'))) b = b.concat(item) // this is the old data model
173
- else b = b.concat(contacts)
174
- } else { b = b.concat(item) }
175
- b = b.concat(item) */
176
-
177
- // to keep compatibility with old data model
178
- // check if item is a contact, else it is a WebID and parse 'sameAs' for contacts
179
- b = kb.any(item, ns.vcard('fn'), null, group.doc()) ? b.concat(item) : b.concat(kb.each(item, ns.owl('sameAs'), null, group.doc()));
180
- });
181
- const strings = new Set(b.map(contact => contact.uri)); // remove dups
182
- b = [...strings].map(uri => kb.sym(uri));
183
- return b;
184
- }
185
- function isLocal(group, item) {
186
- const tree = group.dir().dir().dir();
187
- const local = item.uri && item.uri.startsWith(tree.uri);
188
- // console.log(` isLocal ${local} for ${item.uri} in group ${group} tree ${tree.uri}`)
189
- return local;
190
- }
191
- function getSameAs(kb, item, doc) {
192
- return kb.each(item, ns.owl('sameAs'), null, doc).concat(kb.each(null, ns.owl('sameAs'), item, doc));
193
- }
194
- async function getDataModelIssues(groups) {
195
- const del = [];
196
- const ins = [];
197
- groups.forEach(group => {
198
- const members = kb.each(group, ns.vcard('hasMember'), null, group.doc());
199
- members.forEach(member => {
200
- const others = getSameAs(kb, member, group.doc());
201
- if (others.length && isLocal(group, member)) {
202
- // Problem: local ID used instead of webID
203
- for (const other of others) {
204
- if (!isLocal(group, other)) {
205
- // Let's use this one as the immediate member for CSS ACLs'
206
- // console.warn(`getDataModelIssues: Need to swap ${member} to ${other}`)
207
- del.push($rdf.st(group, ns.vcard('hasMember'), member, group.doc()));
208
- ins.push($rdf.st(group, ns.vcard('hasMember'), other, group.doc()));
209
- break;
210
- }
211
- // console.log('getDataModelIssues: ??? expected id not to be local ' + other)
212
- } // other
213
- } // if
214
- }); // member
215
- }); // next group
216
- return {
217
- del,
218
- ins
219
- };
220
- } // getDataModelIssues
221
-
222
- // Ends
223
- //# sourceMappingURL=contactLogic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contactLogic.js","names":["UI","_interopRequireWildcard","require","$rdf","_solidLogic","_webidControl","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ns","utils","kb","store","updater","updateMany","deletions","insertions","docs","concat","map","st","why","uniqueDocs","forEach","doc","find","uniqueDoc","equals","push","updates","update","filter","sameTerm","Promise","all","saveNewContact","book","name","selectedGroups","klass","fetcher","load","nameEmailIndex","any","vcard","uuid","genUuid","person","sym","dir","uri","agenda","rdf","dct","Date","gu","g","gd","console","error","Error","sanitizeToAlpha","n2","replace","saveNewGroup","gix","gname","group","err","holds","insertTriples","triples","addPersonToGroup","thing","toBeFetched","types","findTypeURIs","alert","pname","already","message","confirm","ins","webIDs","getPersonas","webid","value","length","owl","unload","groupMembers","a","each","b","item","strings","Set","contact","isLocal","tree","local","startsWith","getSameAs","getDataModelIssues","groups","del","members","member","others","other"],"sources":["../src/contactLogic.js"],"sourcesContent":["// Logic for solid contacts\n\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nimport { store } from 'solid-logic'\nimport { getPersonas } from './webidControl'\n\nconst ns = UI.ns\nconst utils = UI.utils\nconst kb = store\nconst updater = kb.updater\n\n/** Perform updates on more than one document @@ Move to rdflib!\n*/\nexport async function updateMany (deletions, insertions = []) {\n const docs = deletions.concat(insertions).map(st => st.why)\n const uniqueDocs = []\n docs.forEach(doc => {\n if (!uniqueDocs.find(uniqueDoc => uniqueDoc.equals(doc))) uniqueDocs.push(doc)\n })\n const updates = uniqueDocs.map(doc =>\n kb.updater.update(deletions.filter(st => st.why.sameTerm(doc)),\n insertions.filter(st => st.why.sameTerm(doc))))\n return Promise.all(updates)\n}\n\n/** Add a new person to the web data\n*\n* adds them to the given groups as well.\n* @returns {NamedNode} the person\n*/\nexport async function saveNewContact (book, name, selectedGroups, klass) {\n await kb.fetcher.load(book.doc())\n const nameEmailIndex = kb.any(book, ns.vcard('nameEmailIndex'))\n\n const uuid = utils.genUuid()\n const person = kb.sym(\n book.dir().uri + 'Person/' + uuid + '/index.ttl#this'\n )\n const doc = person.doc()\n\n // Set of statements to different files\n const agenda = [\n // Patch the main index to add the person\n $rdf.st(person, ns.vcard('inAddressBook'), book, nameEmailIndex), // The people index\n $rdf.st(person, ns.vcard('fn'), name, nameEmailIndex),\n // The new person file\n $rdf.st(person, ns.vcard('fn'), name, doc),\n $rdf.st(person, ns.rdf('type'), klass, doc),\n\n $rdf.st(doc, ns.dct('created'), new Date(), doc) // Note when created - useful for triaging later\n // Note this is propert of the file -- not when the person was created!\n ]\n\n for (const gu in selectedGroups) {\n const g = kb.sym(gu)\n const gd = g.doc()\n agenda.push(\n $rdf.st(g, ns.vcard('hasMember'), person, gd),\n $rdf.st(person, ns.vcard('fn'), name, gd)\n )\n }\n\n try {\n await updater.updateMany([], agenda) // @@ in future, updater.updateMany\n } catch (e) {\n console.error('Error: can\\'t update ' + person + ' as new contact:' + e)\n throw new Error('Updating new contact: ' + e)\n }\n return person\n}\n\nexport function sanitizeToAlpha (name) { // https://mathiasbynens.be/notes/es6-unicode-regex\n const n2 = name.replace(/\\W/gu, '_') // Anything which is not a unicode word characeter\n return n2.replace(/_+/g, '_') // https://www.regular-expressions.info/shorthand.html\n}\n\n/** Write new group to web\n * Creates an empty new group file and adds it to the index\n * @returns group\n*/\nexport async function saveNewGroup (book, name) {\n await kb.fetcher.load(book.doc())\n const gix = kb.any(book, ns.vcard('groupIndex'))\n\n const gname = sanitizeToAlpha(name)\n const group = kb.sym(book.dir().uri + 'Group/' + gname + '.ttl#this')\n const doc = group.doc()\n // console.log(' New group will be: ' + group + '\\n')\n try {\n await kb.fetcher.load(gix)\n } catch (err) {\n throw new Error('Error loading group index!' + gix.uri + ': ' + err)\n }\n if (kb.holds(book, ns.vcard('includesGroup'), group, gix)) {\n return group // Already exists\n }\n const insertTriples = [\n $rdf.st(book, ns.vcard('includesGroup'), group, gix),\n $rdf.st(group, ns.rdf('type'), ns.vcard('Group'), gix),\n $rdf.st(group, ns.vcard('fn'), name, gix)\n ]\n try {\n await updater.update([], insertTriples)\n } catch (e) {\n throw new Error('Could not update group index ' + e) // fail\n }\n\n const triples = [\n $rdf.st(book, ns.vcard('includesGroup'), group, doc), // Pointer back to book\n $rdf.st(group, ns.rdf('type'), ns.vcard('Group'), doc),\n $rdf.st(group, ns.vcard('fn'), name, doc)\n ]\n try {\n await updater.update([], triples)\n } catch (err) {\n throw new Error('Could not update group file: ' + err) // fail\n }\n return group\n}\n\nexport async function addPersonToGroup (thing, group) {\n const toBeFetched = [thing.doc(), group.doc()]\n try {\n await kb.fetcher.load(toBeFetched)\n } catch (e) {\n throw new Error('addPersonToGroup: ' + e)\n }\n\n const types = kb.findTypeURIs(thing)\n // for (const ty in types) {\n // console.log(' drop object type includes: ' + ty) // @@ Allow email addresses and phone numbers to be dropped?\n // }\n if (!(ns.vcard('Individual').uri in types ||\n ns.vcard('Organization').uri in types)) {\n return alert(`Can't add ${thing} to a group: it has to be an individual or another group.`)\n }\n const pname = kb.any(thing, ns.vcard('fn'))\n const gname = kb.any(group, ns.vcard('fn'))\n if (!pname) { return alert('No vcard name known for ' + thing) }\n const already = kb.holds(thing, ns.vcard('fn'), null, group.doc())\n if (already) {\n return alert(\n 'ALREADY added ' + pname + ' to group ' + gname\n )\n }\n const message = 'Add ' + pname + ' to group ' + gname + '?'\n if (!confirm(message)) return\n const ins = [\n $rdf.st(thing, ns.vcard('fn'), pname, group.doc())\n ]\n // find person webIDs and insert in vcard:hasMember\n const webIDs = getPersonas(kb, thing).map(webid => webid.value)\n if (webIDs.length) {\n webIDs.forEach(webid => {\n ins.push($rdf.st(kb.sym(webid), ns.owl('sameAs'), thing, group.doc()))\n ins.push($rdf.st(group, ns.vcard('hasMember'), kb.sym(webid), group.doc()))\n })\n } else {\n ins.push($rdf.st(group, ns.vcard('hasMember'), thing, group.doc()))\n }\n try {\n await updater.update([], ins)\n // to allow refresh of card groupList\n kb.fetcher.unload(group.doc())\n await kb.fetcher.load(group.doc())\n } catch (e) {\n throw new Error(`Error adding ${pname} to group ${gname}:` + e)\n }\n return thing\n}\n\n/**\n * Find persons member of a group\n */\n\nexport function groupMembers (kb, group) {\n const a = kb.each(group, ns.vcard('hasMember'), null, group.doc())\n let b = []\n a.forEach(item => {\n /* const contacts = kb.each(item, ns.owl('sameAs'), null, group.doc())\n if (contacts.length) {\n if (!kb.any(contacts[0], ns.vard('fn'))) b = b.concat(item) // this is the old data model\n else b = b.concat(contacts)\n } else { b = b.concat(item) }\n b = b.concat(item) */\n\n // to keep compatibility with old data model\n // check if item is a contact, else it is a WebID and parse 'sameAs' for contacts\n b = kb.any(item, ns.vcard('fn'), null, group.doc()) ? b.concat(item) : b.concat(kb.each(item, ns.owl('sameAs'), null, group.doc()))\n })\n const strings = new Set(b.map(contact => contact.uri)) // remove dups\n b = [...strings].map(uri => kb.sym(uri))\n return b\n}\n\nexport function isLocal (group, item) {\n const tree = group.dir().dir().dir()\n const local = item.uri && item.uri.startsWith(tree.uri)\n // console.log(` isLocal ${local} for ${item.uri} in group ${group} tree ${tree.uri}`)\n return local\n}\n\nexport function getSameAs (kb, item, doc) {\n return kb.each(item, ns.owl('sameAs'), null, doc).concat(\n kb.each(null, ns.owl('sameAs'), item, doc))\n}\n\nexport async function getDataModelIssues (groups) {\n const del = []\n const ins = []\n groups.forEach(group => {\n const members = kb.each(group, ns.vcard('hasMember'), null, group.doc())\n members.forEach((member) => {\n const others = getSameAs(kb, member, group.doc())\n if (others.length && isLocal(group, member)) { // Problem: local ID used instead of webID\n for (const other of others) {\n if (!isLocal(group, other)) { // Let's use this one as the immediate member for CSS ACLs'\n // console.warn(`getDataModelIssues: Need to swap ${member} to ${other}`)\n del.push($rdf.st(group, ns.vcard('hasMember'), member, group.doc()))\n ins.push($rdf.st(group, ns.vcard('hasMember'), other, group.doc()))\n break\n }\n // console.log('getDataModelIssues: ??? expected id not to be local ' + other)\n } // other\n } // if\n }) // member\n }) // next group\n return { del, ins }\n} // getDataModelIssues\n\n// Ends\n"],"mappings":";;;;;;;;;;;;;;AAEA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAA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