@gramlot/gramlot 0.3.30 → 0.3.31

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 (37) hide show
  1. package/dist/components/charts/__init__.py +1 -1
  2. package/dist/components/charts/assets/collection.js +1 -1
  3. package/dist/components/charts/assets/index.js +1 -1
  4. package/dist/components/grid/__init__.py +2 -2
  5. package/dist/components/grid/assets/collection.js +36 -20
  6. package/dist/components/grid/assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt +21 -0
  7. package/dist/components/grid/assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt +21 -0
  8. package/dist/components/grid/assets/index.js +1 -1
  9. package/dist/components/grid/assets/modules/browser-LVJHKBBV.js +19 -0
  10. package/dist/components/grid/assets/modules/chunk-RMRBEYTI.js +1 -0
  11. package/dist/components/grid/commands.json +42 -1
  12. package/dist/components/grid/grammar.json +384 -2
  13. package/dist/components/vizabi/__init__.py +1 -1
  14. package/dist/components/vizabi/assets/collection.js +1 -1
  15. package/dist/components/vizabi/assets/index.js +1 -1
  16. package/dist/gramlot.js +376 -21
  17. package/dist/gramlot.min.js +46 -46
  18. package/dist/standard-collections.js +1 -1
  19. package/package.json +3 -2
  20. package/src/binding/grid-struct.js +4 -1
  21. package/src/binding/runtime.js +2 -1
  22. package/src/builder/gramlot-builder.js +96 -7
  23. package/src/builder/source.js +18 -0
  24. package/src/components/grid-footer.js +120 -0
  25. package/src/components/grid-formulas.js +403 -0
  26. package/src/components/grid-grammar.json +87 -2
  27. package/src/components/grid-selection.js +118 -0
  28. package/src/components/grid-structure.js +27 -4
  29. package/src/components/grid-styles.js +14 -1
  30. package/src/components/grid-tools.js +229 -0
  31. package/src/components/grid.js +174 -8
  32. package/src/components/licenses/fflate.txt +21 -0
  33. package/src/components/licenses/write-excel-file.txt +21 -0
  34. package/src/editing-session.d.ts +2 -0
  35. package/src/editing-session.js +35 -3
  36. package/src/stores/bag-collection-store.js +14 -5
  37. package/src/stores/bag-collection-view.js +1 -1
@@ -78,10 +78,11 @@
78
78
  },
79
79
  "column": {
80
80
  "_meta": {
81
- "data_element": true
81
+ "data_element": true,
82
+ "keywordPattern": "^formula_[A-Za-z_$][A-Za-z0-9_$]*$"
82
83
  },
83
84
  "attributes": {
84
- "accepts_var_keyword": false,
85
+ "accepts_var_keyword": true,
85
86
  "accepts_var_positional": false,
86
87
  "parameters": [
87
88
  {
@@ -295,6 +296,90 @@
295
296
  "kind": "keyword_only",
296
297
  "name": "title",
297
298
  "role": "attribute"
299
+ },
300
+ {
301
+ "annotation": {
302
+ "dtype": "T",
303
+ "kind": "dtype"
304
+ },
305
+ "default": null,
306
+ "has_default": true,
307
+ "kind": "keyword_only",
308
+ "name": "formula",
309
+ "role": "attribute"
310
+ },
311
+ {
312
+ "annotation": {
313
+ "dtype": "B",
314
+ "kind": "dtype"
315
+ },
316
+ "default": null,
317
+ "has_default": true,
318
+ "kind": "keyword_only",
319
+ "name": "calculated",
320
+ "role": "attribute"
321
+ },
322
+ {
323
+ "annotation": {
324
+ "dtype": "B",
325
+ "kind": "dtype"
326
+ },
327
+ "default": null,
328
+ "has_default": true,
329
+ "kind": "keyword_only",
330
+ "name": "hidden",
331
+ "role": "attribute"
332
+ },
333
+ {
334
+ "annotation": {
335
+ "items": [
336
+ {
337
+ "dtype": "B",
338
+ "kind": "dtype"
339
+ },
340
+ {
341
+ "dtype": "T",
342
+ "kind": "dtype"
343
+ }
344
+ ],
345
+ "kind": "union"
346
+ },
347
+ "default": null,
348
+ "has_default": true,
349
+ "kind": "keyword_only",
350
+ "name": "totalize",
351
+ "role": "attribute"
352
+ },
353
+ {
354
+ "annotation": {
355
+ "dtype": "T",
356
+ "kind": "dtype"
357
+ },
358
+ "default": null,
359
+ "has_default": true,
360
+ "kind": "keyword_only",
361
+ "name": "footer_value",
362
+ "role": "attribute"
363
+ },
364
+ {
365
+ "annotation": {
366
+ "dtype": "T",
367
+ "kind": "dtype"
368
+ },
369
+ "default": null,
370
+ "has_default": true,
371
+ "kind": "keyword_only",
372
+ "name": "footer_format",
373
+ "role": "attribute"
374
+ },
375
+ {
376
+ "annotation": {
377
+ "kind": "any"
378
+ },
379
+ "has_default": false,
380
+ "kind": "var_keyword",
381
+ "name": "attr",
382
+ "role": "attribute"
298
383
  }
299
384
  ]
300
385
  },
@@ -329,6 +414,14 @@
329
414
  "default": null,
330
415
  "nullable": true
331
416
  },
417
+ "footer": {
418
+ "binding": "read",
419
+ "default": false,
420
+ "dtype": [
421
+ "B",
422
+ "T"
423
+ ]
424
+ },
332
425
  "loading": {
333
426
  "binding": "read",
334
427
  "default": false,
@@ -347,6 +440,53 @@
347
440
  "default": false,
348
441
  "dtype": "B"
349
442
  },
443
+ "selectedId": {
444
+ "binding": "write",
445
+ "default": null,
446
+ "dtype": "T",
447
+ "nullable": true
448
+ },
449
+ "selectedIndex": {
450
+ "binding": "write",
451
+ "default": null,
452
+ "dtype": "L",
453
+ "nullable": true
454
+ },
455
+ "selectedLabel": {
456
+ "binding": "write",
457
+ "default": null,
458
+ "dtype": "T",
459
+ "nullable": true
460
+ },
461
+ "selectedNodes": {
462
+ "binding": "write",
463
+ "default": null,
464
+ "dtype": "X",
465
+ "nullable": true
466
+ },
467
+ "selectedPkeys": {
468
+ "binding": "write",
469
+ "default": null,
470
+ "dtype": "X",
471
+ "nullable": true
472
+ },
473
+ "selectedRowData": {
474
+ "binding": "write",
475
+ "default": null,
476
+ "dtype": "X",
477
+ "nullable": true
478
+ },
479
+ "selectedRowidx": {
480
+ "binding": "write",
481
+ "default": null,
482
+ "dtype": "T",
483
+ "nullable": true
484
+ },
485
+ "selectionMode": {
486
+ "binding": "read",
487
+ "default": "multi",
488
+ "dtype": "T"
489
+ },
350
490
  "selfDragRows": {
351
491
  "binding": "read",
352
492
  "default": false,
@@ -389,6 +529,7 @@
389
529
  "presentationDefaults": [],
390
530
  "sourceContext": true
391
531
  },
