@nanoporetech-digital/components 5.12.1 → 6.0.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/CHANGELOG.md +25 -0
- package/dist/cjs/{local-my-account-d79ed0a2.js → local-my-account-1dfd69a0.js} +123 -15
- package/dist/{esm/local-my-account-6662da72.js.map → cjs/local-my-account-1dfd69a0.js.map} +1 -1
- package/dist/cjs/nano-algolia.cjs.entry.js +3 -0
- package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +10 -8
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +17 -43
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/collection/components/algolia/algolia-interface.js.map +1 -1
- package/dist/collection/components/algolia/algolia.js +1 -0
- package/dist/collection/components/algolia/algolia.js.map +1 -1
- package/dist/collection/components/algolia/lib/template.js +2 -0
- package/dist/collection/components/algolia/lib/template.js.map +1 -1
- package/dist/collection/components/global-nav/assets/local-my-account.json +120 -14
- package/dist/collection/components/global-nav/global-nav-interface.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav.js +10 -8
- package/dist/collection/components/global-nav/global-nav.js.map +1 -1
- package/dist/collection/components/global-search-results/global-search-results.js +17 -43
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/components/algolia.js +3 -0
- package/dist/components/algolia.js.map +1 -1
- package/dist/components/local-my-account.js +122 -15
- package/dist/components/local-my-account.js.map +1 -1
- package/dist/components/nano-global-nav.js +9 -7
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/nano-global-search-results.js +17 -43
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/esm/{local-my-account-6662da72.js → local-my-account-ddb62cc1.js} +123 -16
- package/dist/{cjs/local-my-account-d79ed0a2.js.map → esm/local-my-account-ddb62cc1.js.map} +1 -1
- package/dist/esm/nano-algolia.entry.js +3 -0
- package/dist/esm/nano-algolia.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +10 -8
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +17 -43
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/nano-assets/hash.txt +1 -1
- package/dist/nano-assets/local-my-account.json +120 -14
- package/dist/nano-components/assets/local-my-account.json +120 -14
- package/dist/nano-components/local-my-account-ddb62cc1.js +5 -0
- package/dist/nano-components/nano-algolia.entry.js +1 -1
- package/dist/nano-components/nano-algolia.entry.js.map +1 -1
- package/dist/nano-components/nano-global-nav.entry.js +1 -1
- package/dist/nano-components/nano-global-nav.entry.js.map +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js.map +1 -1
- package/dist/types/components/algolia/algolia-interface.d.ts +9 -0
- package/dist/types/components/global-nav/global-nav-interface.d.ts +4 -0
- package/dist/types/interface.d.ts +5 -0
- package/docs-json.json +2 -2
- package/hydrate/index.js +151 -64
- package/package.json +2 -2
- package/dist/nano-components/local-my-account-6662da72.js +0 -5
- /package/dist/nano-components/{local-my-account-6662da72.js.map → local-my-account-ddb62cc1.js.map} +0 -0
@@ -1,20 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"user": {
|
3
|
-
"id": "
|
3
|
+
"id": "john.jenkins",
|
4
4
|
"uuid": "2589690E-A907-50BB-9551-55E18ABB1273",
|
5
|
-
"name": "
|
6
|
-
"first_name": "
|
7
|
-
"last_name": "
|
8
|
-
"email": "
|
9
|
-
"
|
10
|
-
"
|
11
|
-
"small_avatar_url": "https://picsum.photos/75",
|
12
|
-
"is_nanopore_user": false,
|
13
|
-
"lifecycle_stage": "Lead",
|
5
|
+
"name": "John Jenkins",
|
6
|
+
"first_name": "John",
|
7
|
+
"last_name": "Jenkins",
|
8
|
+
"email": "john.jenkins@nanoporetech.com",
|
9
|
+
"company": "Oxford Nanopore Technologies",
|
10
|
+
"lifecycle_stage": "Other",
|
14
11
|
"indirect_customer": false,
|
15
12
|
"registration": {
|
16
13
|
"next_url": null
|
17
|
-
}
|
14
|
+
},
|
15
|
+
"covid19_store_access": false,
|
16
|
+
"ncm20_user_group": false,
|
17
|
+
"job_title": "Tester",
|
18
|
+
"small_avatar_url": "https://myaccount-dev.nanoporetech.com/assets/generic-user-f6fcf06f5177e63bec5a3e34f7aa4adec5de3777bdaefdf4706220cdd99ca340.png",
|
19
|
+
"country_code": "GB"
|
18
20
|
},
|
19
21
|
"domains": [
|
20
22
|
{
|
@@ -220,7 +222,7 @@
|
|
220
222
|
"address": "https://epi2me.nanoporetech.com",
|
221
223
|
"title": "EPI2ME",
|
222
224
|
"order": 6,
|
223
|
-
|
225
|
+
"target": "_blank"
|
224
226
|
},
|
225
227
|
{
|
226
228
|
"id": 13,
|
@@ -284,20 +286,38 @@
|
|
284
286
|
"logout": "https://myaccount-dev.nanoporetech.com/sso/logout?RelayState=",
|
285
287
|
"login": null,
|
286
288
|
"messages": "https://myaccount-dev.nanoporetech.com/message_centre",
|
287
|
-
"cart": "https://
|
289
|
+
"cart": "https://test.store.nanoporetech.com/cart"
|
288
290
|
},
|
289
291
|
"search": {
|
290
292
|
"app_id": "N8NZI5A47F",
|
291
293
|
"api_key": "b38860b015b02c9cb6993cf0367ed203",
|
292
294
|
"indeces": [
|
293
295
|
{
|
294
|
-
"index": "
|
296
|
+
"index": "ont_dev_en_v3",
|
295
297
|
"name": "All",
|
296
298
|
"domain": "nanoporetech.com",
|
297
299
|
"all_group": true,
|
298
300
|
"filters": [
|
299
301
|
"tags",
|
300
302
|
"type"
|
303
|
+
],
|
304
|
+
"replicas": [
|
305
|
+
{
|
306
|
+
"name": "Sort by: Most relevant",
|
307
|
+
"index": "ont_dev_en_v3"
|
308
|
+
},
|
309
|
+
{
|
310
|
+
"name": "Sort by: Newest",
|
311
|
+
"index": "ont_dev_en_v3_date_desc"
|
312
|
+
},
|
313
|
+
{
|
314
|
+
"name": "Sort by: Oldest",
|
315
|
+
"index": "ont_dev_en_v3_date_asc"
|
316
|
+
},
|
317
|
+
{
|
318
|
+
"name": "Sort by: Recent activity",
|
319
|
+
"index": "ont_dev_en_v3_activity_date_desc"
|
320
|
+
}
|
301
321
|
]
|
302
322
|
},
|
303
323
|
{
|
@@ -307,6 +327,24 @@
|
|
307
327
|
"filters": [
|
308
328
|
"tags",
|
309
329
|
"type"
|
330
|
+
],
|
331
|
+
"replicas": [
|
332
|
+
{
|
333
|
+
"name": "Sort by: Most relevant",
|
334
|
+
"index": "cws_english_en"
|
335
|
+
},
|
336
|
+
{
|
337
|
+
"name": "Sort by: Newest",
|
338
|
+
"index": "cws_english_en_date_desc"
|
339
|
+
},
|
340
|
+
{
|
341
|
+
"name": "Sort by: Oldest",
|
342
|
+
"index": "cws_english_en_date_asc"
|
343
|
+
},
|
344
|
+
{
|
345
|
+
"name": "Sort by: Recent activity",
|
346
|
+
"index": "cws_english_en_activity_date_desc"
|
347
|
+
}
|
310
348
|
]
|
311
349
|
},
|
312
350
|
{
|
@@ -315,6 +353,20 @@
|
|
315
353
|
"domain": "store.nanoporetech.com",
|
316
354
|
"filters": [
|
317
355
|
"type"
|
356
|
+
],
|
357
|
+
"replicas": [
|
358
|
+
{
|
359
|
+
"name": "Sort by: Most relevant",
|
360
|
+
"index": "store_prod"
|
361
|
+
},
|
362
|
+
{
|
363
|
+
"name": "Sort by: Newest",
|
364
|
+
"index": "store_date_desc"
|
365
|
+
},
|
366
|
+
{
|
367
|
+
"name": "Sort by: Oldest",
|
368
|
+
"index": "store_date_asc"
|
369
|
+
}
|
318
370
|
]
|
319
371
|
},
|
320
372
|
{
|
@@ -323,6 +375,20 @@
|
|
323
375
|
"domain": "nanoporetech.com",
|
324
376
|
"filters": [
|
325
377
|
"tags"
|
378
|
+
],
|
379
|
+
"replicas": [
|
380
|
+
{
|
381
|
+
"name": "Sort by: Most relevant",
|
382
|
+
"index": "cws_english_resources_en"
|
383
|
+
},
|
384
|
+
{
|
385
|
+
"name": "Sort by: Newest",
|
386
|
+
"index": "cws_english_resources_en_date_desc"
|
387
|
+
},
|
388
|
+
{
|
389
|
+
"name": "Sort by: Oldest",
|
390
|
+
"index": "cws_english_resources_en_date_asc"
|
391
|
+
}
|
326
392
|
]
|
327
393
|
},
|
328
394
|
{
|
@@ -334,8 +400,48 @@
|
|
334
400
|
"channel",
|
335
401
|
"authors",
|
336
402
|
"tags"
|
403
|
+
],
|
404
|
+
"replicas": [
|
405
|
+
{
|
406
|
+
"name": "Sort by: Most relevant",
|
407
|
+
"index": "community_prod"
|
408
|
+
},
|
409
|
+
{
|
410
|
+
"name": "Sort by: Newest",
|
411
|
+
"index": "community_prod_date_desc"
|
412
|
+
},
|
413
|
+
{
|
414
|
+
"name": "Sort by: Oldest",
|
415
|
+
"index": "community_prod_date_asc"
|
416
|
+
},
|
417
|
+
{
|
418
|
+
"name": "Sort by: Recent activity",
|
419
|
+
"index": "community_prod_activity_date_desc"
|
420
|
+
}
|
337
421
|
]
|
338
422
|
}
|
339
423
|
]
|
424
|
+
},
|
425
|
+
"promotion": {
|
426
|
+
"header": {
|
427
|
+
"img": "https://nanoporetech.com/sites/default/files/s3/gn-promotion-lc20.png",
|
428
|
+
"label": "London Calling 2020 Online",
|
429
|
+
"url": "https://londoncallingconf.co.uk/lc20"
|
430
|
+
},
|
431
|
+
"description": "A conference hosted by Oxford Nanopore Technologies",
|
432
|
+
"meta": [
|
433
|
+
{
|
434
|
+
"icon": "calendar",
|
435
|
+
"label": "18th - 19th June 2020"
|
436
|
+
},
|
437
|
+
{
|
438
|
+
"icon": "map-marker",
|
439
|
+
"label": "Online"
|
440
|
+
}
|
441
|
+
],
|
442
|
+
"cta": {
|
443
|
+
"label": "Register Now",
|
444
|
+
"url": "https://nanoporetech.com/lc-online/register"
|
445
|
+
}
|
340
446
|
}
|
341
447
|
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
const e={id:"john.jenkins",uuid:"2589690E-A907-50BB-9551-55E18ABB1273",name:"John Jenkins",first_name:"John",last_name:"Jenkins",email:"john.jenkins@nanoporetech.com",company:"Oxford Nanopore Technologies",lifecycle_stage:"Other",indirect_customer:false,registration:{next_url:null},covid19_store_access:false,ncm20_user_group:false,job_title:"Tester",small_avatar_url:"https://myaccount-dev.nanoporetech.com/assets/generic-user-f6fcf06f5177e63bec5a3e34f7aa4adec5de3777bdaefdf4706220cdd99ca340.png",country_code:"GB"};const t=[{origin:"cws",domain:"nanoporetech.com"},{origin:"store",domain:"store.nanoporetech.com"},{origin:"community",domain:"community.nanoporetech.com"}];const o={count:0,url:"https://shop-test.nanoporetech.com/checkout/cart"};const r={count:0};const a=[{id:1,area:"main",address:"#",title:"Trousers",order:1,target:null},{id:2,area:"logged-out",address:"#",title:"Mouse",order:1,target:null},{id:20,area:"profile-panel-block",address:"https://nanoporetech.com/about-us/news",title:"News",order:3,target:""},{id:21,area:"profile-panel-block",address:"https://nanoporetech.com/about-us",title:"About",order:3,target:""},{id:22,area:"profile-panel-block",address:"https://nanoporetech.com/contact",title:"Contact",order:3,target:""},{id:28,area:"right-side-logged-out",address:"https://nanoporetech.com/contact",title:"Contact",order:3,target:""},{id:29,area:"right-side-logged-out",address:"https://nanoporetech.com/about-us/news",title:"News",order:3,target:""},{id:30,area:"right-side-logged-out",address:"https://nanoporetech.com/about-us",title:"About",order:3,target:""},{id:9,area:"right-side-logged-in",address:"https://nanoporetech.com/contact",title:"Contact",order:4,target:""},{id:10,area:"right-side-logged-in",address:"https://nanoporetech.com/about-us/news",title:"News",order:4,target:""},{id:11,area:"right-side-logged-in",address:"https://nanoporetech.com/about-us",title:"About",order:4,target:""},{id:12,area:"right-side-logged-in",address:"https://nanoporetech.com/events",title:"Events",order:4,target:""},{id:23,area:"left-side-logged-out",address:"https://nanoporetech.com/",title:"Nanoporetech",order:5,target:""},{id:24,area:"left-side-logged-out",address:"https://metrichor.com/",title:"Metrichor",order:5,target:""},{id:25,area:"left-side-logged-out",address:"https://community.nanoporetech.com/",title:"Community",order:5,target:""},{id:26,area:"left-side-logged-out",address:"https://nanoporetech.com/events",title:"Events",order:5,target:""},{id:27,area:"left-side-logged-out",address:"https://store.nanoporetech.com",title:"Store",order:5,target:""},{id:3,area:"left-side-logged-in",address:"https://nanoporetech.com/",title:"Nanoporetech",order:6,target:""},{id:4,area:"left-side-logged-in",address:"https://metrichor.com/",title:"Metrichor",order:6,target:""},{id:5,area:"left-side-logged-in",address:"https://community.nanoporetech.com/",title:"Community",order:6,target:""},{id:6,area:"left-side-logged-in",address:"https://nanoporetech.com/events",title:"Events",order:6,target:""},{id:7,area:"left-side-logged-in",address:"https://store.nanoporetech.com",title:"Store",order:6,target:""},{id:8,area:"left-side-logged-in",address:"https://epi2me.nanoporetech.com",title:"EPI2ME",order:6,target:"_blank"},{id:13,area:"profile-panel-list",address:"https://community.nanoporetech.com/",title:"Community Dashboard",order:7,target:""},{id:14,area:"profile-panel-list",address:"https://myaccount.nanoporetech.com/message_centre",title:"Messages",order:7,target:""},{id:15,area:"profile-panel-list",address:"https://community.nanoporetech.com/my-activity",title:"My Activity",order:7,target:""},{id:16,area:"profile-panel-list",address:"https://myaccount.nanoporetech.com/home",title:"My Account",order:7,target:""},{id:17,area:"profile-panel-list",address:"https://myaccount.nanoporetech.com/account/teams",title:"Team Management ",order:7,target:""},{id:18,area:"profile-panel-list",address:"https://nanoporetech.com/resource-centre/publications",title:"Publications",order:7,target:""},{id:19,area:"profile-panel-list",address:"https://myaccount.nanoporetech.com/profile/status",title:"Preferences",order:7,target:""}];const n={forgot_password:"https://myaccount-dev.nanoporetech.com/profile/details#password-form?RelayState=",logout:"https://myaccount-dev.nanoporetech.com/sso/logout?RelayState=",login:null,messages:"https://myaccount-dev.nanoporetech.com/message_centre",cart:"https://test.store.nanoporetech.com/cart"};const s={app_id:"N8NZI5A47F",api_key:"b38860b015b02c9cb6993cf0367ed203",indeces:[{index:"ont_dev_en_v3",name:"All",domain:"nanoporetech.com",all_group:true,filters:["tags","type"],replicas:[{name:"Sort by: Most relevant",index:"ont_dev_en_v3"},{name:"Sort by: Newest",index:"ont_dev_en_v3_date_desc"},{name:"Sort by: Oldest",index:"ont_dev_en_v3_date_asc"},{name:"Sort by: Recent activity",index:"ont_dev_en_v3_activity_date_desc"}]},{index:"cws_english_en",name:"www",domain:"nanoporetech.com",filters:["tags","type"],replicas:[{name:"Sort by: Most relevant",index:"cws_english_en"},{name:"Sort by: Newest",index:"cws_english_en_date_desc"},{name:"Sort by: Oldest",index:"cws_english_en_date_asc"},{name:"Sort by: Recent activity",index:"cws_english_en_activity_date_desc"}]},{index:"store_prod",name:"Store",domain:"store.nanoporetech.com",filters:["type"],replicas:[{name:"Sort by: Most relevant",index:"store_prod"},{name:"Sort by: Newest",index:"store_date_desc"},{name:"Sort by: Oldest",index:"store_date_asc"}]},{index:"cws_english_resources_en",name:"Resources",domain:"nanoporetech.com",filters:["tags"],replicas:[{name:"Sort by: Most relevant",index:"cws_english_resources_en"},{name:"Sort by: Newest",index:"cws_english_resources_en_date_desc"},{name:"Sort by: Oldest",index:"cws_english_resources_en_date_asc"}]},{index:"community_prod",name:"Community",domain:"community.nanoporetech.com",filters:["type","channel","authors","tags"],replicas:[{name:"Sort by: Most relevant",index:"community_prod"},{name:"Sort by: Newest",index:"community_prod_date_desc"},{name:"Sort by: Oldest",index:"community_prod_date_asc"},{name:"Sort by: Recent activity",index:"community_prod_activity_date_desc"}]}]};const d={header:{img:"https://nanoporetech.com/sites/default/files/s3/gn-promotion-lc20.png",label:"London Calling 2020 Online",url:"https://londoncallingconf.co.uk/lc20"},description:"A conference hosted by Oxford Nanopore Technologies",meta:[{icon:"calendar",label:"18th - 19th June 2020"},{icon:"map-marker",label:"Online"}],cta:{label:"Register Now",url:"https://nanoporetech.com/lc-online/register"}};const i={user:e,domains:t,cart:o,notifications:r,links:a,urls:n,search:s,promotion:d};export default i;export{o as cart,t as domains,a as links,r as notifications,d as promotion,s as search,n as urls,e as user};
|
5
|
+
//# sourceMappingURL=local-my-account-ddb62cc1.js.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
import{g as t,e,r as i,c as s,w as n,d as r,h as o,a as l}from"./index-9695db0a.js";import{a as h}from"./algoliasearch-lite.esm.browser-d71a28dc.js";import{g as a}from"./dom-8599fac1.js";import{C as f}from"./component-store-486d9d7a.js";import{d as c}from"./throttle-ac4fcefa.js";import{S as u}from"./algolia-data-1b42827c.js";var d=new Map;var p=function(t,e){var i=t.fields,s=t.updater;i.forEach((function(t){s(t,e[t])}))};var m={create:function(e,i){var s=t(e);var n=new Map;var r={wormholes:n,state:i};d.set(e,r);var o=e.connectedCallback;e.connectedCallback=function(){d.set(e,r);if(o){o.call(e)}};var l=e.disconnectedCallback;e.disconnectedCallback=function(){d.delete(e);if(l){l.call(e)}};s.addEventListener("openWormhole",(function(t){t.stopPropagation();var e=t.detail,i=e.consumer,s=e.onOpen;if(n.has(i))return;if(typeof i!=="symbol"){var o=i.connectedCallback,l=i.disconnectedCallback;i.connectedCallback=function(){n.set(i,t.detail);if(o){o.call(i)}};i.disconnectedCallback=function(){n.delete(i);if(l){l.call(i)}}}n.set(i,t.detail);p(t.detail,r.state);s===null||s===void 0?void 0:s.resolve((function(){n.delete(i)}))}));s.addEventListener("closeWormhole",(function(t){var e=t.detail;n.delete(e)}))},Provider:function(t,i){var s=t.state;var n=e();if(d.has(n)){var r=d.get(n);r.state=s;r.wormholes.forEach((function(t){p(t,s)}))}return i}};class g{constructor(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}enqueue(t){return new Promise(((e,i)=>{this.queue.push({promise:t,resolve:e,reject:i});this.dequeue()}))}dequeue(){if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}const t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((e=>{this.workingOnPromise=false;t.resolve(e);this.dequeue()})).catch((e=>{this.workingOnPromise=false;t.reject(e);this.dequeue()}))}catch(e){this.workingOnPromise=false;t.reject(e);this.dequeue()}return true}}g.pendingPromise=false;function y(t,e){if(Object.setPrototypeOf){Object.setPrototypeOf(t,e)}else{t.__proto__=e}}function w(t){const e=new Error(t);y(e,w.prototype);return e}w.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:false}});function b(t,e,i){const s=e.slice(0,i).split(/\n/);const n=s.length;const r=s[n-1].length+1;t+=" at line "+n+" col "+r+":\n\n"+" "+e.split(/\n/)[n-1]+"\n"+" "+Array(r).join(" ")+"^";throw w(t)}const v=new Function("return this")().Promise;let x=false;try{x=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError)){throw t}}function F(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function C(t,e,i){for(const s in e){if(F(e,s)){if(e[s]!=null&&typeof e[s]=="object"&&(s==="storage"||s==="prefixes")&&!i){t[s]=C({},e[s])}else{t[s]=e[s]}}}return t}function I(t,e,i,s){let n;let r;if(typeof e.autoTrim==="string"){n=r=e.autoTrim}else if(Array.isArray(e.autoTrim)){n=e.autoTrim[1];r=e.autoTrim[0]}if(i||i===false){n=i}if(s||s===false){r=s}if(n==="slurp"&&r==="slurp"){return t.trim()}if(n==="_"||n==="slurp"){if(!!String.prototype.trimLeft){t=t.trimLeft()}else{t=t.replace(/^[\s\uFEFF\xA0]+/,"")}}else if(n==="-"||n==="nl"){t=t.replace(/^(?:\n|\r|\r\n)/,"")}if(r==="_"||r==="slurp"){if(!!String.prototype.trimRight){t=t.trimRight()}else{t=t.replace(/[\s\uFEFF\xA0]+$/,"")}}else if(r==="-"||r==="nl"){t=t.replace(/(?:\n|\r|\r\n)$/,"")}return t}const S=/^async +/;const j=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;const z=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;const R=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;const _=/[.*+\-?^${}()|[\]\\]/g;function A(t){return _.test(t)?t.replace(_,"\\$&"):t}function k(t,e){if(e.rmWhitespace){t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}j.lastIndex=0;z.lastIndex=0;R.lastIndex=0;const i=e.prefixes;const s=[i.h,i.b,i.i,i.r,i.c,i.e].reduce((function(t,e){if(t&&e){return t+"|"+A(e)}else if(e){return A(e)}else{return t}}),"");const n=new RegExp("([|()]|=>)|"+"('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+A(e.tags[1])+")","g");const r=new RegExp("([^]*?)"+A(e.tags[0])+"(-|_)?\\s*("+s+")?\\s*","g");let o=0;let l=false;function h(i,s){const h={f:[]};let a=0;let f="c";if(s==="h"||s==="b"||s==="c"){f="n"}else if(s==="r"){h.raw=true;s="i"}function c(i){const s=t.slice(o,i);let n=s.trim();if(f==="f"){if(n==="safe"){h.raw=true}else{if(e.async&&S.test(n)){n=n.replace(S,"");h.f.push([n,"",true])}else{h.f.push([n,""])}}}else if(f==="fp"){h.f[h.f.length-1][1]+=n}else if(f==="err"){if(n){const e=s.search(/\S/);b("invalid syntax",t,o+e)}}else{h[f]=n}o=i+1}n.lastIndex=o;let u;while((u=n.exec(t))!==null){const e=u[1];const i=u[2];const d=u[3];const p=u[4];const m=u[5];const g=u.index;if(e){if(e==="("){if(a===0){if(f==="n"){c(g);f="p"}else if(f==="f"){c(g);f="fp"}}a++}else if(e===")"){a--;if(a===0&&f!=="c"){c(g);f="err"}}else if(a===0&&e==="|"){c(g);f="f"}else if(e==="=>"){c(g);o+=1;f="res"}}else if(i){if(i==="/*"){const e=t.indexOf("*/",n.lastIndex);if(e===-1){b("unclosed comment",t,u.index)}n.lastIndex=e+2}else if(i==="'"){z.lastIndex=u.index;const e=z.exec(t);if(e){n.lastIndex=z.lastIndex}else{b("unclosed string",t,u.index)}}else if(i==='"'){R.lastIndex=u.index;const e=R.exec(t);if(e){n.lastIndex=R.lastIndex}else{b("unclosed string",t,u.index)}}else if(i==="`"){j.lastIndex=u.index;const e=j.exec(t);if(e){n.lastIndex=j.lastIndex}else{b("unclosed string",t,u.index)}}}else if(d){c(g);o=g+u[0].length;r.lastIndex=o;l=m;if(p&&s==="h"){s="s"}h.t=s;return h}}b("unclosed tag",t,i);return h}function a(s,n){s.b=[];s.d=[];let f=false;let c=[];function u(t,i){if(t){t=I(t,e,l,i);if(t){t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n");c.push(t)}}}let d;while((d=r.exec(t))!==null){const n=d[1];const r=d[2];const l=d[3]||"";let p;for(const t in i){if(i[t]===l){p=t;break}}u(n,r);o=d.index+d[0].length;if(!p){b("unrecognized tag type: "+l,t,o)}let m=h(d.index,p);const g=m.t;if(g==="h"){const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}m=a(m);c.push(m)}else if(g==="c"){if(s.n===m.n){if(f){f.d=c;s.b.push(f)}else{s.d=c}return s}else{b("Helper start and end don't match",t,d.index+d[0].length)}}else if(g==="b"){if(f){f.d=c;s.b.push(f)}else{s.d=c}const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}f=m;c=[]}else if(g==="s"){const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}c.push(m)}else{c.push(m)}}if(n){u(t.slice(o,t.length),false);s.d=c}else{throw w('unclosed helper "'+s.n+'"')}return s}const f=a({f:[]},true);if(e.plugins){for(let t=0;t<e.plugins.length;t++){const i=e.plugins[t];if(i.processAST){f.d=i.processAST(f.d,e)}}}return f.d}function T(t,e){const i=k(t,e);let s="var tR='';"+(e.useWith?"with("+e.varName+"||{}){":"")+H(i,e)+"if(cb){cb(null,tR)} return tR"+(e.useWith?"}":"");if(e.plugins){for(let t=0;t<e.plugins.length;t++){const i=e.plugins[t];if(i.processFnString){s=i.processFnString(s,e)}}}return s}function P(t,e){for(let i=0;i<e.length;i++){const s=e[i][0];const n=e[i][1];const r=e[i][2];t=(r?"await ":"")+"c.l('F','"+s+"')("+t;if(n){t+=","+n}t+=")"}return t}function O(t,e,i,s,n,r){let o="{exec:"+(n?"async ":"")+N(i,e,t)+",params:["+s+"]";if(r){o+=",name:'"+r+"'"}if(n){o+=",async:true"}o+="}";return o}function E(t,e){let i="[";for(let s=0;s<t.length;s++){const n=t[s];i+=O(e,n.res||"",n.d,n.p||"",n.a,n.n);if(s<t.length){i+=","}}i+="]";return i}function N(t,e,i){return"function("+e+"){var tR='';"+H(t,i)+"return tR}"}function H(t,e){let i=0;const s=t.length;let n="";for(i;i<s;i++){const s=t[i];if(typeof s==="string"){const t=s;n+="tR+='"+t+"';"}else{const t=s.t;let i=s.c||"";const r=s.f;const o=s.n||"";const l=s.p||"";const h=s.res||"";const a=s.b;const f=!!s.a;if(t==="i"){if(e.defaultFilter){i="c.l('F','"+e.defaultFilter+"')("+i+")"}let t=P(i,r);if(!s.raw&&e.autoEscape){t="c.l('F','e')("+t+")"}n+="tR+="+t+";"}else if(t==="h"){if(e.storage.nativeHelpers.get(o)){n+=e.storage.nativeHelpers.get(o)(s,e)}else{let t=(f?"await ":"")+"c.l('H','"+o+"')("+O(e,h,s.d,l,f);if(a){t+=","+E(a,e)}else{t+=",[]"}t+=",c)";n+="tR+="+P(t,r)+";"}}else if(t==="s"){n+="tR+="+P((f?"await ":"")+"c.l('H','"+o+"')({params:["+l+"]},[],c)",r)+";"}else if(t==="e"){n+=i+"\n"}}}return n}class q{constructor(t){this.cache=t}define(t,e){this.cache[t]=e}get(t){return this.cache[t]}remove(t){delete this.cache[t]}reset(){this.cache={}}load(t){C(this.cache,t,true)}}function L(t,e,i,s){if(e&&e.length>0){throw w((s?"Native":"")+"Helper '"+t+"' doesn't accept blocks")}if(i&&i.length>0){throw w((s?"Native":"")+"Helper '"+t+"' doesn't accept filters")}}function $(t,e,i,s,n){i(t[e],e).then((function(r){s+=r;if(e===t.length-1){n(s)}else{$(t,e+1,i,s,n)}}))}function D(t,e,i,s,n,r){s(e[i],t[e[i]]).then((function(o){n+=o;if(i===e.length-1){r(n)}else{D(t,e,i+1,s,n,r)}}))}const M={"&":"&","<":"<",">":">",'"':""","'":"'"};function W(t){return M[t]}function U(t){const e=String(t);if(/[&<>"']/.test(e)){return e.replace(/[&<>"']/g,W)}else{return e}}const B=new q({});const Q=new q({each:function(t,e){let i="";const s=t.params[0];L("each",e,false);if(t.async){return new Promise((function(e){$(s,0,t.exec,i,e)}))}else{for(let e=0;e<s.length;e++){i+=t.exec(s[e],e)}return i}},foreach:function(t,e){const i=t.params[0];L("foreach",e,false);if(t.async){return new Promise((function(e){D(i,Object.keys(i),0,t.exec,"",e)}))}else{let e="";for(const s in i){if(!F(i,s))continue;e+=t.exec(s,i[s])}return e}},include:function(t,e,i){L("include",e,false);const s=i.storage.templates.get(t.params[0]);if(!s){throw w('Could not fetch template "'+t.params[0]+'"')}return s(t.params[1],i)},extends:function(t,e,i){const s=t.params[1]||{};s.content=t.exec();for(let t=0;t<e.length;t++){const i=e[t];s[i.name]=i.exec()}const n=i.storage.templates.get(t.params[0]);if(!n){throw w('Could not fetch template "'+t.params[0]+'"')}return n(s,i)},useScope:function(t,e){L("useScope",e,false);return t.exec(t.params[0])}});const G=new q({if:function(t,e){L("if",false,t.f,true);let i="if("+t.p+"){"+H(t.d,e)+"}";if(t.b){for(let s=0;s<t.b.length;s++){const n=t.b[s];if(n.n==="else"){i+="else{"+H(n.d,e)+"}"}else if(n.n==="elif"){i+="else if("+n.p+"){"+H(n.d,e)+"}"}}}return i},try:function(t,e){L("try",false,t.f,true);if(!t.b||t.b.length!==1||t.b[0].n!=="catch"){throw w("native helper 'try' only accepts 1 block, 'catch'")}let i="try{"+H(t.d,e)+"}";const s=t.b[0];i+="catch"+(s.res?"("+s.res+")":"")+"{"+H(s.d,e)+"}";return i},block:function(t,e){L("block",t.b,t.f,true);const i="if(!"+e.varName+"["+t.p+"]){tR+=("+N(t.d,"",e)+")()}else{tR+="+e.varName+"["+t.p+"]}";return i}});const K=new q({e:U});const J={varName:"it",autoTrim:[false,"nl"],autoEscape:true,defaultFilter:false,tags:["{{","}}"],l:function(t,e){if(t==="H"){const t=this.storage.helpers.get(e);if(t){return t}else{throw w("Can't find helper '"+e+"'")}}else if(t==="F"){const t=this.storage.filters.get(e);if(t){return t}else{throw w("Can't find filter '"+e+"'")}}},async:false,storage:{helpers:Q,nativeHelpers:G,filters:K,templates:B},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:false,plugins:[],useWith:false};J.l.bind(J);function V(t,e){const i={};C(i,J);if(e){C(i,e)}if(t){C(i,t)}i.l.bind(i);return i}function X(t,e){const i=V(e||{});let s=Function;if(i.async){if(x){s=x}else{throw w("This environment doesn't support async/await")}}try{return new s(i.varName,"c","cb",T(t,i))}catch(e){if(e instanceof SyntaxError){throw w("Bad template syntax\n\n"+e.message+"\n"+Array(e.message.length+1).join("=")+"\n"+T(t,i))}else{throw e}}}function Y(t,e){let i;if(e.cache&&e.name&&e.storage.templates.get(e.name)){return e.storage.templates.get(e.name)}if(typeof t==="function"){i=t}else{i=X(t,e)}if(e.cache&&e.name){e.storage.templates.define(e.name,i)}return i}function Z(t,e,i,s){const n=V(i||{});if(n.async){let i;if(!s){if(typeof v==="function"){return new v((function(s,r){try{i=Y(t,n)(e,n);s(i)}catch(t){r(t)}}))}else{throw w("Please provide a callback function, this env doesn't support Promises")}}else{try{Y(t,n)(e,n,s)}catch(t){return s(t)}}}else{return Y(t,n)(e,n)}}const tt=Object.freeze({__proto__:null,compileToString:T,compileScope:H,compileScopeIntoFunction:N,compile:X,parse:k,render:Z,helpers:Q,nativeHelpers:G,filters:K,templates:B,defaultConfig:J,getConfig:V});K.define("date_long",((t,e={year:"numeric",month:"long",day:"numeric"})=>{if(!t)return;const i=new Date(parseInt(t)*1e3);t=i.toLocaleDateString("en-GB",e);return t}));K.define("date_short",((t,e="d/m/y")=>{if(!t)return;const i=new Date(parseInt(t)*1e3);t=e.replace(/(d)/,i.getDate().toString());t=t.replace(/(m)/,(i.getMonth()+1).toString());t=t.replace(/(y)/,i.getFullYear().toString());return t}));K.define("public_name",(t=>{if(!t)return;t=t.split("_").map((t=>t.length<3?t.toUpperCase():t)).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}));K.define("trim_to",((t,e=100)=>{if(!t)return;if(t.length<=e)return t;return t.substr(0,e)+"..."}));K.define("classname",(t=>{if(!t)return;return t.replace(/[\W]+/g,"")}));K.define("abs_url",((t,e=null,i)=>{if(!e)return t;if(!t)return;let s=undefined;if(e.domains&&i&&i.origin){const t=e.domains.find((t=>t.origin===i.origin));s=t?t.domain:""}else if(e.domain)s=e.domain;if(!s)return t;return t.match(/^http/)?t:location.protocol+"//"+s+t}));K.define("replace",((t,e,i)=>t.replace(e,i)));K.define("remove_spaces",(t=>t.replace(/ /g,"_")));K.define("add_spaces",(t=>t=t.replace(/[_\-]/g," ")));K.define("capitalise",(t=>t=t.charAt(0).toUpperCase()+t.slice(1)));K.define("lowercase",(t=>t=t.toLowerCase()));const et=tt;const it=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}:host ::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;block-size:100%;inline-size:100%;min-block-size:100%;max-block-size:100vh !important;max-inline-size:100vw !important;inset-inline-start:0;inset-block-start:0;z-index:-10;font-size:60px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{block-size:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;inset-block-start:0;inset-inline-start:0;display:none}.results-container{position:relative}.results.show{transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, overflow 0.01s ease 0.31s;transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{block-size:auto !important;inline-size:auto !important;display:block;position:static;transform:none;z-index:auto;visibility:inherit;opacity:initial;overflow:visible}";const st=class{constructor(t){i(this,t);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new g;this.searchChange=async()=>{if(!this.algoliaIndex)return;if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return}else return}else if(this.query!=="*"){this.query="*";return}}this.isLoading=true;setTimeout((async()=>{this.resetPage();await this.algoliaSearch(u.Init);await this.updateContent();setTimeout((t=>this.isLoading=false),800);this.showResults=true;this.nanoResultsShown.emit(this.indexResults)}),200)};this.makeAppliedFilters=()=>{const t=[];const e=e=>{Object.values(e).forEach((e=>{if(e.value&&e.value.length){const i=t.find((t=>t.name===e.facetName));if(!i)t.push({name:e.facetName,values:[...e.value]});else i.values=[...i.values,...e.value]}}))};e(this.dynFacetFilters);e(this.staticFacetFilters);if(t.length)return t;return null};this.algoliaSearch=async t=>this.promiseQueue.enqueue((()=>this.queueSearch(t)));this.queueSearch=async t=>{if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return;this.nanoBeforeQuery.emit(this.indexResults);if(u.Init===t)this.clearAllFacetFilters();const e={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0};if(this.searchIndex.filters)e.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)e.hitsPerPage=this.searchIndex.hitsPerPage;let i=await this.algoliaIndex.search(this.query,e);i=this.fixDomain(i);this.changeEvent=t;if(t===u.Init||!this.indexResults){this.indexResults={currentPage:0,totalHits:i.nbHits,hitsPerPage:null,origFilters:i.facets,query:this.query,domain:this.searchIndex.domain||null,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index}}this.indexResults.dynFilters=i.facets;this.indexResults.results=i.hits;this.indexResults.totalHitsWithFilters=i.nbHits;this.indexResults.currentPage=i.page;this.indexResults.totalPages=i.nbPages;this.indexResults.hitsPerPage=i.hitsPerPage;this.indexResults.query=i.query;if(this.changeEvent!==u.Page&&this.changeEvent!==u.Replica){this.facets=i.facets}this.nanoAfterQuery.emit(this.indexResults);return new Promise((t=>{setTimeout((()=>t("tpl updated")),20)})).then((t=>{this.currentHits=this.indexResults.results;this.resultsPage=this.indexResults.currentPage}))};this.handleSearchReset=()=>{this.showResults=false;this.indexResults=null};this.onResultDisplay=()=>{n((()=>{this.resultsDiv.removeEventListener("transitionend",this.onResultDisplay);if(!this.showResults)this.resultsDiv.style.display="none";else{this.defaultDiv.style.display="none";this.resultsDiv.classList.add("shown");this.resultsDiv.style.minHeight="";this.resultsDiv.style.width=""}}))};this._dynFacetFilters={};this.inputField=undefined;this.algoliaIndex=undefined;this.indeces=[];this.indexResults=undefined;this.filterChanged="";this.currentHits=undefined;this.changeEvent=u.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.appId=undefined;this.apiKey=undefined;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplRenderFn=et.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeId=undefined;this.storeMethod="session"}handleListenToChange(){if(!this.listenTo)return;const t=document.querySelector(this.listenTo);if(["nano-input","input"].includes(t.tagName.toLocaleLowerCase())){this.inputField=t}}async removeFilters(t,e){if(!t&&!e)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((i=>{if(t&&this._dynFacetFilters[i].facetName===t){if(!e)this._dynFacetFilters[i].element.value="";else{this._dynFacetFilters[i].element.value=this._dynFacetFilters[i].value.filter((t=>t!==e))}}}))}}onAllTplUpdate(t){t.stopPropagation();if(t.target.tagName==="NANO-ALGOLIA-RESULTS"){requestAnimationFrame((()=>{this.nanoNewResults.emit(this.indexResults)}))}}async onPageChange(t){if(!this.indexResults)return;let e=this.resultsPage;if(t){t.stopPropagation();e=t.detail.page}e=Math.min(this.indexResults.totalPages-1,e);e=Math.max(e,0);if(this.indexResults.currentPage===e)return;this.indexResults.currentPage=e;await this.algoliaSearch(u.Page)}async onFilterChange(t){t.stopPropagation();const e={};const i=t.detail;i.element=t.target;if(this.indexResults){if(this.staticFacetFilters[i.filterId])this.staticFacetFilters[i.filterId]=i;else{e[i.filterId]=i;this._dynFacetFilters={...this._dynFacetFilters,...e}}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[i.filterId]=i;this.filterChanged=i.value&&i.value.length?i.filterId:"all";this.resetPage();this.algoliaSearch(u.Filter)}dynFacetFiltersChange(){Object.values(this._dynFacetFilters).forEach((t=>{if(this.host.ownerDocument===t.element.ownerDocument)this.dynFacetFilters[t.filterId]=t;else delete this.dynFacetFilters[t.filterId]}))}browseIndexChange(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}}inputFieldSet(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query}queryChange(){this.searchChange()}async internalIndexSwitch(){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return;this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(u.Replica)}pageChange(){this.onPageChange()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}}initAlgoliaClient(){if(!this.appId||!this.apiKey)return;this.algoliaClient=h(this.appId,this.apiKey)}initAlgoliaIndex(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(!this.searchIndex.hitsPerPage)this.searchIndex.hitsPerPage=100;if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}}showResultsChange(){if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";n((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.style.display="block";setTimeout((()=>this.resultsDiv.classList.add("show")),50)}))}else{n((()=>{this.resultsDiv.classList.remove("shown");this.defaultDiv.style.display="block";setTimeout((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.classList.remove("show");if(!!this.slottedInput)this.slottedInput.focus({preventScroll:true});else this.defaultDiv.focus({preventScroll:true})}),50)}))}}handleFilterpropChange(){this.algoliaSearch(u.Init)}fixDomain(t){if(!this.searchIndex||!this.searchIndex.domain)return t;t.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.searchIndex.domain+t.url}));return t}resetPage(){if(!this.indexResults)return;this.indexResults.currentPage=0}clearAllFacetFilters(){Object.values(this._dynFacetFilters).forEach((t=>{t.element.value=""}));this._dynFacetFilters={}}algoliaFilterStr(){const t={};const e=e=>{let i;let s;Object.keys(e).forEach((n=>{i=e[n];t[n]=t[n]||{name:i.facetName,or:[],and:[],not:[]};s=t[n][i.operator];if(i.value&&i.value.length){t[n][i.operator]=[...s,...i.value]}}))};e(this.dynFacetFilters);e(this.staticFacetFilters);const i=(t,e)=>{if(e.indexOf(" ")>-1)return t+':"'+e+'"';else return t+":"+e};let s=[];let n;let r;Object.values(t).forEach((function(t){Object.keys(t).filter((t=>t.match(/(or|and|not)/))).forEach((e=>{n=t;r=t.name;if(e==="or"||e==="and"){if(n[e].length){s.push("( "+n[e].map((t=>{if(t.length)return i(r,t)})).join(" "+e.toLocaleUpperCase()+" ")+" )")}}else{if(n.not.length){s.push("( "+n[e].map((t=>{if(t.length)return"NOT "+i(r,t)})).join(" AND ")+" )")}}}))}));s=[...this.filters,...s];return s.join(" "+this.operator.toLocaleUpperCase()+" ")}handleInputChange(t){if(t.target!==this.inputField)return;this.query=this.inputField.value}async updateContent(){return this.promiseQueue.enqueue((()=>this.updateContentQueue()))}async updateContentQueue(){const t=this.outputSlot||this.resultsDiv;if(!t||!this.tpl)return"no tpl";const e=document.createElement("div");e.innerHTML=this.tpl;const i=[];this.placedAlgoliaEles=[];Array.from(e.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach(((t,e)=>{const s=document.createElement("div");s.dataset.placeholderId=e.toString();s.classList.add("nano-ele-placeholder");i.push(t);t.parentNode.replaceChild(s,t)}));t.innerHTML=this.tplRenderFn(e.innerHTML.replace(/>/gm,">").replace(/</gm,"<").replace(/&/gm,"&"),this.indexResults);Array.from(t.querySelectorAll("div.nano-ele-placeholder")).forEach((t=>{t.parentNode.replaceChild(i[parseInt(t.dataset.placeholderId)],t);this.placedAlgoliaEles.push(i[parseInt(t.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return Promise.resolve("algolia setup");return new Promise((e=>{const i=s=>{this.placedAlgoliaEles=this.placedAlgoliaEles.filter((t=>t!==s.detail));if(!this.placedAlgoliaEles.length){setTimeout((()=>e("tpl updated")),500);t.removeEventListener("nanoTplUpdated",i)}};t.addEventListener("nanoTplUpdated",i)}))}componentWillLoad(){r((t=>{this.tplSlot=a(this.host,'[slot="template"]')[0];this.outputSlot=a(this.host,'[slot="output"]')[0];this.slottedInput=a(this.host,'[slot="search-input"]')[0];this.hasLoadSlot=!!a(this.host,'[slot="loader"]')[0];if(!!this.tplSlot)this.tpl=this.tplSlot.innerHTML||this.tplSlot.innerText;if(this.slottedInput&&(this.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||this.slottedInput instanceof HTMLInputElement)){this.inputField=this.slottedInput}else if(this.slottedInput){this.inputField=this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}else this.handleListenToChange();n((t=>{if(this.showResults&&this.tpl)this.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();m.create(this,this.wormholeState);if(this.storeId){f.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);f.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()}connectedCallback(){this.searchChange=c(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))}render(){const t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return o(l,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&o("div",{hidden:!this.isLoading},o("slot",{name:"loader"})),!this.hasLoadSlot&&o("div",{class:{loader:true,loading:this.isLoading}},o("nano-spinner",{overlay:true,type:"circle"})),o(m.Provider,{state:t},o("slot",{name:"search-input"}),o("div",{class:"results-container","aria-live":"polite"},o("div",{ref:t=>this.resultsDiv=t,class:"results"},o("slot",{name:"output"})))),o("div",{ref:t=>this.defaultDiv=t,class:"default",tabindex:"-1"},o("slot",null)))}get host(){return t(this)}static get watchers(){return{listenTo:["handleListenToChange"],_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"],filters:["handleFilterpropChange"]}}};st.style=it;export{st as nano_algolia};
|
4
|
+
import{g as t,e,r as i,c as s,w as n,d as r,h as o,a as l}from"./index-9695db0a.js";import{a as h}from"./algoliasearch-lite.esm.browser-d71a28dc.js";import{g as a}from"./dom-8599fac1.js";import{C as f}from"./component-store-486d9d7a.js";import{d as c}from"./throttle-ac4fcefa.js";import{S as u}from"./algolia-data-1b42827c.js";var d=new Map;var p=function(t,e){var i=t.fields,s=t.updater;i.forEach((function(t){s(t,e[t])}))};var m={create:function(e,i){var s=t(e);var n=new Map;var r={wormholes:n,state:i};d.set(e,r);var o=e.connectedCallback;e.connectedCallback=function(){d.set(e,r);if(o){o.call(e)}};var l=e.disconnectedCallback;e.disconnectedCallback=function(){d.delete(e);if(l){l.call(e)}};s.addEventListener("openWormhole",(function(t){t.stopPropagation();var e=t.detail,i=e.consumer,s=e.onOpen;if(n.has(i))return;if(typeof i!=="symbol"){var o=i.connectedCallback,l=i.disconnectedCallback;i.connectedCallback=function(){n.set(i,t.detail);if(o){o.call(i)}};i.disconnectedCallback=function(){n.delete(i);if(l){l.call(i)}}}n.set(i,t.detail);p(t.detail,r.state);s===null||s===void 0?void 0:s.resolve((function(){n.delete(i)}))}));s.addEventListener("closeWormhole",(function(t){var e=t.detail;n.delete(e)}))},Provider:function(t,i){var s=t.state;var n=e();if(d.has(n)){var r=d.get(n);r.state=s;r.wormholes.forEach((function(t){p(t,s)}))}return i}};class g{constructor(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}enqueue(t){return new Promise(((e,i)=>{this.queue.push({promise:t,resolve:e,reject:i});this.dequeue()}))}dequeue(){if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}const t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((e=>{this.workingOnPromise=false;t.resolve(e);this.dequeue()})).catch((e=>{this.workingOnPromise=false;t.reject(e);this.dequeue()}))}catch(e){this.workingOnPromise=false;t.reject(e);this.dequeue()}return true}}g.pendingPromise=false;function y(t,e){if(Object.setPrototypeOf){Object.setPrototypeOf(t,e)}else{t.__proto__=e}}function w(t){const e=new Error(t);y(e,w.prototype);return e}w.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:false}});function b(t,e,i){const s=e.slice(0,i).split(/\n/);const n=s.length;const r=s[n-1].length+1;t+=" at line "+n+" col "+r+":\n\n"+" "+e.split(/\n/)[n-1]+"\n"+" "+Array(r).join(" ")+"^";throw w(t)}const v=new Function("return this")().Promise;let x=false;try{x=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError)){throw t}}function F(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function C(t,e,i){for(const s in e){if(F(e,s)){if(e[s]!=null&&typeof e[s]=="object"&&(s==="storage"||s==="prefixes")&&!i){t[s]=C({},e[s])}else{t[s]=e[s]}}}return t}function I(t,e,i,s){let n;let r;if(typeof e.autoTrim==="string"){n=r=e.autoTrim}else if(Array.isArray(e.autoTrim)){n=e.autoTrim[1];r=e.autoTrim[0]}if(i||i===false){n=i}if(s||s===false){r=s}if(n==="slurp"&&r==="slurp"){return t.trim()}if(n==="_"||n==="slurp"){if(!!String.prototype.trimLeft){t=t.trimLeft()}else{t=t.replace(/^[\s\uFEFF\xA0]+/,"")}}else if(n==="-"||n==="nl"){t=t.replace(/^(?:\n|\r|\r\n)/,"")}if(r==="_"||r==="slurp"){if(!!String.prototype.trimRight){t=t.trimRight()}else{t=t.replace(/[\s\uFEFF\xA0]+$/,"")}}else if(r==="-"||r==="nl"){t=t.replace(/(?:\n|\r|\r\n)$/,"")}return t}const S=/^async +/;const j=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;const z=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;const R=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;const _=/[.*+\-?^${}()|[\]\\]/g;function A(t){return _.test(t)?t.replace(_,"\\$&"):t}function k(t,e){if(e.rmWhitespace){t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}j.lastIndex=0;z.lastIndex=0;R.lastIndex=0;const i=e.prefixes;const s=[i.h,i.b,i.i,i.r,i.c,i.e].reduce((function(t,e){if(t&&e){return t+"|"+A(e)}else if(e){return A(e)}else{return t}}),"");const n=new RegExp("([|()]|=>)|"+"('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+A(e.tags[1])+")","g");const r=new RegExp("([^]*?)"+A(e.tags[0])+"(-|_)?\\s*("+s+")?\\s*","g");let o=0;let l=false;function h(i,s){const h={f:[]};let a=0;let f="c";if(s==="h"||s==="b"||s==="c"){f="n"}else if(s==="r"){h.raw=true;s="i"}function c(i){const s=t.slice(o,i);let n=s.trim();if(f==="f"){if(n==="safe"){h.raw=true}else{if(e.async&&S.test(n)){n=n.replace(S,"");h.f.push([n,"",true])}else{h.f.push([n,""])}}}else if(f==="fp"){h.f[h.f.length-1][1]+=n}else if(f==="err"){if(n){const e=s.search(/\S/);b("invalid syntax",t,o+e)}}else{h[f]=n}o=i+1}n.lastIndex=o;let u;while((u=n.exec(t))!==null){const e=u[1];const i=u[2];const d=u[3];const p=u[4];const m=u[5];const g=u.index;if(e){if(e==="("){if(a===0){if(f==="n"){c(g);f="p"}else if(f==="f"){c(g);f="fp"}}a++}else if(e===")"){a--;if(a===0&&f!=="c"){c(g);f="err"}}else if(a===0&&e==="|"){c(g);f="f"}else if(e==="=>"){c(g);o+=1;f="res"}}else if(i){if(i==="/*"){const e=t.indexOf("*/",n.lastIndex);if(e===-1){b("unclosed comment",t,u.index)}n.lastIndex=e+2}else if(i==="'"){z.lastIndex=u.index;const e=z.exec(t);if(e){n.lastIndex=z.lastIndex}else{b("unclosed string",t,u.index)}}else if(i==='"'){R.lastIndex=u.index;const e=R.exec(t);if(e){n.lastIndex=R.lastIndex}else{b("unclosed string",t,u.index)}}else if(i==="`"){j.lastIndex=u.index;const e=j.exec(t);if(e){n.lastIndex=j.lastIndex}else{b("unclosed string",t,u.index)}}}else if(d){c(g);o=g+u[0].length;r.lastIndex=o;l=m;if(p&&s==="h"){s="s"}h.t=s;return h}}b("unclosed tag",t,i);return h}function a(s,n){s.b=[];s.d=[];let f=false;let c=[];function u(t,i){if(t){t=I(t,e,l,i);if(t){t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n");c.push(t)}}}let d;while((d=r.exec(t))!==null){const n=d[1];const r=d[2];const l=d[3]||"";let p;for(const t in i){if(i[t]===l){p=t;break}}u(n,r);o=d.index+d[0].length;if(!p){b("unrecognized tag type: "+l,t,o)}let m=h(d.index,p);const g=m.t;if(g==="h"){const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}m=a(m);c.push(m)}else if(g==="c"){if(s.n===m.n){if(f){f.d=c;s.b.push(f)}else{s.d=c}return s}else{b("Helper start and end don't match",t,d.index+d[0].length)}}else if(g==="b"){if(f){f.d=c;s.b.push(f)}else{s.d=c}const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}f=m;c=[]}else if(g==="s"){const t=m.n||"";if(e.async&&S.test(t)){m.a=true;m.n=t.replace(S,"")}c.push(m)}else{c.push(m)}}if(n){u(t.slice(o,t.length),false);s.d=c}else{throw w('unclosed helper "'+s.n+'"')}return s}const f=a({f:[]},true);if(e.plugins){for(let t=0;t<e.plugins.length;t++){const i=e.plugins[t];if(i.processAST){f.d=i.processAST(f.d,e)}}}return f.d}function T(t,e){const i=k(t,e);let s="var tR='';"+(e.useWith?"with("+e.varName+"||{}){":"")+H(i,e)+"if(cb){cb(null,tR)} return tR"+(e.useWith?"}":"");if(e.plugins){for(let t=0;t<e.plugins.length;t++){const i=e.plugins[t];if(i.processFnString){s=i.processFnString(s,e)}}}return s}function P(t,e){for(let i=0;i<e.length;i++){const s=e[i][0];const n=e[i][1];const r=e[i][2];t=(r?"await ":"")+"c.l('F','"+s+"')("+t;if(n){t+=","+n}t+=")"}return t}function O(t,e,i,s,n,r){let o="{exec:"+(n?"async ":"")+N(i,e,t)+",params:["+s+"]";if(r){o+=",name:'"+r+"'"}if(n){o+=",async:true"}o+="}";return o}function E(t,e){let i="[";for(let s=0;s<t.length;s++){const n=t[s];i+=O(e,n.res||"",n.d,n.p||"",n.a,n.n);if(s<t.length){i+=","}}i+="]";return i}function N(t,e,i){return"function("+e+"){var tR='';"+H(t,i)+"return tR}"}function H(t,e){let i=0;const s=t.length;let n="";for(i;i<s;i++){const s=t[i];if(typeof s==="string"){const t=s;n+="tR+='"+t+"';"}else{const t=s.t;let i=s.c||"";const r=s.f;const o=s.n||"";const l=s.p||"";const h=s.res||"";const a=s.b;const f=!!s.a;if(t==="i"){if(e.defaultFilter){i="c.l('F','"+e.defaultFilter+"')("+i+")"}let t=P(i,r);if(!s.raw&&e.autoEscape){t="c.l('F','e')("+t+")"}n+="tR+="+t+";"}else if(t==="h"){if(e.storage.nativeHelpers.get(o)){n+=e.storage.nativeHelpers.get(o)(s,e)}else{let t=(f?"await ":"")+"c.l('H','"+o+"')("+O(e,h,s.d,l,f);if(a){t+=","+E(a,e)}else{t+=",[]"}t+=",c)";n+="tR+="+P(t,r)+";"}}else if(t==="s"){n+="tR+="+P((f?"await ":"")+"c.l('H','"+o+"')({params:["+l+"]},[],c)",r)+";"}else if(t==="e"){n+=i+"\n"}}}return n}class q{constructor(t){this.cache=t}define(t,e){this.cache[t]=e}get(t){return this.cache[t]}remove(t){delete this.cache[t]}reset(){this.cache={}}load(t){C(this.cache,t,true)}}function L(t,e,i,s){if(e&&e.length>0){throw w((s?"Native":"")+"Helper '"+t+"' doesn't accept blocks")}if(i&&i.length>0){throw w((s?"Native":"")+"Helper '"+t+"' doesn't accept filters")}}function $(t,e,i,s,n){i(t[e],e).then((function(r){s+=r;if(e===t.length-1){n(s)}else{$(t,e+1,i,s,n)}}))}function D(t,e,i,s,n,r){s(e[i],t[e[i]]).then((function(o){n+=o;if(i===e.length-1){r(n)}else{D(t,e,i+1,s,n,r)}}))}const M={"&":"&","<":"<",">":">",'"':""","'":"'"};function W(t){return M[t]}function U(t){const e=String(t);if(/[&<>"']/.test(e)){return e.replace(/[&<>"']/g,W)}else{return e}}const B=new q({});const Q=new q({each:function(t,e){let i="";const s=t.params[0];L("each",e,false);if(t.async){return new Promise((function(e){$(s,0,t.exec,i,e)}))}else{for(let e=0;e<s.length;e++){i+=t.exec(s[e],e)}return i}},foreach:function(t,e){const i=t.params[0];L("foreach",e,false);if(t.async){return new Promise((function(e){D(i,Object.keys(i),0,t.exec,"",e)}))}else{let e="";for(const s in i){if(!F(i,s))continue;e+=t.exec(s,i[s])}return e}},include:function(t,e,i){L("include",e,false);const s=i.storage.templates.get(t.params[0]);if(!s){throw w('Could not fetch template "'+t.params[0]+'"')}return s(t.params[1],i)},extends:function(t,e,i){const s=t.params[1]||{};s.content=t.exec();for(let t=0;t<e.length;t++){const i=e[t];s[i.name]=i.exec()}const n=i.storage.templates.get(t.params[0]);if(!n){throw w('Could not fetch template "'+t.params[0]+'"')}return n(s,i)},useScope:function(t,e){L("useScope",e,false);return t.exec(t.params[0])}});const G=new q({if:function(t,e){L("if",false,t.f,true);let i="if("+t.p+"){"+H(t.d,e)+"}";if(t.b){for(let s=0;s<t.b.length;s++){const n=t.b[s];if(n.n==="else"){i+="else{"+H(n.d,e)+"}"}else if(n.n==="elif"){i+="else if("+n.p+"){"+H(n.d,e)+"}"}}}return i},try:function(t,e){L("try",false,t.f,true);if(!t.b||t.b.length!==1||t.b[0].n!=="catch"){throw w("native helper 'try' only accepts 1 block, 'catch'")}let i="try{"+H(t.d,e)+"}";const s=t.b[0];i+="catch"+(s.res?"("+s.res+")":"")+"{"+H(s.d,e)+"}";return i},block:function(t,e){L("block",t.b,t.f,true);const i="if(!"+e.varName+"["+t.p+"]){tR+=("+N(t.d,"",e)+")()}else{tR+="+e.varName+"["+t.p+"]}";return i}});const K=new q({e:U});const J={varName:"it",autoTrim:[false,"nl"],autoEscape:true,defaultFilter:false,tags:["{{","}}"],l:function(t,e){if(t==="H"){const t=this.storage.helpers.get(e);if(t){return t}else{throw w("Can't find helper '"+e+"'")}}else if(t==="F"){const t=this.storage.filters.get(e);if(t){return t}else{throw w("Can't find filter '"+e+"'")}}},async:false,storage:{helpers:Q,nativeHelpers:G,filters:K,templates:B},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:false,plugins:[],useWith:false};J.l.bind(J);function V(t,e){const i={};C(i,J);if(e){C(i,e)}if(t){C(i,t)}i.l.bind(i);return i}function X(t,e){const i=V(e||{});let s=Function;if(i.async){if(x){s=x}else{throw w("This environment doesn't support async/await")}}try{return new s(i.varName,"c","cb",T(t,i))}catch(e){if(e instanceof SyntaxError){throw w("Bad template syntax\n\n"+e.message+"\n"+Array(e.message.length+1).join("=")+"\n"+T(t,i))}else{throw e}}}function Y(t,e){let i;if(e.cache&&e.name&&e.storage.templates.get(e.name)){return e.storage.templates.get(e.name)}if(typeof t==="function"){i=t}else{i=X(t,e)}if(e.cache&&e.name){e.storage.templates.define(e.name,i)}return i}function Z(t,e,i,s){const n=V(i||{});if(n.async){let i;if(!s){if(typeof v==="function"){return new v((function(s,r){try{i=Y(t,n)(e,n);s(i)}catch(t){r(t)}}))}else{throw w("Please provide a callback function, this env doesn't support Promises")}}else{try{Y(t,n)(e,n,s)}catch(t){return s(t)}}}else{return Y(t,n)(e,n)}}const tt=Object.freeze({__proto__:null,compileToString:T,compileScope:H,compileScopeIntoFunction:N,compile:X,parse:k,render:Z,helpers:Q,nativeHelpers:G,filters:K,templates:B,defaultConfig:J,getConfig:V});K.define("date_long",((t,e={year:"numeric",month:"long",day:"numeric"})=>{if(!t)return;const i=new Date(parseInt(t)*1e3);t=i.toLocaleDateString("en-GB",e);return t}));K.define("date_short",((t,e="d/m/y")=>{if(!t)return;const i=new Date(parseInt(t)*1e3);t=e.replace(/(d)/,i.getDate().toString());t=t.replace(/(m)/,(i.getMonth()+1).toString());t=t.replace(/(y)/,i.getFullYear().toString());return t}));K.define("public_name",(t=>{if(!t)return;t=t.split("_").map((t=>t.length<3?t.toUpperCase():t)).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}));K.define("trim_to",((t,e=100)=>{if(!t)return;if(t.length<=e)return t;return t.substr(0,e)+"..."}));K.define("classname",(t=>{if(!t)return;return t.replace(/[\W]+/g,"")}));K.define("abs_url",((t,e=null,i)=>{if(!e)return t;if(!t)return;let s=undefined;if(e.domains&&i&&i.origin){const t=e.domains.find((t=>t.origin===i.origin));s=t?t.domain:""}else if(e.domain)s=e.domain;if(!s)return t;if(!t.startsWith("/"))t="/"+t;return t.match(/^http/)?t:location.protocol+"//"+s+t}));K.define("replace",((t,e,i)=>t.replace(e,i)));K.define("remove_spaces",(t=>t.replace(/ /g,"_")));K.define("add_spaces",(t=>t=t.replace(/[_\-]/g," ")));K.define("capitalise",(t=>t=t.charAt(0).toUpperCase()+t.slice(1)));K.define("lowercase",(t=>t=t.toLowerCase()));const et=tt;const it=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}:host ::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;block-size:100%;inline-size:100%;min-block-size:100%;max-block-size:100vh !important;max-inline-size:100vw !important;inset-inline-start:0;inset-block-start:0;z-index:-10;font-size:60px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{block-size:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;inset-block-start:0;inset-inline-start:0;display:none}.results-container{position:relative}.results.show{transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, overflow 0.01s ease 0.31s;transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{block-size:auto !important;inline-size:auto !important;display:block;position:static;transform:none;z-index:auto;visibility:inherit;opacity:initial;overflow:visible}";const st=class{constructor(t){i(this,t);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new g;this.searchChange=async()=>{if(!this.algoliaIndex)return;if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return}else return}else if(this.query!=="*"){this.query="*";return}}this.isLoading=true;setTimeout((async()=>{this.resetPage();await this.algoliaSearch(u.Init);await this.updateContent();setTimeout((t=>this.isLoading=false),800);this.showResults=true;this.nanoResultsShown.emit(this.indexResults)}),200)};this.makeAppliedFilters=()=>{const t=[];const e=e=>{Object.values(e).forEach((e=>{if(e.value&&e.value.length){const i=t.find((t=>t.name===e.facetName));if(!i)t.push({name:e.facetName,values:[...e.value]});else i.values=[...i.values,...e.value]}}))};e(this.dynFacetFilters);e(this.staticFacetFilters);if(t.length)return t;return null};this.algoliaSearch=async t=>this.promiseQueue.enqueue((()=>this.queueSearch(t)));this.queueSearch=async t=>{if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return;this.nanoBeforeQuery.emit(this.indexResults);if(u.Init===t)this.clearAllFacetFilters();const e={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0};if(this.searchIndex.filters)e.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)e.hitsPerPage=this.searchIndex.hitsPerPage;let i=await this.algoliaIndex.search(this.query,e);i=this.fixDomain(i);this.changeEvent=t;if(t===u.Init||!this.indexResults){this.indexResults={currentPage:0,totalHits:i.nbHits,hitsPerPage:null,origFilters:i.facets,query:this.query,domain:this.searchIndex.domain||null,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index,searchIndex:this.searchIndex}}this.indexResults.dynFilters=i.facets;this.indexResults.results=i.hits;this.indexResults.totalHitsWithFilters=i.nbHits;this.indexResults.currentPage=i.page;this.indexResults.totalPages=i.nbPages;this.indexResults.hitsPerPage=i.hitsPerPage;this.indexResults.query=i.query;if(this.changeEvent!==u.Page&&this.changeEvent!==u.Replica){this.facets=i.facets}this.nanoAfterQuery.emit(this.indexResults);return new Promise((t=>{setTimeout((()=>t("tpl updated")),20)})).then((t=>{this.currentHits=this.indexResults.results;this.resultsPage=this.indexResults.currentPage}))};this.handleSearchReset=()=>{this.showResults=false;this.indexResults=null};this.onResultDisplay=()=>{n((()=>{this.resultsDiv.removeEventListener("transitionend",this.onResultDisplay);if(!this.showResults)this.resultsDiv.style.display="none";else{this.defaultDiv.style.display="none";this.resultsDiv.classList.add("shown");this.resultsDiv.style.minHeight="";this.resultsDiv.style.width=""}}))};this._dynFacetFilters={};this.inputField=undefined;this.algoliaIndex=undefined;this.indeces=[];this.indexResults=undefined;this.filterChanged="";this.currentHits=undefined;this.changeEvent=u.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.appId=undefined;this.apiKey=undefined;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplRenderFn=et.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeId=undefined;this.storeMethod="session"}handleListenToChange(){if(!this.listenTo)return;const t=document.querySelector(this.listenTo);if(["nano-input","input"].includes(t.tagName.toLocaleLowerCase())){this.inputField=t}}async removeFilters(t,e){if(!t&&!e)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((i=>{if(t&&this._dynFacetFilters[i].facetName===t){if(!e)this._dynFacetFilters[i].element.value="";else{this._dynFacetFilters[i].element.value=this._dynFacetFilters[i].value.filter((t=>t!==e))}}}))}}onAllTplUpdate(t){t.stopPropagation();if(t.target.tagName==="NANO-ALGOLIA-RESULTS"){requestAnimationFrame((()=>{this.nanoNewResults.emit(this.indexResults)}))}}async onPageChange(t){if(!this.indexResults)return;let e=this.resultsPage;if(t){t.stopPropagation();e=t.detail.page}e=Math.min(this.indexResults.totalPages-1,e);e=Math.max(e,0);if(this.indexResults.currentPage===e)return;this.indexResults.currentPage=e;await this.algoliaSearch(u.Page)}async onFilterChange(t){t.stopPropagation();const e={};const i=t.detail;i.element=t.target;if(this.indexResults){if(this.staticFacetFilters[i.filterId])this.staticFacetFilters[i.filterId]=i;else{e[i.filterId]=i;this._dynFacetFilters={...this._dynFacetFilters,...e}}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[i.filterId]=i;this.filterChanged=i.value&&i.value.length?i.filterId:"all";this.resetPage();this.algoliaSearch(u.Filter)}dynFacetFiltersChange(){Object.values(this._dynFacetFilters).forEach((t=>{if(this.host.ownerDocument===t.element.ownerDocument)this.dynFacetFilters[t.filterId]=t;else delete this.dynFacetFilters[t.filterId]}))}browseIndexChange(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}}inputFieldSet(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query}queryChange(){this.searchChange()}async internalIndexSwitch(){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return;this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(u.Replica)}pageChange(){this.onPageChange()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}}initAlgoliaClient(){if(!this.appId||!this.apiKey)return;this.algoliaClient=h(this.appId,this.apiKey)}initAlgoliaIndex(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(!this.searchIndex.hitsPerPage)this.searchIndex.hitsPerPage=100;if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}}showResultsChange(){if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";n((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.style.display="block";setTimeout((()=>this.resultsDiv.classList.add("show")),50)}))}else{n((()=>{this.resultsDiv.classList.remove("shown");this.defaultDiv.style.display="block";setTimeout((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.classList.remove("show");if(!!this.slottedInput)this.slottedInput.focus({preventScroll:true});else this.defaultDiv.focus({preventScroll:true})}),50)}))}}handleFilterpropChange(){this.algoliaSearch(u.Init)}fixDomain(t){if(!this.searchIndex||!this.searchIndex.domain)return t;t.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.searchIndex.domain+t.url}));return t}resetPage(){if(!this.indexResults)return;this.indexResults.currentPage=0}clearAllFacetFilters(){Object.values(this._dynFacetFilters).forEach((t=>{t.element.value=""}));this._dynFacetFilters={}}algoliaFilterStr(){const t={};const e=e=>{let i;let s;Object.keys(e).forEach((n=>{i=e[n];t[n]=t[n]||{name:i.facetName,or:[],and:[],not:[]};s=t[n][i.operator];if(i.value&&i.value.length){t[n][i.operator]=[...s,...i.value]}}))};e(this.dynFacetFilters);e(this.staticFacetFilters);const i=(t,e)=>{if(e.indexOf(" ")>-1)return t+':"'+e+'"';else return t+":"+e};let s=[];let n;let r;Object.values(t).forEach((function(t){Object.keys(t).filter((t=>t.match(/(or|and|not)/))).forEach((e=>{n=t;r=t.name;if(e==="or"||e==="and"){if(n[e].length){s.push("( "+n[e].map((t=>{if(t.length)return i(r,t)})).join(" "+e.toLocaleUpperCase()+" ")+" )")}}else{if(n.not.length){s.push("( "+n[e].map((t=>{if(t.length)return"NOT "+i(r,t)})).join(" AND ")+" )")}}}))}));s=[...this.filters,...s];return s.join(" "+this.operator.toLocaleUpperCase()+" ")}handleInputChange(t){if(t.target!==this.inputField)return;this.query=this.inputField.value}async updateContent(){return this.promiseQueue.enqueue((()=>this.updateContentQueue()))}async updateContentQueue(){const t=this.outputSlot||this.resultsDiv;if(!t||!this.tpl)return"no tpl";const e=document.createElement("div");e.innerHTML=this.tpl;const i=[];this.placedAlgoliaEles=[];Array.from(e.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach(((t,e)=>{const s=document.createElement("div");s.dataset.placeholderId=e.toString();s.classList.add("nano-ele-placeholder");i.push(t);t.parentNode.replaceChild(s,t)}));t.innerHTML=this.tplRenderFn(e.innerHTML.replace(/>/gm,">").replace(/</gm,"<").replace(/&/gm,"&"),this.indexResults);Array.from(t.querySelectorAll("div.nano-ele-placeholder")).forEach((t=>{t.parentNode.replaceChild(i[parseInt(t.dataset.placeholderId)],t);this.placedAlgoliaEles.push(i[parseInt(t.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return Promise.resolve("algolia setup");return new Promise((e=>{const i=s=>{this.placedAlgoliaEles=this.placedAlgoliaEles.filter((t=>t!==s.detail));if(!this.placedAlgoliaEles.length){setTimeout((()=>e("tpl updated")),500);t.removeEventListener("nanoTplUpdated",i)}};t.addEventListener("nanoTplUpdated",i)}))}componentWillLoad(){r((t=>{this.tplSlot=a(this.host,'[slot="template"]')[0];this.outputSlot=a(this.host,'[slot="output"]')[0];this.slottedInput=a(this.host,'[slot="search-input"]')[0];this.hasLoadSlot=!!a(this.host,'[slot="loader"]')[0];if(!!this.tplSlot)this.tpl=this.tplSlot.innerHTML||this.tplSlot.innerText;if(this.slottedInput&&(this.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||this.slottedInput instanceof HTMLInputElement)){this.inputField=this.slottedInput}else if(this.slottedInput){this.inputField=this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}else this.handleListenToChange();n((t=>{if(this.showResults&&this.tpl)this.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();m.create(this,this.wormholeState);if(this.storeId){f.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);f.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()}connectedCallback(){this.searchChange=c(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))}render(){const t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return o(l,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&o("div",{hidden:!this.isLoading},o("slot",{name:"loader"})),!this.hasLoadSlot&&o("div",{class:{loader:true,loading:this.isLoading}},o("nano-spinner",{overlay:true,type:"circle"})),o(m.Provider,{state:t},o("slot",{name:"search-input"}),o("div",{class:"results-container","aria-live":"polite"},o("div",{ref:t=>this.resultsDiv=t,class:"results"},o("slot",{name:"output"})))),o("div",{ref:t=>this.defaultDiv=t,class:"default",tabindex:"-1"},o("slot",null)))}get host(){return t(this)}static get watchers(){return{listenTo:["handleListenToChange"],_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"],filters:["handleFilterpropChange"]}}};st.style=it;export{st as nano_algolia};
|
5
5
|
//# sourceMappingURL=nano-algolia.entry.js.map
|