@fluid-topics/ft-infinite-scroll 1.1.25 → 1.1.26
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.
|
@@ -28,10 +28,13 @@ export declare class FtInfiniteScroll<T> extends FtLitElement implements FtInfin
|
|
|
28
28
|
scrolledToTarget: boolean;
|
|
29
29
|
private scrolling;
|
|
30
30
|
private firstScrollableParent?;
|
|
31
|
-
private
|
|
31
|
+
private renderApprovalTimeouts;
|
|
32
|
+
private renderedIndexes;
|
|
32
33
|
private get scrollable();
|
|
33
34
|
protected render(): TemplateResult<1>;
|
|
34
35
|
private renderItemContainer;
|
|
36
|
+
private prepareRenderIfNeeded;
|
|
37
|
+
private inRenderRange;
|
|
35
38
|
private scrollDebouncer;
|
|
36
39
|
private scrollDoneDebouncer;
|
|
37
40
|
resetScroll(): void;
|
|
@@ -38,7 +38,8 @@ class FtInfiniteScroll extends FtLitElement {
|
|
|
38
38
|
this.visibleItems = [];
|
|
39
39
|
this.scrolledToTarget = false;
|
|
40
40
|
this.scrolling = false;
|
|
41
|
-
this.
|
|
41
|
+
this.renderApprovalTimeouts = [];
|
|
42
|
+
this.renderedIndexes = new Set();
|
|
42
43
|
this.scrollDebouncer = new Debouncer(5);
|
|
43
44
|
this.scrollDoneDebouncer = new Debouncer(10);
|
|
44
45
|
this.onVisibilityChange = (items) => {
|
|
@@ -57,7 +58,7 @@ class FtInfiniteScroll extends FtLitElement {
|
|
|
57
58
|
this.visibleItems = [...visibleItems].sort((a, b) => a - b);
|
|
58
59
|
};
|
|
59
60
|
this.intersectionObserver = new IntersectionObserver(this.onVisibilityChange);
|
|
60
|
-
this.scrollingDebouncer = new Debouncer(
|
|
61
|
+
this.scrollingDebouncer = new Debouncer(50);
|
|
61
62
|
this.ignoreNextScrollEvent = false;
|
|
62
63
|
this.scrollListener = () => {
|
|
63
64
|
if (!this.ignoreNextScrollEvent) {
|
|
@@ -107,12 +108,9 @@ class FtInfiniteScroll extends FtLitElement {
|
|
|
107
108
|
`;
|
|
108
109
|
}
|
|
109
110
|
renderItemContainer(item, index) {
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
const isRendered = this.
|
|
113
|
-
if (isRendered) {
|
|
114
|
-
this.alreadyRenderedIndexes.add(index);
|
|
115
|
-
}
|
|
111
|
+
this.prepareRenderIfNeeded(index);
|
|
112
|
+
const isVisible = this.scrolledToTarget && this.visibleItems.includes(index);
|
|
113
|
+
const isRendered = this.renderedIndexes.has(index);
|
|
116
114
|
const renderItem = () => {
|
|
117
115
|
const rendered = this.renderItem(item, index);
|
|
118
116
|
return typeof rendered === "string" ? unsafeHTML(rendered) : rendered;
|
|
@@ -125,6 +123,23 @@ class FtInfiniteScroll extends FtLitElement {
|
|
|
125
123
|
</div>
|
|
126
124
|
`;
|
|
127
125
|
}
|
|
126
|
+
prepareRenderIfNeeded(index) {
|
|
127
|
+
const isAwaitingRenderApproval = this.renderApprovalTimeouts[index] != null;
|
|
128
|
+
if (this.inRenderRange(index) && !isAwaitingRenderApproval) {
|
|
129
|
+
this.renderApprovalTimeouts[index] = setTimeout(() => {
|
|
130
|
+
if (this.inRenderRange(index)) { // Still in render range after timeout
|
|
131
|
+
this.renderedIndexes.add(index);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this.renderApprovalTimeouts[index] = undefined;
|
|
135
|
+
}
|
|
136
|
+
this.requestUpdate();
|
|
137
|
+
}, 300);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
inRenderRange(index) {
|
|
141
|
+
return index >= this.visibleItems[0] - this.renderBeforeFirst && index <= last(this.visibleItems) + this.renderAfterLast;
|
|
142
|
+
}
|
|
128
143
|
resetScroll() {
|
|
129
144
|
this.triggerFindScrollableParent();
|
|
130
145
|
this.intersectionObserver.disconnect();
|
|
@@ -143,6 +158,9 @@ class FtInfiniteScroll extends FtLitElement {
|
|
|
143
158
|
this.scrollRestorationItem = internalScrollToIndex >= 0 ? internalScrollToIndex : undefined;
|
|
144
159
|
this.scrollRestorationOffset = internalScrollToIndex === 0 ? -this.getOffset(target) : 0;
|
|
145
160
|
this.onMutation();
|
|
161
|
+
if (target != null) {
|
|
162
|
+
this.renderedIndexes.add(internalScrollToIndex);
|
|
163
|
+
}
|
|
146
164
|
this.scrolledToTarget = true;
|
|
147
165
|
});
|
|
148
166
|
});
|
|
@@ -266,7 +284,7 @@ class FtInfiniteScroll extends FtLitElement {
|
|
|
266
284
|
update(props) {
|
|
267
285
|
super.update(props);
|
|
268
286
|
if (props.has("items")) {
|
|
269
|
-
this.
|
|
287
|
+
this.renderedIndexes = new Set();
|
|
270
288
|
}
|
|
271
289
|
if ((props.has("scrollToItem") || props.has("scrollToIndex")) && (this.scrollToItem != null || this.scrollToIndex != null)) {
|
|
272
290
|
this.resetScroll();
|
|
@@ -352,4 +370,7 @@ __decorate([
|
|
|
352
370
|
__decorate([
|
|
353
371
|
state()
|
|
354
372
|
], FtInfiniteScroll.prototype, "scrolling", void 0);
|
|
373
|
+
__decorate([
|
|
374
|
+
state({ hasChanged: (a, b) => !deepEqual(a, b) })
|
|
375
|
+
], FtInfiniteScroll.prototype, "renderedIndexes", void 0);
|
|
355
376
|
export { FtInfiniteScroll };
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
display: flow-root;
|
|
29
29
|
min-height: ${l.itemContainerMinHeight};
|
|
30
30
|
}
|
|
31
|
-
`;var o=function(t,i,e,s){for(var h,n=arguments.length,l=n<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,r=t.length-1;r>=0;r--)(h=t[r])&&(l=(n<3?h(l):n>3?h(i,e,l):h(i,e))||l);return n>3&&l&&Object.defineProperty(i,e,l),l};class a extends CustomEvent{constructor(t,i){super("visible-items-change",{detail:{visibleIndexes:t,visibleItems:i}})}}class d extends Event{constructor(){super("scrolled-to-target")}}class c extends i.FtLitElement{constructor(){super(...arguments),this.items=[],this.renderItem=()=>e.html``,this.getItemKey=(t,i)=>`${i} - ${JSON.stringify(t)}`,this.internalScroll=!1,this.renderBeforeFirst=1,this.renderAfterLast=1,this.visibleItems=[],this.scrolledToTarget=!1,this.scrolling=!1,this.
|
|
31
|
+
`;var o=function(t,i,e,s){for(var h,n=arguments.length,l=n<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,r=t.length-1;r>=0;r--)(h=t[r])&&(l=(n<3?h(l):n>3?h(i,e,l):h(i,e))||l);return n>3&&l&&Object.defineProperty(i,e,l),l};class a extends CustomEvent{constructor(t,i){super("visible-items-change",{detail:{visibleIndexes:t,visibleItems:i}})}}class d extends Event{constructor(){super("scrolled-to-target")}}class c extends i.FtLitElement{constructor(){super(...arguments),this.items=[],this.renderItem=()=>e.html``,this.getItemKey=(t,i)=>`${i} - ${JSON.stringify(t)}`,this.internalScroll=!1,this.renderBeforeFirst=1,this.renderAfterLast=1,this.visibleItems=[],this.scrolledToTarget=!1,this.scrolling=!1,this.renderApprovalTimeouts=[],this.renderedIndexes=new Set,this.scrollDebouncer=new i.Debouncer(5),this.scrollDoneDebouncer=new i.Debouncer(10),this.onVisibilityChange=t=>{let i=new Set(this.visibleItems),e=new Set;for(let s of t){let t=+s.target.attributes.getNamedItem("data-item-index").value;s.intersectionRect.height>0?(i.add(t),e.add(t)):e.has(t)||i.delete(t)}this.visibleItems=[...i].sort(((t,i)=>t-i))},this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange),this.scrollingDebouncer=new i.Debouncer(50),this.ignoreNextScrollEvent=!1,this.scrollListener=()=>{this.ignoreNextScrollEvent||(this.scrolling=!0,this.scrollingDebouncer.run((()=>this.scrolling=!1))),this.ignoreNextScrollEvent=!1;const t=this.searchFirstVisibleItem(this.itemsContainer.children);this.scrollRestorationItem=t?+t.getAttribute("data-item-index"):void 0,this.scrollRestorationOffset=this.scrollable.scrollTop-this.getOffset(t)},this.onResize=t=>{for(const i of t)i.contentRect.height>0&&i.target.setAttribute("data-last-known-height",""+i.contentRect.height);if(null!=this.scrollRestorationItem&&null!=this.scrollRestorationOffset&&this.scrolledToTarget){this.ignoreNextScrollEvent=!0;const t=this.getItem(this.scrollRestorationItem),e=this.getOffset(t),s=i.minmax(0===this.scrollRestorationItem?-e:0,this.scrollRestorationOffset,this.getLastKnownHeight(t)+1);this.scrollable.scrollTop=e+s}},this.resizeObserver=new ResizeObserver(this.onResize),this.onMutation=()=>{[...this.itemsContainer.children].forEach((t=>{this.intersectionObserver.observe(t),this.resizeObserver.observe(t)}))},this.mutationObserver=new MutationObserver(this.onMutation),this.resetVisibleItemsDebouncer=new i.Debouncer(10)}get scrollable(){var t;return null!==(t=this.internalScroll?this.internalScrollable:this.firstScrollableParent)&&void 0!==t?t:document.body}render(){return e.html`
|
|
32
32
|
<div class="items-container ${this.internalScroll?"scrollable":""}"
|
|
33
33
|
tabindex="-1"
|
|
34
34
|
@find-scrollable-parent=${this.findScrollableParent}>
|
|
35
35
|
${h.repeat(this.items,((t,i)=>this.getItemKey(t,i)),((t,i)=>this.renderItemContainer(t,i)))}
|
|
36
36
|
</div>
|
|
37
|
-
`}renderItemContainer(t,i){const s
|
|
37
|
+
`}renderItemContainer(t,i){this.prepareRenderIfNeeded(i);const s=this.scrolledToTarget&&this.visibleItems.includes(i),h=this.renderedIndexes.has(i);return e.html`
|
|
38
38
|
<div id="item-${i}"
|
|
39
|
-
class="item-container ${
|
|
39
|
+
class="item-container ${h?"rendered":""} ${s?"visible":""}"
|
|
40
40
|
data-item-index="${i}">
|
|
41
|
-
${
|
|
41
|
+
${h?(()=>{const e=this.renderItem(t,i);return"string"==typeof e?n.unsafeHTML(e):e})():e.nothing}
|
|
42
42
|
</div>
|
|
43
|
-
`}resetScroll(){this.triggerFindScrollableParent(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.visibleItems=[],this.scrolledToTarget=!1,this.scrollDebouncer.run((()=>{var t;let i=null!==(t=this.scrollToIndex)&&void 0!==t?t:this.scrollToItem?this.items.indexOf(this.scrollToItem):-1;i>=this.items.length&&(i=-1);const e=this.getItem(i);this.scrollToTarget(e),this.scrollDoneDebouncer.run((()=>{this.scrollRestorationItem=i>=0?i:void 0,this.scrollRestorationOffset=0===i?-this.getOffset(e):0,this.onMutation(),this.scrolledToTarget=!0}))}))}getItem(t){var i;return null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(`#item-${t}`)}scrollToTarget(t){var i;if(t){let e=+(null!==(i=t.getAttribute("data-item-index"))&&void 0!==i?i:"0");this.scrollable&&0===e?this.scrollable.scrollTop=0:this.scrollable.scrollTop=this.getOffset(t)}}getOffset(t){var i;let e=0,s=t;for(;s&&s.offsetParent!==this.scrollable.offsetParent;)e+=s.offsetTop,s=s.offsetParent;return e+(null!==(i=null==s?void 0:s.offsetTop)&&void 0!==i?i:0)-this.scrollable.offsetTop}getLastKnownHeight(t){var i;return+(null!==(i=null==t?void 0:t.getAttribute("data-last-known-height"))&&void 0!==i?i:1e3)}appendItems(...t){this.items=[...this.items,...t]}prependItems(...t){this.items=[...t,...this.items]}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.triggerFindScrollableParent(),this.initIntersectionObserver(),this.mutationObserver.disconnect(),this.mutationObserver.observe(this.itemsContainer,{childList:!0})}),0)}initIntersectionObserver(){this.intersectionObserver.disconnect(),this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange,{root:this.scrollable,rootMargin:"-8px",threshold:[0,.01,.1,1]})}triggerFindScrollableParent(){var t;null===(t=this.itemsContainer)||void 0===t||t.dispatchEvent(new Event("find-scrollable-parent",{composed:!0}))}findScrollableParent(t){var i;let e,s;t.stopPropagation();for(let i of t.composedPath()){const t=i,h=this.elementCanScroll(t);if(t.clientHeight&&t.clientHeight<t.scrollHeight&&h){e=t;break}h&&(s=t)}let h=e||s;h!==this.firstScrollableParent&&(null===(i=this.firstScrollableParent)||void 0===i||i.removeEventListener("scroll",this.scrollListener),null==h||h.addEventListener("scroll",this.scrollListener),this.firstScrollableParent=h,this.initIntersectionObserver(),this.resetScroll())}elementCanScroll(t){try{return["auto","scroll"].includes(getComputedStyle(t).overflowY)}catch(t){return!1}}searchFirstVisibleItem(t,i,e){if(i=null!=i?i:0,(e=null!=e?e:t.length-1)<=i)return t[i];const s=Math.floor((e-i)/2)+i,h=t[s];return this.getOffset(h)>this.scrollable.scrollTop?this.searchFirstVisibleItem(t,i,s-1):this.getOffset(h)+this.getLastKnownHeight(h)<this.scrollable.scrollTop?this.searchFirstVisibleItem(t,s+1,e):h}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.mutationObserver.disconnect()}firstUpdated(t){super.firstUpdated(t),this.resetScroll()}update(t){super.update(t),t.has("items")&&(this.
|
|
43
|
+
`}prepareRenderIfNeeded(t){const i=null!=this.renderApprovalTimeouts[t];this.inRenderRange(t)&&!i&&(this.renderApprovalTimeouts[t]=setTimeout((()=>{this.inRenderRange(t)?this.renderedIndexes.add(t):this.renderApprovalTimeouts[t]=void 0,this.requestUpdate()}),300))}inRenderRange(t){return t>=this.visibleItems[0]-this.renderBeforeFirst&&t<=(null!=(i=this.visibleItems)?i:[])[(null!=i?i:[]).length-1]+this.renderAfterLast;var i}resetScroll(){this.triggerFindScrollableParent(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.visibleItems=[],this.scrolledToTarget=!1,this.scrollDebouncer.run((()=>{var t;let i=null!==(t=this.scrollToIndex)&&void 0!==t?t:this.scrollToItem?this.items.indexOf(this.scrollToItem):-1;i>=this.items.length&&(i=-1);const e=this.getItem(i);this.scrollToTarget(e),this.scrollDoneDebouncer.run((()=>{this.scrollRestorationItem=i>=0?i:void 0,this.scrollRestorationOffset=0===i?-this.getOffset(e):0,this.onMutation(),null!=e&&this.renderedIndexes.add(i),this.scrolledToTarget=!0}))}))}getItem(t){var i;return null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(`#item-${t}`)}scrollToTarget(t){var i;if(t){let e=+(null!==(i=t.getAttribute("data-item-index"))&&void 0!==i?i:"0");this.scrollable&&0===e?this.scrollable.scrollTop=0:this.scrollable.scrollTop=this.getOffset(t)}}getOffset(t){var i;let e=0,s=t;for(;s&&s.offsetParent!==this.scrollable.offsetParent;)e+=s.offsetTop,s=s.offsetParent;return e+(null!==(i=null==s?void 0:s.offsetTop)&&void 0!==i?i:0)-this.scrollable.offsetTop}getLastKnownHeight(t){var i;return+(null!==(i=null==t?void 0:t.getAttribute("data-last-known-height"))&&void 0!==i?i:1e3)}appendItems(...t){this.items=[...this.items,...t]}prependItems(...t){this.items=[...t,...this.items]}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.triggerFindScrollableParent(),this.initIntersectionObserver(),this.mutationObserver.disconnect(),this.mutationObserver.observe(this.itemsContainer,{childList:!0})}),0)}initIntersectionObserver(){this.intersectionObserver.disconnect(),this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange,{root:this.scrollable,rootMargin:"-8px",threshold:[0,.01,.1,1]})}triggerFindScrollableParent(){var t;null===(t=this.itemsContainer)||void 0===t||t.dispatchEvent(new Event("find-scrollable-parent",{composed:!0}))}findScrollableParent(t){var i;let e,s;t.stopPropagation();for(let i of t.composedPath()){const t=i,h=this.elementCanScroll(t);if(t.clientHeight&&t.clientHeight<t.scrollHeight&&h){e=t;break}h&&(s=t)}let h=e||s;h!==this.firstScrollableParent&&(null===(i=this.firstScrollableParent)||void 0===i||i.removeEventListener("scroll",this.scrollListener),null==h||h.addEventListener("scroll",this.scrollListener),this.firstScrollableParent=h,this.initIntersectionObserver(),this.resetScroll())}elementCanScroll(t){try{return["auto","scroll"].includes(getComputedStyle(t).overflowY)}catch(t){return!1}}searchFirstVisibleItem(t,i,e){if(i=null!=i?i:0,(e=null!=e?e:t.length-1)<=i)return t[i];const s=Math.floor((e-i)/2)+i,h=t[s];return this.getOffset(h)>this.scrollable.scrollTop?this.searchFirstVisibleItem(t,i,s-1):this.getOffset(h)+this.getLastKnownHeight(h)<this.scrollable.scrollTop?this.searchFirstVisibleItem(t,s+1,e):h}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.mutationObserver.disconnect()}firstUpdated(t){super.firstUpdated(t),this.resetScroll()}update(t){super.update(t),t.has("items")&&(this.renderedIndexes=new Set),!t.has("scrollToItem")&&!t.has("scrollToIndex")||null==this.scrollToItem&&null==this.scrollToIndex||this.resetScroll()}updated(t){super.updated(t),(t.has("visibleItems")||t.has("items"))&&this.onVisibleItemsChange(),t.has("scrolledToTarget")&&this.scrolledToTarget&&(null!=this.scrollToItem||null!=this.scrollToIndex)&&this.dispatchEvent(new d)}onVisibleItemsChange(){this.visibleItems.every(((t,i)=>null==this.visibleItems[i+1]||t+1===this.visibleItems[i+1]))||i.deepEqual(this.visibleItems,this.lastNotOkVisibleItems)?(this.resetVisibleItemsDebouncer.cancel(),this.dispatchVisibleItemsEvent()):this.resetVisibleItemsDebouncer.run((()=>{this.lastNotOkVisibleItems=[...this.visibleItems],this.visibleItems=[],this.initIntersectionObserver(),this.onMutation()}))}dispatchVisibleItemsEvent(){var t;null===(t=this.cancelableDispatchEvent)||void 0===t||t.cancel(),this.cancelableDispatchEvent=i.cancelable(i.waitUntil((()=>!this.scrolling))),this.cancelableDispatchEvent.then((()=>this.dispatchEvent(new a(this.visibleItems,this.visibleItems.map((t=>this.items[t])))))).catch((()=>null))}}c.styles=r,o([s.property({type:Array})],c.prototype,"items",void 0),o([s.property({attribute:!1})],c.prototype,"renderItem",void 0),o([s.property({attribute:!1})],c.prototype,"getItemKey",void 0),o([s.property({type:Object})],c.prototype,"scrollToItem",void 0),o([s.property({type:Number})],c.prototype,"scrollToIndex",void 0),o([s.property({type:Boolean})],c.prototype,"internalScroll",void 0),o([s.property({type:Number})],c.prototype,"renderBeforeFirst",void 0),o([s.property({type:Number})],c.prototype,"renderAfterLast",void 0),o([s.state({hasChanged:(t,i)=>null!=t&&null==i||t.length!==i.length||t[0]!==i[0]})],c.prototype,"visibleItems",void 0),o([s.query(".scrollable")],c.prototype,"internalScrollable",void 0),o([s.query(".items-container")],c.prototype,"itemsContainer",void 0),o([s.state()],c.prototype,"scrolledToTarget",void 0),o([s.state()],c.prototype,"scrolling",void 0),o([s.state({hasChanged:(t,e)=>!i.deepEqual(t,e)})],c.prototype,"renderedIndexes",void 0),i.customElement("ft-infinite-scroll")(c),t.FtInfiniteScroll=c,t.FtInfiniteScrollCssVariables=l,t.ScrolledToTargetEvent=d,t.VisibleItemsChangeEvent=a,t.styles=r}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litUnsafeHTML);
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
* subject to an additional IP rights grant found at
|
|
13
13
|
* http://polymer.github.io/PATENTS.txt
|
|
14
14
|
*/
|
|
15
|
-
if(!ShadowRoot.prototype.createElement){const t=window.HTMLElement,o=window.customElements.define,e=window.customElements.get,r=window.customElements,i=new WeakMap,n=new WeakMap,
|
|
15
|
+
if(!ShadowRoot.prototype.createElement){const t=window.HTMLElement,o=window.customElements.define,e=window.customElements.get,r=window.customElements,i=new WeakMap,n=new WeakMap,s=new WeakMap,a=new WeakMap;let c;window.CustomElementRegistry=class{constructor(){this._definitionsByTag=new Map,this._definitionsByClass=new Map,this._whenDefinedPromises=new Map,this._awaitingUpgrade=new Map}define(t,i){if(t=t.toLowerCase(),void 0!==this._getDefinition(t))throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(void 0!==this._definitionsByClass.get(i))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");const a=i.prototype.attributeChangedCallback,c=new Set(i.observedAttributes||[]);p(i,c,a);const l={elementClass:i,connectedCallback:i.prototype.connectedCallback,disconnectedCallback:i.prototype.disconnectedCallback,adoptedCallback:i.prototype.adoptedCallback,attributeChangedCallback:a,formAssociated:i.formAssociated,formAssociatedCallback:i.prototype.formAssociatedCallback,formDisabledCallback:i.prototype.formDisabledCallback,formResetCallback:i.prototype.formResetCallback,formStateRestoreCallback:i.prototype.formStateRestoreCallback,observedAttributes:c};this._definitionsByTag.set(t,l),this._definitionsByClass.set(i,l);let h=e.call(r,t);h||(h=f(t),o.call(r,t,h)),this===window.customElements&&(s.set(i,l),l.standInClass=h);const d=this._awaitingUpgrade.get(t);if(d){this._awaitingUpgrade.delete(t);for(const t of d)n.delete(t),u(t,l,!0)}const y=this._whenDefinedPromises.get(t);return void 0!==y&&(y.resolve(i),this._whenDefinedPromises.delete(t)),i}upgrade(){g.push(this),r.upgrade.apply(r,arguments),g.pop()}get(t){const o=this._definitionsByTag.get(t);return o?.elementClass}_getDefinition(t){return this._definitionsByTag.get(t)}whenDefined(t){const o=this._getDefinition(t);if(void 0!==o)return Promise.resolve(o.elementClass);let e=this._whenDefinedPromises.get(t);return void 0===e&&(e={},e.promise=new Promise((t=>e.resolve=t)),this._whenDefinedPromises.set(t,e)),e.promise}_upgradeWhenDefined(t,o,e){let r=this._awaitingUpgrade.get(o);r||this._awaitingUpgrade.set(o,r=new Set),e?r.add(t):r.delete(t)}},window.HTMLElement=function(){let o=c;if(o)return c=void 0,o;const e=s.get(this.constructor);if(!e)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return o=Reflect.construct(t,[],e.standInClass),Object.setPrototypeOf(o,this.constructor.prototype),i.set(o,e),o},window.HTMLElement.prototype=t.prototype;const l=t=>t===document||t instanceof ShadowRoot,h=t=>{let o=t.getRootNode();if(!l(o)){const t=g[g.length-1];if(t instanceof CustomElementRegistry)return t;o=t.getRootNode(),l(o)||(o=a.get(o)?.getRootNode()||document)}return o.customElements},f=o=>class{static get formAssociated(){return!0}constructor(){const e=Reflect.construct(t,[],this.constructor);Object.setPrototypeOf(e,HTMLElement.prototype);const r=h(e)||window.customElements,i=r._getDefinition(o);return i?u(e,i):n.set(e,r),e}connectedCallback(){const t=i.get(this);t?t.connectedCallback&&t.connectedCallback.apply(this,arguments):n.get(this)._upgradeWhenDefined(this,o,!0)}disconnectedCallback(){const t=i.get(this);t?t.disconnectedCallback&&t.disconnectedCallback.apply(this,arguments):n.get(this)._upgradeWhenDefined(this,o,!1)}adoptedCallback(){const t=i.get(this);t?.adoptedCallback?.apply(this,arguments)}formAssociatedCallback(){const t=i.get(this);t&&t.formAssociated&&t?.formAssociatedCallback?.apply(this,arguments)}formDisabledCallback(){const t=i.get(this);t?.formAssociated&&t?.formDisabledCallback?.apply(this,arguments)}formResetCallback(){const t=i.get(this);t?.formAssociated&&t?.formResetCallback?.apply(this,arguments)}formStateRestoreCallback(){const t=i.get(this);t?.formAssociated&&t?.formStateRestoreCallback?.apply(this,arguments)}},p=(t,o,e)=>{if(0===o.size||void 0===e)return;const r=t.prototype.setAttribute;r&&(t.prototype.setAttribute=function(t,i){const n=t.toLowerCase();if(o.has(n)){const t=this.getAttribute(n);r.call(this,n,i),e.call(this,n,t,i)}else r.call(this,n,i)});const i=t.prototype.removeAttribute;i&&(t.prototype.removeAttribute=function(t){const r=t.toLowerCase();if(o.has(r)){const t=this.getAttribute(r);i.call(this,r),e.call(this,r,t,null)}else i.call(this,r)});const n=t.prototype.toggleAttribute;n&&(t.prototype.toggleAttribute=function(t,r){const i=t.toLowerCase();if(o.has(i)){const t=this.getAttribute(i);n.call(this,i,r);const o=this.getAttribute(i);e.call(this,i,t,o)}else n.call(this,i,r)})},d=o=>{const e=Object.getPrototypeOf(o);if(e!==window.HTMLElement)return e===t?Object.setPrototypeOf(o,window.HTMLElement):d(e)},u=(t,o,e=!1)=>{Object.setPrototypeOf(t,o.elementClass.prototype),i.set(t,o),c=t;try{new o.elementClass}catch(t){d(o.elementClass),new o.elementClass}o.attributeChangedCallback&&o.observedAttributes.forEach((e=>{t.hasAttribute(e)&&o.attributeChangedCallback.call(t,e,null,t.getAttribute(e))})),e&&o.connectedCallback&&t.isConnected&&o.connectedCallback.call(t)},y=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){const o=y.apply(this,arguments);return t.customElements&&(o.customElements=t.customElements),o};let g=[document];const b=(t,o,e=void 0)=>{const r=(e?Object.getPrototypeOf(e):t.prototype)[o];t.prototype[o]=function(){g.push(this);const t=r.apply(e||this,arguments);return void 0!==t&&a.set(t,this),g.pop(),t}};b(ShadowRoot,"createElement",document),b(ShadowRoot,"importNode",document),b(Element,"insertAdjacentHTML");const m=(t,o)=>{const e=Object.getOwnPropertyDescriptor(t.prototype,o);Object.defineProperty(t.prototype,o,{...e,set(t){g.push(this),e.set.call(this,t),g.pop()}})};if(m(Element,"innerHTML"),m(ShadowRoot,"innerHTML"),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){const t=new WeakMap,o=HTMLElement.prototype.attachInternals,e=["setFormValue","setValidity","checkValidity","reportValidity"];HTMLElement.prototype.attachInternals=function(...e){const r=o.call(this,...e);return t.set(r,this),r},e.forEach((o=>{const e=window.ElementInternals.prototype,r=e[o];e[o]=function(...o){const e=t.get(this);if(!0===i.get(e).formAssociated)return r?.call(this,...o);throw new DOMException(`Failed to execute ${r} on 'ElementInternals': The target element is not a form-associated custom element.`)}}));class r extends Array{constructor(t){super(...t),this._elements=t}get value(){return this._elements.find((t=>!0===t.checked))?.value||""}}class n{constructor(t){const o=new Map;t.forEach(((t,e)=>{const r=t.getAttribute("name"),i=o.get(r)||[];this[+e]=t,i.push(t),o.set(r,i)})),this.length=t.length,o.forEach(((t,o)=>{t&&(1===t.length?this[o]=t[0]:this[o]=new r(t))}))}namedItem(t){return this[t]}}const s=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){const t=s.get.call(this,[]),o=[];for(const e of t){const t=i.get(e);t&&!0!==t.formAssociated||o.push(e)}return new n(o)}})}}try{window.customElements.define("custom-element",null)}catch(ie){const t=window.customElements.define;window.customElements.define=(o,e,r)=>{if(null!==e)try{t.bind(window.customElements)(o,e,r)}catch(t){console.info(o,e,r,t)}}}class o extends Error{constructor(t,o,e){super(t),this.canceledPromiseResult=o,this.canceledPromiseError=e}}class e extends Promise{constructor(t){super(((e,r)=>t((t=>{this.isCanceled?r(new o("Promise has been canceled",t)):e(t)}),(t=>{this.isCanceled?r(new o("Promise has been canceled",void 0,t)):r(t)})))),this.isCanceled=!1}cancel(){this.isCanceled=!0}}class r{constructor(t=0){this.timeout=t,this.callbacks=[]}run(t,o){return this.callbacks=[t],this.debounce(o)}queue(t,o){return this.callbacks.push(t),this.debounce(o)}cancel(){this.clearTimeout(),this.resolvePromise&&this.resolvePromise(!1),this.clearPromise()}debounce(t){return null==this.promise&&(this.promise=new Promise(((t,o)=>{this.resolvePromise=t,this.rejectPromise=o}))),this.clearTimeout(),this._debounce=window.setTimeout((()=>this.runCallbacks()),null!=t?t:this.timeout),this.promise}async runCallbacks(){var t,o;const e=[...this.callbacks];this.callbacks=[];const r=null!==(t=this.rejectPromise)&&void 0!==t?t:()=>null,i=null!==(o=this.resolvePromise)&&void 0!==o?o:()=>null;this.clearPromise();for(let t of e)try{await t()}catch(t){return void r(t)}i(!0)}clearTimeout(){null!=this._debounce&&window.clearTimeout(this._debounce)}clearPromise(){this.promise=void 0,this.resolvePromise=void 0,this.rejectPromise=void 0}}
|
|
16
16
|
/**
|
|
17
17
|
* @license
|
|
18
18
|
* Copyright 2019 Google LLC
|
|
19
19
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
-
*/const i=globalThis,n=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,
|
|
20
|
+
*/const i=globalThis,n=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),a=new WeakMap;const c=t=>new class{constructor(t,o,e){if(this._$cssResult$=!0,e!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=o}get styleSheet(){let t=this.o;const o=this.t;if(n&&void 0===t){const e=void 0!==o&&1===o.length;e&&(t=a.get(o)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&a.set(o,t))}return t}toString(){return this.cssText}}("string"==typeof t?t:t+"",void 0,s),l=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let o="";for(const e of t.cssRules)o+=e.cssText;return c(o)})(t):t
|
|
21
21
|
/**
|
|
22
22
|
* @license
|
|
23
23
|
* Copyright 2017 Google LLC
|
|
@@ -49,7 +49,7 @@ const x={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:S},R=(t=x,o,
|
|
|
49
49
|
* Copyright 2017 Google LLC
|
|
50
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
51
|
*/
|
|
52
|
-
const K=globalThis,Z=K.trustedTypes,$=Z?Z.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",M=`lit$${(Math.random()+"").slice(9)}$`,F="?"+M,B=`<${F}>`,z=document,D=()=>z.createComment(""),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,_=t=>T(t)||"function"==typeof t?.[Symbol.iterator],G="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,H=/-->/g,Y=/>/g,J=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,q=/"/g,X=/^(?:script|style|textarea|title)$/i,Q=Symbol.for("lit-noChange"),tt=Symbol.for("lit-nothing"),ot=new WeakMap,et=z.createTreeWalker(z,129);function rt(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(o):o}const it=(t,o)=>{const e=t.length-1,r=[];let i,n=2===o?"<svg>":"",
|
|
52
|
+
const K=globalThis,Z=K.trustedTypes,$=Z?Z.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",M=`lit$${(Math.random()+"").slice(9)}$`,F="?"+M,B=`<${F}>`,z=document,D=()=>z.createComment(""),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,_=t=>T(t)||"function"==typeof t?.[Symbol.iterator],G="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,H=/-->/g,Y=/>/g,J=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,q=/"/g,X=/^(?:script|style|textarea|title)$/i,Q=Symbol.for("lit-noChange"),tt=Symbol.for("lit-nothing"),ot=new WeakMap,et=z.createTreeWalker(z,129);function rt(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(o):o}const it=(t,o)=>{const e=t.length-1,r=[];let i,n=2===o?"<svg>":"",s=j;for(let o=0;o<e;o++){const e=t[o];let a,c,l=-1,h=0;for(;h<e.length&&(s.lastIndex=h,c=s.exec(e),null!==c);)h=s.lastIndex,s===j?"!--"===c[1]?s=H:void 0!==c[1]?s=Y:void 0!==c[2]?(X.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=J):void 0!==c[3]&&(s=J):s===J?">"===c[0]?(s=i??j,l=-1):void 0===c[1]?l=-2:(l=s.lastIndex-c[2].length,a=c[1],s=void 0===c[3]?J:'"'===c[3]?q:V):s===q||s===V?s=J:s===H||s===Y?s=j:(s=J,i=void 0);const f=s===J&&t[o+1].startsWith("/>")?" ":"";n+=s===j?e+B:l>=0?(r.push(a),e.slice(0,l)+A+e.slice(l)+M+f):e+M+(-2===l?o:f)}return[rt(t,n+(t[e]||"<?>")+(2===o?"</svg>":"")),r]};let nt=class t{constructor({strings:o,_$litType$:e},r){let i;this.parts=[];let n=0,s=0;const a=o.length-1,c=this.parts,[l,h]=it(o,e);if(this.el=t.createElement(l,r),et.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=et.nextNode())&&c.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(A)){const o=h[s++],e=i.getAttribute(t).split(M),r=/([.?@])?(.*)/.exec(o);c.push({type:1,index:n,name:r[2],strings:e,ctor:"."===r[1]?ht:"?"===r[1]?ft:"@"===r[1]?pt:lt}),i.removeAttribute(t)}else t.startsWith(M)&&(c.push({type:6,index:n}),i.removeAttribute(t));if(X.test(i.tagName)){const t=i.textContent.split(M),o=t.length-1;if(o>0){i.textContent=Z?Z.emptyScript:"";for(let e=0;e<o;e++)i.append(t[e],D()),et.nextNode(),c.push({type:2,index:++n});i.append(t[o],D())}}}else if(8===i.nodeType)if(i.data===F)c.push({type:2,index:n});else{let t=-1;for(;-1!==(t=i.data.indexOf(M,t+1));)c.push({type:7,index:n}),t+=M.length-1}n++}}static createElement(t,o){const e=z.createElement("template");return e.innerHTML=t,e}};function st(t,o,e=t,r){if(o===Q)return o;let i=void 0!==r?e._$Co?.[r]:e._$Cl;const n=P(o)?void 0:o._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),void 0===n?i=void 0:(i=new n(t),i._$AT(t,e,r)),void 0!==r?(e._$Co??=[])[r]=i:e._$Cl=i),void 0!==i&&(o=st(t,i._$AS(t,o.values),i,r)),o}let at=class{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:o},parts:e}=this._$AD,r=(t?.creationScope??z).importNode(o,!0);et.currentNode=r;let i=et.nextNode(),n=0,s=0,a=e[0];for(;void 0!==a;){if(n===a.index){let o;2===a.type?o=new ct(i,i.nextSibling,this,t):1===a.type?o=new a.ctor(i,a.name,a.strings,this,t):6===a.type&&(o=new dt(i,this,t)),this._$AV.push(o),a=e[++s]}n!==a?.index&&(i=et.nextNode(),n++)}return et.currentNode=z,r}p(t){let o=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,o),o+=e.strings.length-2):e._$AI(t[o])),o++}},ct=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,e,r){this.type=2,this._$AH=tt,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const o=this._$AM;return void 0!==o&&11===t?.nodeType&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=st(this,t,o),P(t)?t===tt||null==t||""===t?(this._$AH!==tt&&this._$AR(),this._$AH=tt):t!==this._$AH&&t!==Q&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):_(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==tt&&P(this._$AH)?this._$AA.nextSibling.data=t:this.$(z.createTextNode(t)),this._$AH=t}g(t){const{values:o,_$litType$:e}=t,r="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=nt.createElement(rt(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(o);else{const t=new at(r,this),e=t.u(this.options);t.p(o),this.$(e),this._$AH=t}}_$AC(t){let o=ot.get(t.strings);return void 0===o&&ot.set(t.strings,o=new nt(t)),o}T(o){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const n of o)i===e.length?e.push(r=new t(this.k(D()),this.k(D()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t&&t!==this._$AB;){const o=t.nextSibling;t.remove(),t=o}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},lt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,e,r,i){this.type=1,this._$AH=tt,this._$AN=void 0,this.element=t,this.name=o,this._$AM=r,this.options=i,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=tt}_$AI(t,o=this,e,r){const i=this.strings;let n=!1;if(void 0===i)t=st(this,t,o,0),n=!P(t)||t!==this._$AH&&t!==Q,n&&(this._$AH=t);else{const r=t;let s,a;for(t=i[0],s=0;s<i.length-1;s++)a=st(this,r[e+s],o,s),a===Q&&(a=this._$AH[s]),n||=!P(a)||a!==this._$AH[s],a===tt?t=tt:t!==tt&&(t+=(a??"")+i[s+1]),this._$AH[s]=a}n&&!r&&this.O(t)}O(t){t===tt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ht=class extends lt{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===tt?void 0:t}},ft=class extends lt{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==tt)}},pt=class extends lt{constructor(t,o,e,r,i){super(t,o,e,r,i),this.type=5}_$AI(t,o=this){if((t=st(this,t,o,0)??tt)===Q)return;const e=this._$AH,r=t===tt&&e!==tt||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,i=t!==tt&&(e===tt||r);r&&this.element.removeEventListener(this.name,this,e),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},dt=class{constructor(t,o,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){st(this,t)}};const ut={j:A,P:M,A:F,C:1,M:it,L:at,R:_,V:st,D:ct,I:lt,H:ft,N:pt,U:ht,B:dt},yt=K.litHtmlPolyfillSupport;yt?.(nt,ct),(K.litHtmlVersions??=[]).push("3.1.0");
|
|
53
53
|
/**
|
|
54
54
|
* @license
|
|
55
55
|
* Copyright 2019 Google LLC
|
|
@@ -66,7 +66,7 @@ const gt=globalThis,bt=gt.ShadowRoot&&(void 0===gt.ShadyCSS||gt.ShadyCSS.nativeS
|
|
|
66
66
|
* Copyright 2017 Google LLC
|
|
67
67
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
68
68
|
*/
|
|
69
|
-
const Bt=globalThis,zt=Bt.trustedTypes,Dt=zt?zt.createPolicy("lit-html",{createHTML:t=>t}):void 0,Pt="$lit$",Tt=`lit$${(Math.random()+"").slice(9)}$`,_t="?"+Tt,Gt=`<${_t}>`,jt=document,Ht=()=>jt.createComment(""),Yt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Jt=Array.isArray,Vt="[ \t\n\f\r]",qt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xt=/-->/g,Qt=/>/g,to=RegExp(`>|${Vt}(?:([^\\s"'>=/]+)(${Vt}*=${Vt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),oo=/'/g,eo=/"/g,ro=/^(?:script|style|textarea|title)$/i,io=(t=>(o,...e)=>({_$litType$:t,strings:o,values:e}))(1),no=Symbol.for("lit-noChange"),
|
|
69
|
+
const Bt=globalThis,zt=Bt.trustedTypes,Dt=zt?zt.createPolicy("lit-html",{createHTML:t=>t}):void 0,Pt="$lit$",Tt=`lit$${(Math.random()+"").slice(9)}$`,_t="?"+Tt,Gt=`<${_t}>`,jt=document,Ht=()=>jt.createComment(""),Yt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Jt=Array.isArray,Vt="[ \t\n\f\r]",qt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xt=/-->/g,Qt=/>/g,to=RegExp(`>|${Vt}(?:([^\\s"'>=/]+)(${Vt}*=${Vt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),oo=/'/g,eo=/"/g,ro=/^(?:script|style|textarea|title)$/i,io=(t=>(o,...e)=>({_$litType$:t,strings:o,values:e}))(1),no=Symbol.for("lit-noChange"),so=Symbol.for("lit-nothing"),ao=new WeakMap,co=jt.createTreeWalker(jt,129);function lo(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Dt?Dt.createHTML(o):o}const ho=(t,o)=>{const e=t.length-1,r=[];let i,n=2===o?"<svg>":"",s=qt;for(let o=0;o<e;o++){const e=t[o];let a,c,l=-1,h=0;for(;h<e.length&&(s.lastIndex=h,c=s.exec(e),null!==c);)h=s.lastIndex,s===qt?"!--"===c[1]?s=Xt:void 0!==c[1]?s=Qt:void 0!==c[2]?(ro.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=to):void 0!==c[3]&&(s=to):s===to?">"===c[0]?(s=i??qt,l=-1):void 0===c[1]?l=-2:(l=s.lastIndex-c[2].length,a=c[1],s=void 0===c[3]?to:'"'===c[3]?eo:oo):s===eo||s===oo?s=to:s===Xt||s===Qt?s=qt:(s=to,i=void 0);const f=s===to&&t[o+1].startsWith("/>")?" ":"";n+=s===qt?e+Gt:l>=0?(r.push(a),e.slice(0,l)+Pt+e.slice(l)+Tt+f):e+Tt+(-2===l?o:f)}return[lo(t,n+(t[e]||"<?>")+(2===o?"</svg>":"")),r]};class fo{constructor({strings:t,_$litType$:o},e){let r;this.parts=[];let i=0,n=0;const s=t.length-1,a=this.parts,[c,l]=ho(t,o);if(this.el=fo.createElement(c,e),co.currentNode=this.el.content,2===o){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=co.nextNode())&&a.length<s;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(Pt)){const o=l[n++],e=r.getAttribute(t).split(Tt),s=/([.?@])?(.*)/.exec(o);a.push({type:1,index:i,name:s[2],strings:e,ctor:"."===s[1]?go:"?"===s[1]?bo:"@"===s[1]?mo:yo}),r.removeAttribute(t)}else t.startsWith(Tt)&&(a.push({type:6,index:i}),r.removeAttribute(t));if(ro.test(r.tagName)){const t=r.textContent.split(Tt),o=t.length-1;if(o>0){r.textContent=zt?zt.emptyScript:"";for(let e=0;e<o;e++)r.append(t[e],Ht()),co.nextNode(),a.push({type:2,index:++i});r.append(t[o],Ht())}}}else if(8===r.nodeType)if(r.data===_t)a.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(Tt,t+1));)a.push({type:7,index:i}),t+=Tt.length-1}i++}}static createElement(t,o){const e=jt.createElement("template");return e.innerHTML=t,e}}function po(t,o,e=t,r){if(o===no)return o;let i=void 0!==r?e._$Co?.[r]:e._$Cl;const n=Yt(o)?void 0:o._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),void 0===n?i=void 0:(i=new n(t),i._$AT(t,e,r)),void 0!==r?(e._$Co??=[])[r]=i:e._$Cl=i),void 0!==i&&(o=po(t,i._$AS(t,o.values),i,r)),o}class uo{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,e,r){this.type=2,this._$AH=so,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const o=this._$AM;return void 0!==o&&11===t?.nodeType&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=po(this,t,o),Yt(t)?t===so||null==t||""===t?(this._$AH!==so&&this._$AR(),this._$AH=so):t!==this._$AH&&t!==no&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>Jt(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==so&&Yt(this._$AH)?this._$AA.nextSibling.data=t:this.$(jt.createTextNode(t)),this._$AH=t}g(t){const{values:o,_$litType$:e}=t,r="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=fo.createElement(lo(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(o);else{const t=new class{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:o},parts:e}=this._$AD,r=(t?.creationScope??jt).importNode(o,!0);co.currentNode=r;let i=co.nextNode(),n=0,s=0,a=e[0];for(;void 0!==a;){if(n===a.index){let o;2===a.type?o=new uo(i,i.nextSibling,this,t):1===a.type?o=new a.ctor(i,a.name,a.strings,this,t):6===a.type&&(o=new Oo(i,this,t)),this._$AV.push(o),a=e[++s]}n!==a?.index&&(i=co.nextNode(),n++)}return co.currentNode=jt,r}p(t){let o=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,o),o+=e.strings.length-2):e._$AI(t[o])),o++}}(r,this),e=t.u(this.options);t.p(o),this.$(e),this._$AH=t}}_$AC(t){let o=ao.get(t.strings);return void 0===o&&ao.set(t.strings,o=new fo(t)),o}T(t){Jt(this._$AH)||(this._$AH=[],this._$AR());const o=this._$AH;let e,r=0;for(const i of t)r===o.length?o.push(e=new uo(this.k(Ht()),this.k(Ht()),this,this.options)):e=o[r],e._$AI(i),r++;r<o.length&&(this._$AR(e&&e._$AB.nextSibling,r),o.length=r)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t&&t!==this._$AB;){const o=t.nextSibling;t.remove(),t=o}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class yo{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,e,r,i){this.type=1,this._$AH=so,this._$AN=void 0,this.element=t,this.name=o,this._$AM=r,this.options=i,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=so}_$AI(t,o=this,e,r){const i=this.strings;let n=!1;if(void 0===i)t=po(this,t,o,0),n=!Yt(t)||t!==this._$AH&&t!==no,n&&(this._$AH=t);else{const r=t;let s,a;for(t=i[0],s=0;s<i.length-1;s++)a=po(this,r[e+s],o,s),a===no&&(a=this._$AH[s]),n||=!Yt(a)||a!==this._$AH[s],a===so?t=so:t!==so&&(t+=(a??"")+i[s+1]),this._$AH[s]=a}n&&!r&&this.O(t)}O(t){t===so?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class go extends yo{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===so?void 0:t}}class bo extends yo{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==so)}}class mo extends yo{constructor(t,o,e,r,i){super(t,o,e,r,i),this.type=5}_$AI(t,o=this){if((t=po(this,t,o,0)??so)===no)return;const e=this._$AH,r=t===so&&e!==so||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,i=t!==so&&(e===so||r);r&&this.element.removeEventListener(this.name,this,e),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Oo{constructor(t,o,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){po(this,t)}}const No=Bt.litHtmlPolyfillSupport;No?.(fo,uo),(Bt.litHtmlVersions??=[]).push("3.1.0");
|
|
70
70
|
/**
|
|
71
71
|
* @license
|
|
72
72
|
* Copyright 2017 Google LLC
|
|
@@ -78,7 +78,7 @@ let vo=class extends Ft{constructor(){super(...arguments),this.renderOptions={ho
|
|
|
78
78
|
* Copyright 2019 Google LLC
|
|
79
79
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
80
80
|
*/
|
|
81
|
-
const Uo=window,Eo=Uo.ShadowRoot&&(void 0===Uo.ShadyCSS||Uo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class Io extends vo{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([o,e])=>t.registry.define(o,e))));const o={...t.shadowRootOptions,customElements:t.registry},e=this.renderOptions.creationScope=this.attachShadow(o);return((t,o)=>{Eo?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((o=>{const e=document.createElement("style"),r=Uo.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=o.cssText,t.appendChild(e)}))})(e,t.elementStyles),e}}var Lo,Wo=function(t,o,e,r){for(var i,n=arguments.length,
|
|
81
|
+
const Uo=window,Eo=Uo.ShadowRoot&&(void 0===Uo.ShadyCSS||Uo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class Io extends vo{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([o,e])=>t.registry.define(o,e))));const o={...t.shadowRootOptions,customElements:t.registry},e=this.renderOptions.creationScope=this.attachShadow(o);return((t,o)=>{Eo?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((o=>{const e=document.createElement("style"),r=Uo.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=o.cssText,t.appendChild(e)}))})(e,t.elementStyles),e}}var Lo,Wo=function(t,o,e,r){for(var i,n=arguments.length,s=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(o,e,s):i(o,e))||s);return n>3&&s&&Object.defineProperty(o,e,s),s};const ko=Symbol("constructorPrototype"),Ko=Symbol("constructorName"),Zo=Symbol("exportpartsDebouncer");class $o extends Io{constructor(){super(),this[Lo]=new r(5),this[Ko]=this.constructor.name,this[ko]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Ko]&&Object.setPrototypeOf(this,this[ko])}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){var o,e;if((null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==e?e:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){this[Zo].run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var o,e,r,i,n,s;const a=t=>null!=t&&t.trim().length>0,c=t.filter(a).map((t=>t.trim()));if(0===c.length)return void this.removeAttribute("exportparts");const l=new Set;for(let t of null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll("[part],[exportparts]"))&&void 0!==e?e:[]){const o=null!==(i=null===(r=t.getAttribute("part"))||void 0===r?void 0:r.split(" "))&&void 0!==i?i:[],e=null!==(s=null===(n=t.getAttribute("exportparts"))||void 0===n?void 0:n.split(",").map((t=>t.split(":")[1])))&&void 0!==s?s:[];new Array(...o,...e).filter(a).map((t=>t.trim())).forEach((t=>l.add(t)))}if(0===l.size)return void this.removeAttribute("exportparts");const h=[...l.values()].flatMap((t=>c.map((o=>`${t}:${o}--${t}`))));this.setAttribute("exportparts",[...this.part,...h].join(", "))}}Lo=Zo,Wo([U()],$o.prototype,"exportpartsPrefix",void 0),Wo([function(t,o){const e=()=>JSON.parse(JSON.stringify(t));return U({type:Object,converter:{fromAttribute:t=>{if(null==t)return e();try{return JSON.parse(t)}catch{return e()}},toAttribute:t=>JSON.stringify(t)},hasChanged:(t,o)=>!k(t,o),...null!=o?o:{}})}([])],$o.prototype,"exportpartsPrefixes",void 0),Wo([U()],$o.prototype,"customStylesheet",void 0);const Ao=Co.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");function Mo(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var Fo,Bo,zo;St`
|
|
82
82
|
.highlight-html-match {
|
|
83
83
|
background: ${Ao};
|
|
84
84
|
}
|
|
@@ -125,7 +125,7 @@ const Ho=2,Yo=t=>(...o)=>({_$litDirective$:t,values:o});class Jo{constructor(t){
|
|
|
125
125
|
* @license
|
|
126
126
|
* Copyright 2020 Google LLC
|
|
127
127
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
128
|
-
*/const{D:Vo}=ut,qo=()=>document.createComment(""),Xo=(t,o,e)=>{const r=t._$AA.parentNode,i=void 0===o?t._$AB:o._$AA;if(void 0===e){const o=r.insertBefore(qo(),i),n=r.insertBefore(qo(),i);e=new Vo(o,n,t,t.options)}else{const o=e._$AB.nextSibling,n=e._$AM,
|
|
128
|
+
*/const{D:Vo}=ut,qo=()=>document.createComment(""),Xo=(t,o,e)=>{const r=t._$AA.parentNode,i=void 0===o?t._$AB:o._$AA;if(void 0===e){const o=r.insertBefore(qo(),i),n=r.insertBefore(qo(),i);e=new Vo(o,n,t,t.options)}else{const o=e._$AB.nextSibling,n=e._$AM,s=n!==t;if(s){let o;e._$AQ?.(t),e._$AM=t,void 0!==e._$AP&&(o=t._$AU)!==n._$AU&&e._$AP(o)}if(o!==i||s){let t=e._$AA;for(;t!==o;){const o=t.nextSibling;r.insertBefore(t,i),t=o}}}return e},Qo=(t,o,e=t)=>(t._$AI(o,e),t),te={},oe=t=>{t._$AP?.(!1,!0);let o=t._$AA;const e=t._$AB.nextSibling;for(;o!==e;){const t=o.nextSibling;o.remove(),o=t}},ee=(t,o,e)=>{const r=new Map;for(let i=o;i<=e;i++)r.set(t[i],i);return r},re=Yo(class extends Jo{constructor(t){if(super(t),t.type!==Ho)throw Error("repeat() can only be used in text expressions")}ht(t,o,e){let r;void 0===e?e=o:void 0!==o&&(r=o);const i=[],n=[];let s=0;for(const o of t)i[s]=r?r(o,s):s,n[s]=e(o,s),s++;return{values:n,keys:i}}render(t,o,e){return this.ht(t,o,e).values}update(t,[o,e,r]){const i=(t=>t._$AH)(t),{values:n,keys:s}=this.ht(o,e,r);if(!Array.isArray(i))return this.dt=s,n;const a=this.dt??=[],c=[];let l,h,f=0,p=i.length-1,d=0,u=n.length-1;for(;f<=p&&d<=u;)if(null===i[f])f++;else if(null===i[p])p--;else if(a[f]===s[d])c[d]=Qo(i[f],n[d]),f++,d++;else if(a[p]===s[u])c[u]=Qo(i[p],n[u]),p--,u--;else if(a[f]===s[u])c[u]=Qo(i[f],n[u]),Xo(t,c[u+1],i[f]),f++,u--;else if(a[p]===s[d])c[d]=Qo(i[p],n[d]),Xo(t,i[f],i[p]),p--,d++;else if(void 0===l&&(l=ee(s,d,u),h=ee(a,f,p)),l.has(a[f]))if(l.has(a[p])){const o=h.get(s[d]),e=void 0!==o?i[o]:null;if(null===e){const o=Xo(t,i[f]);Qo(o,n[d]),c[d]=o}else c[d]=Qo(e,n[d]),Xo(t,i[f],e),i[o]=null;d++}else oe(i[p]),p--;else oe(i[f]),f++;for(;d<=u;){const o=Xo(t,c[u+1]);Qo(o,n[d]),c[d++]=o}for(;f<=p;){const t=i[f++];null!==t&&oe(t)}return this.dt=s,((t,o=te)=>{t._$AH=o})(t,c),Q}});
|
|
129
129
|
/**
|
|
130
130
|
* @license
|
|
131
131
|
* Copyright 2017 Google LLC
|
|
@@ -136,9 +136,9 @@ const Ho=2,Yo=t=>(...o)=>({_$litDirective$:t,values:o});class Jo{constructor(t){
|
|
|
136
136
|
* Copyright 2017 Google LLC
|
|
137
137
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
138
138
|
*/
|
|
139
|
-
class ie extends Jo{constructor(t){if(super(t),this.et=tt,t.type!==Ho)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===tt||null==t)return this.vt=void 0,this.et=t;if(t===Q)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;const o=[t];return o.raw=o,this.vt={_$litType$:this.constructor.resultType,strings:o,values:[]}}}ie.directiveName="unsafeHTML",ie.resultType=1;const ne=Yo(ie),
|
|
139
|
+
class ie extends Jo{constructor(t){if(super(t),this.et=tt,t.type!==Ho)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===tt||null==t)return this.vt=void 0,this.et=t;if(t===Q)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;const o=[t];return o.raw=o,this.vt={_$litType$:this.constructor.resultType,strings:o,values:[]}}}ie.directiveName="unsafeHTML",ie.resultType=1;const ne=Yo(ie),se={padding:Co.create("--ft-infinite-scroll-padding","","SIZE","0"),itemsGap:Co.create("--ft-infinite-scroll-items-gap","","SIZE","4px"),itemContainerMinHeight:Co.create("--ft-infinite-scroll-item-container-min-height","","SIZE",".1px")},ae=St`
|
|
140
140
|
.items-container {
|
|
141
|
-
padding: ${
|
|
141
|
+
padding: ${se.padding};
|
|
142
142
|
outline: none;
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -155,7 +155,7 @@ class ie extends Jo{constructor(t){if(super(t),this.et=tt,t.type!==Ho)throw Erro
|
|
|
155
155
|
By adding this gap we ensure that the previous item will be fully hidden
|
|
156
156
|
and even if its size changes, it will not impact the scroll offset
|
|
157
157
|
*/
|
|
158
|
-
margin-top: ${
|
|
158
|
+
margin-top: ${se.itemsGap};
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
.item-container:not(.rendered) {
|
|
@@ -164,18 +164,18 @@ class ie extends Jo{constructor(t){if(super(t),this.et=tt,t.type!==Ho)throw Erro
|
|
|
164
164
|
|
|
165
165
|
.item-container.rendered {
|
|
166
166
|
display: flow-root;
|
|
167
|
-
min-height: ${
|
|
167
|
+
min-height: ${se.itemContainerMinHeight};
|
|
168
168
|
}
|
|
169
|
-
`;var ce=function(t,o,e,r){for(var i,n=arguments.length,
|
|
169
|
+
`;var ce=function(t,o,e,r){for(var i,n=arguments.length,s=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(o,e,s):i(o,e))||s);return n>3&&s&&Object.defineProperty(o,e,s),s};class le extends CustomEvent{constructor(t,o){super("visible-items-change",{detail:{visibleIndexes:t,visibleItems:o}})}}class he extends Event{constructor(){super("scrolled-to-target")}}class fe extends $o{constructor(){super(...arguments),this.items=[],this.renderItem=()=>io``,this.getItemKey=(t,o)=>`${o} - ${JSON.stringify(t)}`,this.internalScroll=!1,this.renderBeforeFirst=1,this.renderAfterLast=1,this.visibleItems=[],this.scrolledToTarget=!1,this.scrolling=!1,this.renderApprovalTimeouts=[],this.renderedIndexes=new Set,this.scrollDebouncer=new r(5),this.scrollDoneDebouncer=new r(10),this.onVisibilityChange=t=>{let o=new Set(this.visibleItems),e=new Set;for(let r of t){let t=+r.target.attributes.getNamedItem("data-item-index").value;r.intersectionRect.height>0?(o.add(t),e.add(t)):e.has(t)||o.delete(t)}this.visibleItems=[...o].sort(((t,o)=>t-o))},this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange),this.scrollingDebouncer=new r(50),this.ignoreNextScrollEvent=!1,this.scrollListener=()=>{this.ignoreNextScrollEvent||(this.scrolling=!0,this.scrollingDebouncer.run((()=>this.scrolling=!1))),this.ignoreNextScrollEvent=!1;const t=this.searchFirstVisibleItem(this.itemsContainer.children);this.scrollRestorationItem=t?+t.getAttribute("data-item-index"):void 0,this.scrollRestorationOffset=this.scrollable.scrollTop-this.getOffset(t)},this.onResize=t=>{for(const o of t)o.contentRect.height>0&&o.target.setAttribute("data-last-known-height",""+o.contentRect.height);if(null!=this.scrollRestorationItem&&null!=this.scrollRestorationOffset&&this.scrolledToTarget){this.ignoreNextScrollEvent=!0;const t=this.getItem(this.scrollRestorationItem),i=this.getOffset(t),n=(o=0===this.scrollRestorationItem?-i:0,e=this.scrollRestorationOffset,r=this.getLastKnownHeight(t)+1,Math.min(Math.max(o,e),r));this.scrollable.scrollTop=i+n}var o,e,r},this.resizeObserver=new ResizeObserver(this.onResize),this.onMutation=()=>{[...this.itemsContainer.children].forEach((t=>{this.intersectionObserver.observe(t),this.resizeObserver.observe(t)}))},this.mutationObserver=new MutationObserver(this.onMutation),this.resetVisibleItemsDebouncer=new r(10)}get scrollable(){var t;return null!==(t=this.internalScroll?this.internalScrollable:this.firstScrollableParent)&&void 0!==t?t:document.body}render(){return io`
|
|
170
170
|
<div class="items-container ${this.internalScroll?"scrollable":""}"
|
|
171
171
|
tabindex="-1"
|
|
172
172
|
@find-scrollable-parent=${this.findScrollableParent}>
|
|
173
173
|
${re(this.items,((t,o)=>this.getItemKey(t,o)),((t,o)=>this.renderItemContainer(t,o)))}
|
|
174
174
|
</div>
|
|
175
|
-
`}renderItemContainer(t,o){const e
|
|
175
|
+
`}renderItemContainer(t,o){this.prepareRenderIfNeeded(o);const e=this.scrolledToTarget&&this.visibleItems.includes(o),r=this.renderedIndexes.has(o);return io`
|
|
176
176
|
<div id="item-${o}"
|
|
177
|
-
class="item-container ${
|
|
177
|
+
class="item-container ${r?"rendered":""} ${e?"visible":""}"
|
|
178
178
|
data-item-index="${o}">
|
|
179
|
-
${
|
|
179
|
+
${r?(()=>{const e=this.renderItem(t,o);return"string"==typeof e?ne(e):e})():so}
|
|
180
180
|
</div>
|
|
181
|
-
`}resetScroll(){this.triggerFindScrollableParent(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.visibleItems=[],this.scrolledToTarget=!1,this.scrollDebouncer.run((()=>{var t;let o=null!==(t=this.scrollToIndex)&&void 0!==t?t:this.scrollToItem?this.items.indexOf(this.scrollToItem):-1;o>=this.items.length&&(o=-1);const e=this.getItem(o);this.scrollToTarget(e),this.scrollDoneDebouncer.run((()=>{this.scrollRestorationItem=o>=0?o:void 0,this.scrollRestorationOffset=0===o?-this.getOffset(e):0,this.onMutation(),this.scrolledToTarget=!0}))}))}getItem(t){var o;return null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(`#item-${t}`)}scrollToTarget(t){var o;if(t){let e=+(null!==(o=t.getAttribute("data-item-index"))&&void 0!==o?o:"0");this.scrollable&&0===e?this.scrollable.scrollTop=0:this.scrollable.scrollTop=this.getOffset(t)}}getOffset(t){var o;let e=0,r=t;for(;r&&r.offsetParent!==this.scrollable.offsetParent;)e+=r.offsetTop,r=r.offsetParent;return e+(null!==(o=null==r?void 0:r.offsetTop)&&void 0!==o?o:0)-this.scrollable.offsetTop}getLastKnownHeight(t){var o;return+(null!==(o=null==t?void 0:t.getAttribute("data-last-known-height"))&&void 0!==o?o:1e3)}appendItems(...t){this.items=[...this.items,...t]}prependItems(...t){this.items=[...t,...this.items]}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.triggerFindScrollableParent(),this.initIntersectionObserver(),this.mutationObserver.disconnect(),this.mutationObserver.observe(this.itemsContainer,{childList:!0})}),0)}initIntersectionObserver(){this.intersectionObserver.disconnect(),this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange,{root:this.scrollable,rootMargin:"-8px",threshold:[0,.01,.1,1]})}triggerFindScrollableParent(){var t;null===(t=this.itemsContainer)||void 0===t||t.dispatchEvent(new Event("find-scrollable-parent",{composed:!0}))}findScrollableParent(t){var o;let e,r;t.stopPropagation();for(let o of t.composedPath()){const t=o,i=this.elementCanScroll(t);if(t.clientHeight&&t.clientHeight<t.scrollHeight&&i){e=t;break}i&&(r=t)}let i=e||r;i!==this.firstScrollableParent&&(null===(o=this.firstScrollableParent)||void 0===o||o.removeEventListener("scroll",this.scrollListener),null==i||i.addEventListener("scroll",this.scrollListener),this.firstScrollableParent=i,this.initIntersectionObserver(),this.resetScroll())}elementCanScroll(t){try{return["auto","scroll"].includes(getComputedStyle(t).overflowY)}catch(t){return!1}}searchFirstVisibleItem(t,o,e){if(o=null!=o?o:0,(e=null!=e?e:t.length-1)<=o)return t[o];const r=Math.floor((e-o)/2)+o,i=t[r];return this.getOffset(i)>this.scrollable.scrollTop?this.searchFirstVisibleItem(t,o,r-1):this.getOffset(i)+this.getLastKnownHeight(i)<this.scrollable.scrollTop?this.searchFirstVisibleItem(t,r+1,e):i}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.mutationObserver.disconnect()}firstUpdated(t){super.firstUpdated(t),this.resetScroll()}update(t){super.update(t),t.has("items")&&(this.
|
|
181
|
+
`}prepareRenderIfNeeded(t){const o=null!=this.renderApprovalTimeouts[t];this.inRenderRange(t)&&!o&&(this.renderApprovalTimeouts[t]=setTimeout((()=>{this.inRenderRange(t)?this.renderedIndexes.add(t):this.renderApprovalTimeouts[t]=void 0,this.requestUpdate()}),300))}inRenderRange(t){return t>=this.visibleItems[0]-this.renderBeforeFirst&&t<=(null!=(o=this.visibleItems)?o:[])[(null!=o?o:[]).length-1]+this.renderAfterLast;var o}resetScroll(){this.triggerFindScrollableParent(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.visibleItems=[],this.scrolledToTarget=!1,this.scrollDebouncer.run((()=>{var t;let o=null!==(t=this.scrollToIndex)&&void 0!==t?t:this.scrollToItem?this.items.indexOf(this.scrollToItem):-1;o>=this.items.length&&(o=-1);const e=this.getItem(o);this.scrollToTarget(e),this.scrollDoneDebouncer.run((()=>{this.scrollRestorationItem=o>=0?o:void 0,this.scrollRestorationOffset=0===o?-this.getOffset(e):0,this.onMutation(),null!=e&&this.renderedIndexes.add(o),this.scrolledToTarget=!0}))}))}getItem(t){var o;return null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(`#item-${t}`)}scrollToTarget(t){var o;if(t){let e=+(null!==(o=t.getAttribute("data-item-index"))&&void 0!==o?o:"0");this.scrollable&&0===e?this.scrollable.scrollTop=0:this.scrollable.scrollTop=this.getOffset(t)}}getOffset(t){var o;let e=0,r=t;for(;r&&r.offsetParent!==this.scrollable.offsetParent;)e+=r.offsetTop,r=r.offsetParent;return e+(null!==(o=null==r?void 0:r.offsetTop)&&void 0!==o?o:0)-this.scrollable.offsetTop}getLastKnownHeight(t){var o;return+(null!==(o=null==t?void 0:t.getAttribute("data-last-known-height"))&&void 0!==o?o:1e3)}appendItems(...t){this.items=[...this.items,...t]}prependItems(...t){this.items=[...t,...this.items]}connectedCallback(){super.connectedCallback(),setTimeout((()=>{this.triggerFindScrollableParent(),this.initIntersectionObserver(),this.mutationObserver.disconnect(),this.mutationObserver.observe(this.itemsContainer,{childList:!0})}),0)}initIntersectionObserver(){this.intersectionObserver.disconnect(),this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange,{root:this.scrollable,rootMargin:"-8px",threshold:[0,.01,.1,1]})}triggerFindScrollableParent(){var t;null===(t=this.itemsContainer)||void 0===t||t.dispatchEvent(new Event("find-scrollable-parent",{composed:!0}))}findScrollableParent(t){var o;let e,r;t.stopPropagation();for(let o of t.composedPath()){const t=o,i=this.elementCanScroll(t);if(t.clientHeight&&t.clientHeight<t.scrollHeight&&i){e=t;break}i&&(r=t)}let i=e||r;i!==this.firstScrollableParent&&(null===(o=this.firstScrollableParent)||void 0===o||o.removeEventListener("scroll",this.scrollListener),null==i||i.addEventListener("scroll",this.scrollListener),this.firstScrollableParent=i,this.initIntersectionObserver(),this.resetScroll())}elementCanScroll(t){try{return["auto","scroll"].includes(getComputedStyle(t).overflowY)}catch(t){return!1}}searchFirstVisibleItem(t,o,e){if(o=null!=o?o:0,(e=null!=e?e:t.length-1)<=o)return t[o];const r=Math.floor((e-o)/2)+o,i=t[r];return this.getOffset(i)>this.scrollable.scrollTop?this.searchFirstVisibleItem(t,o,r-1):this.getOffset(i)+this.getLastKnownHeight(i)<this.scrollable.scrollTop?this.searchFirstVisibleItem(t,r+1,e):i}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver.disconnect(),this.resizeObserver.disconnect(),this.mutationObserver.disconnect()}firstUpdated(t){super.firstUpdated(t),this.resetScroll()}update(t){super.update(t),t.has("items")&&(this.renderedIndexes=new Set),!t.has("scrollToItem")&&!t.has("scrollToIndex")||null==this.scrollToItem&&null==this.scrollToIndex||this.resetScroll()}updated(t){super.updated(t),(t.has("visibleItems")||t.has("items"))&&this.onVisibleItemsChange(),t.has("scrolledToTarget")&&this.scrolledToTarget&&(null!=this.scrollToItem||null!=this.scrollToIndex)&&this.dispatchEvent(new he)}onVisibleItemsChange(){const t=this.visibleItems.every(((t,o)=>null==this.visibleItems[o+1]||t+1===this.visibleItems[o+1]));t||k(this.visibleItems,this.lastNotOkVisibleItems)?(this.resetVisibleItemsDebouncer.cancel(),this.dispatchVisibleItemsEvent()):this.resetVisibleItemsDebouncer.run((()=>{this.lastNotOkVisibleItems=[...this.visibleItems],this.visibleItems=[],this.initIntersectionObserver(),this.onMutation()}))}dispatchVisibleItemsEvent(){var t,o;null===(t=this.cancelableDispatchEvent)||void 0===t||t.cancel(),this.cancelableDispatchEvent=(o=async function(t,o=5,e){let r,i,n=await t();for(r=i=performance.now();!n&&(!e||i-r<e);)await W(o),n=await t(),i=performance.now();if(null==n)throw new Error("Timeout exceeded")}((()=>!this.scrolling)),new e(((t,e)=>o.then(t).catch(e)))),this.cancelableDispatchEvent.then((()=>this.dispatchEvent(new le(this.visibleItems,this.visibleItems.map((t=>this.items[t])))))).catch((()=>null))}}var pe;fe.styles=ae,ce([U({type:Array})],fe.prototype,"items",void 0),ce([U({attribute:!1})],fe.prototype,"renderItem",void 0),ce([U({attribute:!1})],fe.prototype,"getItemKey",void 0),ce([U({type:Object})],fe.prototype,"scrollToItem",void 0),ce([U({type:Number})],fe.prototype,"scrollToIndex",void 0),ce([U({type:Boolean})],fe.prototype,"internalScroll",void 0),ce([U({type:Number})],fe.prototype,"renderBeforeFirst",void 0),ce([U({type:Number})],fe.prototype,"renderAfterLast",void 0),ce([E({hasChanged:(t,o)=>null!=t&&null==o||t.length!==o.length||t[0]!==o[0]})],fe.prototype,"visibleItems",void 0),ce([L(".scrollable")],fe.prototype,"internalScrollable",void 0),ce([L(".items-container")],fe.prototype,"itemsContainer",void 0),ce([E()],fe.prototype,"scrolledToTarget",void 0),ce([E()],fe.prototype,"scrolling",void 0),ce([E({hasChanged:(t,o)=>!k(t,o)})],fe.prototype,"renderedIndexes",void 0),(pe="ft-infinite-scroll",t=>{window.customElements.get(pe)||window.customElements.define(pe,t)})(fe),t.FtInfiniteScroll=fe,t.FtInfiniteScrollCssVariables=se,t.ScrolledToTargetEvent=he,t.VisibleItemsChangeEvent=le,t.styles=ae}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-infinite-scroll",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.26",
|
|
4
4
|
"description": "An infinite scroller.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "1.1.26",
|
|
23
23
|
"lit": "3.1.0"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "6734976f5a7f6b986917a085be0c38ca3ae562a0"
|
|
26
26
|
}
|