532
+ "parameterPattern": "^selected_[A-Za-z_][A-Za-z0-9_]*$",
392
533
  "render_tag": "gramlot-grid"
393
534
  },
394
535
  "attributes": {
@@ -616,6 +757,247 @@
616
757
  "name": "rowHeaders",
617
758
  "role": "attribute"
618
759
  },
760
+ {
761
+ "annotation": {
762
+ "items": [
763
+ {
764
+ "dtype": "B",
765
+ "kind": "dtype"
766
+ },
767
+ {
768
+ "dtype": "T",
769
+ "kind": "dtype"
770
+ },
771
+ {
772
+ "base": {
773
+ "dtype": "T",
774
+ "kind": "dtype"
775
+ },
776
+ "kind": "annotated",
777
+ "metadata": [
778
+ {
779
+ "flags": 0,
780
+ "kind": "regex",
781
+ "pattern": "^[\\^=].+"
782
+ }
783
+ ]
784
+ }
785
+ ],
786
+ "kind": "union"
787
+ },
788
+ "default": false,
789
+ "has_default": true,
790
+ "kind": "keyword_only",
791
+ "name": "footer",
792
+ "role": "attribute"
793
+ },
794
+ {
795
+ "annotation": {
796
+ "dtype": "T",
797
+ "kind": "dtype"
798
+ },
799
+ "default": "multi",
800
+ "has_default": true,
801
+ "kind": "keyword_only",
802
+ "name": "selectionMode",
803
+ "role": "attribute"
804
+ },
805
+ {
806
+ "annotation": {
807
+ "items": [
808
+ {
809
+ "dtype": "T",
810
+ "kind": "dtype"
811
+ },
812
+ {
813
+ "dtype": "NN",
814
+ "kind": "dtype"
815
+ }
816
+ ],
817
+ "kind": "union"
818
+ },
819
+ "default": null,
820
+ "has_default": true,
821
+ "kind": "keyword_only",
822
+ "name": "selectedId",
823
+ "role": "attribute"
824
+ },
825
+ {
826
+ "annotation": {
827
+ "items": [
828
+ {
829
+ "dtype": "L",
830
+ "kind": "dtype"
831
+ },
832
+ {
833
+ "dtype": "NN",
834
+ "kind": "dtype"
835
+ },
836
+ {
837
+ "base": {
838
+ "dtype": "T",
839
+ "kind": "dtype"
840
+ },
841
+ "kind": "annotated",
842
+ "metadata": [
843
+ {
844
+ "flags": 0,
845
+ "kind": "regex",
846
+ "pattern": "^[\\^=].+"
847
+ }
848
+ ]
849
+ }
850
+ ],
851
+ "kind": "union"
852
+ },
853
+ "default": null,
854
+ "has_default": true,
855
+ "kind": "keyword_only",
856
+ "name": "selectedIndex",
857
+ "role": "attribute"
858
+ },
859
+ {
860
+ "annotation": {
861
+ "items": [
862
+ {
863
+ "dtype": "T",
864
+ "kind": "dtype"
865
+ },
866
+ {
867
+ "dtype": "NN",
868
+ "kind": "dtype"
869
+ }
870
+ ],
871
+ "kind": "union"
872
+ },
873
+ "default": null,
874
+ "has_default": true,
875
+ "kind": "keyword_only",
876
+ "name": "selectedLabel",
877
+ "role": "attribute"
878
+ },
879
+ {
880
+ "annotation": {
881
+ "items": [
882
+ {
883
+ "dtype": "X",
884
+ "kind": "dtype"
885
+ },
886
+ {
887
+ "dtype": "NN",
888
+ "kind": "dtype"
889
+ },
890
+ {
891
+ "base": {
892
+ "dtype": "T",
893
+ "kind": "dtype"
894
+ },
895
+ "kind": "annotated",
896
+ "metadata": [
897
+ {
898
+ "flags": 0,
899
+ "kind": "regex",
900
+ "pattern": "^[\\^=].+"
901
+ }
902
+ ]
903
+ }
904
+ ],
905
+ "kind": "union"
906
+ },
907
+ "default": null,
908
+ "has_default": true,
909
+ "kind": "keyword_only",
910
+ "name": "selectedPkeys",
911
+ "role": "attribute"
912
+ },
913
+ {
914
+ "annotation": {
915
+ "items": [
916
+ {
917
+ "dtype": "T",
918
+ "kind": "dtype"
919
+ },
920
+ {
921
+ "dtype": "NN",
922
+ "kind": "dtype"
923
+ }
924
+ ],
925
+ "kind": "union"
926
+ },
927
+ "default": null,
928
+ "has_default": true,
929
+ "kind": "keyword_only",
930
+ "name": "selectedRowidx",
931
+ "role": "attribute"
932
+ },
933
+ {
934
+ "annotation": {
935
+ "items": [
936
+ {
937
+ "dtype": "X",
938
+ "kind": "dtype"
939
+ },
940
+ {
941
+ "dtype": "NN",
942
+ "kind": "dtype"
943
+ },
944
+ {
945
+ "base": {
946
+ "dtype": "T",
947
+ "kind": "dtype"
948
+ },
949
+ "kind": "annotated",
950
+ "metadata": [
951
+ {
952
+ "flags": 0,
953
+ "kind": "regex",
954
+ "pattern": "^[\\^=].+"
955
+ }
956
+ ]
957
+ }
958
+ ],
959
+ "kind": "union"
960
+ },
961
+ "default": null,
962
+ "has_default": true,
963
+ "kind": "keyword_only",
964
+ "name": "selectedNodes",
965
+ "role": "attribute"
966
+ },
967
+ {
968
+ "annotation": {
969
+ "items": [
970
+ {
971
+ "dtype": "X",
972
+ "kind": "dtype"
973
+ },
974
+ {
975
+ "dtype": "NN",
976
+ "kind": "dtype"
977
+ },
978
+ {
979
+ "base": {
980
+ "dtype": "T",
981
+ "kind": "dtype"
982
+ },
983
+ "kind": "annotated",
984
+ "metadata": [
985
+ {
986
+ "flags": 0,
987
+ "kind": "regex",
988
+ "pattern": "^[\\^=].+"
989
+ }
990
+ ]
991
+ }
992
+ ],
993
+ "kind": "union"
994
+ },
995
+ "default": null,
996
+ "has_default": true,
997
+ "kind": "keyword_only",
998
+ "name": "selectedRowData",
999
+ "role": "attribute"
1000
+ },
619
1001
  {
620
1002
  "annotation": {
621
1003
  "items": [
@@ -8,6 +8,6 @@ mygramlot = GramlotCollection(
8
8
  module="assets/index.js",
9
9
  css=(),
10
10
  dependencies=(),
11
- build_id="sha256:f58b08f79cbd299caaefaf01f1a75ad7207c703a90f62aa11510c8612f32559d",
11
+ build_id="sha256:981775460d1201f63f9a484cf3f1e35b5013023e942b7860eb87a200bf209f69",
12
12
  files=("assets/collection.js", "assets/index.js", "commands.json", "grammar.json",),
13
13
  )
@@ -18,5 +18,5 @@ ${o}`),o}_bagToXml(e=null,r=!1,n=0){let i=[];for(let s of this._nodes)i.push((r?
18
18
  ${h}
19
19
  ${" ".repeat(i)}</${o}>`:`<${o}${l}>${h}</${o}>`:r===null||r.includes(o)?`<${o}${l}/>`:`<${o}${l}></${o}>`}if(a==null||a==="")return r===null||r.includes(o)?`<${o}${l}/>`:`<${o}${l}></${o}>`;let c=a instanceof Date&&!Number.isNaN(a.getTime())?_f(a):String(a),f=this._escapeXml(c);return`<${o}${l}>${f}</${o}>`}_sanitizeTag(e){return e?e.replace(/[^a-zA-Z0-9_\-.:]/g,"_"):"_none_"}_escapeXml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}_escapeAttr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}static fromXml(e,r={}){let{tagAttribute:n=null}=r,i;if(typeof DOMParser<"u"){i=new DOMParser().parseFromString(e,"application/xml");let o=i.querySelector("parsererror");if(o)throw new Error(`XML parse error: ${o.textContent}`)}else i=new Zo.DOMParser().parseFromString(e,"application/xml");return this._xmlElementToBag(i.documentElement,n)}static _xmlElementToBag(e,r=null){let n=new this,i=Array.from(e.childNodes).filter(s=>s.nodeType===1);for(let s of i){let o=s.tagName,u={};for(let p=0;p<s.attributes.length;p++){let g=s.attributes[p];u[g.name]=g.value}let l=mn(u._resolver);l&&delete u._resolver;let a=String(u._T||"").toUpperCase()==="BAG";Object.assign(u,vi(u));let c=o;"_tag"in u&&(c=u._tag,delete u._tag),r&&r in u&&(c=u[r],delete u[r]);let f=c,h=1;for(;n.getNode(c);)c=`${f}_${h++}`;let d=Array.from(s.childNodes).filter(p=>p.nodeType===1),m;if(d.length>0||a){let p=this._xmlElementToBag(s,r);m=n.setItem(c,p,Object.keys(u).length>0?u:null)}else{let p=s.textContent||"";m=n.setItem(c,p,Object.keys(u).length>0?u:null)}l&&(m.resolver=l),m.xmlTag=o}return n}static async fromUrl(e,r={}){let{timeout:n=30}=r,i={};n&&(i.signal=AbortSignal.timeout(n*1e3));let s=await fetch(e,i),o=s.headers.get("content-type")||"",u=await s.text();if(o.includes("json"))return t.fromTytx(u);if(o.includes("xml"))return t.fromXml(u);let l=u.trim();if(l.startsWith("<"))return t.fromXml(u);if(l.startsWith("{")||l.startsWith("["))return t.fromTytx(u);throw new Tr(`Unsupported content-type: ${o}`)}toJson(e=!0){let r=[];for(let n of this._nodes)r.push(this._nodeToJsonDict(n,e));return e?De(r):JSON.stringify(r)}_nodeToJsonDict(e,r){let n=e.resolver?null:e.getValue(!0);if(n&&typeof n._nodeToJsonDict=="function"){let s=[];for(let o of n._nodes)s.push(n._nodeToJsonDict(o,r));n=s}let i={label:e.label,value:n,attr:gn(e.attr)};return e.nodeTag!==null&&(i.tag=e.nodeTag),e.resolver&&(i.resolver=Ar(e.resolver)),i}static fromJson(e,r={}){return Jo||(console.warn("Bag.fromJson is deprecated; use Bag.fromTytx"),Jo=!0),this.fromTytx(e,"json",r)}toStringTree(e=!0,r=null,n="",i=!0){r===null&&(r=new Map);let s=[],o=[...this._nodes];for(let u=0;u<o.length;u++){let l=o[u],a=u===o.length-1,c=l.getValue(e),f=l.getAttr(),h="",d=Object.keys(f);d.length>0&&(h=" ["+d.map(w=>`${w}=${JSON.stringify(f[w])}`).join(", ")+"]");let m=a?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",p=n+(a?" ":"\u2502 ");if(c instanceof t){let g=l,w=c.backref?"(*)":"";if(r.has(g))s.push(`${n}${m}${l.label}${w}${h} \u2192 (circular ref)`);else{r.set(g,l.label),s.push(`${n}${m}${l.label}${w}${h}`);let T=c.toStringTree(e,r,p,a);T&&s.push(T)}}else{let g;if(c===null)g="null";else if(c===void 0)g="undefined";else if(c instanceof ArrayBuffer||c instanceof Uint8Array){let w=new TextDecoder("utf-8",{fatal:!1}),T=c instanceof ArrayBuffer?new Uint8Array(c):c;g=w.decode(T)}else typeof c=="string"?c.length>50?g=JSON.stringify(c.slice(0,47)+"..."):g=JSON.stringify(c):g=String(c);s.push(`${n}${m}${l.label}: ${g}${h}`)}}return s.join(`
20
20
  `)}toString(e=!0,r=null,n=""){r||(r=new Set);let i=[],s=[...this._nodes];for(let o=0;o<s.length;o++){let u=s[o],l=o===s.length-1,a=u.getValue(e),c="",f=u.attr;f&&Object.keys(f).length>0&&(c=` [${Object.entries(f).map(([p,g])=>`${p}=${JSON.stringify(g)}`).join(", ")}]`);let h=l?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",d=n+(l?" ":"\u2502 ");if(a&&typeof a._htraverse=="function"){let m=u;if(r.has(m))i.push(`${n}${h}${u.label}${c} \u2192 (circular ref)`);else{r.add(m),i.push(`${n}${h}${u.label}${c}`);let p=a.toString(e,r,d);p&&i.push(p)}}else{let m;a==null?m="null":typeof a=="string"&&a.length>50?m=JSON.stringify(a.slice(0,47)+"..."):typeof a=="string"?m=JSON.stringify(a):m=String(a),i.push(`${n}${h}${u.label}: ${m}${c}`)}}return i.join(`
21
- `)}},Tr=class extends Error{constructor(e){super(e),this.name="BagException"}};ie.registerBagClass(_e);wi(_e,"X",t=>t._toTytxPayload(),t=>_e._fromTytxPayload(t));yi(_e.tytxSuffix,{...Ut(_e.tytxSuffix),Bag:_e});function Ci(t,e){let r=[],n=Object.freeze({full:e.full,rows:Object.freeze([...e.rows])});for(let i of[...t])if(t.has(i))try{i(n)}catch(s){r.push(s)}if(r.length)throw new AggregateError(r,"Collection notification failed")}var En=class{#i;#u=null;#a=new Set;#n=new Map;#t="";#e=new Map;#s=null;constructor(e){this.bindStore(e)}get bag(){return this.#i.bag}get rowMode(){return this.#i.rowMode}get sortedBy(){return this.#t}get criteria(){return Ko(this.#t)}get filter(){return this.#e.get("search")?.definition??null}get filterSignature(){return JSON.stringify([...this.#e].map(([e,{definition:r}])=>[e,r]))}get filterContributions(){return Object.freeze([...this.#e].map(([e,r])=>Object.freeze([e,Object.freeze({...r})])))}copyFiltersFrom(e){this.filterSignature!==e.filterSignature&&this.#o(this.#r(),this.#t,new Map(e.filterContributions))}get filtered(){return this.#s===null?null:[...this.#s]}isFiltered(){return this.#s!==null}value(e,r){return this.#i.value(e,r)}subscribe(e){return this.#a.add(e),()=>this.#a.delete(e)}connect(){this.#u||(this.synchronize(),this.#u=this.#i.subscribe(e=>this.synchronize(e)))}disconnect(){this.#u?.(),this.#u=null}bindStore(e){if(this.#i===e)return;let r=this.#u!==null;this.disconnect(),this.#i=e,this.#n.clear(),r?this.connect():this.synchronize()}getRows(e=!0){let r=this.#r();return e&&this.#s!==null?this.#s.map(n=>r[n]):r}#r(){return this.#i.getRows().toSorted((e,r)=>(this.#n.get(e)??1/0)-(this.#n.get(r)??1/0))}synchronize(e={full:!0,rows:[]}){if(!e.full&&!this.#t&&!this.#e.size){Ci(this.#a,e);return}this.#o(this.#f(this.#r(),this.criteria),this.#t,this.#e,e)}sort(e){let r=this.#f(this.#r(),Ko(e));this.#o(r,e,this.#e)}moveRow(e,r,n=!1){if(e===r||e.parentBag!==this.bag||r.parentBag!==this.bag)return;let i=this.getRows(!1);i.splice(i.indexOf(e),1),i.splice(i.indexOf(r)+Number(n),0,e),this.#o(i,"",this.#e)}applyFilter(e,r="search"){if(!["base","search"].includes(r))throw new TypeError("Unknown collection filter contribution");let n=e===null?null:Object.freeze({...e,columns:Object.freeze([...e.columns])});this.#c(r,n,jo(n))}applySetFilter(e){let r=e===null?null:Object.freeze(e.map(({field:i,value:s})=>{if(typeof i!="string"||!i)throw new TypeError("Set filter requires an identity field");return Ho(s),Object.freeze({field:i,value:s})})),n=r===null?null:i=>r.every(({field:s,value:o})=>zo(o,Xo(i(s))));this.#c("sets",r,n)}columnFilter(e){return this.#e.get(`column:${e}`)?.definition.values??null}columnRange(e){let r=this.#e.get(`column:${e}`)?.definition.range;return r?{...r,from:r.from&&new Date(r.from+"T00:00:00Z"),to:r.to&&new Date(r.to+"T00:00:00Z")}:null}applyColumnFilter(e,r,n=this.columnRange(e)){if(n=Mo(n),typeof e!="string"||!e)throw new TypeError("Column filter requires a field");let i=r===null?null:Bo(r),s=i?.map(at),o=i===null&&n===null?null:Object.freeze({field:e,values:i,keys:s&&Object.freeze(s),range:n}),u=o===null?null:l=>cn(l(e),n)&&(s===void 0||s.includes(at(l(e))));this.#c(`column:${e}`,o,u)}columnFacets(e){let r=new Map,n=this.#e.get(`column:${e}`)?.definition.range??null,i=this.columnFilter(e),s=i?.map(at),o=[...this.#e].filter(([u])=>u!==`column:${e}`).map(([,u])=>u.predicate).filter(u=>u!==null);for(let u of this.#r()){let l=Di(this.value(u,e)),a=at(l);r.has(a)||r.set(a,{key:a,value:l,count:0,selected:cn(l,n)&&(s===void 0||s.includes(a))}),o.every(c=>c(f=>this.value(u,f)))&&r.get(a).count++}for(let u of i??[]){let l=at(u);r.has(l)||r.set(l,{key:l,value:u,count:0,selected:!0})}return[...r.values()].filter(u=>cn(u.value,n))}#c(e,r,n){if(JSON.stringify(this.#e.get(e)?.definition??null)===JSON.stringify(r))return;let i=new Map(this.#e);r===null?i.delete(e):i.set(e,{definition:r,predicate:n}),this.#o(this.#r(),this.#t,i)}#o(e,r,n,i={full:!1,rows:[]}){let s=[...n.values()].map(c=>c.predicate).filter(c=>c!==null),o=s.length?e.flatMap((c,f)=>s.every(h=>h(d=>this.value(c,d)))?[f]:[]):null,u=i.full||r!==this.#t||n!==this.#e||e.length!==this.#n.size||e.some((c,f)=>this.#n.get(c)!==f)||JSON.stringify(o)!==JSON.stringify(this.#s);this.#n=new Map(e.map((c,f)=>[c,f])),this.#t=r,this.#e=n,this.#s=o;let l=o===null?null:new Set(o),a=u?[]:i.rows.filter(c=>this.#n.has(c)&&(l===null||l.has(this.#n.get(c))));(u||a.length||i.rows.length)&&Ci(this.#a,{full:u,rows:a})}#f(e,r){if(!r.length)return e;let n=e.map(i=>({node:i,keys:r.map(({field:s})=>this.value(i,s))}));for(let i=0;i<r.length;i++)if(new Set(n.map(o=>Sf(o.keys[i])).filter(o=>o!==null)).size>1)throw new TypeError(`collection view cannot compare mixed types in ${r[i].field}`);return n.sort((i,s)=>{for(let[o,{direction:u}]of r.entries()){let l=If(i.keys[o],s.keys[o]);if(l)return u==="a"?l:-l}return 0}).map(i=>i.node)}};function Ko(t){if(typeof t!="string")throw new TypeError("collection view sortedBy must be a string");if(t==="")return[];let e=new Set;return t.split(",").map(r=>{let n=/^([^,:]+):([ad])$/.exec(r);if(!n||e.has(n[1]))throw new TypeError(`Invalid collection view sort criterion: ${r}`);return e.add(n[1]),{field:n[1],direction:n[2]}})}function Sf(t){if(t==null)return null;if(typeof t=="number"&&Number.isFinite(t)||ee(t)&&t.isFinite())return"number";if(t instanceof Date&&Number.isFinite(t.getTime()))return"date";if(typeof t=="string"||typeof t=="boolean")return typeof t;throw new TypeError("collection view sort requires loaded finite scalar values")}function If(t,e){return t==null||e==null?t==null?e==null?0:-1:1:ee(t)?t.comparedTo(e):ee(e)?-e.comparedTo(t):t<e?-1:t>e?1:0}function wn(){return Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)),t=>t.toString(16).padStart(2,"0")).join("")}var yn=class{constructor(e,r,n,i){this.library=e,this.configuration=i,this.element=r;let{Vizabi:s,BubbleChart:o,mobx:u}=e;if(!Number.isInteger(i.getItem("year"))||typeof i.getItem("playing")!="boolean"||!Number.isFinite(i.getItem("speed"))||i.getItem("speed")<=0)throw new TypeError("Vizabi requires an integer year, Boolean playing and positive speed in milliseconds");let a=Object.fromEntries(["entityField","timeField","xField","yField","sizeField","colorField"].map(p=>[p,i.getItem(p)]));for(let[p,g]of Object.entries(a))if(typeof g!="string"||!g)throw new TypeError(`${p} requires a field name`);if(Object.entries(a).some(([p,g])=>g==="name"&&p!=="entityField"))throw new TypeError("The Vizabi entity catalogue reserves name for the entity display name");let c=n.getRows().map(p=>Object.fromEntries([...new Set(Object.values(a))].map(g=>[g,n.value(p,g)]))),f=new Set;for(let p of c){if(typeof p[a.entityField]!="string"||!Number.isInteger(p[a.timeField]))throw new TypeError("Vizabi trial requires text entities and integer years");let g=JSON.stringify([p[a.entityField],p[a.timeField]]);if(f.has(g))throw new TypeError("Vizabi requires one prepared row per entity and year");f.add(g);for(let w of[a.xField,a.yField,a.sizeField])if(typeof p[w]!="number"||!Number.isFinite(p[w]))throw new TypeError(`${w} requires finite numbers`);if(p[a.sizeField]<0)throw new TypeError("Bubble size cannot be negative");if(typeof p[a.colorField]!="string")throw new TypeError("Bubble color requires a text category")}for(let p of c)p.name=p[a.entityField];if(!c.length)throw new TypeError("No data to display");this.id=`bubble_${wn()}`,this.legendId=`legend_${wn()}`,this.sourceId=`data_${wn()}`;let h=JSON.parse(JSON.stringify(o.DEFAULT_MODEL).replaceAll("markers.bubble",`markers.${this.id}`).replaceAll("markers.legend",`markers.${this.legendId}`)),d=h.bubble;d.data={source:this.sourceId,space:[a.entityField,a.timeField]};for(let[p,g]of Object.entries({x:a.xField,y:a.yField,size:a.sizeField,color:a.colorField,label:a.entityField}))d.encoding[p].data={concept:g,constant:null};d.encoding.label.data={modelType:"entityPropertyDataConfig",concept:"name"},d.requiredEncodings=["x","y","size","color","label"],d.encoding.y.modelType="baseType",d.encoding.y.scale.type="linear",d.encoding.frame={modelType:"frame",data:{concept:a.timeField},value:String(i.getItem("year")),speed:i.getItem("speed"),splash:!1,loop:!0};let m=s({dataSources:{[this.sourceId]:{values:c,keyConcepts:[a.entityField,a.timeField],dtypes:{[a.timeField]:"year"}}},markers:{[this.id]:d,[this.legendId]:h.legend}});this.models=m,this.frame=m.markers[this.id].encoding.frame,this.tool=new o({Vizabi:s,placeholder:r,model:{config:m.config,dataSources:m.dataSources,markers:{bubble:m.markers[this.id],legend:m.markers[this.legendId]}},locale:{id:"en",resolve:{en:e.locale},placeholder:r},layout:{placeholder:r},ui:{buttons:{buttons:[]},dialogs:{dialogs:{sidebar:[],popup:[]}}}}),this.release=u.reaction(()=>{let p=m.markers[this.id];return[p.state==="fulfilled"?this.frame.value.getUTCFullYear():null,this.frame.playing,...["x","y","size","color"].map(g=>p.encoding[g].data.concept)]},([p,g,w,T,D,x])=>{if(Number.isFinite(p)){this.writing=!0;try{for(let[O,R]of Object.entries({xField:w,yField:T,sizeField:D,colorField:x}))i.getItem(O)!==R&&i.setItem(O,R);i.getItem("year")!==p&&i.setItem("year",p),i.getItem("playing")!==g&&i.setItem("playing",g)}finally{this.writing=!1}}}),this.ready=u.when(()=>m.markers[this.id].state==="fulfilled",()=>this.update())}update(){if(this.writing||this.models.markers[this.id].state!=="fulfilled")return;let e=this.configuration,r=this.frame;this.library.mobx.runInAction(()=>{r.setSpeed(e.getItem("speed")),r.value?.getUTCFullYear()!==e.getItem("year")&&r.setValue(String(e.getItem("year"))),r.playing!==e.getItem("playing")&&r.setPlaying(e.getItem("playing"))})}resize(){this.tool.services.layout._resizeHandler()}dispose(){this.release(),this.ready(),this.frame.stopPlaying(),this.tool.deconstruct();let e=this.library.Vizabi.stores;e.markers.dispose(this.legendId),e.markers.dispose(this.id),e.dataSources.dispose(this.sourceId),this.element.replaceChildren()}};var Bf=(0,Re.defineComponent)({name:"vizabiBubble",tag:"gramlot-vizabi-bubble",base:vn,sourceContext:!0,bagStore:!0,parameters:{storepath:{dtype:"T"},rowMode:{dtype:"T",default:"attributes"},configuration:{dtype:"X",binding:"read"},libraryUrl:{dtype:"T"}},implementation:t=>class extends t{#i;#u;#a;#n;#t;#e;#s;#r;#c;#o=0;#f=!1;#d=Symbol("vizabi-config");#p;#l;#h;constructor(){super(),this.control.replaceChildren(),this.#p=this.ownerDocument.createElement("style"),this.shadowRoot.append(this.#p),this.#l=this.ownerDocument.createElement("div"),this.#l.setAttribute("role","status"),this.#h=this.ownerDocument.createElement("div"),this.#h.style.cssText="width:100%;height:100%;position:relative;background:white;color:#222",this.control.append(this.#l,this.#h),this.control.style.height="100%",this.#c=new this.ownerDocument.defaultView.ResizeObserver(()=>this.#r?.resize())}setSourceContext(e){this.#i=e}setStoreBag(e){this.#u=e}projectAttributes(e,r){let n=super.projectAttributes(e,r);return this.#f&&this.#m(),n}connectedCallback(){this.#f=!0,this.#m(),this.#c.observe(this.#h)}#m(){let e=this.#n!==this.parameters.libraryUrl;this.#n=this.parameters.libraryUrl;let r=this.parameters.configuration;if(!(r instanceof Of))throw new TypeError("vizabiBubble requires a configuration Bag");this.#t!==r&&(e=!0,this.#t?.unsubscribe(this.#d,{any:!0}),this.#t=r,r.subscribe(this.#d,{any:()=>{this.#r?.writing||this.#g()}}));let n=this.#i.sourceNode.rootBuilder.binding.collectionStore(this.#u,this.parameters.rowMode);if(!this.#e)e=!0,this.#e=new En(n),this.#e.connect(),this.#s=this.#e.subscribe(()=>this.#E());else if(this.#e.bag!==this.#u){this.#e.bindStore(n);return}e&&(this.#a=null),this.#g()}#g(){let e=JSON.stringify(["entityField","timeField","xField","yField","sizeField","colorField"].map(r=>this.#t.getItem(r)));if(this.#r?.writing){this.#a=e;return}e!==this.#a?(this.#a=e,this.#E()):this.#r?.update()}async#E(){let e=++this.#o;this.#r?.dispose(),this.#r=null,this.#l.hidden=!1,this.#l.textContent="Loading optional Vizabi library\u2026";try{if(!this.parameters.libraryUrl)throw new Error("Provide libraryUrl to load the optional Vizabi module");let r=await import(this.parameters.libraryUrl);if(!this.#f||e!==this.#o)return;this.#p.textContent=r.style+`
21
+ `)}},Tr=class extends Error{constructor(e){super(e),this.name="BagException"}};ie.registerBagClass(_e);wi(_e,"X",t=>t._toTytxPayload(),t=>_e._fromTytxPayload(t));yi(_e.tytxSuffix,{...Ut(_e.tytxSuffix),Bag:_e});function Ci(t,e){let r=[],n=Object.freeze({full:e.full,rows:Object.freeze([...e.rows]),event:e.event??null,field:e.field??null});for(let i of[...t])if(t.has(i))try{i(n)}catch(s){r.push(s)}if(r.length)throw new AggregateError(r,"Collection notification failed")}var En=class{#i;#u=null;#a=new Set;#n=new Map;#t="";#e=new Map;#s=null;constructor(e){this.bindStore(e)}get bag(){return this.#i.bag}get rowMode(){return this.#i.rowMode}get sortedBy(){return this.#t}get criteria(){return Ko(this.#t)}get filter(){return this.#e.get("search")?.definition??null}get filterSignature(){return JSON.stringify([...this.#e].map(([e,{definition:r}])=>[e,r]))}get filterContributions(){return Object.freeze([...this.#e].map(([e,r])=>Object.freeze([e,Object.freeze({...r})])))}copyFiltersFrom(e){this.filterSignature!==e.filterSignature&&this.#o(this.#r(),this.#t,new Map(e.filterContributions))}get filtered(){return this.#s===null?null:[...this.#s]}isFiltered(){return this.#s!==null}value(e,r){return this.#i.value(e,r)}subscribe(e){return this.#a.add(e),()=>this.#a.delete(e)}connect(){this.#u||(this.synchronize(),this.#u=this.#i.subscribe(e=>this.synchronize(e)))}disconnect(){this.#u?.(),this.#u=null}bindStore(e){if(this.#i===e)return;let r=this.#u!==null;this.disconnect(),this.#i=e,this.#n.clear(),r?this.connect():this.synchronize()}getRows(e=!0){let r=this.#r();return e&&this.#s!==null?this.#s.map(n=>r[n]):r}#r(){return this.#i.getRows().toSorted((e,r)=>(this.#n.get(e)??1/0)-(this.#n.get(r)??1/0))}synchronize(e={full:!0,rows:[]}){if(!e.full&&!this.#t&&!this.#e.size){Ci(this.#a,{full:e.full,rows:e.rows});return}this.#o(this.#f(this.#r(),this.criteria),this.#t,this.#e,e)}sort(e){let r=this.#f(this.#r(),Ko(e));this.#o(r,e,this.#e)}moveRow(e,r,n=!1){if(e===r||e.parentBag!==this.bag||r.parentBag!==this.bag)return;let i=this.getRows(!1);i.splice(i.indexOf(e),1),i.splice(i.indexOf(r)+Number(n),0,e),this.#o(i,"",this.#e)}applyFilter(e,r="search"){if(!["base","search"].includes(r))throw new TypeError("Unknown collection filter contribution");let n=e===null?null:Object.freeze({...e,columns:Object.freeze([...e.columns])});this.#c(r,n,jo(n))}applySetFilter(e){let r=e===null?null:Object.freeze(e.map(({field:i,value:s})=>{if(typeof i!="string"||!i)throw new TypeError("Set filter requires an identity field");return Ho(s),Object.freeze({field:i,value:s})})),n=r===null?null:i=>r.every(({field:s,value:o})=>zo(o,Xo(i(s))));this.#c("sets",r,n)}columnFilter(e){return this.#e.get(`column:${e}`)?.definition.values??null}columnRange(e){let r=this.#e.get(`column:${e}`)?.definition.range;return r?{...r,from:r.from&&new Date(r.from+"T00:00:00Z"),to:r.to&&new Date(r.to+"T00:00:00Z")}:null}applyColumnFilter(e,r,n=this.columnRange(e)){if(n=Mo(n),typeof e!="string"||!e)throw new TypeError("Column filter requires a field");let i=r===null?null:Bo(r),s=i?.map(at),o=i===null&&n===null?null:Object.freeze({field:e,values:i,keys:s&&Object.freeze(s),range:n}),u=o===null?null:l=>cn(l(e),n)&&(s===void 0||s.includes(at(l(e))));this.#c(`column:${e}`,o,u)}columnFacets(e){let r=new Map,n=this.#e.get(`column:${e}`)?.definition.range??null,i=this.columnFilter(e),s=i?.map(at),o=[...this.#e].filter(([u])=>u!==`column:${e}`).map(([,u])=>u.predicate).filter(u=>u!==null);for(let u of this.#r()){let l=Di(this.value(u,e)),a=at(l);r.has(a)||r.set(a,{key:a,value:l,count:0,selected:cn(l,n)&&(s===void 0||s.includes(a))}),o.every(c=>c(f=>this.value(u,f)))&&r.get(a).count++}for(let u of i??[]){let l=at(u);r.has(l)||r.set(l,{key:l,value:u,count:0,selected:!0})}return[...r.values()].filter(u=>cn(u.value,n))}#c(e,r,n){if(JSON.stringify(this.#e.get(e)?.definition??null)===JSON.stringify(r))return;let i=new Map(this.#e);r===null?i.delete(e):i.set(e,{definition:r,predicate:n}),this.#o(this.#r(),this.#t,i)}#o(e,r,n,i={full:!1,rows:[]}){let s=[...n.values()].map(c=>c.predicate).filter(c=>c!==null),o=s.length?e.flatMap((c,f)=>s.every(h=>h(d=>this.value(c,d)))?[f]:[]):null,u=i.full||r!==this.#t||n!==this.#e||e.length!==this.#n.size||e.some((c,f)=>this.#n.get(c)!==f)||JSON.stringify(o)!==JSON.stringify(this.#s);this.#n=new Map(e.map((c,f)=>[c,f])),this.#t=r,this.#e=n,this.#s=o;let l=o===null?null:new Set(o),a=u?[]:i.rows.filter(c=>this.#n.has(c)&&(l===null||l.has(this.#n.get(c))));(u||a.length||i.rows.length)&&Ci(this.#a,{full:u,rows:a})}#f(e,r){if(!r.length)return e;let n=e.map(i=>({node:i,keys:r.map(({field:s})=>this.value(i,s))}));for(let i=0;i<r.length;i++)if(new Set(n.map(o=>Sf(o.keys[i])).filter(o=>o!==null)).size>1)throw new TypeError(`collection view cannot compare mixed types in ${r[i].field}`);return n.sort((i,s)=>{for(let[o,{direction:u}]of r.entries()){let l=If(i.keys[o],s.keys[o]);if(l)return u==="a"?l:-l}return 0}).map(i=>i.node)}};function Ko(t){if(typeof t!="string")throw new TypeError("collection view sortedBy must be a string");if(t==="")return[];let e=new Set;return t.split(",").map(r=>{let n=/^([^,:]+):([ad])$/.exec(r);if(!n||e.has(n[1]))throw new TypeError(`Invalid collection view sort criterion: ${r}`);return e.add(n[1]),{field:n[1],direction:n[2]}})}function Sf(t){if(t==null)return null;if(typeof t=="number"&&Number.isFinite(t)||ee(t)&&t.isFinite())return"number";if(t instanceof Date&&Number.isFinite(t.getTime()))return"date";if(typeof t=="string"||typeof t=="boolean")return typeof t;throw new TypeError("collection view sort requires loaded finite scalar values")}function If(t,e){return t==null||e==null?t==null?e==null?0:-1:1:ee(t)?t.comparedTo(e):ee(e)?-e.comparedTo(t):t<e?-1:t>e?1:0}function wn(){return Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)),t=>t.toString(16).padStart(2,"0")).join("")}var yn=class{constructor(e,r,n,i){this.library=e,this.configuration=i,this.element=r;let{Vizabi:s,BubbleChart:o,mobx:u}=e;if(!Number.isInteger(i.getItem("year"))||typeof i.getItem("playing")!="boolean"||!Number.isFinite(i.getItem("speed"))||i.getItem("speed")<=0)throw new TypeError("Vizabi requires an integer year, Boolean playing and positive speed in milliseconds");let a=Object.fromEntries(["entityField","timeField","xField","yField","sizeField","colorField"].map(p=>[p,i.getItem(p)]));for(let[p,g]of Object.entries(a))if(typeof g!="string"||!g)throw new TypeError(`${p} requires a field name`);if(Object.entries(a).some(([p,g])=>g==="name"&&p!=="entityField"))throw new TypeError("The Vizabi entity catalogue reserves name for the entity display name");let c=n.getRows().map(p=>Object.fromEntries([...new Set(Object.values(a))].map(g=>[g,n.value(p,g)]))),f=new Set;for(let p of c){if(typeof p[a.entityField]!="string"||!Number.isInteger(p[a.timeField]))throw new TypeError("Vizabi trial requires text entities and integer years");let g=JSON.stringify([p[a.entityField],p[a.timeField]]);if(f.has(g))throw new TypeError("Vizabi requires one prepared row per entity and year");f.add(g);for(let w of[a.xField,a.yField,a.sizeField])if(typeof p[w]!="number"||!Number.isFinite(p[w]))throw new TypeError(`${w} requires finite numbers`);if(p[a.sizeField]<0)throw new TypeError("Bubble size cannot be negative");if(typeof p[a.colorField]!="string")throw new TypeError("Bubble color requires a text category")}for(let p of c)p.name=p[a.entityField];if(!c.length)throw new TypeError("No data to display");this.id=`bubble_${wn()}`,this.legendId=`legend_${wn()}`,this.sourceId=`data_${wn()}`;let h=JSON.parse(JSON.stringify(o.DEFAULT_MODEL).replaceAll("markers.bubble",`markers.${this.id}`).replaceAll("markers.legend",`markers.${this.legendId}`)),d=h.bubble;d.data={source:this.sourceId,space:[a.entityField,a.timeField]};for(let[p,g]of Object.entries({x:a.xField,y:a.yField,size:a.sizeField,color:a.colorField,label:a.entityField}))d.encoding[p].data={concept:g,constant:null};d.encoding.label.data={modelType:"entityPropertyDataConfig",concept:"name"},d.requiredEncodings=["x","y","size","color","label"],d.encoding.y.modelType="baseType",d.encoding.y.scale.type="linear",d.encoding.frame={modelType:"frame",data:{concept:a.timeField},value:String(i.getItem("year")),speed:i.getItem("speed"),splash:!1,loop:!0};let m=s({dataSources:{[this.sourceId]:{values:c,keyConcepts:[a.entityField,a.timeField],dtypes:{[a.timeField]:"year"}}},markers:{[this.id]:d,[this.legendId]:h.legend}});this.models=m,this.frame=m.markers[this.id].encoding.frame,this.tool=new o({Vizabi:s,placeholder:r,model:{config:m.config,dataSources:m.dataSources,markers:{bubble:m.markers[this.id],legend:m.markers[this.legendId]}},locale:{id:"en",resolve:{en:e.locale},placeholder:r},layout:{placeholder:r},ui:{buttons:{buttons:[]},dialogs:{dialogs:{sidebar:[],popup:[]}}}}),this.release=u.reaction(()=>{let p=m.markers[this.id];return[p.state==="fulfilled"?this.frame.value.getUTCFullYear():null,this.frame.playing,...["x","y","size","color"].map(g=>p.encoding[g].data.concept)]},([p,g,w,T,D,x])=>{if(Number.isFinite(p)){this.writing=!0;try{for(let[O,R]of Object.entries({xField:w,yField:T,sizeField:D,colorField:x}))i.getItem(O)!==R&&i.setItem(O,R);i.getItem("year")!==p&&i.setItem("year",p),i.getItem("playing")!==g&&i.setItem("playing",g)}finally{this.writing=!1}}}),this.ready=u.when(()=>m.markers[this.id].state==="fulfilled",()=>this.update())}update(){if(this.writing||this.models.markers[this.id].state!=="fulfilled")return;let e=this.configuration,r=this.frame;this.library.mobx.runInAction(()=>{r.setSpeed(e.getItem("speed")),r.value?.getUTCFullYear()!==e.getItem("year")&&r.setValue(String(e.getItem("year"))),r.playing!==e.getItem("playing")&&r.setPlaying(e.getItem("playing"))})}resize(){this.tool.services.layout._resizeHandler()}dispose(){this.release(),this.ready(),this.frame.stopPlaying(),this.tool.deconstruct();let e=this.library.Vizabi.stores;e.markers.dispose(this.legendId),e.markers.dispose(this.id),e.dataSources.dispose(this.sourceId),this.element.replaceChildren()}};var Bf=(0,Re.defineComponent)({name:"vizabiBubble",tag:"gramlot-vizabi-bubble",base:vn,sourceContext:!0,bagStore:!0,parameters:{storepath:{dtype:"T"},rowMode:{dtype:"T",default:"attributes"},configuration:{dtype:"X",binding:"read"},libraryUrl:{dtype:"T"}},implementation:t=>class extends t{#i;#u;#a;#n;#t;#e;#s;#r;#c;#o=0;#f=!1;#d=Symbol("vizabi-config");#p;#l;#h;constructor(){super(),this.control.replaceChildren(),this.#p=this.ownerDocument.createElement("style"),this.shadowRoot.append(this.#p),this.#l=this.ownerDocument.createElement("div"),this.#l.setAttribute("role","status"),this.#h=this.ownerDocument.createElement("div"),this.#h.style.cssText="width:100%;height:100%;position:relative;background:white;color:#222",this.control.append(this.#l,this.#h),this.control.style.height="100%",this.#c=new this.ownerDocument.defaultView.ResizeObserver(()=>this.#r?.resize())}setSourceContext(e){this.#i=e}setStoreBag(e){this.#u=e}projectAttributes(e,r){let n=super.projectAttributes(e,r);return this.#f&&this.#m(),n}connectedCallback(){this.#f=!0,this.#m(),this.#c.observe(this.#h)}#m(){let e=this.#n!==this.parameters.libraryUrl;this.#n=this.parameters.libraryUrl;let r=this.parameters.configuration;if(!(r instanceof Of))throw new TypeError("vizabiBubble requires a configuration Bag");this.#t!==r&&(e=!0,this.#t?.unsubscribe(this.#d,{any:!0}),this.#t=r,r.subscribe(this.#d,{any:()=>{this.#r?.writing||this.#g()}}));let n=this.#i.sourceNode.rootBuilder.binding.collectionStore(this.#u,this.parameters.rowMode);if(!this.#e)e=!0,this.#e=new En(n),this.#e.connect(),this.#s=this.#e.subscribe(()=>this.#E());else if(this.#e.bag!==this.#u){this.#e.bindStore(n);return}e&&(this.#a=null),this.#g()}#g(){let e=JSON.stringify(["entityField","timeField","xField","yField","sizeField","colorField"].map(r=>this.#t.getItem(r)));if(this.#r?.writing){this.#a=e;return}e!==this.#a?(this.#a=e,this.#E()):this.#r?.update()}async#E(){let e=++this.#o;this.#r?.dispose(),this.#r=null,this.#l.hidden=!1,this.#l.textContent="Loading optional Vizabi library\u2026";try{if(!this.parameters.libraryUrl)throw new Error("Provide libraryUrl to load the optional Vizabi module");let r=await import(this.parameters.libraryUrl);if(!this.#f||e!==this.#o)return;this.#p.textContent=r.style+`
22
22
  :host{display:block;height:100%;min-height:0}.control-box{height:100%}`,this.#r=new yn(r,this.#h,this.#e,this.#t),this.#l.hidden=!0}catch(r){if(e!==this.#o)return;this.#l.setAttribute("role","alert"),this.#l.textContent=r.message}}disconnectedCallback(){this.#f=!1,this.#o++,this.#c.disconnect(),this.#t?.unsubscribe(this.#d,{any:!0}),this.#s?.(),this.#e?.disconnect(),this.#r?.dispose(),this.#r=null,this.#e=null,this.#t=null}}}),t0=bn({name:"vizabi",components:[Bf]});export{t0 as default};
@@ -1,3 +1,3 @@
1
1
  export {default} from "./collection.js";
2
2
  export * from "./collection.js";
3
- export const buildId = "sha256:f58b08f79cbd299caaefaf01f1a75ad7207c703a90f62aa11510c8612f32559d";
3
+ export const buildId = "sha256:981775460d1201f63f9a484cf3f1e35b5013023e942b7860eb87a200bf209f69";