@neuronet.io/vido
Advanced tools
Comparing version 4.0.4 to 4.0.5
@@ -1,3 +0,1 @@ | ||
export { PropertiesHyphenFallback as CSSProps } from 'csstype'; | ||
/** | ||
@@ -8,12 +6,12 @@ * @license | ||
*/ | ||
var t;const i=globalThis.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,e=`lit$${(Math.random()+"").slice(9)}$`,o="?"+e,n=`<${o}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,u=t=>{var i;return d(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,a=/>/g,f=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,_=/'/g,m=/"/g,g=/^(?:script|style|textarea)$/i,$=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),p=$(1),y=$(2),b=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),x=new WeakMap,w=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h(),t),t,void 0,null!=s?s:{});}return l._$AI(t),l},A=l.createTreeWalker(l,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c;for(let i=0;i<o;i++){const s=t[i];let o,u,$=-1,p=0;for(;p<s.length&&(d.lastIndex=p,u=d.exec(s),null!==u);)p=d.lastIndex,d===c?"!--"===u[1]?d=v:void 0!==u[1]?d=a:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f):void 0!==u[3]&&(d=f):d===f?">"===u[0]?(d=null!=h?h:c,$=-1):void 0===u[1]?$=-2:($=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f:'"'===u[3]?m:_):d===m||d===_?d=f:d===v||d===a?d=c:(d=f,h=void 0);const y=d===f&&t[i+1].startsWith("/>")?" ":"";r+=d===c?s+n:$>=0?(l.push(o),s.slice(0,$)+"$lit$"+s.slice($)+e+y):s+e+(-2===$?(l.push(void 0),i):y);}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");return [void 0!==s?s.createHTML(u):u,l]};class P{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=P.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?k:"@"===i[1]?H:S});}else c.push({type:6,index:r});}for(const i of t)l.removeAttribute(i);}if(g.test(l.tagName)){const t=l.textContent.split(e),s=t.length-1;if(s>0){l.textContent=i?i.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h());}}}else if(8===l.nodeType)if(l.data===o)c.push({type:2,index:r});else {let t=-1;for(;-1!==(t=l.data.indexOf(e,t+1));)c.push({type:7,index:r}),t+=e.length-1;}r++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function V(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r(i)?void 0:i._$litDirective$;return (null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=V(t,d._$AS(t,i.values),d,e)),i}class E{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new I(n,this,t)),this.v.push(i),d=e[++r];}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++);}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o;}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=V(this,t,i),r(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):u(t)?this.M(t):this.$(t);}A(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t));}$(t){this._$AH!==T&&r(this._$AH)?this._$AA.nextSibling.data=t:this.S(l.createTextNode(t)),this._$AH=t;}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=P.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else {const t=new E(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t;}}_$AC(t){let i=x.get(t.strings);return void 0===i&&x.set(t.strings,i=new P(t)),i}M(t){d(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.A(h()),this.A(h()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t));}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T;}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=V(this,t,i,0),n=!r(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else {const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=V(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r(h)||h!==this._$AH[l]),h===T?t=T:t!==T&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h;}n&&!e&&this.k(t);}k(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class M extends S{constructor(){super(...arguments),this.type=3;}k(t){this.element[this.name]=t===T?void 0:t;}}class k extends S{constructor(){super(...arguments),this.type=4;}k(t){t&&t!==T?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name);}}class H extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5;}_$AI(t,i=this){var s;if((t=null!==(s=V(this,t,i,0))&&void 0!==s?s:T)===b)return;const e=this._$AH,o=t===T&&e!==T||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==T&&(e===T||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t);}}class I{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t);}}const L={P:"$lit$",V:e,L:o,I:1,N:C,R:E,D:u,j:V,H:N,O:S,F:k,B:H,W:M,Z:I},R=window.litHtmlPolyfillSupport;null==R||R(P,N),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.0.1"); | ||
var t$3;const i$5=globalThis.trustedTypes,s$2=i$5?i$5.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5=`lit$${(Math.random()+"").slice(9)}$`,o$4="?"+e$5,n$2=`<${o$4}>`,l$3=document,h$3=(t="")=>l$3.createComment(t),r$2=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d$2=Array.isArray,u$2=t=>{var i;return d$2(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c$4=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v$1=/-->/g,a$1=/>/g,f$1=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,_=/'/g,m$1=/"/g,g=/^(?:script|style|textarea)$/i,$=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),p$1=$(1),y=$(2),b=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),x=new WeakMap,w=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h$3(),t),t,void 0,null!=s?s:{});}return l._$AI(t),l},A=l$3.createTreeWalker(l$3,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c$4;for(let i=0;i<o;i++){const s=t[i];let o,u,$=-1,p=0;for(;p<s.length&&(d.lastIndex=p,u=d.exec(s),null!==u);)p=d.lastIndex,d===c$4?"!--"===u[1]?d=v$1:void 0!==u[1]?d=a$1:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f$1):void 0!==u[3]&&(d=f$1):d===f$1?">"===u[0]?(d=null!=h?h:c$4,$=-1):void 0===u[1]?$=-2:($=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f$1:'"'===u[3]?m$1:_):d===m$1||d===_?d=f$1:d===v$1||d===a$1?d=c$4:(d=f$1,h=void 0);const y=d===f$1&&t[i+1].startsWith("/>")?" ":"";r+=d===c$4?s+n$2:$>=0?(l.push(o),s.slice(0,$)+"$lit$"+s.slice($)+e$5+y):s+e$5+(-2===$?(l.push(void 0),i):y);}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");return [void 0!==s$2?s$2.createHTML(u):u,l]};class P{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=P.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e$5)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e$5),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?k:"@"===i[1]?H:S});}else c.push({type:6,index:r});}for(const i of t)l.removeAttribute(i);}if(g.test(l.tagName)){const t=l.textContent.split(e$5),s=t.length-1;if(s>0){l.textContent=i$5?i$5.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h$3()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h$3());}}}else if(8===l.nodeType)if(l.data===o$4)c.push({type:2,index:r});else {let t=-1;for(;-1!==(t=l.data.indexOf(e$5,t+1));)c.push({type:7,index:r}),t+=e$5.length-1;}r++;}}static createElement(t,i){const s=l$3.createElement("template");return s.innerHTML=t,s}}function V(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r$2(i)?void 0:i._$litDirective$;return (null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=V(t,d._$AS(t,i.values),d,e)),i}class E{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l$3).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new I(n,this,t)),this.v.push(i),d=e[++r];}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++);}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o;}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=V(this,t,i),r$2(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):u$2(t)?this.M(t):this.$(t);}A(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t));}$(t){this._$AH!==T&&r$2(this._$AH)?this._$AA.nextSibling.data=t:this.S(l$3.createTextNode(t)),this._$AH=t;}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=P.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else {const t=new E(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t;}}_$AC(t){let i=x.get(t.strings);return void 0===i&&x.set(t.strings,i=new P(t)),i}M(t){d$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.A(h$3()),this.A(h$3()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t));}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T;}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=V(this,t,i,0),n=!r$2(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else {const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=V(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r$2(h)||h!==this._$AH[l]),h===T?t=T:t!==T&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h;}n&&!e&&this.k(t);}k(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class M extends S{constructor(){super(...arguments),this.type=3;}k(t){this.element[this.name]=t===T?void 0:t;}}class k extends S{constructor(){super(...arguments),this.type=4;}k(t){t&&t!==T?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name);}}class H extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5;}_$AI(t,i=this){var s;if((t=null!==(s=V(this,t,i,0))&&void 0!==s?s:T)===b)return;const e=this._$AH,o=t===T&&e!==T||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==T&&(e===T||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t);}}class I{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t);}}const L={P:"$lit$",V:e$5,L:o$4,I:1,N:C,R:E,D:u$2,j:V,H:N,O:S,F:k,B:H,W:M,Z:I},R=window.litHtmlPolyfillSupport;null==R||R(P,N),(null!==(t$3=globalThis.litHtmlVersions)&&void 0!==t$3?t$3:globalThis.litHtmlVersions=[]).push("2.0.1"); | ||
var lithtml = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
_$LH: L, | ||
html: p, | ||
noChange: b, | ||
nothing: T, | ||
render: w, | ||
svg: y | ||
__proto__: null, | ||
_$LH: L, | ||
html: p$1, | ||
noChange: b, | ||
nothing: T, | ||
render: w, | ||
svg: y | ||
}); | ||
@@ -26,3 +24,3 @@ | ||
*/ | ||
const t$1={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$1=t=>(...e)=>({_$litDirective$:t,values:e});class i$1{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} | ||
const t$2={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$4=t=>(...e)=>({_$litDirective$:t,values:e});class i$4{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} | ||
@@ -33,3 +31,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const {H:i$2}=L,t$2=o=>null===o||"object"!=typeof o&&"function"!=typeof o,v$1=(o,i)=>{var t,n;return void 0===i?void 0!==(null===(t=o)||void 0===t?void 0:t._$litType$):(null===(n=o)||void 0===n?void 0:n._$litType$)===i},r$1=o=>void 0===o.strings,e$2=()=>document.createComment(""),u$1=(o,t,n)=>{var v;const l=o._$AA.parentNode,d=void 0===t?o._$AB:t._$AA;if(void 0===n){const t=l.insertBefore(e$2(),d),v=l.insertBefore(e$2(),d);n=new i$2(t,v,o,o.options);}else {const i=n._$AB.nextSibling,t=n._$AM,r=t!==o;if(r){let i;null===(v=n._$AQ)||void 0===v||v.call(n,o),n._$AM=o,void 0!==n._$AP&&(i=o._$AU)!==t._$AU&&n._$AP(i);}if(i!==d||r){let o=n._$AA;for(;o!==i;){const i=o.nextSibling;l.insertBefore(o,d),o=i;}}}return n},c$1=(o,i,t=o)=>(o._$AI(i,t),o),f$1={},s$1=(o,i=f$1)=>o._$AH=i,a$1=o=>o._$AH,m$1=o=>{var i;null===(i=o._$AP)||void 0===i||i.call(o,!1,!0);let t=o._$AA;const n=o._$AB.nextSibling;for(;t!==n;){const o=t.nextSibling;t.remove(),t=o;}},p$1=o=>{o._$AR();}; | ||
*/const {H:i$3}=L,t$1=o=>null===o||"object"!=typeof o&&"function"!=typeof o,v=(o,i)=>{var t,n;return void 0===i?void 0!==(null===(t=o)||void 0===t?void 0:t._$litType$):(null===(n=o)||void 0===n?void 0:n._$litType$)===i},r$1=o=>void 0===o.strings,e$3=()=>document.createComment(""),u$1=(o,t,n)=>{var v;const l=o._$AA.parentNode,d=void 0===t?o._$AB:t._$AA;if(void 0===n){const t=l.insertBefore(e$3(),d),v=l.insertBefore(e$3(),d);n=new i$3(t,v,o,o.options);}else {const i=n._$AB.nextSibling,t=n._$AM,r=t!==o;if(r){let i;null===(v=n._$AQ)||void 0===v||v.call(n,o),n._$AM=o,void 0!==n._$AP&&(i=o._$AU)!==t._$AU&&n._$AP(i);}if(i!==d||r){let o=n._$AA;for(;o!==i;){const i=o.nextSibling;l.insertBefore(o,d),o=i;}}}return n},c$3=(o,i,t=o)=>(o._$AI(i,t),o),f={},s$1=(o,i=f)=>o._$AH=i,a=o=>o._$AH,m=o=>{var i;null===(i=o._$AP)||void 0===i||i.call(o,!1,!0);let t=o._$AA;const n=o._$AB.nextSibling;for(;t!==n;){const o=t.nextSibling;t.remove(),t=o;}},p=o=>{o._$AR();}; | ||
@@ -40,3 +38,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const e$3=(i,t)=>{var s,o;const n=i._$AN;if(void 0===n)return !1;for(const i of n)null===(o=(s=i)._$AO)||void 0===o||o.call(s,t,!1),e$3(i,t);return !0},o$1=i=>{let t,s;do{if(void 0===(t=i._$AM))break;s=t._$AN,s.delete(i),i=t;}while(0===(null==s?void 0:s.size))},n$1=i=>{for(let t;t=i._$AM;i=t){let s=t._$AN;if(void 0===s)t._$AN=s=new Set;else if(s.has(i))break;s.add(i),l$1(t);}};function r$2(i){void 0!==this._$AN?(o$1(this),this._$AM=i,n$1(this)):this._$AM=i;}function h$1(i,t=!1,s=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(t)if(Array.isArray(n))for(let i=s;i<n.length;i++)e$3(n[i],!1),o$1(n[i]);else null!=n&&(e$3(n,!1),o$1(n));else e$3(this,i);}const l$1=i=>{var t,e,o,n;i.type==t$1.CHILD&&(null!==(t=(o=i)._$AP)&&void 0!==t||(o._$AP=h$1),null!==(e=(n=i)._$AQ)&&void 0!==e||(n._$AQ=r$2));};class d$1 extends i$1{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,t,s){super._$AT(i,t,s),n$1(this),this.isConnected=i._$AU;}_$AO(i,t=!0){var s,n;i!==this.isConnected&&(this.isConnected=i,i?null===(s=this.reconnected)||void 0===s||s.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),t&&(e$3(this,i),o$1(this));}setValue(t){if(r$1(this._$Ct))this._$Ct._$AI(t,this);else {const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0);}}disconnected(){}reconnected(){}} | ||
*/const e$2=(i,t)=>{var s,o;const n=i._$AN;if(void 0===n)return !1;for(const i of n)null===(o=(s=i)._$AO)||void 0===o||o.call(s,t,!1),e$2(i,t);return !0},o$3=i=>{let t,s;do{if(void 0===(t=i._$AM))break;s=t._$AN,s.delete(i),i=t;}while(0===(null==s?void 0:s.size))},n$1=i=>{for(let t;t=i._$AM;i=t){let s=t._$AN;if(void 0===s)t._$AN=s=new Set;else if(s.has(i))break;s.add(i),l$2(t);}};function r(i){void 0!==this._$AN?(o$3(this),this._$AM=i,n$1(this)):this._$AM=i;}function h$2(i,t=!1,s=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(t)if(Array.isArray(n))for(let i=s;i<n.length;i++)e$2(n[i],!1),o$3(n[i]);else null!=n&&(e$2(n,!1),o$3(n));else e$2(this,i);}const l$2=i=>{var t,e,o,n;i.type==t$2.CHILD&&(null!==(t=(o=i)._$AP)&&void 0!==t||(o._$AP=h$2),null!==(e=(n=i)._$AQ)&&void 0!==e||(n._$AQ=r));};class d$1 extends i$4{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,t,s){super._$AT(i,t,s),n$1(this),this.isConnected=i._$AU;}_$AO(i,t=!0){var s,n;i!==this.isConnected&&(this.isConnected=i,i?null===(s=this.reconnected)||void 0===s||s.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),t&&(e$2(this,i),o$3(this));}setValue(t){if(r$1(this._$Ct))this._$Ct._$AI(t,this);else {const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0);}}disconnected(){}reconnected(){}} | ||
@@ -48,3 +46,3 @@ /** | ||
*/ | ||
const t$3=async(t,s)=>{for await(const i of t)if(!1===await s(i))return};class s$2{constructor(t){this.U=t;}disconnect(){this.U=void 0;}reconnect(t){this.U=t;}deref(){return this.U}}class i$3{constructor(){this.Y=void 0,this.q=void 0;}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.q=t)));}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0;}} | ||
const t=async(t,s)=>{for await(const i of t)if(!1===await s(i))return};class s{constructor(t){this.U=t;}disconnect(){this.U=void 0;}reconnect(t){this.U=t;}deref(){return this.U}}class i$2{constructor(){this.Y=void 0,this.q=void 0;}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.q=t)));}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0;}} | ||
@@ -55,3 +53,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class o$2 extends d$1{constructor(){super(...arguments),this._$CG=new s$2(this),this._$CK=new i$3;}render(i,s){return b}update(i,[s,r]){if(this.isConnected||this.disconnected(),s===this._$CJ)return;this._$CJ=s;let e=0;const{_$CG:o,_$CK:h}=this;return t$3(s,(async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){if(i._$CJ!==s)return !1;void 0!==r&&(t=r(t,e)),i.commitValue(t,e),e++;}return !0})),b}commitValue(t,i){this.setValue(t);}disconnected(){this._$CG.disconnect(),this._$CK.pause();}reconnected(){this._$CG.reconnect(this),this._$CK.resume();}}const h$2=e$1(o$2); | ||
*/class o$2 extends d$1{constructor(){super(...arguments),this._$CG=new s(this),this._$CK=new i$2;}render(i,s){return b}update(i,[s,r]){if(this.isConnected||this.disconnected(),s===this._$CJ)return;this._$CJ=s;let e=0;const{_$CG:o,_$CK:h}=this;return t(s,(async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){if(i._$CJ!==s)return !1;void 0!==r&&(t=r(t,e)),i.commitValue(t,e),e++;}return !0})),b}commitValue(t,i){this.setValue(t);}disconnected(){this._$CG.disconnect(),this._$CK.pause();}reconnected(){this._$CG.reconnect(this),this._$CK.resume();}}const h$1=e$4(o$2); | ||
@@ -62,3 +60,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const c$2=e$1(class extends o$2{constructor(r){if(super(r),r.type!==t$1.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$CX=r,super.update(r,e)}commitValue(r,e){0===e&&p$1(this._$CX);const s=u$1(this._$CX);c$1(s,r);}}); | ||
*/const c$2=e$4(class extends o$2{constructor(r){if(super(r),r.type!==t$2.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$CX=r,super.update(r,e)}commitValue(r,e){0===e&&p(this._$CX);const s=u$1(this._$CX);c$3(s,r);}}); | ||
@@ -69,3 +67,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const d$2=e$1(class extends i$1{constructor(t){super(t),this.tt=new WeakMap;}render(t){return [t]}update(s,[e]){if(v$1(this.it)&&(!v$1(e)||this.it.strings!==e.strings)){const e=a$1(s).pop();let o=this.tt.get(this.it.strings);if(void 0===o){const s=document.createDocumentFragment();o=w(T,s),o.setConnected(!1),this.tt.set(this.it.strings,o);}s$1(o,[e]),u$1(o,void 0,e);}if(v$1(e)){if(!v$1(this.it)||this.it.strings!==e.strings){const t=this.tt.get(e.strings);if(void 0!==t){const i=a$1(t).pop();p$1(s),u$1(s,void 0,i),s$1(s,[i]);}}this.it=e;}else this.it=void 0;return this.render(e)}}); | ||
*/const d=e$4(class extends i$4{constructor(t){super(t),this.tt=new WeakMap;}render(t){return [t]}update(s,[e]){if(v(this.it)&&(!v(e)||this.it.strings!==e.strings)){const e=a(s).pop();let o=this.tt.get(this.it.strings);if(void 0===o){const s=document.createDocumentFragment();o=w(T,s),o.setConnected(!1),this.tt.set(this.it.strings,o);}s$1(o,[e]),u$1(o,void 0,e);}if(v(e)){if(!v(this.it)||this.it.strings!==e.strings){const t=this.tt.get(e.strings);if(void 0!==t){const i=a(t).pop();p(s),u$1(s,void 0,i),s$1(s,[i]);}}this.it=e;}else this.it=void 0;return this.render(e)}}); | ||
@@ -77,3 +75,3 @@ /** | ||
*/ | ||
const e$4={},i$4=e$1(class extends i$1{constructor(){super(...arguments),this.ot=e$4;}render(r,t){return t()}update(t,[s,e]){if(Array.isArray(s)){if(Array.isArray(this.ot)&&this.ot.length===s.length&&s.every(((r,t)=>r===this.ot[t])))return b}else if(this.ot===s)return b;return this.ot=Array.isArray(s)?Array.from(s):s,this.render(s,e)}}); | ||
const e$1={},i$1=e$4(class extends i$4{constructor(){super(...arguments),this.ot=e$1;}render(r,t){return t()}update(t,[s,e]){if(Array.isArray(s)){if(Array.isArray(this.ot)&&this.ot.length===s.length&&s.every(((r,t)=>r===this.ot[t])))return b}else if(this.ot===s)return b;return this.ot=Array.isArray(s)?Array.from(s):s,this.render(s,e)}}); | ||
@@ -84,3 +82,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const l$2=l=>null!=l?l:T; | ||
*/const l$1=l=>null!=l?l:T; | ||
@@ -92,3 +90,3 @@ /** | ||
*/ | ||
const u$2=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c$3=e$1(class extends i$1{constructor(e){if(super(e),e.type!==t$1.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return {values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){var d;const a=a$1(s),{values:p,keys:v}=this.dt(t,r,c);if(!Array.isArray(a))return this.ct=v,p;const h=null!==(d=this.ct)&&void 0!==d?d:this.ct=[],m=[];let y,x,j=0,k=a.length-1,w=0,A=p.length-1;for(;j<=k&&w<=A;)if(null===a[j])j++;else if(null===a[k])k--;else if(h[j]===v[w])m[w]=c$1(a[j],p[w]),j++,w++;else if(h[k]===v[A])m[A]=c$1(a[k],p[A]),k--,A--;else if(h[j]===v[A])m[A]=c$1(a[j],p[A]),u$1(s,m[A+1],a[j]),j++,A--;else if(h[k]===v[w])m[w]=c$1(a[k],p[w]),u$1(s,a[j],a[k]),k--,w++;else if(void 0===y&&(y=u$2(v,w,A),x=u$2(h,j,k)),y.has(h[j]))if(y.has(h[k])){const e=x.get(v[w]),t=void 0!==e?a[e]:null;if(null===t){const e=u$1(s,a[j]);c$1(e,p[w]),m[w]=e;}else m[w]=c$1(t,p[w]),u$1(s,a[j],t),a[e]=null;w++;}else m$1(a[k]),k--;else m$1(a[j]),j++;for(;w<=A;){const e=u$1(s,m[A+1]);c$1(e,p[w]),m[w++]=e;}for(;j<=k;){const e=a[j++];null!==e&&m$1(e);}return this.ct=v,s$1(s,m),b}}); | ||
const u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c$1=e$4(class extends i$4{constructor(e){if(super(e),e.type!==t$2.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return {values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){var d;const a$1=a(s),{values:p,keys:v}=this.dt(t,r,c);if(!Array.isArray(a$1))return this.ct=v,p;const h=null!==(d=this.ct)&&void 0!==d?d:this.ct=[],m$1=[];let y,x,j=0,k=a$1.length-1,w=0,A=p.length-1;for(;j<=k&&w<=A;)if(null===a$1[j])j++;else if(null===a$1[k])k--;else if(h[j]===v[w])m$1[w]=c$3(a$1[j],p[w]),j++,w++;else if(h[k]===v[A])m$1[A]=c$3(a$1[k],p[A]),k--,A--;else if(h[j]===v[A])m$1[A]=c$3(a$1[j],p[A]),u$1(s,m$1[A+1],a$1[j]),j++,A--;else if(h[k]===v[w])m$1[w]=c$3(a$1[k],p[w]),u$1(s,a$1[j],a$1[k]),k--,w++;else if(void 0===y&&(y=u(v,w,A),x=u(h,j,k)),y.has(h[j]))if(y.has(h[k])){const e=x.get(v[w]),t=void 0!==e?a$1[e]:null;if(null===t){const e=u$1(s,a$1[j]);c$3(e,p[w]),m$1[w]=e;}else m$1[w]=c$3(t,p[w]),u$1(s,a$1[j],t),a$1[e]=null;w++;}else m(a$1[k]),k--;else m(a$1[j]),j++;for(;w<=A;){const e=u$1(s,m$1[A+1]);c$3(e,p[w]),m$1[w++]=e;}for(;j<=k;){const e=a$1[j++];null!==e&&m(e);}return this.ct=v,s$1(s,m$1),b}}); | ||
@@ -99,3 +97,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class e$5 extends i$1{constructor(i){if(super(i),this.it=T,i.type!==t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===T||null==r)return this.vt=void 0,this.it=r;if(r===b)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this.vt;this.it=r;const s=[r];return s.raw=s,this.vt={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e$5.directiveName="unsafeHTML",e$5.resultType=1;const o$3=e$1(e$5); | ||
*/class e extends i$4{constructor(i){if(super(i),this.it=T,i.type!==t$2.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===T||null==r)return this.vt=void 0,this.it=r;if(r===b)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this.vt;this.it=r;const s=[r];return s.raw=s,this.vt={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o$1=e$4(e); | ||
@@ -106,3 +104,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const n$2=t=>!t$2(t)&&"function"==typeof t.then;class h$3 extends d$1{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new s$2(this),this._$CK=new i$3;}render(...s){var i;return null!==(i=s.find((t=>!n$2(t))))&&void 0!==i?i:b}update(s,i){const r=this._$Cwt;let e=r.length;this._$Cwt=i;const o=this._$CG,h=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<i.length&&!(t>this._$Cft);t++){const s=i[t];if(!n$2(s))return this._$Cft=t,s;t<e&&s===r[t]||(this._$Cft=1073741823,e=0,Promise.resolve(s).then((async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){const r=i._$Cwt.indexOf(s);r>-1&&r<i._$Cft&&(i._$Cft=r,i.setValue(t));}})));}return b}disconnected(){this._$CG.disconnect(),this._$CK.pause();}reconnected(){this._$CG.reconnect(this),this._$CK.resume();}}const c$4=e$1(h$3); | ||
*/const n=t=>!t$1(t)&&"function"==typeof t.then;class h extends d$1{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new s(this),this._$CK=new i$2;}render(...s){var i;return null!==(i=s.find((t=>!n(t))))&&void 0!==i?i:b}update(s,i){const r=this._$Cwt;let e=r.length;this._$Cwt=i;const o=this._$CG,h=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<i.length&&!(t>this._$Cft);t++){const s=i[t];if(!n(s))return this._$Cft=t,s;t<e&&s===r[t]||(this._$Cft=1073741823,e=0,Promise.resolve(s).then((async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){const r=i._$Cwt.indexOf(s);r>-1&&r<i._$Cft&&(i._$Cft=r,i.setValue(t));}})));}return b}disconnected(){this._$CG.disconnect(),this._$CK.pause();}reconnected(){this._$CG.reconnect(this),this._$CK.resume();}}const c=e$4(h); | ||
@@ -113,6 +111,6 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const l$3=e$1(class extends i$1{constructor(r){if(super(r),r.type!==t$1.PROPERTY&&r.type!==t$1.ATTRIBUTE&&r.type!==t$1.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!r$1(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t]){if(t===b||t===T)return t;const o=i.element,l=i.name;if(i.type===t$1.PROPERTY){if(t===o[l])return b}else if(i.type===t$1.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(l))return b}else if(i.type===t$1.ATTRIBUTE&&o.getAttribute(l)===t+"")return b;return s$1(i),t}}); | ||
*/const l=e$4(class extends i$4{constructor(r){if(super(r),r.type!==t$2.PROPERTY&&r.type!==t$2.ATTRIBUTE&&r.type!==t$2.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!r$1(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t]){if(t===b||t===T)return t;const o=i.element,l=i.name;if(i.type===t$2.PROPERTY){if(t===o[l])return b}else if(i.type===t$2.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(l))return b}else if(i.type===t$2.ATTRIBUTE&&o.getAttribute(l)===t+"")return b;return s$1(i),t}}); | ||
const detached = new WeakMap(); | ||
class Detach extends i$1 { | ||
class Detach extends i$4 { | ||
render(shouldDetach) { | ||
@@ -156,3 +154,3 @@ return T; | ||
} | ||
const detach = e$1(Detach); | ||
const detach = e$4(Detach); | ||
@@ -163,3 +161,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const i$5=e$1(class extends i$1{constructor(t){var e;if(super(t),t.type!==t$1.ATTRIBUTE||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ut){this.ut=new Set;for(const t in r)this.ut.add(t);return this.render(r)}this.ut.forEach((t=>{null==r[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]="");}));for(const t in r){const e=r[t];null!=e&&(this.ut.add(t),t.includes("-")?s.setProperty(t,e):s[t]=e);}return b}}); | ||
*/const i=e$4(class extends i$4{constructor(t){var e;if(super(t),t.type!==t$2.ATTRIBUTE||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ut){this.ut=new Set;for(const t in r)this.ut.add(t);return this.render(r)}this.ut.forEach((t=>{null==r[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]="");}));for(const t in r){const e=r[t];null!=e&&(this.ut.add(t),t.includes("-")?s.setProperty(t,e):s[t]=e);}return b}}); | ||
@@ -170,3 +168,3 @@ /** | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const o$4=e$1(class extends i$1{constructor(t){var i;if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(i,[s]){var r,o;if(void 0===this.st){this.st=new Set,void 0!==i.strings&&(this.et=new Set(i.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in s)s[t]&&!(null===(r=this.et)||void 0===r?void 0:r.has(t))&&this.st.add(t);return this.render(s)}const e=i.element.classList;this.st.forEach((t=>{t in s||(e.remove(t),this.st.delete(t));}));for(const t in s){const i=!!s[t];i===this.st.has(t)||(null===(o=this.et)||void 0===o?void 0:o.has(t))||(i?(e.add(t),this.st.add(t)):(e.remove(t),this.st.delete(t)));}return b}}); | ||
*/const o=e$4(class extends i$4{constructor(t){var i;if(super(t),t.type!==t$2.ATTRIBUTE||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(i,[s]){var r,o;if(void 0===this.st){this.st=new Set,void 0!==i.strings&&(this.et=new Set(i.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in s)s[t]&&!(null===(r=this.et)||void 0===r?void 0:r.has(t))&&this.st.add(t);return this.render(s)}const e=i.element.classList;this.st.forEach((t=>{t in s||(e.remove(t),this.st.delete(t));}));for(const t in s){const i=!!s[t];i===this.st.has(t)||(null===(o=this.et)||void 0===o?void 0:o.has(t))||(i?(e.add(t),this.st.add(t)):(e.remove(t),this.st.delete(t)));}return b}}); | ||
@@ -509,3 +507,3 @@ class Action { | ||
function getActionsCollector(actionsByInstance) { | ||
return class ActionsCollector extends i$1 { | ||
return class ActionsCollector extends i$4 { | ||
update(part, props) { | ||
@@ -816,3 +814,3 @@ const element = part.element; | ||
class GetElementDirective extends i$1 { | ||
class GetElementDirective extends i$4 { | ||
update(part, props) { | ||
@@ -845,3 +843,3 @@ if (typeof props[0] !== 'function') { | ||
create(actions, props) { | ||
const actionsInstanceDirective = e$1(ActionsCollector); | ||
const actionsInstanceDirective = e$4(ActionsCollector); | ||
const actionsInstance = () => { | ||
@@ -866,18 +864,18 @@ return actionsInstanceDirective(this.instance, actions, props); | ||
this.lastProps = {}; | ||
this.html = p; | ||
this.html = p$1; | ||
this.svg = y; | ||
this.directive = e$1; | ||
this.directive = e$4; | ||
this.asyncAppend = c$2; | ||
this.asyncReplace = h$2; | ||
this.cache = d$2; | ||
this.classMap = o$4; | ||
this.styleMap = i$5; | ||
this.guard = i$4; | ||
this.live = l$3; | ||
this.ifDefined = l$2; | ||
this.repeat = c$3; | ||
this.unsafeHTML = o$3; | ||
this.until = c$4; | ||
this.asyncReplace = h$1; | ||
this.cache = d; | ||
this.classMap = o; | ||
this.styleMap = i; | ||
this.guard = i$1; | ||
this.live = l; | ||
this.ifDefined = l$1; | ||
this.repeat = c$1; | ||
this.unsafeHTML = o$1; | ||
this.until = c; | ||
this.schedule = schedule; | ||
this.getElement = e$1(GetElementDirective); | ||
this.getElement = e$4(GetElementDirective); | ||
this.actionsByInstance = ( /* componentActions, props */) => { }; | ||
@@ -1117,21 +1115,20 @@ this.detach = detach; | ||
Vido.prototype.Action = Action; | ||
Vido.prototype.Directive = i$1; | ||
Vido.prototype.Directive = i$4; | ||
Vido.prototype.schedule = schedule; | ||
Vido.prototype.detach = detach; | ||
Vido.prototype.styleMap = i$5; | ||
Vido.prototype.classMap = o$4; | ||
Vido.prototype.styleMap = i; | ||
Vido.prototype.classMap = o; | ||
Vido.prototype.PointerAction = PointerAction; | ||
Vido.prototype.asyncAppend = c$2; | ||
Vido.prototype.asyncReplace = h$2; | ||
Vido.prototype.cache = d$2; | ||
Vido.prototype.guard = i$4; | ||
Vido.prototype.live = l$3; | ||
Vido.prototype.ifDefined = l$2; | ||
Vido.prototype.repeat = c$3; | ||
Vido.prototype.unsafeHTML = o$3; | ||
Vido.prototype.until = c$4; | ||
Vido.prototype.asyncReplace = h$1; | ||
Vido.prototype.cache = d; | ||
Vido.prototype.guard = i$1; | ||
Vido.prototype.live = l; | ||
Vido.prototype.ifDefined = l$1; | ||
Vido.prototype.repeat = c$1; | ||
Vido.prototype.unsafeHTML = o$1; | ||
Vido.prototype.until = c; | ||
Vido.prototype.Slots = Slots; | ||
export default Vido; | ||
export { Action, i$1 as Directive, PointerAction, Slots, c$2 as asyncAppend, h$2 as asyncReplace, d$2 as cache, o$4 as classMap, detach, i$4 as guard, helpers, l$2 as ifDefined, lithtml, c$3 as repeat, schedule, i$5 as styleMap, o$3 as unsafeHTML, c$4 as until }; | ||
export { Action, i$4 as Directive, PointerAction, Slots, c$2 as asyncAppend, h$1 as asyncReplace, d as cache, o as classMap, Vido as default, detach, i$1 as guard, helpers, l$1 as ifDefined, lithtml, c$1 as repeat, schedule, i as styleMap, o$1 as unsafeHTML, c as until }; | ||
//# sourceMappingURL=vido.esm.js.map |
@@ -1,2 +0,1 @@ | ||
export{PropertiesHyphenFallback as CSSProps}from"csstype"; | ||
/** | ||
@@ -6,3 +5,4 @@ * @license | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/var t;const e=globalThis.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,n=`lit$${(Math.random()+"").slice(9)}$`,i="?"+n,o=`<${i}>`,r=document,h=(t="")=>r.createComment(t),l=t=>null===t||"object"!=typeof t&&"function"!=typeof t,c=Array.isArray,a=t=>{var e;return c(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])},d=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,u=/-->/g,p=/>/g,v=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,f=/'/g,m=/"/g,g=/^(?:script|style|textarea)$/i,y=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),$=y(1),A=y(2),_=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),x=new WeakMap,C=(t,e,s)=>{var n,i;const o=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:e;let r=o._$litPart$;if(void 0===r){const t=null!==(i=null==s?void 0:s.renderBefore)&&void 0!==i?i:null;o._$litPart$=r=new P(e.insertBefore(h(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r},w=r.createTreeWalker(r,129,null,!1),M=(t,e)=>{const i=t.length-1,r=[];let h,l=2===e?"<svg>":"",c=d;for(let e=0;e<i;e++){const s=t[e];let i,a,y=-1,$=0;for(;$<s.length&&(c.lastIndex=$,a=c.exec(s),null!==a);)$=c.lastIndex,c===d?"!--"===a[1]?c=u:void 0!==a[1]?c=p:void 0!==a[2]?(g.test(a[2])&&(h=RegExp("</"+a[2],"g")),c=v):void 0!==a[3]&&(c=v):c===v?">"===a[0]?(c=null!=h?h:d,y=-1):void 0===a[1]?y=-2:(y=c.lastIndex-a[2].length,i=a[1],c=void 0===a[3]?v:'"'===a[3]?m:f):c===m||c===f?c=v:c===u||c===p?c=d:(c=v,h=void 0);const A=c===v&&t[e+1].startsWith("/>")?" ":"";l+=c===d?s+o:y>=0?(r.push(i),s.slice(0,y)+"$lit$"+s.slice(y)+n+A):s+n+(-2===y?(r.push(void 0),e):A)}const a=l+(t[i]||"<?>")+(2===e?"</svg>":"");return[void 0!==s?s.createHTML(a):a,r]};class I{constructor({strings:t,_$litType$:s},o){let r;this.parts=[];let l=0,c=0;const a=t.length-1,d=this.parts,[u,p]=M(t,s);if(this.el=I.createElement(u,o),w.currentNode=this.el.content,2===s){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(r=w.nextNode())&&d.length<a;){if(1===r.nodeType){if(r.hasAttributes()){const t=[];for(const e of r.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(n)){const s=p[c++];if(t.push(e),void 0!==s){const t=r.getAttribute(s.toLowerCase()+"$lit$").split(n),e=/([.?@])?(.*)/.exec(s);d.push({type:1,index:l,name:e[2],strings:t,ctor:"."===e[1]?H:"?"===e[1]?T:"@"===e[1]?N:E})}else d.push({type:6,index:l})}for(const e of t)r.removeAttribute(e)}if(g.test(r.tagName)){const t=r.textContent.split(n),s=t.length-1;if(s>0){r.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)r.append(t[e],h()),w.nextNode(),d.push({type:2,index:++l});r.append(t[s],h())}}}else if(8===r.nodeType)if(r.data===i)d.push({type:2,index:l});else{let t=-1;for(;-1!==(t=r.data.indexOf(n,t+1));)d.push({type:7,index:l}),t+=n.length-1}l++}}static createElement(t,e){const s=r.createElement("template");return s.innerHTML=t,s}}function Y(t,e,s=t,n){var i,o,r,h;if(e===_)return e;let c=void 0!==n?null===(i=s._$Cl)||void 0===i?void 0:i[n]:s._$Cu;const a=l(e)?void 0:e._$litDirective$;return(null==c?void 0:c.constructor)!==a&&(null===(o=null==c?void 0:c._$AO)||void 0===o||o.call(c,!1),void 0===a?c=void 0:(c=new a(t),c._$AT(t,s,n)),void 0!==n?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[n]=c:s._$Cu=c),void 0!==c&&(e=Y(t,c._$AS(t,e.values),c,n)),e}class X{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:s},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:r).importNode(s,!0);w.currentNode=i;let o=w.nextNode(),h=0,l=0,c=n[0];for(;void 0!==c;){if(h===c.index){let e;2===c.type?e=new P(o,o.nextSibling,this,t):1===c.type?e=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(e=new S(o,this,t)),this.v.push(e),c=n[++l]}h!==(null==c?void 0:c.index)&&(o=w.nextNode(),h++)}return i}m(t){let e=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class P{constructor(t,e,s,n){var i;this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cg=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),l(t)?t===b||null==t||""===t?(this._$AH!==b&&this._$AR(),this._$AH=b):t!==this._$AH&&t!==_&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):a(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==b&&l(this._$AH)?this._$AA.nextSibling.data=t:this.S(r.createTextNode(t)),this._$AH=t}T(t){var e;const{values:s,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=I.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.m(s);else{const t=new X(i,this),e=t.p(this.options);t.m(s),this.S(e),this._$AH=t}}_$AC(t){let e=x.get(t.strings);return void 0===e&&x.set(t.strings,e=new I(t)),e}M(t){c(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const i of t)n===e.length?e.push(s=new P(this.A(h()),this.A(h()),this,this.options)):s=e[n],s._$AI(i),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class E{constructor(t,e,s,n,i){this.type=1,this._$AH=b,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=Y(this,t,e,0),o=!l(t)||t!==this._$AH&&t!==_,o&&(this._$AH=t);else{const n=t;let r,h;for(t=i[0],r=0;r<i.length-1;r++)h=Y(this,n[s+r],e,r),h===_&&(h=this._$AH[r]),o||(o=!l(h)||h!==this._$AH[r]),h===b?t=b:t!==b&&(t+=(null!=h?h:"")+i[r+1]),this._$AH[r]=h}o&&!n&&this.k(t)}k(t){t===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class H extends E{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===b?void 0:t}}class T extends E{constructor(){super(...arguments),this.type=4}k(t){t&&t!==b?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}}class N extends E{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){var s;if((t=null!==(s=Y(this,t,e,0))&&void 0!==s?s:b)===_)return;const n=this._$AH,i=t===b&&n!==b||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==b&&(n===b||i);i&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class S{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const L={P:"$lit$",V:n,L:i,I:1,N:M,R:X,D:a,j:Y,H:P,O:E,F:T,B:N,W:H,Z:S},D=window.litHtmlPolyfillSupport;null==D||D(I,P),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.0.1");var U=Object.freeze({__proto__:null,_$LH:L,html:$,noChange:_,nothing:b,render:C,svg:A}); | ||
*/ | ||
var t;const e=globalThis.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,n=`lit$${(Math.random()+"").slice(9)}$`,i="?"+n,o=`<${i}>`,r=document,h=(t="")=>r.createComment(t),l=t=>null===t||"object"!=typeof t&&"function"!=typeof t,c=Array.isArray,a=t=>{var e;return c(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])},d=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,u=/-->/g,p=/>/g,v=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,f=/'/g,m=/"/g,g=/^(?:script|style|textarea)$/i,y=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),$=y(1),A=y(2),_=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),x=new WeakMap,C=(t,e,s)=>{var n,i;const o=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:e;let r=o._$litPart$;if(void 0===r){const t=null!==(i=null==s?void 0:s.renderBefore)&&void 0!==i?i:null;o._$litPart$=r=new E(e.insertBefore(h(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r},w=r.createTreeWalker(r,129,null,!1),M=(t,e)=>{const i=t.length-1,r=[];let h,l=2===e?"<svg>":"",c=d;for(let e=0;e<i;e++){const s=t[e];let i,a,y=-1,$=0;for(;$<s.length&&(c.lastIndex=$,a=c.exec(s),null!==a);)$=c.lastIndex,c===d?"!--"===a[1]?c=u:void 0!==a[1]?c=p:void 0!==a[2]?(g.test(a[2])&&(h=RegExp("</"+a[2],"g")),c=v):void 0!==a[3]&&(c=v):c===v?">"===a[0]?(c=null!=h?h:d,y=-1):void 0===a[1]?y=-2:(y=c.lastIndex-a[2].length,i=a[1],c=void 0===a[3]?v:'"'===a[3]?m:f):c===m||c===f?c=v:c===u||c===p?c=d:(c=v,h=void 0);const A=c===v&&t[e+1].startsWith("/>")?" ":"";l+=c===d?s+o:y>=0?(r.push(i),s.slice(0,y)+"$lit$"+s.slice(y)+n+A):s+n+(-2===y?(r.push(void 0),e):A)}const a=l+(t[i]||"<?>")+(2===e?"</svg>":"");return[void 0!==s?s.createHTML(a):a,r]};class I{constructor({strings:t,_$litType$:s},o){let r;this.parts=[];let l=0,c=0;const a=t.length-1,d=this.parts,[u,p]=M(t,s);if(this.el=I.createElement(u,o),w.currentNode=this.el.content,2===s){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(r=w.nextNode())&&d.length<a;){if(1===r.nodeType){if(r.hasAttributes()){const t=[];for(const e of r.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(n)){const s=p[c++];if(t.push(e),void 0!==s){const t=r.getAttribute(s.toLowerCase()+"$lit$").split(n),e=/([.?@])?(.*)/.exec(s);d.push({type:1,index:l,name:e[2],strings:t,ctor:"."===e[1]?T:"?"===e[1]?H:"@"===e[1]?N:P})}else d.push({type:6,index:l})}for(const e of t)r.removeAttribute(e)}if(g.test(r.tagName)){const t=r.textContent.split(n),s=t.length-1;if(s>0){r.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)r.append(t[e],h()),w.nextNode(),d.push({type:2,index:++l});r.append(t[s],h())}}}else if(8===r.nodeType)if(r.data===i)d.push({type:2,index:l});else{let t=-1;for(;-1!==(t=r.data.indexOf(n,t+1));)d.push({type:7,index:l}),t+=n.length-1}l++}}static createElement(t,e){const s=r.createElement("template");return s.innerHTML=t,s}}function Y(t,e,s=t,n){var i,o,r,h;if(e===_)return e;let c=void 0!==n?null===(i=s._$Cl)||void 0===i?void 0:i[n]:s._$Cu;const a=l(e)?void 0:e._$litDirective$;return(null==c?void 0:c.constructor)!==a&&(null===(o=null==c?void 0:c._$AO)||void 0===o||o.call(c,!1),void 0===a?c=void 0:(c=new a(t),c._$AT(t,s,n)),void 0!==n?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[n]=c:s._$Cu=c),void 0!==c&&(e=Y(t,c._$AS(t,e.values),c,n)),e}class X{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:s},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:r).importNode(s,!0);w.currentNode=i;let o=w.nextNode(),h=0,l=0,c=n[0];for(;void 0!==c;){if(h===c.index){let e;2===c.type?e=new E(o,o.nextSibling,this,t):1===c.type?e=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(e=new S(o,this,t)),this.v.push(e),c=n[++l]}h!==(null==c?void 0:c.index)&&(o=w.nextNode(),h++)}return i}m(t){let e=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class E{constructor(t,e,s,n){var i;this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cg=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),l(t)?t===b||null==t||""===t?(this._$AH!==b&&this._$AR(),this._$AH=b):t!==this._$AH&&t!==_&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):a(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==b&&l(this._$AH)?this._$AA.nextSibling.data=t:this.S(r.createTextNode(t)),this._$AH=t}T(t){var e;const{values:s,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=I.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.m(s);else{const t=new X(i,this),e=t.p(this.options);t.m(s),this.S(e),this._$AH=t}}_$AC(t){let e=x.get(t.strings);return void 0===e&&x.set(t.strings,e=new I(t)),e}M(t){c(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const i of t)n===e.length?e.push(s=new E(this.A(h()),this.A(h()),this,this.options)):s=e[n],s._$AI(i),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class P{constructor(t,e,s,n,i){this.type=1,this._$AH=b,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=Y(this,t,e,0),o=!l(t)||t!==this._$AH&&t!==_,o&&(this._$AH=t);else{const n=t;let r,h;for(t=i[0],r=0;r<i.length-1;r++)h=Y(this,n[s+r],e,r),h===_&&(h=this._$AH[r]),o||(o=!l(h)||h!==this._$AH[r]),h===b?t=b:t!==b&&(t+=(null!=h?h:"")+i[r+1]),this._$AH[r]=h}o&&!n&&this.k(t)}k(t){t===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class T extends P{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===b?void 0:t}}class H extends P{constructor(){super(...arguments),this.type=4}k(t){t&&t!==b?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}}class N extends P{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){var s;if((t=null!==(s=Y(this,t,e,0))&&void 0!==s?s:b)===_)return;const n=this._$AH,i=t===b&&n!==b||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==b&&(n===b||i);i&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class S{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const L={P:"$lit$",V:n,L:i,I:1,N:M,R:X,D:a,j:Y,H:E,O:P,F:H,B:N,W:T,Z:S},D=window.litHtmlPolyfillSupport;null==D||D(I,E),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.0.1");var U=Object.freeze({__proto__:null,_$LH:L,html:$,noChange:_,nothing:b,render:C,svg:A}); | ||
/** | ||
@@ -27,3 +27,3 @@ * @license | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class ct{constructor(t){this.U=t}disconnect(){this.U=void 0}reconnect(t){this.U=t}deref(){return this.U}}class at{constructor(){this.Y=void 0,this.q=void 0}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise(t=>this.q=t))}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0}} | ||
*/class ct{constructor(t){this.U=t}disconnect(){this.U=void 0}reconnect(t){this.U=t}deref(){return this.U}}class at{constructor(){this.Y=void 0,this.q=void 0}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.q=t)))}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0}} | ||
/** | ||
@@ -33,3 +33,3 @@ * @license | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class dt extends lt{constructor(){super(...arguments),this._$CG=new ct(this),this._$CK=new at}render(t,e){return _}update(t,[e,s]){if(this.isConnected||this.disconnected(),e===this._$CJ)return;this._$CJ=e;let n=0;const{_$CG:i,_$CK:o}=this;return(async(t,e)=>{for await(const s of t)if(!1===await e(s))return})(e,async t=>{for(;o.get();)await o.get();const r=i.deref();if(void 0!==r){if(r._$CJ!==e)return!1;void 0!==s&&(t=s(t,n)),r.commitValue(t,n),n++}return!0}),_}commitValue(t,e){this.setValue(t)}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}const ut=j(dt),pt=j(class extends dt{constructor(t){if(super(t),t.type!==B)throw Error("asyncAppend can only be used in child expressions")}update(t,e){return this._$CX=t,super.update(t,e)}commitValue(t,e){0===e&&et(this._$CX);const s=K(this._$CX);q(s,t)}}),vt=j(class extends z{constructor(t){super(t),this.tt=new WeakMap}render(t){return[t]}update(t,[e]){if(R(this.it)&&(!R(e)||this.it.strings!==e.strings)){const e=Q(t).pop();let s=this.tt.get(this.it.strings);if(void 0===s){const t=document.createDocumentFragment();s=C(b,t),s.setConnected(!1),this.tt.set(this.it.strings,s)}J(s,[e]),K(s,void 0,e)}if(R(e)){if(!R(this.it)||this.it.strings!==e.strings){const s=this.tt.get(e.strings);if(void 0!==s){const e=Q(s).pop();et(t),K(t,void 0,e),J(t,[e])}}this.it=e}else this.it=void 0;return this.render(e)}}),ft={},mt=j(class extends z{constructor(){super(...arguments),this.ot=ft}render(t,e){return e()}update(t,[e,s]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every((t,e)=>t===this.ot[e]))return _}else if(this.ot===e)return _;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,s)}}),gt=t=>null!=t?t:b | ||
*/class dt extends lt{constructor(){super(...arguments),this._$CG=new ct(this),this._$CK=new at}render(t,e){return _}update(t,[e,s]){if(this.isConnected||this.disconnected(),e===this._$CJ)return;this._$CJ=e;let n=0;const{_$CG:i,_$CK:o}=this;return(async(t,e)=>{for await(const s of t)if(!1===await e(s))return})(e,(async t=>{for(;o.get();)await o.get();const r=i.deref();if(void 0!==r){if(r._$CJ!==e)return!1;void 0!==s&&(t=s(t,n)),r.commitValue(t,n),n++}return!0})),_}commitValue(t,e){this.setValue(t)}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}const ut=j(dt),pt=j(class extends dt{constructor(t){if(super(t),t.type!==B)throw Error("asyncAppend can only be used in child expressions")}update(t,e){return this._$CX=t,super.update(t,e)}commitValue(t,e){0===e&&et(this._$CX);const s=K(this._$CX);q(s,t)}}),vt=j(class extends z{constructor(t){super(t),this.tt=new WeakMap}render(t){return[t]}update(t,[e]){if(R(this.it)&&(!R(e)||this.it.strings!==e.strings)){const e=Q(t).pop();let s=this.tt.get(this.it.strings);if(void 0===s){const t=document.createDocumentFragment();s=C(b,t),s.setConnected(!1),this.tt.set(this.it.strings,s)}J(s,[e]),K(s,void 0,e)}if(R(e)){if(!R(this.it)||this.it.strings!==e.strings){const s=this.tt.get(e.strings);if(void 0!==s){const e=Q(s).pop();et(t),K(t,void 0,e),J(t,[e])}}this.it=e}else this.it=void 0;return this.render(e)}}),ft={},mt=j(class extends z{constructor(){super(...arguments),this.ot=ft}render(t,e){return e()}update(t,[e,s]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every(((t,e)=>t===this.ot[e])))return _}else if(this.ot===e)return _;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,s)}}),gt=t=>null!=t?t:b | ||
/** | ||
@@ -55,3 +55,3 @@ * @license | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const xt=j(class extends lt{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new ct(this),this._$CK=new at}render(...t){var e;return null!==(e=t.find(t=>!bt(t)))&&void 0!==e?e:_}update(t,e){const s=this._$Cwt;let n=s.length;this._$Cwt=e;const i=this._$CG,o=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cft);t++){const r=e[t];if(!bt(r))return this._$Cft=t,r;t<n&&r===s[t]||(this._$Cft=1073741823,n=0,Promise.resolve(r).then(async t=>{for(;o.get();)await o.get();const e=i.deref();if(void 0!==e){const s=e._$Cwt.indexOf(r);s>-1&&s<e._$Cft&&(e._$Cft=s,e.setValue(t))}}))}return _}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}),Ct=j(class extends z{constructor(t){if(super(t),t.type!==W&&t.type!==k&&t.type!==O)throw Error("The `live` directive is not allowed on child or event bindings");if(!V(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===_||e===b)return e;const s=t.element,n=t.name;if(t.type===W){if(e===s[n])return _}else if(t.type===O){if(!!e===s.hasAttribute(n))return _}else if(t.type===k&&s.getAttribute(n)===e+"")return _;return J(t),e}}),wt=new WeakMap; | ||
*/const xt=j(class extends lt{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new ct(this),this._$CK=new at}render(...t){var e;return null!==(e=t.find((t=>!bt(t))))&&void 0!==e?e:_}update(t,e){const s=this._$Cwt;let n=s.length;this._$Cwt=e;const i=this._$CG,o=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cft);t++){const r=e[t];if(!bt(r))return this._$Cft=t,r;t<n&&r===s[t]||(this._$Cft=1073741823,n=0,Promise.resolve(r).then((async t=>{for(;o.get();)await o.get();const e=i.deref();if(void 0!==e){const s=e._$Cwt.indexOf(r);s>-1&&s<e._$Cft&&(e._$Cft=s,e.setValue(t))}})))}return _}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}),Ct=j(class extends z{constructor(t){if(super(t),t.type!==W&&t.type!==k&&t.type!==O)throw Error("The `live` directive is not allowed on child or event bindings");if(!V(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===_||e===b)return e;const s=t.element,n=t.name;if(t.type===W){if(e===s[n])return _}else if(t.type===O){if(!!e===s.hasAttribute(n))return _}else if(t.type===k&&s.getAttribute(n)===e+"")return _;return J(t),e}}),wt=new WeakMap; | ||
/** | ||
@@ -61,3 +61,3 @@ * @license | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const Mt=j(class extends z{render(t){return b}update(t,e){if("boolean"!=typeof e[0])throw new Error("[vido] Detach directive argument should be a boolean.");let s=e[0];const n=t.element;if(s)wt.has(t)||wt.set(t,{element:n,nextSibling:n.nextSibling,previousSibling:n.previousSibling,parent:n.parentNode}),n.remove();else{const e=wt.get(t);e&&(e.nextSibling&&e.nextSibling.parentNode?e.nextSibling.parentNode.insertBefore(e.element,e.nextSibling):e.previousSibling&&e.previousSibling.parentNode?e.previousSibling.parentNode.appendChild(e.element):e.parent&&e.parent.appendChild(e.element),wt.delete(t))}return this.render(s)}}),It=j(class extends z{constructor(t){var e;if(super(t),t.type!==k||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,s)=>{const n=t[s];return null==n?e:e+`${s=s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ut){this.ut=new Set;for(const t in e)this.ut.add(t);return this.render(e)}this.ut.forEach(t=>{null==e[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]="")});for(const t in e){const n=e[t];null!=n&&(this.ut.add(t),t.includes("-")?s.setProperty(t,n):s[t]=n)}return _}}),Yt=j(class extends z{constructor(t){var e;if(super(t),t.type!==k||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var s,n;if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.et=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!(null===(s=this.et)||void 0===s?void 0:s.has(t))&&this.st.add(t);return this.render(e)}const i=t.element.classList;this.st.forEach(t=>{t in e||(i.remove(t),this.st.delete(t))});for(const t in e){const s=!!e[t];s===this.st.has(t)||(null===(n=this.et)||void 0===n?void 0:n.has(t))||(s?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return _}}); | ||
*/const Mt=j(class extends z{render(t){return b}update(t,e){if("boolean"!=typeof e[0])throw new Error("[vido] Detach directive argument should be a boolean.");let s=e[0];const n=t.element;if(s)wt.has(t)||wt.set(t,{element:n,nextSibling:n.nextSibling,previousSibling:n.previousSibling,parent:n.parentNode}),n.remove();else{const e=wt.get(t);e&&(e.nextSibling&&e.nextSibling.parentNode?e.nextSibling.parentNode.insertBefore(e.element,e.nextSibling):e.previousSibling&&e.previousSibling.parentNode?e.previousSibling.parentNode.appendChild(e.element):e.parent&&e.parent.appendChild(e.element),wt.delete(t))}return this.render(s)}}),It=j(class extends z{constructor(t){var e;if(super(t),t.type!==k||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,s)=>{const n=t[s];return null==n?e:e+`${s=s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ut){this.ut=new Set;for(const t in e)this.ut.add(t);return this.render(e)}this.ut.forEach((t=>{null==e[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]="")}));for(const t in e){const n=e[t];null!=n&&(this.ut.add(t),t.includes("-")?s.setProperty(t,n):s[t]=n)}return _}}),Yt=j(class extends z{constructor(t){var e;if(super(t),t.type!==k||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var s,n;if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.et=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(s=this.et)||void 0===s?void 0:s.has(t))&&this.st.add(t);return this.render(e)}const i=t.element.classList;this.st.forEach((t=>{t in e||(i.remove(t),this.st.delete(t))}));for(const t in e){const s=!!e[t];s===this.st.has(t)||(null===(n=this.et)||void 0===n?void 0:n.has(t))||(s?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return _}}); | ||
/** | ||
@@ -67,3 +67,3 @@ * @license | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class Xt{constructor(){this.isAction=!0}}Xt.prototype.isAction=!0;const Pt={element:document.createTextNode(""),axis:"xy",threshold:10,onDown(){},onMove(){},onUp(){},onWheel(){}},Et="undefined"!=typeof PointerEvent;let Ht=0;class Tt extends Xt{constructor(t,e){super(),this.moving="",this.initialX=0,this.initialY=0,this.lastY=0,this.lastX=0,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onWheel=this.onWheel.bind(this),this.element=t,this.id=++Ht,this.options=Object.assign(Object.assign({},Pt),e.pointerOptions),Et?(t.addEventListener("pointerdown",this.onPointerDown),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)):(t.addEventListener("touchstart",this.onPointerDown),document.addEventListener("touchmove",this.onPointerMove,{passive:!1}),document.addEventListener("touchend",this.onPointerUp),document.addEventListener("touchcancel",this.onPointerUp),t.addEventListener("mousedown",this.onPointerDown),document.addEventListener("mousemove",this.onPointerMove,{passive:!1}),document.addEventListener("mouseup",this.onPointerUp))}normalizeMouseWheelEvent(t){let e=t.deltaX||0,s=t.deltaY||0,n=t.deltaZ||0;const i=t.deltaMode,o=parseInt(getComputedStyle(t.target).getPropertyValue("line-height"));let r=1;switch(i){case 1:r=o;break;case 2:r=window.height}return e*=r,s*=r,n*=r,{x:e,y:s,z:n,event:t}}onWheel(t){const e=this.normalizeMouseWheelEvent(t);this.options.onWheel(e)}normalizePointerEvent(t){let e={x:0,y:0,pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0,event:t};switch(t.type){case"wheel":const s=this.normalizeMouseWheelEvent(t);e.x=s.x,e.y=s.y,e.pageX=e.x,e.pageY=e.y,e.screenX=e.x,e.screenY=e.y,e.clientX=e.x,e.clientY=e.y;break;case"touchstart":case"touchmove":case"touchend":case"touchcancel":e.x=t.changedTouches[0].screenX,e.y=t.changedTouches[0].screenY,e.pageX=t.changedTouches[0].pageX,e.pageY=t.changedTouches[0].pageY,e.screenX=t.changedTouches[0].screenX,e.screenY=t.changedTouches[0].screenY,e.clientX=t.changedTouches[0].clientX,e.clientY=t.changedTouches[0].clientY;break;default:e.x=t.x,e.y=t.y,e.pageX=t.pageX,e.pageY=t.pageY,e.screenX=t.screenX,e.screenY=t.screenY,e.clientX=t.clientX,e.clientY=t.clientY}return e}onPointerDown(t){if("mousedown"===t.type&&0!==t.button)return;this.moving="xy";const e=this.normalizePointerEvent(t);this.lastX=e.x,this.lastY=e.y,this.initialX=e.x,this.initialY=e.y,this.options.onDown(e)}handleX(t){let e=t.x-this.lastX;return this.lastY=t.y,this.lastX=t.x,e}handleY(t){let e=t.y-this.lastY;return this.lastY=t.y,this.lastX=t.x,e}onPointerMove(t){if(""===this.moving||"mousemove"===t.type&&0!==t.button)return;const e=this.normalizePointerEvent(t);if("x|y"===this.options.axis){let s=0,n=0;("x"===this.moving||"xy"===this.moving&&Math.abs(e.x-this.initialX)>this.options.threshold)&&(this.moving="x",s=this.handleX(e)),("y"===this.moving||"xy"===this.moving&&Math.abs(e.y-this.initialY)>this.options.threshold)&&(this.moving="y",n=this.handleY(e)),this.options.onMove({movementX:s,movementY:n,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}else if("xy"===this.options.axis){let s=0,n=0;Math.abs(e.x-this.initialX)>this.options.threshold&&(s=this.handleX(e)),Math.abs(e.y-this.initialY)>this.options.threshold&&(n=this.handleY(e)),this.options.onMove({movementX:s,movementY:n,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}else if("x"===this.options.axis)("x"===this.moving||"xy"===this.moving&&Math.abs(e.x-this.initialX)>this.options.threshold)&&(this.moving="x",this.options.onMove({movementX:this.handleX(e),movementY:0,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t}));else if("y"===this.options.axis){let s=0;("y"===this.moving||"xy"===this.moving&&Math.abs(e.y-this.initialY)>this.options.threshold)&&(this.moving="y",s=this.handleY(e)),this.options.onMove({movementX:0,movementY:s,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}}onPointerUp(t){this.moving="";const e=this.normalizePointerEvent(t);this.options.onUp({movementX:0,movementY:0,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t}),this.lastY=0,this.lastX=0}destroy(t){Et?(t.removeEventListener("pointerdown",this.onPointerDown),document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp)):(t.removeEventListener("mousedown",this.onPointerDown),document.removeEventListener("mousemove",this.onPointerMove),document.removeEventListener("mouseup",this.onPointerUp),t.removeEventListener("touchstart",this.onPointerDown),document.removeEventListener("touchmove",this.onPointerMove),document.removeEventListener("touchend",this.onPointerUp),document.removeEventListener("touchcancel",this.onPointerUp))}}function Nt(t){let e=0;return function(s){e||(e=requestAnimationFrame((function(){e=0,t.apply(void 0,[s])})))}}function St(t){return t&&t.constructor?"Object"===t.constructor.name:"object"==typeof t&&null!==t}function Lt(t,...e){const s=e.shift();if(St(t)&&St(s))for(const e in s)if(St(s[e]))"function"==typeof s[e].clone?t[e]=s[e].clone():(void 0===t[e]&&(t[e]={}),t[e]=Lt(t[e],s[e]));else if(Array.isArray(s[e])){t[e]=new Array(s[e].length);let n=0;for(let i of s[e])St(i)?"function"==typeof i.clone?t[e][n]=i.clone():t[e][n]=Lt({},i):t[e][n]=i,n++}else t[e]=s[e];return e.length?Lt(t,...e):t}function Dt(t){if(void 0!==t.actions){const e=t.actions.map(t=>{const e=Object.assign({},t),s=Object.assign({},e.props);return delete s.state,delete s.api,delete e.element,e.props=s,e});t.actions=e}return Lt({},t)}var Ut={mergeDeep:Lt,clone:Dt,schedule:Nt};class kt{constructor(t,e){this.slotInstances={},this.destroyed=!1,this.vido=t,this.props=e,this.destroy=this.destroy.bind(this),this.change=this.change.bind(this),this.html=this.html.bind(this),this.getInstances=this.getInstances.bind(this),this.setComponents=this.setComponents.bind(this),this.vido.onDestroy(()=>{this.destroy()})}setComponents(t){if(t&&!this.destroyed){for(const e in t){const s=t[e];void 0===this.slotInstances[e]&&(this.slotInstances[e]=[]);for(const t of this.slotInstances[e])t.destroy();this.slotInstances[e].length=0;for(const t of s)this.slotInstances[e].push(this.vido.createComponent(t,this.props))}this.vido.update()}}destroy(){if(!this.destroyed){for(const t in this.slotInstances){for(const e of this.slotInstances[t])e.destroy();this.slotInstances[t].length=0}this.destroyed=!0}}change(t,e){if(!this.destroyed)for(const s in this.slotInstances){const n=this.slotInstances[s];for(const s of n)s.change(t,e)}}getInstances(t){return this.destroyed?[]:void 0===t?this.slotInstances:this.slotInstances[t]}html(t,e){if(this.destroyed)return;if(!this.slotInstances[t]||0===this.slotInstances[t].length)return e;let s=e;for(const e of this.slotInstances[t])s=e.html(s);return s}getProps(){return this.props}isDestroyed(){return this.destroyed}}class Bt extends z{update(t,e){if("function"!=typeof e[0])throw new Error("[vido] GetElementDirective argument should be a function.");(0,e[0])(t.element)}render(){return b}}function Wt(t,e){let s=0;const n=new Map;let i,o,r=new Map,h=0;const l=[],c=Promise.resolve(),a={},d=function(t){return class extends z{update(e,s){const n=e.element,i=s[0],o=s[1],r=s[2];for(const e of o)if(void 0!==e){let s;if(t.has(i))for(const o of t.get(i))if(o.componentAction.create===e&&o.element===n){s=o;break}if(s)s.props=r;else{void 0!==n.vido&&delete n.vido;const s={instance:i,componentAction:{create:e,update(){},destroy(){}},element:n,props:r};let o=[];t.has(i)&&(o=t.get(i)),o.push(s),t.set(i,o)}}}render(t,e,s){return b}}}(r);class u{constructor(t){this.instance=t}create(t,e){const s=j(d);return()=>s(this.instance,t,e)}}const p=function(t,e,s){return class{constructor(t,e,s={}){this.destroyed=!1,this.instance=t,this.name=e.name,this.vidoInstance=e,this.props=s,this.destroy=this.destroy.bind(this),this.update=this.update.bind(this),this.change=this.change.bind(this),this.html=this.html.bind(this)}destroy(){this.destroyed||(this.vidoInstance.debug&&(console.groupCollapsed("destroying component "+this.instance),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.vidoInstance.destroyComponent(this.instance,this.vidoInstance),this.destroyed=!0)}update(n){return this.vidoInstance.debug&&(console.groupCollapsed("updating component "+this.instance),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.vidoInstance.updateTemplate(n)}change(n,i={}){this.vidoInstance.debug&&(console.groupCollapsed("changing component "+this.instance),console.log(s({props:this.props,newProps:n,components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd());const o=t.get(this.instance);o&&o.change(n,i)}html(e={}){const s=t.get(this.instance);if(s&&!s.destroyed)return s.update(e,this.vidoInstance)}_getComponents(){return t}_getActions(){return e}}}(n,r,Dt),v=function(t,e,s){return class{constructor(t,e,s){this.destroyed=!1,this.instance=t,this.vidoInstance=e,this.renderFunction=s,this.destroy=this.destroy.bind(this),this.update=this.update.bind(this),this.change=this.change.bind(this)}destroy(){if(!this.destroyed){this.vidoInstance.debug&&(console.groupCollapsed("component destroy method fired "+this.instance),console.log(s({props:this.vidoInstance.props,components:t.keys(),destroyable:this.vidoInstance.destroyable,actionsByInstance:e})),console.trace(),console.groupEnd()),this.content&&"function"==typeof this.content.destroy&&this.content.destroy();for(const t of this.vidoInstance.destroyable)t();this.vidoInstance.onChangeFunctions.length=0,this.vidoInstance.destroyable.length=0,this.vidoInstance.destroyed=!0,this.destroyed=!0,this.vidoInstance.update()}}update(n={}){return this.vidoInstance.debug&&(console.groupCollapsed("component update method fired "+this.instance),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.renderFunction(n)}change(n,i={leave:!1}){const o=n;this.vidoInstance.debug&&(console.groupCollapsed("component change method fired "+this.instance),console.log(s({props:o,components:t.keys(),onChangeFunctions:this.vidoInstance.onChangeFunctions,changedProps:n,actionsByInstance:e})),console.trace(),console.groupEnd());for(const t of this.vidoInstance.onChangeFunctions)t(n,i)}}}(n,r,Dt);class f{constructor(s="",i=""){this.instance="",this.name="",this.destroyable=[],this.destroyed=!1,this.onChangeFunctions=[],this.debug=!1,this.state=t,this.api=e,this.lastProps={},this.html=$,this.svg=A,this.directive=j,this.asyncAppend=pt,this.asyncReplace=ut,this.cache=vt,this.classMap=Yt,this.styleMap=It,this.guard=mt,this.live=Ct,this.ifDefined=gt,this.repeat=$t,this.unsafeHTML=_t,this.until=xt,this.schedule=Nt,this.getElement=j(Bt),this.actionsByInstance=()=>{},this.detach=Mt,this.PointerAction=Tt,this.Action=Xt,this.Slots=kt,this._components=n,this._actions=r,this.instance=s,this.reuseComponents=this.reuseComponents.bind(this),this.onDestroy=this.onDestroy.bind(this),this.onChange=this.onChange.bind(this),this.update=this.update.bind(this),this.destroyComponent=this.destroyComponent.bind(this);for(const t in a)this[t]=a[t].bind(this);this.name=i,this.Actions=new u(s)}static addMethod(t,e){a[t]=e}onDestroy(t){this.destroyable.push(t)}onChange(t){this.onChangeFunctions.push(t)}update(t){return this.updateTemplate(t)}reuseComponents(t,e,s,n,i=!0,o=!1){const r=[],h=t.length,l=e.length;let c=!1;!i||void 0!==e&&0!==e.length||(c=!0);let a=0;if(h<l){let i=l-h;for(;i;){const o=e[l-i],h=this.createComponent(n,s(o));t.push(h),r.push(h),i--}}else if(h>l){let e=h-l;for(i&&(c=!0,a=h-e);e;){const s=h-e;i||(r.push(t[s]),t[s].destroy()),e--}i||(t.length=l)}let d=0;o&&console.log("modified components",r),o&&console.log("current components",t),o&&console.log("data array",e);for(const n of t){const t=e[d];o&&console.log(`reuse components data at '${d}'`,t),n&&!r.includes(n)&&(o&&console.log("getProps fn result",s(t)),n.change(s(t),{leave:c&&d>=a})),d++}}createComponent(t,e={}){const i=t.name+":"+s++;let o;o=new f(i,t.name);const h=new p(i,o,e),l=new v(i,o,t(o,e));return n.set(i,l),n.get(i).change(e),o.debug&&(console.groupCollapsed("component created "+i),console.log(Dt({props:e,components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd()),h}destroyComponent(t,e){if(e.debug&&(console.groupCollapsed(`destroying component ${t}...`),console.log(Dt({components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd()),r.has(t))for(const e of r.get(t))"function"==typeof e.componentAction.destroy&&e.componentAction.destroy(e.element,e.props);r.delete(t);const s=n.get(t);s?(s.destroy(),n.delete(t),e.debug&&(console.groupCollapsed("component destroyed "+t),console.log(Dt({components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd())):console.warn(`No component to destroy! [${t}]`)}executeActions(){for(const t of r.values()){for(const e of t)if(void 0===e.element.vido){const t=n.get(e.instance);e.isActive=function(){return t&&!1===t.destroyed};const s=e.componentAction,i=s.create;if(void 0!==i){let t;t=i.prototype&&(i.prototype.isAction||i.prototype.update||i.prototype.destroy)||i.isAction?new i(e.element,e.props):i(e.element,e.props),void 0!==t&&("function"==typeof t?s.destroy=t:("function"==typeof t.update&&(s.update=t.update.bind(t)),"function"==typeof t.destroy&&(s.destroy=t.destroy.bind(t))))}}else e.element.vido=e.props,"function"==typeof e.componentAction.update&&e.isActive()&&e.componentAction.update(e.element,e.props);for(const e of t)e.element.vido=e.props}}updateTemplate(t){return t&&l.push(t),new Promise(t=>{const e=++h,s=this;c.then((function(){if(e===h){h=0,s.render();for(const t of l)t();l.length=0,t(null)}}))})}createApp(t){o=t.element;const e=this.createComponent(t.component,t.props);return i=e.instance,this.render(),e}render(){const t=n.get(i);t?(C(t.update(),o),this.executeActions()):o&&o.remove()}}return new f}Wt.prototype.lithtml=U,Wt.prototype.Action=Xt,Wt.prototype.Directive=z,Wt.prototype.schedule=Nt,Wt.prototype.detach=Mt,Wt.prototype.styleMap=It,Wt.prototype.classMap=Yt,Wt.prototype.PointerAction=Tt,Wt.prototype.asyncAppend=pt,Wt.prototype.asyncReplace=ut,Wt.prototype.cache=vt,Wt.prototype.guard=mt,Wt.prototype.live=Ct,Wt.prototype.ifDefined=gt,Wt.prototype.repeat=$t,Wt.prototype.unsafeHTML=_t,Wt.prototype.until=xt,Wt.prototype.Slots=kt;export default Wt;export{Xt as Action,z as Directive,Tt as PointerAction,kt as Slots,pt as asyncAppend,ut as asyncReplace,vt as cache,Yt as classMap,Mt as detach,mt as guard,Ut as helpers,gt as ifDefined,U as lithtml,$t as repeat,Nt as schedule,It as styleMap,_t as unsafeHTML,xt as until}; | ||
*/class Xt{constructor(){this.isAction=!0}}Xt.prototype.isAction=!0;const Et={element:document.createTextNode(""),axis:"xy",threshold:10,onDown(){},onMove(){},onUp(){},onWheel(){}},Pt="undefined"!=typeof PointerEvent;let Tt=0;class Ht extends Xt{constructor(t,e){super(),this.moving="",this.initialX=0,this.initialY=0,this.lastY=0,this.lastX=0,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onWheel=this.onWheel.bind(this),this.element=t,this.id=++Tt,this.options=Object.assign(Object.assign({},Et),e.pointerOptions),Pt?(t.addEventListener("pointerdown",this.onPointerDown),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)):(t.addEventListener("touchstart",this.onPointerDown),document.addEventListener("touchmove",this.onPointerMove,{passive:!1}),document.addEventListener("touchend",this.onPointerUp),document.addEventListener("touchcancel",this.onPointerUp),t.addEventListener("mousedown",this.onPointerDown),document.addEventListener("mousemove",this.onPointerMove,{passive:!1}),document.addEventListener("mouseup",this.onPointerUp))}normalizeMouseWheelEvent(t){let e=t.deltaX||0,s=t.deltaY||0,n=t.deltaZ||0;const i=t.deltaMode,o=parseInt(getComputedStyle(t.target).getPropertyValue("line-height"));let r=1;switch(i){case 1:r=o;break;case 2:r=window.height}return e*=r,s*=r,n*=r,{x:e,y:s,z:n,event:t}}onWheel(t){const e=this.normalizeMouseWheelEvent(t);this.options.onWheel(e)}normalizePointerEvent(t){let e={x:0,y:0,pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0,event:t};switch(t.type){case"wheel":const s=this.normalizeMouseWheelEvent(t);e.x=s.x,e.y=s.y,e.pageX=e.x,e.pageY=e.y,e.screenX=e.x,e.screenY=e.y,e.clientX=e.x,e.clientY=e.y;break;case"touchstart":case"touchmove":case"touchend":case"touchcancel":e.x=t.changedTouches[0].screenX,e.y=t.changedTouches[0].screenY,e.pageX=t.changedTouches[0].pageX,e.pageY=t.changedTouches[0].pageY,e.screenX=t.changedTouches[0].screenX,e.screenY=t.changedTouches[0].screenY,e.clientX=t.changedTouches[0].clientX,e.clientY=t.changedTouches[0].clientY;break;default:e.x=t.x,e.y=t.y,e.pageX=t.pageX,e.pageY=t.pageY,e.screenX=t.screenX,e.screenY=t.screenY,e.clientX=t.clientX,e.clientY=t.clientY}return e}onPointerDown(t){if("mousedown"===t.type&&0!==t.button)return;this.moving="xy";const e=this.normalizePointerEvent(t);this.lastX=e.x,this.lastY=e.y,this.initialX=e.x,this.initialY=e.y,this.options.onDown(e)}handleX(t){let e=t.x-this.lastX;return this.lastY=t.y,this.lastX=t.x,e}handleY(t){let e=t.y-this.lastY;return this.lastY=t.y,this.lastX=t.x,e}onPointerMove(t){if(""===this.moving||"mousemove"===t.type&&0!==t.button)return;const e=this.normalizePointerEvent(t);if("x|y"===this.options.axis){let s=0,n=0;("x"===this.moving||"xy"===this.moving&&Math.abs(e.x-this.initialX)>this.options.threshold)&&(this.moving="x",s=this.handleX(e)),("y"===this.moving||"xy"===this.moving&&Math.abs(e.y-this.initialY)>this.options.threshold)&&(this.moving="y",n=this.handleY(e)),this.options.onMove({movementX:s,movementY:n,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}else if("xy"===this.options.axis){let s=0,n=0;Math.abs(e.x-this.initialX)>this.options.threshold&&(s=this.handleX(e)),Math.abs(e.y-this.initialY)>this.options.threshold&&(n=this.handleY(e)),this.options.onMove({movementX:s,movementY:n,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}else if("x"===this.options.axis)("x"===this.moving||"xy"===this.moving&&Math.abs(e.x-this.initialX)>this.options.threshold)&&(this.moving="x",this.options.onMove({movementX:this.handleX(e),movementY:0,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t}));else if("y"===this.options.axis){let s=0;("y"===this.moving||"xy"===this.moving&&Math.abs(e.y-this.initialY)>this.options.threshold)&&(this.moving="y",s=this.handleY(e)),this.options.onMove({movementX:0,movementY:s,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}}onPointerUp(t){this.moving="";const e=this.normalizePointerEvent(t);this.options.onUp({movementX:0,movementY:0,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t}),this.lastY=0,this.lastX=0}destroy(t){Pt?(t.removeEventListener("pointerdown",this.onPointerDown),document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp)):(t.removeEventListener("mousedown",this.onPointerDown),document.removeEventListener("mousemove",this.onPointerMove),document.removeEventListener("mouseup",this.onPointerUp),t.removeEventListener("touchstart",this.onPointerDown),document.removeEventListener("touchmove",this.onPointerMove),document.removeEventListener("touchend",this.onPointerUp),document.removeEventListener("touchcancel",this.onPointerUp))}}function Nt(t){let e=0;return function(s){e||(e=requestAnimationFrame((function(){e=0,t.apply(void 0,[s])})))}}function St(t){return t&&t.constructor?"Object"===t.constructor.name:"object"==typeof t&&null!==t}function Lt(t,...e){const s=e.shift();if(St(t)&&St(s))for(const e in s)if(St(s[e]))"function"==typeof s[e].clone?t[e]=s[e].clone():(void 0===t[e]&&(t[e]={}),t[e]=Lt(t[e],s[e]));else if(Array.isArray(s[e])){t[e]=new Array(s[e].length);let n=0;for(let i of s[e])St(i)?"function"==typeof i.clone?t[e][n]=i.clone():t[e][n]=Lt({},i):t[e][n]=i,n++}else t[e]=s[e];return e.length?Lt(t,...e):t}function Dt(t){if(void 0!==t.actions){const e=t.actions.map((t=>{const e=Object.assign({},t),s=Object.assign({},e.props);return delete s.state,delete s.api,delete e.element,e.props=s,e}));t.actions=e}return Lt({},t)}var Ut={mergeDeep:Lt,clone:Dt,schedule:Nt};class kt{constructor(t,e){this.slotInstances={},this.destroyed=!1,this.vido=t,this.props=e,this.destroy=this.destroy.bind(this),this.change=this.change.bind(this),this.html=this.html.bind(this),this.getInstances=this.getInstances.bind(this),this.setComponents=this.setComponents.bind(this),this.vido.onDestroy((()=>{this.destroy()}))}setComponents(t){if(t&&!this.destroyed){for(const e in t){const s=t[e];void 0===this.slotInstances[e]&&(this.slotInstances[e]=[]);for(const t of this.slotInstances[e])t.destroy();this.slotInstances[e].length=0;for(const t of s)this.slotInstances[e].push(this.vido.createComponent(t,this.props))}this.vido.update()}}destroy(){if(!this.destroyed){for(const t in this.slotInstances){for(const e of this.slotInstances[t])e.destroy();this.slotInstances[t].length=0}this.destroyed=!0}}change(t,e){if(!this.destroyed)for(const s in this.slotInstances){const n=this.slotInstances[s];for(const s of n)s.change(t,e)}}getInstances(t){return this.destroyed?[]:void 0===t?this.slotInstances:this.slotInstances[t]}html(t,e){if(this.destroyed)return;if(!this.slotInstances[t]||0===this.slotInstances[t].length)return e;let s=e;for(const e of this.slotInstances[t])s=e.html(s);return s}getProps(){return this.props}isDestroyed(){return this.destroyed}}class Bt extends z{update(t,e){if("function"!=typeof e[0])throw new Error("[vido] GetElementDirective argument should be a function.");(0,e[0])(t.element)}render(){return b}}function Wt(t,e){let s=0;const n=new Map;let i,o,r=new Map,h=0;const l=[],c=Promise.resolve(),a={},d=function(t){return class extends z{update(e,s){const n=e.element,i=s[0],o=s[1],r=s[2];for(const e of o)if(void 0!==e){let s;if(t.has(i))for(const o of t.get(i))if(o.componentAction.create===e&&o.element===n){s=o;break}if(s)s.props=r;else{void 0!==n.vido&&delete n.vido;const s={instance:i,componentAction:{create:e,update(){},destroy(){}},element:n,props:r};let o=[];t.has(i)&&(o=t.get(i)),o.push(s),t.set(i,o)}}}render(t,e,s){return b}}}(r);class u{constructor(t){this.instance=t}create(t,e){const s=j(d);return()=>s(this.instance,t,e)}}const p=function(t,e,s){return class{constructor(t,e,s={}){this.destroyed=!1,this.instance=t,this.name=e.name,this.vidoInstance=e,this.props=s,this.destroy=this.destroy.bind(this),this.update=this.update.bind(this),this.change=this.change.bind(this),this.html=this.html.bind(this)}destroy(){this.destroyed||(this.vidoInstance.debug&&(console.groupCollapsed(`destroying component ${this.instance}`),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.vidoInstance.destroyComponent(this.instance,this.vidoInstance),this.destroyed=!0)}update(n){return this.vidoInstance.debug&&(console.groupCollapsed(`updating component ${this.instance}`),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.vidoInstance.updateTemplate(n)}change(n,i={}){this.vidoInstance.debug&&(console.groupCollapsed(`changing component ${this.instance}`),console.log(s({props:this.props,newProps:n,components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd());const o=t.get(this.instance);o&&o.change(n,i)}html(e={}){const s=t.get(this.instance);if(s&&!s.destroyed)return s.update(e,this.vidoInstance)}_getComponents(){return t}_getActions(){return e}}}(n,r,Dt),v=function(t,e,s){return class{constructor(t,e,s){this.destroyed=!1,this.instance=t,this.vidoInstance=e,this.renderFunction=s,this.destroy=this.destroy.bind(this),this.update=this.update.bind(this),this.change=this.change.bind(this)}destroy(){if(!this.destroyed){this.vidoInstance.debug&&(console.groupCollapsed(`component destroy method fired ${this.instance}`),console.log(s({props:this.vidoInstance.props,components:t.keys(),destroyable:this.vidoInstance.destroyable,actionsByInstance:e})),console.trace(),console.groupEnd()),this.content&&"function"==typeof this.content.destroy&&this.content.destroy();for(const t of this.vidoInstance.destroyable)t();this.vidoInstance.onChangeFunctions.length=0,this.vidoInstance.destroyable.length=0,this.vidoInstance.destroyed=!0,this.destroyed=!0,this.vidoInstance.update()}}update(n={}){return this.vidoInstance.debug&&(console.groupCollapsed(`component update method fired ${this.instance}`),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.renderFunction(n)}change(n,i={leave:!1}){const o=n;this.vidoInstance.debug&&(console.groupCollapsed(`component change method fired ${this.instance}`),console.log(s({props:o,components:t.keys(),onChangeFunctions:this.vidoInstance.onChangeFunctions,changedProps:n,actionsByInstance:e})),console.trace(),console.groupEnd());for(const t of this.vidoInstance.onChangeFunctions)t(n,i)}}}(n,r,Dt);class f{constructor(s="",i=""){this.instance="",this.name="",this.destroyable=[],this.destroyed=!1,this.onChangeFunctions=[],this.debug=!1,this.state=t,this.api=e,this.lastProps={},this.html=$,this.svg=A,this.directive=j,this.asyncAppend=pt,this.asyncReplace=ut,this.cache=vt,this.classMap=Yt,this.styleMap=It,this.guard=mt,this.live=Ct,this.ifDefined=gt,this.repeat=$t,this.unsafeHTML=_t,this.until=xt,this.schedule=Nt,this.getElement=j(Bt),this.actionsByInstance=()=>{},this.detach=Mt,this.PointerAction=Ht,this.Action=Xt,this.Slots=kt,this._components=n,this._actions=r,this.instance=s,this.reuseComponents=this.reuseComponents.bind(this),this.onDestroy=this.onDestroy.bind(this),this.onChange=this.onChange.bind(this),this.update=this.update.bind(this),this.destroyComponent=this.destroyComponent.bind(this);for(const t in a)this[t]=a[t].bind(this);this.name=i,this.Actions=new u(s)}static addMethod(t,e){a[t]=e}onDestroy(t){this.destroyable.push(t)}onChange(t){this.onChangeFunctions.push(t)}update(t){return this.updateTemplate(t)}reuseComponents(t,e,s,n,i=!0,o=!1){const r=[],h=t.length,l=e.length;let c=!1;!i||void 0!==e&&0!==e.length||(c=!0);let a=0;if(h<l){let i=l-h;for(;i;){const o=e[l-i],h=this.createComponent(n,s(o));t.push(h),r.push(h),i--}}else if(h>l){let e=h-l;for(i&&(c=!0,a=h-e);e;){const s=h-e;i||(r.push(t[s]),t[s].destroy()),e--}i||(t.length=l)}let d=0;o&&console.log("modified components",r),o&&console.log("current components",t),o&&console.log("data array",e);for(const n of t){const t=e[d];o&&console.log(`reuse components data at '${d}'`,t),n&&!r.includes(n)&&(o&&console.log("getProps fn result",s(t)),n.change(s(t),{leave:c&&d>=a})),d++}}createComponent(t,e={}){const i=t.name+":"+s++;let o;o=new f(i,t.name);const h=new p(i,o,e),l=new v(i,o,t(o,e));return n.set(i,l),n.get(i).change(e),o.debug&&(console.groupCollapsed(`component created ${i}`),console.log(Dt({props:e,components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd()),h}destroyComponent(t,e){if(e.debug&&(console.groupCollapsed(`destroying component ${t}...`),console.log(Dt({components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd()),r.has(t))for(const e of r.get(t))"function"==typeof e.componentAction.destroy&&e.componentAction.destroy(e.element,e.props);r.delete(t);const s=n.get(t);s?(s.destroy(),n.delete(t),e.debug&&(console.groupCollapsed(`component destroyed ${t}`),console.log(Dt({components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd())):console.warn(`No component to destroy! [${t}]`)}executeActions(){for(const t of r.values()){for(const e of t)if(void 0===e.element.vido){const t=n.get(e.instance);e.isActive=function(){return t&&!1===t.destroyed};const s=e.componentAction,i=s.create;if(void 0!==i){let t;t=i.prototype&&(i.prototype.isAction||i.prototype.update||i.prototype.destroy)||i.isAction?new i(e.element,e.props):i(e.element,e.props),void 0!==t&&("function"==typeof t?s.destroy=t:("function"==typeof t.update&&(s.update=t.update.bind(t)),"function"==typeof t.destroy&&(s.destroy=t.destroy.bind(t))))}}else e.element.vido=e.props,"function"==typeof e.componentAction.update&&e.isActive()&&e.componentAction.update(e.element,e.props);for(const e of t)e.element.vido=e.props}}updateTemplate(t){return t&&l.push(t),new Promise((t=>{const e=++h,s=this;c.then((function(){if(e===h){h=0,s.render();for(const t of l)t();l.length=0,t(null)}}))}))}createApp(t){o=t.element;const e=this.createComponent(t.component,t.props);return i=e.instance,this.render(),e}render(){const t=n.get(i);t?(C(t.update(),o),this.executeActions()):o&&o.remove()}}return new f}Wt.prototype.lithtml=U,Wt.prototype.Action=Xt,Wt.prototype.Directive=z,Wt.prototype.schedule=Nt,Wt.prototype.detach=Mt,Wt.prototype.styleMap=It,Wt.prototype.classMap=Yt,Wt.prototype.PointerAction=Ht,Wt.prototype.asyncAppend=pt,Wt.prototype.asyncReplace=ut,Wt.prototype.cache=vt,Wt.prototype.guard=mt,Wt.prototype.live=Ct,Wt.prototype.ifDefined=gt,Wt.prototype.repeat=$t,Wt.prototype.unsafeHTML=_t,Wt.prototype.until=xt,Wt.prototype.Slots=kt;export{Xt as Action,z as Directive,Ht as PointerAction,kt as Slots,pt as asyncAppend,ut as asyncReplace,vt as cache,Yt as classMap,Wt as default,Mt as detach,mt as guard,Ut as helpers,gt as ifDefined,U as lithtml,$t as repeat,Nt as schedule,It as styleMap,_t as unsafeHTML,xt as until}; | ||
//# sourceMappingURL=vido.esm.min.js.map |
2168
dist/vido.umd.js
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('csstype')) : | ||
typeof define === 'function' && define.amd ? define(['csstype'], factory) : | ||
(global = global || self, global.Vido = factory(global.csstype)); | ||
}(this, (function (csstype) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Vido = factory()); | ||
})(this, (function () { 'use strict'; | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
var t;const i=globalThis.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,e=`lit$${(Math.random()+"").slice(9)}$`,o="?"+e,n=`<${o}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,u=t=>{var i;return d(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,a=/>/g,f=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,_=/'/g,m=/"/g,g=/^(?:script|style|textarea)$/i,$=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),p=$(1),y=$(2),b=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),x=new WeakMap,w=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h(),t),t,void 0,null!=s?s:{});}return l._$AI(t),l},A=l.createTreeWalker(l,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c;for(let i=0;i<o;i++){const s=t[i];let o,u,$=-1,p=0;for(;p<s.length&&(d.lastIndex=p,u=d.exec(s),null!==u);)p=d.lastIndex,d===c?"!--"===u[1]?d=v:void 0!==u[1]?d=a:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f):void 0!==u[3]&&(d=f):d===f?">"===u[0]?(d=null!=h?h:c,$=-1):void 0===u[1]?$=-2:($=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f:'"'===u[3]?m:_):d===m||d===_?d=f:d===v||d===a?d=c:(d=f,h=void 0);const y=d===f&&t[i+1].startsWith("/>")?" ":"";r+=d===c?s+n:$>=0?(l.push(o),s.slice(0,$)+"$lit$"+s.slice($)+e+y):s+e+(-2===$?(l.push(void 0),i):y);}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");return [void 0!==s?s.createHTML(u):u,l]};class P{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=P.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?k:"@"===i[1]?H:S});}else c.push({type:6,index:r});}for(const i of t)l.removeAttribute(i);}if(g.test(l.tagName)){const t=l.textContent.split(e),s=t.length-1;if(s>0){l.textContent=i?i.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h());}}}else if(8===l.nodeType)if(l.data===o)c.push({type:2,index:r});else {let t=-1;for(;-1!==(t=l.data.indexOf(e,t+1));)c.push({type:7,index:r}),t+=e.length-1;}r++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function V(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r(i)?void 0:i._$litDirective$;return (null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=V(t,d._$AS(t,i.values),d,e)),i}class E{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new I(n,this,t)),this.v.push(i),d=e[++r];}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++);}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o;}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=V(this,t,i),r(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):u(t)?this.M(t):this.$(t);}A(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t));}$(t){this._$AH!==T&&r(this._$AH)?this._$AA.nextSibling.data=t:this.S(l.createTextNode(t)),this._$AH=t;}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=P.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else {const t=new E(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t;}}_$AC(t){let i=x.get(t.strings);return void 0===i&&x.set(t.strings,i=new P(t)),i}M(t){d(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.A(h()),this.A(h()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t));}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T;}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=V(this,t,i,0),n=!r(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else {const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=V(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r(h)||h!==this._$AH[l]),h===T?t=T:t!==T&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h;}n&&!e&&this.k(t);}k(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class M extends S{constructor(){super(...arguments),this.type=3;}k(t){this.element[this.name]=t===T?void 0:t;}}class k extends S{constructor(){super(...arguments),this.type=4;}k(t){t&&t!==T?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name);}}class H extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5;}_$AI(t,i=this){var s;if((t=null!==(s=V(this,t,i,0))&&void 0!==s?s:T)===b)return;const e=this._$AH,o=t===T&&e!==T||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==T&&(e===T||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t);}}class I{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t);}}const L={P:"$lit$",V:e,L:o,I:1,N:C,R:E,D:u,j:V,H:N,O:S,F:k,B:H,W:M,Z:I},R=window.litHtmlPolyfillSupport;null==R||R(P,N),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.0.1"); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
var t$3;const i$5=globalThis.trustedTypes,s$2=i$5?i$5.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5=`lit$${(Math.random()+"").slice(9)}$`,o$4="?"+e$5,n$2=`<${o$4}>`,l$3=document,h$3=(t="")=>l$3.createComment(t),r$2=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d$2=Array.isArray,u$2=t=>{var i;return d$2(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c$4=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v$1=/-->/g,a$1=/>/g,f$1=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,_=/'/g,m$1=/"/g,g=/^(?:script|style|textarea)$/i,$=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),p$1=$(1),y=$(2),b=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),x=new WeakMap,w=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h$3(),t),t,void 0,null!=s?s:{});}return l._$AI(t),l},A=l$3.createTreeWalker(l$3,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c$4;for(let i=0;i<o;i++){const s=t[i];let o,u,$=-1,p=0;for(;p<s.length&&(d.lastIndex=p,u=d.exec(s),null!==u);)p=d.lastIndex,d===c$4?"!--"===u[1]?d=v$1:void 0!==u[1]?d=a$1:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f$1):void 0!==u[3]&&(d=f$1):d===f$1?">"===u[0]?(d=null!=h?h:c$4,$=-1):void 0===u[1]?$=-2:($=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f$1:'"'===u[3]?m$1:_):d===m$1||d===_?d=f$1:d===v$1||d===a$1?d=c$4:(d=f$1,h=void 0);const y=d===f$1&&t[i+1].startsWith("/>")?" ":"";r+=d===c$4?s+n$2:$>=0?(l.push(o),s.slice(0,$)+"$lit$"+s.slice($)+e$5+y):s+e$5+(-2===$?(l.push(void 0),i):y);}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");return [void 0!==s$2?s$2.createHTML(u):u,l]};class P{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=P.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e$5)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e$5),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?k:"@"===i[1]?H:S});}else c.push({type:6,index:r});}for(const i of t)l.removeAttribute(i);}if(g.test(l.tagName)){const t=l.textContent.split(e$5),s=t.length-1;if(s>0){l.textContent=i$5?i$5.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h$3()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h$3());}}}else if(8===l.nodeType)if(l.data===o$4)c.push({type:2,index:r});else {let t=-1;for(;-1!==(t=l.data.indexOf(e$5,t+1));)c.push({type:7,index:r}),t+=e$5.length-1;}r++;}}static createElement(t,i){const s=l$3.createElement("template");return s.innerHTML=t,s}}function V(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r$2(i)?void 0:i._$litDirective$;return (null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=V(t,d._$AS(t,i.values),d,e)),i}class E{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l$3).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new I(n,this,t)),this.v.push(i),d=e[++r];}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++);}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o;}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=V(this,t,i),r$2(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):u$2(t)?this.M(t):this.$(t);}A(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t));}$(t){this._$AH!==T&&r$2(this._$AH)?this._$AA.nextSibling.data=t:this.S(l$3.createTextNode(t)),this._$AH=t;}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=P.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else {const t=new E(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t;}}_$AC(t){let i=x.get(t.strings);return void 0===i&&x.set(t.strings,i=new P(t)),i}M(t){d$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.A(h$3()),this.A(h$3()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t));}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T;}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=V(this,t,i,0),n=!r$2(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else {const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=V(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r$2(h)||h!==this._$AH[l]),h===T?t=T:t!==T&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h;}n&&!e&&this.k(t);}k(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class M extends S{constructor(){super(...arguments),this.type=3;}k(t){this.element[this.name]=t===T?void 0:t;}}class k extends S{constructor(){super(...arguments),this.type=4;}k(t){t&&t!==T?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name);}}class H extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5;}_$AI(t,i=this){var s;if((t=null!==(s=V(this,t,i,0))&&void 0!==s?s:T)===b)return;const e=this._$AH,o=t===T&&e!==T||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==T&&(e===T||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t);}}class I{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t);}}const L={P:"$lit$",V:e$5,L:o$4,I:1,N:C,R:E,D:u$2,j:V,H:N,O:S,F:k,B:H,W:M,Z:I},R=window.litHtmlPolyfillSupport;null==R||R(P,N),(null!==(t$3=globalThis.litHtmlVersions)&&void 0!==t$3?t$3:globalThis.litHtmlVersions=[]).push("2.0.1"); | ||
var lithtml = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
_$LH: L, | ||
html: p, | ||
noChange: b, | ||
nothing: T, | ||
render: w, | ||
svg: y | ||
}); | ||
var lithtml = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
_$LH: L, | ||
html: p$1, | ||
noChange: b, | ||
nothing: T, | ||
render: w, | ||
svg: y | ||
}); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const t$1={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$1=t=>(...e)=>({_$litDirective$:t,values:e});class i$1{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const t$2={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$4=t=>(...e)=>({_$litDirective$:t,values:e});class i$4{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const {H:i$2}=L,t$2=o=>null===o||"object"!=typeof o&&"function"!=typeof o,v$1=(o,i)=>{var t,n;return void 0===i?void 0!==(null===(t=o)||void 0===t?void 0:t._$litType$):(null===(n=o)||void 0===n?void 0:n._$litType$)===i},r$1=o=>void 0===o.strings,e$2=()=>document.createComment(""),u$1=(o,t,n)=>{var v;const l=o._$AA.parentNode,d=void 0===t?o._$AB:t._$AA;if(void 0===n){const t=l.insertBefore(e$2(),d),v=l.insertBefore(e$2(),d);n=new i$2(t,v,o,o.options);}else {const i=n._$AB.nextSibling,t=n._$AM,r=t!==o;if(r){let i;null===(v=n._$AQ)||void 0===v||v.call(n,o),n._$AM=o,void 0!==n._$AP&&(i=o._$AU)!==t._$AU&&n._$AP(i);}if(i!==d||r){let o=n._$AA;for(;o!==i;){const i=o.nextSibling;l.insertBefore(o,d),o=i;}}}return n},c$1=(o,i,t=o)=>(o._$AI(i,t),o),f$1={},s$1=(o,i=f$1)=>o._$AH=i,a$1=o=>o._$AH,m$1=o=>{var i;null===(i=o._$AP)||void 0===i||i.call(o,!1,!0);let t=o._$AA;const n=o._$AB.nextSibling;for(;t!==n;){const o=t.nextSibling;t.remove(),t=o;}},p$1=o=>{o._$AR();}; | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const {H:i$3}=L,t$1=o=>null===o||"object"!=typeof o&&"function"!=typeof o,v=(o,i)=>{var t,n;return void 0===i?void 0!==(null===(t=o)||void 0===t?void 0:t._$litType$):(null===(n=o)||void 0===n?void 0:n._$litType$)===i},r$1=o=>void 0===o.strings,e$3=()=>document.createComment(""),u$1=(o,t,n)=>{var v;const l=o._$AA.parentNode,d=void 0===t?o._$AB:t._$AA;if(void 0===n){const t=l.insertBefore(e$3(),d),v=l.insertBefore(e$3(),d);n=new i$3(t,v,o,o.options);}else {const i=n._$AB.nextSibling,t=n._$AM,r=t!==o;if(r){let i;null===(v=n._$AQ)||void 0===v||v.call(n,o),n._$AM=o,void 0!==n._$AP&&(i=o._$AU)!==t._$AU&&n._$AP(i);}if(i!==d||r){let o=n._$AA;for(;o!==i;){const i=o.nextSibling;l.insertBefore(o,d),o=i;}}}return n},c$3=(o,i,t=o)=>(o._$AI(i,t),o),f={},s$1=(o,i=f)=>o._$AH=i,a=o=>o._$AH,m=o=>{var i;null===(i=o._$AP)||void 0===i||i.call(o,!1,!0);let t=o._$AA;const n=o._$AB.nextSibling;for(;t!==n;){const o=t.nextSibling;t.remove(),t=o;}},p=o=>{o._$AR();}; | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const e$3=(i,t)=>{var s,o;const n=i._$AN;if(void 0===n)return !1;for(const i of n)null===(o=(s=i)._$AO)||void 0===o||o.call(s,t,!1),e$3(i,t);return !0},o$1=i=>{let t,s;do{if(void 0===(t=i._$AM))break;s=t._$AN,s.delete(i),i=t;}while(0===(null==s?void 0:s.size))},n$1=i=>{for(let t;t=i._$AM;i=t){let s=t._$AN;if(void 0===s)t._$AN=s=new Set;else if(s.has(i))break;s.add(i),l$1(t);}};function r$2(i){void 0!==this._$AN?(o$1(this),this._$AM=i,n$1(this)):this._$AM=i;}function h$1(i,t=!1,s=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(t)if(Array.isArray(n))for(let i=s;i<n.length;i++)e$3(n[i],!1),o$1(n[i]);else null!=n&&(e$3(n,!1),o$1(n));else e$3(this,i);}const l$1=i=>{var t,e,o,n;i.type==t$1.CHILD&&(null!==(t=(o=i)._$AP)&&void 0!==t||(o._$AP=h$1),null!==(e=(n=i)._$AQ)&&void 0!==e||(n._$AQ=r$2));};class d$1 extends i$1{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,t,s){super._$AT(i,t,s),n$1(this),this.isConnected=i._$AU;}_$AO(i,t=!0){var s,n;i!==this.isConnected&&(this.isConnected=i,i?null===(s=this.reconnected)||void 0===s||s.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),t&&(e$3(this,i),o$1(this));}setValue(t){if(r$1(this._$Ct))this._$Ct._$AI(t,this);else {const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0);}}disconnected(){}reconnected(){}} | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const e$2=(i,t)=>{var s,o;const n=i._$AN;if(void 0===n)return !1;for(const i of n)null===(o=(s=i)._$AO)||void 0===o||o.call(s,t,!1),e$2(i,t);return !0},o$3=i=>{let t,s;do{if(void 0===(t=i._$AM))break;s=t._$AN,s.delete(i),i=t;}while(0===(null==s?void 0:s.size))},n$1=i=>{for(let t;t=i._$AM;i=t){let s=t._$AN;if(void 0===s)t._$AN=s=new Set;else if(s.has(i))break;s.add(i),l$2(t);}};function r(i){void 0!==this._$AN?(o$3(this),this._$AM=i,n$1(this)):this._$AM=i;}function h$2(i,t=!1,s=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(t)if(Array.isArray(n))for(let i=s;i<n.length;i++)e$2(n[i],!1),o$3(n[i]);else null!=n&&(e$2(n,!1),o$3(n));else e$2(this,i);}const l$2=i=>{var t,e,o,n;i.type==t$2.CHILD&&(null!==(t=(o=i)._$AP)&&void 0!==t||(o._$AP=h$2),null!==(e=(n=i)._$AQ)&&void 0!==e||(n._$AQ=r));};class d$1 extends i$4{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,t,s){super._$AT(i,t,s),n$1(this),this.isConnected=i._$AU;}_$AO(i,t=!0){var s,n;i!==this.isConnected&&(this.isConnected=i,i?null===(s=this.reconnected)||void 0===s||s.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),t&&(e$2(this,i),o$3(this));}setValue(t){if(r$1(this._$Ct))this._$Ct._$AI(t,this);else {const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0);}}disconnected(){}reconnected(){}} | ||
/** | ||
* @license | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const t$3=async(t,s)=>{for await(const i of t)if(!1===await s(i))return};class s$2{constructor(t){this.U=t;}disconnect(){this.U=void 0;}reconnect(t){this.U=t;}deref(){return this.U}}class i$3{constructor(){this.Y=void 0,this.q=void 0;}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.q=t)));}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0;}} | ||
/** | ||
* @license | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const t=async(t,s)=>{for await(const i of t)if(!1===await s(i))return};class s{constructor(t){this.U=t;}disconnect(){this.U=void 0;}reconnect(t){this.U=t;}deref(){return this.U}}class i$2{constructor(){this.Y=void 0,this.q=void 0;}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.q=t)));}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0;}} | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class o$2 extends d$1{constructor(){super(...arguments),this._$CG=new s$2(this),this._$CK=new i$3;}render(i,s){return b}update(i,[s,r]){if(this.isConnected||this.disconnected(),s===this._$CJ)return;this._$CJ=s;let e=0;const{_$CG:o,_$CK:h}=this;return t$3(s,(async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){if(i._$CJ!==s)return !1;void 0!==r&&(t=r(t,e)),i.commitValue(t,e),e++;}return !0})),b}commitValue(t,i){this.setValue(t);}disconnected(){this._$CG.disconnect(),this._$CK.pause();}reconnected(){this._$CG.reconnect(this),this._$CK.resume();}}const h$2=e$1(o$2); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class o$2 extends d$1{constructor(){super(...arguments),this._$CG=new s(this),this._$CK=new i$2;}render(i,s){return b}update(i,[s,r]){if(this.isConnected||this.disconnected(),s===this._$CJ)return;this._$CJ=s;let e=0;const{_$CG:o,_$CK:h}=this;return t(s,(async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){if(i._$CJ!==s)return !1;void 0!==r&&(t=r(t,e)),i.commitValue(t,e),e++;}return !0})),b}commitValue(t,i){this.setValue(t);}disconnected(){this._$CG.disconnect(),this._$CK.pause();}reconnected(){this._$CG.reconnect(this),this._$CK.resume();}}const h$1=e$4(o$2); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const c$2=e$1(class extends o$2{constructor(r){if(super(r),r.type!==t$1.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$CX=r,super.update(r,e)}commitValue(r,e){0===e&&p$1(this._$CX);const s=u$1(this._$CX);c$1(s,r);}}); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const c$2=e$4(class extends o$2{constructor(r){if(super(r),r.type!==t$2.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$CX=r,super.update(r,e)}commitValue(r,e){0===e&&p(this._$CX);const s=u$1(this._$CX);c$3(s,r);}}); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const d$2=e$1(class extends i$1{constructor(t){super(t),this.tt=new WeakMap;}render(t){return [t]}update(s,[e]){if(v$1(this.it)&&(!v$1(e)||this.it.strings!==e.strings)){const e=a$1(s).pop();let o=this.tt.get(this.it.strings);if(void 0===o){const s=document.createDocumentFragment();o=w(T,s),o.setConnected(!1),this.tt.set(this.it.strings,o);}s$1(o,[e]),u$1(o,void 0,e);}if(v$1(e)){if(!v$1(this.it)||this.it.strings!==e.strings){const t=this.tt.get(e.strings);if(void 0!==t){const i=a$1(t).pop();p$1(s),u$1(s,void 0,i),s$1(s,[i]);}}this.it=e;}else this.it=void 0;return this.render(e)}}); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const d=e$4(class extends i$4{constructor(t){super(t),this.tt=new WeakMap;}render(t){return [t]}update(s,[e]){if(v(this.it)&&(!v(e)||this.it.strings!==e.strings)){const e=a(s).pop();let o=this.tt.get(this.it.strings);if(void 0===o){const s=document.createDocumentFragment();o=w(T,s),o.setConnected(!1),this.tt.set(this.it.strings,o);}s$1(o,[e]),u$1(o,void 0,e);}if(v(e)){if(!v(this.it)||this.it.strings!==e.strings){const t=this.tt.get(e.strings);if(void 0!==t){const i=a(t).pop();p(s),u$1(s,void 0,i),s$1(s,[i]);}}this.it=e;}else this.it=void 0;return this.render(e)}}); | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const e$4={},i$4=e$1(class extends i$1{constructor(){super(...arguments),this.ot=e$4;}render(r,t){return t()}update(t,[s,e]){if(Array.isArray(s)){if(Array.isArray(this.ot)&&this.ot.length===s.length&&s.every(((r,t)=>r===this.ot[t])))return b}else if(this.ot===s)return b;return this.ot=Array.isArray(s)?Array.from(s):s,this.render(s,e)}}); | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const e$1={},i$1=e$4(class extends i$4{constructor(){super(...arguments),this.ot=e$1;}render(r,t){return t()}update(t,[s,e]){if(Array.isArray(s)){if(Array.isArray(this.ot)&&this.ot.length===s.length&&s.every(((r,t)=>r===this.ot[t])))return b}else if(this.ot===s)return b;return this.ot=Array.isArray(s)?Array.from(s):s,this.render(s,e)}}); | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const l$2=l=>null!=l?l:T; | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const l$1=l=>null!=l?l:T; | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const u$2=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c$3=e$1(class extends i$1{constructor(e){if(super(e),e.type!==t$1.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return {values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){var d;const a=a$1(s),{values:p,keys:v}=this.dt(t,r,c);if(!Array.isArray(a))return this.ct=v,p;const h=null!==(d=this.ct)&&void 0!==d?d:this.ct=[],m=[];let y,x,j=0,k=a.length-1,w=0,A=p.length-1;for(;j<=k&&w<=A;)if(null===a[j])j++;else if(null===a[k])k--;else if(h[j]===v[w])m[w]=c$1(a[j],p[w]),j++,w++;else if(h[k]===v[A])m[A]=c$1(a[k],p[A]),k--,A--;else if(h[j]===v[A])m[A]=c$1(a[j],p[A]),u$1(s,m[A+1],a[j]),j++,A--;else if(h[k]===v[w])m[w]=c$1(a[k],p[w]),u$1(s,a[j],a[k]),k--,w++;else if(void 0===y&&(y=u$2(v,w,A),x=u$2(h,j,k)),y.has(h[j]))if(y.has(h[k])){const e=x.get(v[w]),t=void 0!==e?a[e]:null;if(null===t){const e=u$1(s,a[j]);c$1(e,p[w]),m[w]=e;}else m[w]=c$1(t,p[w]),u$1(s,a[j],t),a[e]=null;w++;}else m$1(a[k]),k--;else m$1(a[j]),j++;for(;w<=A;){const e=u$1(s,m[A+1]);c$1(e,p[w]),m[w++]=e;}for(;j<=k;){const e=a[j++];null!==e&&m$1(e);}return this.ct=v,s$1(s,m),b}}); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c$1=e$4(class extends i$4{constructor(e){if(super(e),e.type!==t$2.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return {values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){var d;const a$1=a(s),{values:p,keys:v}=this.dt(t,r,c);if(!Array.isArray(a$1))return this.ct=v,p;const h=null!==(d=this.ct)&&void 0!==d?d:this.ct=[],m$1=[];let y,x,j=0,k=a$1.length-1,w=0,A=p.length-1;for(;j<=k&&w<=A;)if(null===a$1[j])j++;else if(null===a$1[k])k--;else if(h[j]===v[w])m$1[w]=c$3(a$1[j],p[w]),j++,w++;else if(h[k]===v[A])m$1[A]=c$3(a$1[k],p[A]),k--,A--;else if(h[j]===v[A])m$1[A]=c$3(a$1[j],p[A]),u$1(s,m$1[A+1],a$1[j]),j++,A--;else if(h[k]===v[w])m$1[w]=c$3(a$1[k],p[w]),u$1(s,a$1[j],a$1[k]),k--,w++;else if(void 0===y&&(y=u(v,w,A),x=u(h,j,k)),y.has(h[j]))if(y.has(h[k])){const e=x.get(v[w]),t=void 0!==e?a$1[e]:null;if(null===t){const e=u$1(s,a$1[j]);c$3(e,p[w]),m$1[w]=e;}else m$1[w]=c$3(t,p[w]),u$1(s,a$1[j],t),a$1[e]=null;w++;}else m(a$1[k]),k--;else m(a$1[j]),j++;for(;w<=A;){const e=u$1(s,m$1[A+1]);c$3(e,p[w]),m$1[w++]=e;}for(;j<=k;){const e=a$1[j++];null!==e&&m(e);}return this.ct=v,s$1(s,m$1),b}}); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class e$5 extends i$1{constructor(i){if(super(i),this.it=T,i.type!==t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===T||null==r)return this.vt=void 0,this.it=r;if(r===b)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this.vt;this.it=r;const s=[r];return s.raw=s,this.vt={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e$5.directiveName="unsafeHTML",e$5.resultType=1;const o$3=e$1(e$5); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class e extends i$4{constructor(i){if(super(i),this.it=T,i.type!==t$2.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===T||null==r)return this.vt=void 0,this.it=r;if(r===b)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this.vt;this.it=r;const s=[r];return s.raw=s,this.vt={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o$1=e$4(e); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const n$2=t=>!t$2(t)&&"function"==typeof t.then;class h$3 extends d$1{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new s$2(this),this._$CK=new i$3;}render(...s){var i;return null!==(i=s.find((t=>!n$2(t))))&&void 0!==i?i:b}update(s,i){const r=this._$Cwt;let e=r.length;this._$Cwt=i;const o=this._$CG,h=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<i.length&&!(t>this._$Cft);t++){const s=i[t];if(!n$2(s))return this._$Cft=t,s;t<e&&s===r[t]||(this._$Cft=1073741823,e=0,Promise.resolve(s).then((async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){const r=i._$Cwt.indexOf(s);r>-1&&r<i._$Cft&&(i._$Cft=r,i.setValue(t));}})));}return b}disconnected(){this._$CG.disconnect(),this._$CK.pause();}reconnected(){this._$CG.reconnect(this),this._$CK.resume();}}const c$4=e$1(h$3); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const n=t=>!t$1(t)&&"function"==typeof t.then;class h extends d$1{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new s(this),this._$CK=new i$2;}render(...s){var i;return null!==(i=s.find((t=>!n(t))))&&void 0!==i?i:b}update(s,i){const r=this._$Cwt;let e=r.length;this._$Cwt=i;const o=this._$CG,h=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<i.length&&!(t>this._$Cft);t++){const s=i[t];if(!n(s))return this._$Cft=t,s;t<e&&s===r[t]||(this._$Cft=1073741823,e=0,Promise.resolve(s).then((async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){const r=i._$Cwt.indexOf(s);r>-1&&r<i._$Cft&&(i._$Cft=r,i.setValue(t));}})));}return b}disconnected(){this._$CG.disconnect(),this._$CK.pause();}reconnected(){this._$CG.reconnect(this),this._$CK.resume();}}const c=e$4(h); | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const l$3=e$1(class extends i$1{constructor(r){if(super(r),r.type!==t$1.PROPERTY&&r.type!==t$1.ATTRIBUTE&&r.type!==t$1.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!r$1(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t]){if(t===b||t===T)return t;const o=i.element,l=i.name;if(i.type===t$1.PROPERTY){if(t===o[l])return b}else if(i.type===t$1.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(l))return b}else if(i.type===t$1.ATTRIBUTE&&o.getAttribute(l)===t+"")return b;return s$1(i),t}}); | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const l=e$4(class extends i$4{constructor(r){if(super(r),r.type!==t$2.PROPERTY&&r.type!==t$2.ATTRIBUTE&&r.type!==t$2.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!r$1(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t]){if(t===b||t===T)return t;const o=i.element,l=i.name;if(i.type===t$2.PROPERTY){if(t===o[l])return b}else if(i.type===t$2.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(l))return b}else if(i.type===t$2.ATTRIBUTE&&o.getAttribute(l)===t+"")return b;return s$1(i),t}}); | ||
const detached = new WeakMap(); | ||
class Detach extends i$1 { | ||
render(shouldDetach) { | ||
return T; | ||
} | ||
update(part, props) { | ||
if (typeof props[0] !== 'boolean') { | ||
throw new Error('[vido] Detach directive argument should be a boolean.'); | ||
} | ||
let detach = props[0]; | ||
const element = part.element; | ||
if (detach) { | ||
if (!detached.has(part)) { | ||
detached.set(part, { | ||
element, | ||
nextSibling: element.nextSibling, | ||
previousSibling: element.previousSibling, | ||
parent: element.parentNode, | ||
}); | ||
} | ||
element.remove(); | ||
} | ||
else { | ||
const data = detached.get(part); | ||
if (data) { | ||
if (data.nextSibling && data.nextSibling.parentNode) { | ||
data.nextSibling.parentNode.insertBefore(data.element, data.nextSibling); | ||
} | ||
else if (data.previousSibling && data.previousSibling.parentNode) { | ||
data.previousSibling.parentNode.appendChild(data.element); | ||
} | ||
else if (data.parent) { | ||
data.parent.appendChild(data.element); | ||
} | ||
detached.delete(part); | ||
} | ||
} | ||
return this.render(detach); | ||
} | ||
} | ||
const detach = e$1(Detach); | ||
const detached = new WeakMap(); | ||
class Detach extends i$4 { | ||
render(shouldDetach) { | ||
return T; | ||
} | ||
update(part, props) { | ||
if (typeof props[0] !== 'boolean') { | ||
throw new Error('[vido] Detach directive argument should be a boolean.'); | ||
} | ||
let detach = props[0]; | ||
const element = part.element; | ||
if (detach) { | ||
if (!detached.has(part)) { | ||
detached.set(part, { | ||
element, | ||
nextSibling: element.nextSibling, | ||
previousSibling: element.previousSibling, | ||
parent: element.parentNode, | ||
}); | ||
} | ||
element.remove(); | ||
} | ||
else { | ||
const data = detached.get(part); | ||
if (data) { | ||
if (data.nextSibling && data.nextSibling.parentNode) { | ||
data.nextSibling.parentNode.insertBefore(data.element, data.nextSibling); | ||
} | ||
else if (data.previousSibling && data.previousSibling.parentNode) { | ||
data.previousSibling.parentNode.appendChild(data.element); | ||
} | ||
else if (data.parent) { | ||
data.parent.appendChild(data.element); | ||
} | ||
detached.delete(part); | ||
} | ||
} | ||
return this.render(detach); | ||
} | ||
} | ||
const detach = e$4(Detach); | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const i$5=e$1(class extends i$1{constructor(t){var e;if(super(t),t.type!==t$1.ATTRIBUTE||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ut){this.ut=new Set;for(const t in r)this.ut.add(t);return this.render(r)}this.ut.forEach((t=>{null==r[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]="");}));for(const t in r){const e=r[t];null!=e&&(this.ut.add(t),t.includes("-")?s.setProperty(t,e):s[t]=e);}return b}}); | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const i=e$4(class extends i$4{constructor(t){var e;if(super(t),t.type!==t$2.ATTRIBUTE||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ut){this.ut=new Set;for(const t in r)this.ut.add(t);return this.render(r)}this.ut.forEach((t=>{null==r[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]="");}));for(const t in r){const e=r[t];null!=e&&(this.ut.add(t),t.includes("-")?s.setProperty(t,e):s[t]=e);}return b}}); | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const o$4=e$1(class extends i$1{constructor(t){var i;if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(i,[s]){var r,o;if(void 0===this.st){this.st=new Set,void 0!==i.strings&&(this.et=new Set(i.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in s)s[t]&&!(null===(r=this.et)||void 0===r?void 0:r.has(t))&&this.st.add(t);return this.render(s)}const e=i.element.classList;this.st.forEach((t=>{t in s||(e.remove(t),this.st.delete(t));}));for(const t in s){const i=!!s[t];i===this.st.has(t)||(null===(o=this.et)||void 0===o?void 0:o.has(t))||(i?(e.add(t),this.st.add(t)):(e.remove(t),this.st.delete(t)));}return b}}); | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const o=e$4(class extends i$4{constructor(t){var i;if(super(t),t.type!==t$2.ATTRIBUTE||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(i,[s]){var r,o;if(void 0===this.st){this.st=new Set,void 0!==i.strings&&(this.et=new Set(i.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in s)s[t]&&!(null===(r=this.et)||void 0===r?void 0:r.has(t))&&this.st.add(t);return this.render(s)}const e=i.element.classList;this.st.forEach((t=>{t in s||(e.remove(t),this.st.delete(t));}));for(const t in s){const i=!!s[t];i===this.st.has(t)||(null===(o=this.et)||void 0===o?void 0:o.has(t))||(i?(e.add(t),this.st.add(t)):(e.remove(t),this.st.delete(t)));}return b}}); | ||
class Action { | ||
constructor() { | ||
this.isAction = true; | ||
} | ||
} | ||
Action.prototype.isAction = true; | ||
class Action { | ||
constructor() { | ||
this.isAction = true; | ||
} | ||
} | ||
Action.prototype.isAction = true; | ||
const defaultOptions = { | ||
element: document.createTextNode(''), | ||
axis: 'xy', | ||
threshold: 10, | ||
onDown() { }, | ||
onMove() { }, | ||
onUp() { }, | ||
onWheel() { }, | ||
}; | ||
const pointerEventsExists = typeof PointerEvent !== 'undefined'; | ||
let id = 0; | ||
class PointerAction extends Action { | ||
constructor(element, data) { | ||
super(); | ||
this.moving = ''; | ||
this.initialX = 0; | ||
this.initialY = 0; | ||
this.lastY = 0; | ||
this.lastX = 0; | ||
this.onPointerDown = this.onPointerDown.bind(this); | ||
this.onPointerMove = this.onPointerMove.bind(this); | ||
this.onPointerUp = this.onPointerUp.bind(this); | ||
this.onWheel = this.onWheel.bind(this); | ||
this.element = element; | ||
this.id = ++id; | ||
this.options = Object.assign(Object.assign({}, defaultOptions), data.pointerOptions); | ||
if (pointerEventsExists) { | ||
element.addEventListener('pointerdown', this.onPointerDown); | ||
document.addEventListener('pointermove', this.onPointerMove); | ||
document.addEventListener('pointerup', this.onPointerUp); | ||
} | ||
else { | ||
element.addEventListener('touchstart', this.onPointerDown); | ||
document.addEventListener('touchmove', this.onPointerMove, { passive: false }); | ||
document.addEventListener('touchend', this.onPointerUp); | ||
document.addEventListener('touchcancel', this.onPointerUp); | ||
element.addEventListener('mousedown', this.onPointerDown); | ||
document.addEventListener('mousemove', this.onPointerMove, { passive: false }); | ||
document.addEventListener('mouseup', this.onPointerUp); | ||
} | ||
} | ||
normalizeMouseWheelEvent(event) { | ||
// @ts-ignore | ||
let x = event.deltaX || 0; | ||
// @ts-ignore | ||
let y = event.deltaY || 0; | ||
// @ts-ignore | ||
let z = event.deltaZ || 0; | ||
// @ts-ignore | ||
const mode = event.deltaMode; | ||
// @ts-ignore | ||
const lineHeight = parseInt(getComputedStyle(event.target).getPropertyValue('line-height')); | ||
let scale = 1; | ||
switch (mode) { | ||
case 1: | ||
scale = lineHeight; | ||
break; | ||
case 2: | ||
// @ts-ignore | ||
scale = window.height; | ||
break; | ||
} | ||
x *= scale; | ||
y *= scale; | ||
z *= scale; | ||
return { x, y, z, event }; | ||
} | ||
onWheel(event) { | ||
const normalized = this.normalizeMouseWheelEvent(event); | ||
this.options.onWheel(normalized); | ||
} | ||
normalizePointerEvent(event) { | ||
let result = { x: 0, y: 0, pageX: 0, pageY: 0, clientX: 0, clientY: 0, screenX: 0, screenY: 0, event }; | ||
switch (event.type) { | ||
case 'wheel': | ||
const wheel = this.normalizeMouseWheelEvent(event); | ||
result.x = wheel.x; | ||
result.y = wheel.y; | ||
result.pageX = result.x; | ||
result.pageY = result.y; | ||
result.screenX = result.x; | ||
result.screenY = result.y; | ||
result.clientX = result.x; | ||
result.clientY = result.y; | ||
break; | ||
case 'touchstart': | ||
case 'touchmove': | ||
case 'touchend': | ||
case 'touchcancel': | ||
result.x = event.changedTouches[0].screenX; | ||
result.y = event.changedTouches[0].screenY; | ||
result.pageX = event.changedTouches[0].pageX; | ||
result.pageY = event.changedTouches[0].pageY; | ||
result.screenX = event.changedTouches[0].screenX; | ||
result.screenY = event.changedTouches[0].screenY; | ||
result.clientX = event.changedTouches[0].clientX; | ||
result.clientY = event.changedTouches[0].clientY; | ||
break; | ||
default: | ||
result.x = event.x; | ||
result.y = event.y; | ||
result.pageX = event.pageX; | ||
result.pageY = event.pageY; | ||
result.screenX = event.screenX; | ||
result.screenY = event.screenY; | ||
result.clientX = event.clientX; | ||
result.clientY = event.clientY; | ||
break; | ||
} | ||
return result; | ||
} | ||
onPointerDown(event) { | ||
if (event.type === 'mousedown' && event.button !== 0) | ||
return; | ||
this.moving = 'xy'; | ||
const normalized = this.normalizePointerEvent(event); | ||
this.lastX = normalized.x; | ||
this.lastY = normalized.y; | ||
this.initialX = normalized.x; | ||
this.initialY = normalized.y; | ||
this.options.onDown(normalized); | ||
} | ||
handleX(normalized) { | ||
let movementX = normalized.x - this.lastX; | ||
this.lastY = normalized.y; | ||
this.lastX = normalized.x; | ||
return movementX; | ||
} | ||
handleY(normalized) { | ||
let movementY = normalized.y - this.lastY; | ||
this.lastY = normalized.y; | ||
this.lastX = normalized.x; | ||
return movementY; | ||
} | ||
onPointerMove(event) { | ||
if (this.moving === '' || (event.type === 'mousemove' && event.button !== 0)) | ||
return; | ||
const normalized = this.normalizePointerEvent(event); | ||
if (this.options.axis === 'x|y') { | ||
let movementX = 0, movementY = 0; | ||
if (this.moving === 'x' || | ||
(this.moving === 'xy' && Math.abs(normalized.x - this.initialX) > this.options.threshold)) { | ||
this.moving = 'x'; | ||
movementX = this.handleX(normalized); | ||
} | ||
if (this.moving === 'y' || | ||
(this.moving === 'xy' && Math.abs(normalized.y - this.initialY) > this.options.threshold)) { | ||
this.moving = 'y'; | ||
movementY = this.handleY(normalized); | ||
} | ||
this.options.onMove({ | ||
movementX, | ||
movementY, | ||
x: normalized.x, | ||
y: normalized.y, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
} | ||
else if (this.options.axis === 'xy') { | ||
let movementX = 0, movementY = 0; | ||
if (Math.abs(normalized.x - this.initialX) > this.options.threshold) { | ||
movementX = this.handleX(normalized); | ||
} | ||
if (Math.abs(normalized.y - this.initialY) > this.options.threshold) { | ||
movementY = this.handleY(normalized); | ||
} | ||
this.options.onMove({ | ||
movementX, | ||
movementY, | ||
x: normalized.x, | ||
y: normalized.y, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
} | ||
else if (this.options.axis === 'x') { | ||
if (this.moving === 'x' || | ||
(this.moving === 'xy' && Math.abs(normalized.x - this.initialX) > this.options.threshold)) { | ||
this.moving = 'x'; | ||
// @ts-ignore | ||
this.options.onMove({ | ||
movementX: this.handleX(normalized), | ||
movementY: 0, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
} | ||
} | ||
else if (this.options.axis === 'y') { | ||
let movementY = 0; | ||
if (this.moving === 'y' || | ||
(this.moving === 'xy' && Math.abs(normalized.y - this.initialY) > this.options.threshold)) { | ||
this.moving = 'y'; | ||
movementY = this.handleY(normalized); | ||
} | ||
this.options.onMove({ | ||
movementX: 0, | ||
movementY, | ||
x: normalized.x, | ||
y: normalized.y, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
} | ||
} | ||
onPointerUp(event) { | ||
this.moving = ''; | ||
const normalized = this.normalizePointerEvent(event); | ||
this.options.onUp({ | ||
movementX: 0, | ||
movementY: 0, | ||
x: normalized.x, | ||
y: normalized.y, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
this.lastY = 0; | ||
this.lastX = 0; | ||
} | ||
destroy(element) { | ||
if (pointerEventsExists) { | ||
element.removeEventListener('pointerdown', this.onPointerDown); | ||
document.removeEventListener('pointermove', this.onPointerMove); | ||
document.removeEventListener('pointerup', this.onPointerUp); | ||
} | ||
else { | ||
element.removeEventListener('mousedown', this.onPointerDown); | ||
document.removeEventListener('mousemove', this.onPointerMove); | ||
document.removeEventListener('mouseup', this.onPointerUp); | ||
element.removeEventListener('touchstart', this.onPointerDown); | ||
document.removeEventListener('touchmove', this.onPointerMove); | ||
document.removeEventListener('touchend', this.onPointerUp); | ||
document.removeEventListener('touchcancel', this.onPointerUp); | ||
} | ||
} | ||
} | ||
const defaultOptions = { | ||
element: document.createTextNode(''), | ||
axis: 'xy', | ||
threshold: 10, | ||
onDown() { }, | ||
onMove() { }, | ||
onUp() { }, | ||
onWheel() { }, | ||
}; | ||
const pointerEventsExists = typeof PointerEvent !== 'undefined'; | ||
let id = 0; | ||
class PointerAction extends Action { | ||
constructor(element, data) { | ||
super(); | ||
this.moving = ''; | ||
this.initialX = 0; | ||
this.initialY = 0; | ||
this.lastY = 0; | ||
this.lastX = 0; | ||
this.onPointerDown = this.onPointerDown.bind(this); | ||
this.onPointerMove = this.onPointerMove.bind(this); | ||
this.onPointerUp = this.onPointerUp.bind(this); | ||
this.onWheel = this.onWheel.bind(this); | ||
this.element = element; | ||
this.id = ++id; | ||
this.options = Object.assign(Object.assign({}, defaultOptions), data.pointerOptions); | ||
if (pointerEventsExists) { | ||
element.addEventListener('pointerdown', this.onPointerDown); | ||
document.addEventListener('pointermove', this.onPointerMove); | ||
document.addEventListener('pointerup', this.onPointerUp); | ||
} | ||
else { | ||
element.addEventListener('touchstart', this.onPointerDown); | ||
document.addEventListener('touchmove', this.onPointerMove, { passive: false }); | ||
document.addEventListener('touchend', this.onPointerUp); | ||
document.addEventListener('touchcancel', this.onPointerUp); | ||
element.addEventListener('mousedown', this.onPointerDown); | ||
document.addEventListener('mousemove', this.onPointerMove, { passive: false }); | ||
document.addEventListener('mouseup', this.onPointerUp); | ||
} | ||
} | ||
normalizeMouseWheelEvent(event) { | ||
// @ts-ignore | ||
let x = event.deltaX || 0; | ||
// @ts-ignore | ||
let y = event.deltaY || 0; | ||
// @ts-ignore | ||
let z = event.deltaZ || 0; | ||
// @ts-ignore | ||
const mode = event.deltaMode; | ||
// @ts-ignore | ||
const lineHeight = parseInt(getComputedStyle(event.target).getPropertyValue('line-height')); | ||
let scale = 1; | ||
switch (mode) { | ||
case 1: | ||
scale = lineHeight; | ||
break; | ||
case 2: | ||
// @ts-ignore | ||
scale = window.height; | ||
break; | ||
} | ||
x *= scale; | ||
y *= scale; | ||
z *= scale; | ||
return { x, y, z, event }; | ||
} | ||
onWheel(event) { | ||
const normalized = this.normalizeMouseWheelEvent(event); | ||
this.options.onWheel(normalized); | ||
} | ||
normalizePointerEvent(event) { | ||
let result = { x: 0, y: 0, pageX: 0, pageY: 0, clientX: 0, clientY: 0, screenX: 0, screenY: 0, event }; | ||
switch (event.type) { | ||
case 'wheel': | ||
const wheel = this.normalizeMouseWheelEvent(event); | ||
result.x = wheel.x; | ||
result.y = wheel.y; | ||
result.pageX = result.x; | ||
result.pageY = result.y; | ||
result.screenX = result.x; | ||
result.screenY = result.y; | ||
result.clientX = result.x; | ||
result.clientY = result.y; | ||
break; | ||
case 'touchstart': | ||
case 'touchmove': | ||
case 'touchend': | ||
case 'touchcancel': | ||
result.x = event.changedTouches[0].screenX; | ||
result.y = event.changedTouches[0].screenY; | ||
result.pageX = event.changedTouches[0].pageX; | ||
result.pageY = event.changedTouches[0].pageY; | ||
result.screenX = event.changedTouches[0].screenX; | ||
result.screenY = event.changedTouches[0].screenY; | ||
result.clientX = event.changedTouches[0].clientX; | ||
result.clientY = event.changedTouches[0].clientY; | ||
break; | ||
default: | ||
result.x = event.x; | ||
result.y = event.y; | ||
result.pageX = event.pageX; | ||
result.pageY = event.pageY; | ||
result.screenX = event.screenX; | ||
result.screenY = event.screenY; | ||
result.clientX = event.clientX; | ||
result.clientY = event.clientY; | ||
break; | ||
} | ||
return result; | ||
} | ||
onPointerDown(event) { | ||
if (event.type === 'mousedown' && event.button !== 0) | ||
return; | ||
this.moving = 'xy'; | ||
const normalized = this.normalizePointerEvent(event); | ||
this.lastX = normalized.x; | ||
this.lastY = normalized.y; | ||
this.initialX = normalized.x; | ||
this.initialY = normalized.y; | ||
this.options.onDown(normalized); | ||
} | ||
handleX(normalized) { | ||
let movementX = normalized.x - this.lastX; | ||
this.lastY = normalized.y; | ||
this.lastX = normalized.x; | ||
return movementX; | ||
} | ||
handleY(normalized) { | ||
let movementY = normalized.y - this.lastY; | ||
this.lastY = normalized.y; | ||
this.lastX = normalized.x; | ||
return movementY; | ||
} | ||
onPointerMove(event) { | ||
if (this.moving === '' || (event.type === 'mousemove' && event.button !== 0)) | ||
return; | ||
const normalized = this.normalizePointerEvent(event); | ||
if (this.options.axis === 'x|y') { | ||
let movementX = 0, movementY = 0; | ||
if (this.moving === 'x' || | ||
(this.moving === 'xy' && Math.abs(normalized.x - this.initialX) > this.options.threshold)) { | ||
this.moving = 'x'; | ||
movementX = this.handleX(normalized); | ||
} | ||
if (this.moving === 'y' || | ||
(this.moving === 'xy' && Math.abs(normalized.y - this.initialY) > this.options.threshold)) { | ||
this.moving = 'y'; | ||
movementY = this.handleY(normalized); | ||
} | ||
this.options.onMove({ | ||
movementX, | ||
movementY, | ||
x: normalized.x, | ||
y: normalized.y, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
} | ||
else if (this.options.axis === 'xy') { | ||
let movementX = 0, movementY = 0; | ||
if (Math.abs(normalized.x - this.initialX) > this.options.threshold) { | ||
movementX = this.handleX(normalized); | ||
} | ||
if (Math.abs(normalized.y - this.initialY) > this.options.threshold) { | ||
movementY = this.handleY(normalized); | ||
} | ||
this.options.onMove({ | ||
movementX, | ||
movementY, | ||
x: normalized.x, | ||
y: normalized.y, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
} | ||
else if (this.options.axis === 'x') { | ||
if (this.moving === 'x' || | ||
(this.moving === 'xy' && Math.abs(normalized.x - this.initialX) > this.options.threshold)) { | ||
this.moving = 'x'; | ||
// @ts-ignore | ||
this.options.onMove({ | ||
movementX: this.handleX(normalized), | ||
movementY: 0, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
} | ||
} | ||
else if (this.options.axis === 'y') { | ||
let movementY = 0; | ||
if (this.moving === 'y' || | ||
(this.moving === 'xy' && Math.abs(normalized.y - this.initialY) > this.options.threshold)) { | ||
this.moving = 'y'; | ||
movementY = this.handleY(normalized); | ||
} | ||
this.options.onMove({ | ||
movementX: 0, | ||
movementY, | ||
x: normalized.x, | ||
y: normalized.y, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
} | ||
} | ||
onPointerUp(event) { | ||
this.moving = ''; | ||
const normalized = this.normalizePointerEvent(event); | ||
this.options.onUp({ | ||
movementX: 0, | ||
movementY: 0, | ||
x: normalized.x, | ||
y: normalized.y, | ||
initialX: this.initialX, | ||
initialY: this.initialY, | ||
lastX: this.lastX, | ||
lastY: this.lastY, | ||
event, | ||
}); | ||
this.lastY = 0; | ||
this.lastX = 0; | ||
} | ||
destroy(element) { | ||
if (pointerEventsExists) { | ||
element.removeEventListener('pointerdown', this.onPointerDown); | ||
document.removeEventListener('pointermove', this.onPointerMove); | ||
document.removeEventListener('pointerup', this.onPointerUp); | ||
} | ||
else { | ||
element.removeEventListener('mousedown', this.onPointerDown); | ||
document.removeEventListener('mousemove', this.onPointerMove); | ||
document.removeEventListener('mouseup', this.onPointerUp); | ||
element.removeEventListener('touchstart', this.onPointerDown); | ||
document.removeEventListener('touchmove', this.onPointerMove); | ||
document.removeEventListener('touchend', this.onPointerUp); | ||
document.removeEventListener('touchcancel', this.onPointerUp); | ||
} | ||
} | ||
} | ||
function getPublicComponentMethods(components, actionsByInstance, clone) { | ||
return class PublicComponentMethods { | ||
constructor(instance, vidoInstance, props = {}) { | ||
this.destroyed = false; | ||
this.instance = instance; | ||
this.name = vidoInstance.name; | ||
this.vidoInstance = vidoInstance; | ||
this.props = props; | ||
this.destroy = this.destroy.bind(this); | ||
this.update = this.update.bind(this); | ||
this.change = this.change.bind(this); | ||
this.html = this.html.bind(this); | ||
} | ||
/** | ||
* Destroy component | ||
*/ | ||
destroy() { | ||
if (this.destroyed) | ||
return; | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`destroying component ${this.instance}`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
this.vidoInstance.destroyComponent(this.instance, this.vidoInstance); | ||
this.destroyed = true; | ||
} | ||
/** | ||
* Update template - trigger rendering process | ||
*/ | ||
update(callback = undefined) { | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`updating component ${this.instance}`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
return this.vidoInstance.updateTemplate(callback); | ||
} | ||
/** | ||
* Change component input properties | ||
* @param {any} newProps | ||
*/ | ||
change(newProps, options = {}) { | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`changing component ${this.instance}`); | ||
console.log(clone({ props: this.props, newProps: newProps, components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
const component = components.get(this.instance); | ||
if (component) | ||
component.change(newProps, options); | ||
} | ||
/** | ||
* Get component lit-html template | ||
* @param {} templateProps | ||
*/ | ||
html(templateProps = {}) { | ||
const component = components.get(this.instance); | ||
if (component && !component.destroyed) { | ||
return component.update(templateProps, this.vidoInstance); | ||
} | ||
return undefined; | ||
} | ||
_getComponents() { | ||
return components; | ||
} | ||
_getActions() { | ||
return actionsByInstance; | ||
} | ||
}; | ||
} | ||
function getPublicComponentMethods(components, actionsByInstance, clone) { | ||
return class PublicComponentMethods { | ||
constructor(instance, vidoInstance, props = {}) { | ||
this.destroyed = false; | ||
this.instance = instance; | ||
this.name = vidoInstance.name; | ||
this.vidoInstance = vidoInstance; | ||
this.props = props; | ||
this.destroy = this.destroy.bind(this); | ||
this.update = this.update.bind(this); | ||
this.change = this.change.bind(this); | ||
this.html = this.html.bind(this); | ||
} | ||
/** | ||
* Destroy component | ||
*/ | ||
destroy() { | ||
if (this.destroyed) | ||
return; | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`destroying component ${this.instance}`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
this.vidoInstance.destroyComponent(this.instance, this.vidoInstance); | ||
this.destroyed = true; | ||
} | ||
/** | ||
* Update template - trigger rendering process | ||
*/ | ||
update(callback = undefined) { | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`updating component ${this.instance}`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
return this.vidoInstance.updateTemplate(callback); | ||
} | ||
/** | ||
* Change component input properties | ||
* @param {any} newProps | ||
*/ | ||
change(newProps, options = {}) { | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`changing component ${this.instance}`); | ||
console.log(clone({ props: this.props, newProps: newProps, components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
const component = components.get(this.instance); | ||
if (component) | ||
component.change(newProps, options); | ||
} | ||
/** | ||
* Get component lit-html template | ||
* @param {} templateProps | ||
*/ | ||
html(templateProps = {}) { | ||
const component = components.get(this.instance); | ||
if (component && !component.destroyed) { | ||
return component.update(templateProps, this.vidoInstance); | ||
} | ||
return undefined; | ||
} | ||
_getComponents() { | ||
return components; | ||
} | ||
_getActions() { | ||
return actionsByInstance; | ||
} | ||
}; | ||
} | ||
function getActionsCollector(actionsByInstance) { | ||
return class ActionsCollector extends i$1 { | ||
update(part, props) { | ||
const element = part.element; | ||
const instance = props[0]; | ||
const actions = props[1]; | ||
const actionProps = props[2]; | ||
for (const create of actions) { | ||
if (typeof create !== 'undefined') { | ||
let exists; | ||
if (actionsByInstance.has(instance)) { | ||
for (const action of actionsByInstance.get(instance)) { | ||
if (action.componentAction.create === create && action.element === element) { | ||
exists = action; | ||
break; | ||
} | ||
} | ||
} | ||
if (!exists) { | ||
// @ts-ignore | ||
if (typeof element.vido !== 'undefined') | ||
delete element.vido; | ||
const componentAction = { | ||
create, | ||
update() { }, | ||
destroy() { }, | ||
}; | ||
const action = { instance: instance, componentAction, element, props: actionProps }; | ||
let byInstance = []; | ||
if (actionsByInstance.has(instance)) { | ||
byInstance = actionsByInstance.get(instance); | ||
} | ||
byInstance.push(action); | ||
actionsByInstance.set(instance, byInstance); | ||
} | ||
else { | ||
exists.props = actionProps; | ||
} | ||
} | ||
} | ||
} | ||
render(instance, actions, props) { | ||
return T; | ||
} | ||
}; | ||
} | ||
function getActionsCollector(actionsByInstance) { | ||
return class ActionsCollector extends i$4 { | ||
update(part, props) { | ||
const element = part.element; | ||
const instance = props[0]; | ||
const actions = props[1]; | ||
const actionProps = props[2]; | ||
for (const create of actions) { | ||
if (typeof create !== 'undefined') { | ||
let exists; | ||
if (actionsByInstance.has(instance)) { | ||
for (const action of actionsByInstance.get(instance)) { | ||
if (action.componentAction.create === create && action.element === element) { | ||
exists = action; | ||
break; | ||
} | ||
} | ||
} | ||
if (!exists) { | ||
// @ts-ignore | ||
if (typeof element.vido !== 'undefined') | ||
delete element.vido; | ||
const componentAction = { | ||
create, | ||
update() { }, | ||
destroy() { }, | ||
}; | ||
const action = { instance: instance, componentAction, element, props: actionProps }; | ||
let byInstance = []; | ||
if (actionsByInstance.has(instance)) { | ||
byInstance = actionsByInstance.get(instance); | ||
} | ||
byInstance.push(action); | ||
actionsByInstance.set(instance, byInstance); | ||
} | ||
else { | ||
exists.props = actionProps; | ||
} | ||
} | ||
} | ||
} | ||
render(instance, actions, props) { | ||
return T; | ||
} | ||
}; | ||
} | ||
function getInternalComponentMethods(components, actionsByInstance, clone) { | ||
return class InternalComponentMethods { | ||
constructor(instance, vidoInstance, renderFunction) { | ||
this.destroyed = false; | ||
this.instance = instance; | ||
this.vidoInstance = vidoInstance; | ||
this.renderFunction = renderFunction; | ||
this.destroy = this.destroy.bind(this); | ||
this.update = this.update.bind(this); | ||
this.change = this.change.bind(this); | ||
} | ||
destroy() { | ||
if (this.destroyed) | ||
return; | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`component destroy method fired ${this.instance}`); | ||
console.log(clone({ | ||
props: this.vidoInstance.props, | ||
components: components.keys(), | ||
destroyable: this.vidoInstance.destroyable, | ||
actionsByInstance, | ||
})); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
if (this.content && typeof this.content.destroy === 'function') { | ||
this.content.destroy(); | ||
} | ||
for (const d of this.vidoInstance.destroyable) { | ||
d(); | ||
} | ||
this.vidoInstance.onChangeFunctions.length = 0; | ||
this.vidoInstance.destroyable.length = 0; | ||
this.vidoInstance.destroyed = true; | ||
this.destroyed = true; | ||
this.vidoInstance.update(); | ||
} | ||
update(props = {}) { | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`component update method fired ${this.instance}`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
return this.renderFunction(props); | ||
} | ||
change(changedProps, options = { leave: false }) { | ||
const props = changedProps; | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`component change method fired ${this.instance}`); | ||
console.log(clone({ | ||
props, | ||
components: components.keys(), | ||
onChangeFunctions: this.vidoInstance.onChangeFunctions, | ||
changedProps, | ||
actionsByInstance, | ||
})); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
for (const fn of this.vidoInstance.onChangeFunctions) { | ||
fn(changedProps, options); | ||
} | ||
} | ||
}; | ||
} | ||
function getInternalComponentMethods(components, actionsByInstance, clone) { | ||
return class InternalComponentMethods { | ||
constructor(instance, vidoInstance, renderFunction) { | ||
this.destroyed = false; | ||
this.instance = instance; | ||
this.vidoInstance = vidoInstance; | ||
this.renderFunction = renderFunction; | ||
this.destroy = this.destroy.bind(this); | ||
this.update = this.update.bind(this); | ||
this.change = this.change.bind(this); | ||
} | ||
destroy() { | ||
if (this.destroyed) | ||
return; | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`component destroy method fired ${this.instance}`); | ||
console.log(clone({ | ||
props: this.vidoInstance.props, | ||
components: components.keys(), | ||
destroyable: this.vidoInstance.destroyable, | ||
actionsByInstance, | ||
})); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
if (this.content && typeof this.content.destroy === 'function') { | ||
this.content.destroy(); | ||
} | ||
for (const d of this.vidoInstance.destroyable) { | ||
d(); | ||
} | ||
this.vidoInstance.onChangeFunctions.length = 0; | ||
this.vidoInstance.destroyable.length = 0; | ||
this.vidoInstance.destroyed = true; | ||
this.destroyed = true; | ||
this.vidoInstance.update(); | ||
} | ||
update(props = {}) { | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`component update method fired ${this.instance}`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
return this.renderFunction(props); | ||
} | ||
change(changedProps, options = { leave: false }) { | ||
const props = changedProps; | ||
if (this.vidoInstance.debug) { | ||
console.groupCollapsed(`component change method fired ${this.instance}`); | ||
console.log(clone({ | ||
props, | ||
components: components.keys(), | ||
onChangeFunctions: this.vidoInstance.onChangeFunctions, | ||
changedProps, | ||
actionsByInstance, | ||
})); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
for (const fn of this.vidoInstance.onChangeFunctions) { | ||
fn(changedProps, options); | ||
} | ||
} | ||
}; | ||
} | ||
/** | ||
* Schedule - a throttle function that uses requestAnimationFrame to limit the rate at which a function is called. | ||
* | ||
* @param {function} fn | ||
* @returns {function} | ||
*/ | ||
function schedule(fn) { | ||
let frameId = 0; | ||
function wrapperFn(argument) { | ||
if (frameId) { | ||
return; | ||
} | ||
function executeFrame() { | ||
frameId = 0; | ||
fn.apply(undefined, [argument]); | ||
} | ||
frameId = requestAnimationFrame(executeFrame); | ||
} | ||
return wrapperFn; | ||
} | ||
/** | ||
* Is object - helper function to determine if specified variable is an object | ||
* | ||
* @param {any} item | ||
* @returns {boolean} | ||
*/ | ||
function isObject(item) { | ||
if (item && item.constructor) { | ||
return item.constructor.name === 'Object'; | ||
} | ||
return typeof item === 'object' && item !== null; | ||
} | ||
/** | ||
* Merge deep - helper function which will merge objects recursively - creating brand new one - like clone | ||
* | ||
* @param {object} target | ||
* @params {[object]} sources | ||
* @returns {object} | ||
*/ | ||
function mergeDeep(target, ...sources) { | ||
const source = sources.shift(); | ||
if (isObject(target) && isObject(source)) { | ||
for (const key in source) { | ||
if (isObject(source[key])) { | ||
if (typeof source[key].clone === 'function') { | ||
target[key] = source[key].clone(); | ||
} | ||
else { | ||
if (typeof target[key] === 'undefined') { | ||
target[key] = {}; | ||
} | ||
target[key] = mergeDeep(target[key], source[key]); | ||
} | ||
} | ||
else if (Array.isArray(source[key])) { | ||
target[key] = new Array(source[key].length); | ||
let index = 0; | ||
for (let item of source[key]) { | ||
if (isObject(item)) { | ||
if (typeof item.clone === 'function') { | ||
target[key][index] = item.clone(); | ||
} | ||
else { | ||
target[key][index] = mergeDeep({}, item); | ||
} | ||
} | ||
else { | ||
target[key][index] = item; | ||
} | ||
index++; | ||
} | ||
} | ||
else { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
if (!sources.length) { | ||
return target; | ||
} | ||
return mergeDeep(target, ...sources); | ||
} | ||
/** | ||
* Clone helper function | ||
* | ||
* @param source | ||
* @returns {object} cloned source | ||
*/ | ||
function clone(source) { | ||
// @ts-ignore | ||
if (typeof source.actions !== 'undefined') { | ||
// @ts-ignore | ||
const actns = source.actions.map((action) => { | ||
const result = Object.assign({}, action); | ||
const props = Object.assign({}, result.props); | ||
delete props.state; | ||
delete props.api; | ||
delete result.element; | ||
result.props = props; | ||
return result; | ||
}); | ||
// @ts-ignore | ||
source.actions = actns; | ||
} | ||
return mergeDeep({}, source); | ||
} | ||
/** | ||
* Schedule - a throttle function that uses requestAnimationFrame to limit the rate at which a function is called. | ||
* | ||
* @param {function} fn | ||
* @returns {function} | ||
*/ | ||
function schedule(fn) { | ||
let frameId = 0; | ||
function wrapperFn(argument) { | ||
if (frameId) { | ||
return; | ||
} | ||
function executeFrame() { | ||
frameId = 0; | ||
fn.apply(undefined, [argument]); | ||
} | ||
frameId = requestAnimationFrame(executeFrame); | ||
} | ||
return wrapperFn; | ||
} | ||
/** | ||
* Is object - helper function to determine if specified variable is an object | ||
* | ||
* @param {any} item | ||
* @returns {boolean} | ||
*/ | ||
function isObject(item) { | ||
if (item && item.constructor) { | ||
return item.constructor.name === 'Object'; | ||
} | ||
return typeof item === 'object' && item !== null; | ||
} | ||
/** | ||
* Merge deep - helper function which will merge objects recursively - creating brand new one - like clone | ||
* | ||
* @param {object} target | ||
* @params {[object]} sources | ||
* @returns {object} | ||
*/ | ||
function mergeDeep(target, ...sources) { | ||
const source = sources.shift(); | ||
if (isObject(target) && isObject(source)) { | ||
for (const key in source) { | ||
if (isObject(source[key])) { | ||
if (typeof source[key].clone === 'function') { | ||
target[key] = source[key].clone(); | ||
} | ||
else { | ||
if (typeof target[key] === 'undefined') { | ||
target[key] = {}; | ||
} | ||
target[key] = mergeDeep(target[key], source[key]); | ||
} | ||
} | ||
else if (Array.isArray(source[key])) { | ||
target[key] = new Array(source[key].length); | ||
let index = 0; | ||
for (let item of source[key]) { | ||
if (isObject(item)) { | ||
if (typeof item.clone === 'function') { | ||
target[key][index] = item.clone(); | ||
} | ||
else { | ||
target[key][index] = mergeDeep({}, item); | ||
} | ||
} | ||
else { | ||
target[key][index] = item; | ||
} | ||
index++; | ||
} | ||
} | ||
else { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
if (!sources.length) { | ||
return target; | ||
} | ||
return mergeDeep(target, ...sources); | ||
} | ||
/** | ||
* Clone helper function | ||
* | ||
* @param source | ||
* @returns {object} cloned source | ||
*/ | ||
function clone(source) { | ||
// @ts-ignore | ||
if (typeof source.actions !== 'undefined') { | ||
// @ts-ignore | ||
const actns = source.actions.map((action) => { | ||
const result = Object.assign({}, action); | ||
const props = Object.assign({}, result.props); | ||
delete props.state; | ||
delete props.api; | ||
delete result.element; | ||
result.props = props; | ||
return result; | ||
}); | ||
// @ts-ignore | ||
source.actions = actns; | ||
} | ||
return mergeDeep({}, source); | ||
} | ||
class Slots { | ||
constructor(vido, props) { | ||
this.slotInstances = {}; | ||
this.destroyed = false; | ||
this.vido = vido; | ||
this.props = props; | ||
this.destroy = this.destroy.bind(this); | ||
this.change = this.change.bind(this); | ||
this.html = this.html.bind(this); | ||
this.getInstances = this.getInstances.bind(this); | ||
this.setComponents = this.setComponents.bind(this); | ||
this.vido.onDestroy(() => { | ||
this.destroy(); | ||
}); | ||
} | ||
setComponents(slots) { | ||
if (!slots || this.destroyed) | ||
return; | ||
for (const slotPlacement in slots) { | ||
const slotsComponents = slots[slotPlacement]; | ||
if (typeof this.slotInstances[slotPlacement] === 'undefined') { | ||
this.slotInstances[slotPlacement] = []; | ||
} | ||
for (const instance of this.slotInstances[slotPlacement]) { | ||
instance.destroy(); | ||
} | ||
this.slotInstances[slotPlacement].length = 0; | ||
for (const component of slotsComponents) { | ||
this.slotInstances[slotPlacement].push(this.vido.createComponent(component, this.props)); | ||
} | ||
} | ||
this.vido.update(); | ||
} | ||
destroy() { | ||
if (this.destroyed) | ||
return; | ||
for (const slotPlacement in this.slotInstances) { | ||
for (const instance of this.slotInstances[slotPlacement]) { | ||
instance.destroy(); | ||
} | ||
this.slotInstances[slotPlacement].length = 0; | ||
} | ||
this.destroyed = true; | ||
} | ||
change(changedProps, options = undefined) { | ||
if (this.destroyed) | ||
return; | ||
for (const slotPlacement in this.slotInstances) { | ||
const instances = this.slotInstances[slotPlacement]; | ||
for (const slot of instances) { | ||
slot.change(changedProps, options); | ||
} | ||
} | ||
} | ||
getInstances(placement) { | ||
if (this.destroyed) | ||
return []; | ||
if (placement === undefined) | ||
return this.slotInstances; | ||
return this.slotInstances[placement]; | ||
} | ||
html(placement, templateProps) { | ||
if (this.destroyed) | ||
return; | ||
if (!this.slotInstances[placement] || this.slotInstances[placement].length === 0) { | ||
return templateProps; | ||
} | ||
let result = templateProps; | ||
for (const slotInstance of this.slotInstances[placement]) { | ||
result = slotInstance.html(result); | ||
} | ||
return result; | ||
} | ||
getProps() { | ||
return this.props; | ||
} | ||
isDestroyed() { | ||
return this.destroyed; | ||
} | ||
} | ||
class Slots { | ||
constructor(vido, props) { | ||
this.slotInstances = {}; | ||
this.destroyed = false; | ||
this.vido = vido; | ||
this.props = props; | ||
this.destroy = this.destroy.bind(this); | ||
this.change = this.change.bind(this); | ||
this.html = this.html.bind(this); | ||
this.getInstances = this.getInstances.bind(this); | ||
this.setComponents = this.setComponents.bind(this); | ||
this.vido.onDestroy(() => { | ||
this.destroy(); | ||
}); | ||
} | ||
setComponents(slots) { | ||
if (!slots || this.destroyed) | ||
return; | ||
for (const slotPlacement in slots) { | ||
const slotsComponents = slots[slotPlacement]; | ||
if (typeof this.slotInstances[slotPlacement] === 'undefined') { | ||
this.slotInstances[slotPlacement] = []; | ||
} | ||
for (const instance of this.slotInstances[slotPlacement]) { | ||
instance.destroy(); | ||
} | ||
this.slotInstances[slotPlacement].length = 0; | ||
for (const component of slotsComponents) { | ||
this.slotInstances[slotPlacement].push(this.vido.createComponent(component, this.props)); | ||
} | ||
} | ||
this.vido.update(); | ||
} | ||
destroy() { | ||
if (this.destroyed) | ||
return; | ||
for (const slotPlacement in this.slotInstances) { | ||
for (const instance of this.slotInstances[slotPlacement]) { | ||
instance.destroy(); | ||
} | ||
this.slotInstances[slotPlacement].length = 0; | ||
} | ||
this.destroyed = true; | ||
} | ||
change(changedProps, options = undefined) { | ||
if (this.destroyed) | ||
return; | ||
for (const slotPlacement in this.slotInstances) { | ||
const instances = this.slotInstances[slotPlacement]; | ||
for (const slot of instances) { | ||
slot.change(changedProps, options); | ||
} | ||
} | ||
} | ||
getInstances(placement) { | ||
if (this.destroyed) | ||
return []; | ||
if (placement === undefined) | ||
return this.slotInstances; | ||
return this.slotInstances[placement]; | ||
} | ||
html(placement, templateProps) { | ||
if (this.destroyed) | ||
return; | ||
if (!this.slotInstances[placement] || this.slotInstances[placement].length === 0) { | ||
return templateProps; | ||
} | ||
let result = templateProps; | ||
for (const slotInstance of this.slotInstances[placement]) { | ||
result = slotInstance.html(result); | ||
} | ||
return result; | ||
} | ||
getProps() { | ||
return this.props; | ||
} | ||
isDestroyed() { | ||
return this.destroyed; | ||
} | ||
} | ||
class GetElementDirective extends i$1 { | ||
update(part, props) { | ||
if (typeof props[0] !== 'function') { | ||
throw new Error('[vido] GetElementDirective argument should be a function.'); | ||
} | ||
const callback = props[0]; | ||
callback(part.element); | ||
} | ||
render() { | ||
return T; | ||
} | ||
} | ||
class GetElementDirective extends i$4 { | ||
update(part, props) { | ||
if (typeof props[0] !== 'function') { | ||
throw new Error('[vido] GetElementDirective argument should be a function.'); | ||
} | ||
const callback = props[0]; | ||
callback(part.element); | ||
} | ||
render() { | ||
return T; | ||
} | ||
} | ||
function Vido(state, api) { | ||
let componentId = 0; | ||
const components = new Map(); | ||
let actionsByInstance = new Map(); | ||
let app, element; | ||
let shouldUpdateCount = 0; | ||
const afterUpdateCallbacks = []; | ||
const resolved = Promise.resolve(); | ||
const additionalMethods = {}; | ||
const ActionsCollector = getActionsCollector(actionsByInstance); | ||
class InstanceActionsCollector { | ||
constructor(instance) { | ||
this.instance = instance; | ||
} | ||
create(actions, props) { | ||
const actionsInstanceDirective = e$1(ActionsCollector); | ||
const actionsInstance = () => { | ||
return actionsInstanceDirective(this.instance, actions, props); | ||
}; | ||
return actionsInstance; | ||
} | ||
} | ||
const PublicComponentMethods = getPublicComponentMethods(components, actionsByInstance, clone); | ||
const InternalComponentMethods = getInternalComponentMethods(components, actionsByInstance, clone); | ||
class VidoInstance { | ||
constructor(instance = '', name = '') { | ||
this.instance = ''; | ||
this.name = ''; | ||
this.destroyable = []; | ||
this.destroyed = false; | ||
this.onChangeFunctions = []; | ||
this.debug = false; | ||
this.state = state; | ||
this.api = api; | ||
this.lastProps = {}; | ||
this.html = p; | ||
this.svg = y; | ||
this.directive = e$1; | ||
this.asyncAppend = c$2; | ||
this.asyncReplace = h$2; | ||
this.cache = d$2; | ||
this.classMap = o$4; | ||
this.styleMap = i$5; | ||
this.guard = i$4; | ||
this.live = l$3; | ||
this.ifDefined = l$2; | ||
this.repeat = c$3; | ||
this.unsafeHTML = o$3; | ||
this.until = c$4; | ||
this.schedule = schedule; | ||
this.getElement = e$1(GetElementDirective); | ||
this.actionsByInstance = ( /* componentActions, props */) => { }; | ||
this.detach = detach; | ||
this.PointerAction = PointerAction; | ||
this.Action = Action; | ||
this.Slots = Slots; | ||
this._components = components; | ||
this._actions = actionsByInstance; | ||
this.instance = instance; | ||
this.reuseComponents = this.reuseComponents.bind(this); | ||
this.onDestroy = this.onDestroy.bind(this); | ||
this.onChange = this.onChange.bind(this); | ||
this.update = this.update.bind(this); | ||
this.destroyComponent = this.destroyComponent.bind(this); | ||
for (const name in additionalMethods) { | ||
// @ts-ignore | ||
this[name] = additionalMethods[name].bind(this); | ||
} | ||
this.name = name; | ||
this.Actions = new InstanceActionsCollector(instance); | ||
} | ||
static addMethod(name, body) { | ||
// @ts-ignore | ||
additionalMethods[name] = body; | ||
} | ||
onDestroy(fn) { | ||
this.destroyable.push(fn); | ||
} | ||
onChange(fn) { | ||
this.onChangeFunctions.push(fn); | ||
} | ||
update(callback) { | ||
return this.updateTemplate(callback); | ||
} | ||
/** | ||
* Reuse existing components when your data was changed | ||
* | ||
* @param {array} currentComponents - array of components | ||
* @param {array} dataArray - any data as array for each component | ||
* @param {function} getProps - you can pass params to component from array item ( example: item=>({id:item.id}) ) | ||
* @param {function} component - what kind of components do you want to create? | ||
* @param {boolean} leaveTail - leave last elements and do not destroy corresponding components | ||
* @param {boolean} debug - show debug info | ||
* @returns {array} of components (with updated/destroyed/created ones) | ||
*/ | ||
reuseComponents(currentComponents, dataArray, getProps, component, leaveTail = true, debug = false) { | ||
const modified = []; | ||
const currentLen = currentComponents.length; | ||
const dataLen = dataArray.length; | ||
let leave = false; | ||
if (leaveTail && (dataArray === undefined || dataArray.length === 0)) { | ||
leave = true; | ||
} | ||
let leaveStartingAt = 0; | ||
if (currentLen < dataLen) { | ||
let diff = dataLen - currentLen; | ||
while (diff) { | ||
const item = dataArray[dataLen - diff]; | ||
const newComponent = this.createComponent(component, getProps(item)); | ||
currentComponents.push(newComponent); | ||
modified.push(newComponent); | ||
diff--; | ||
} | ||
} | ||
else if (currentLen > dataLen) { | ||
let diff = currentLen - dataLen; | ||
if (leaveTail) { | ||
leave = true; | ||
leaveStartingAt = currentLen - diff; | ||
} | ||
while (diff) { | ||
const index = currentLen - diff; | ||
if (!leaveTail) { | ||
modified.push(currentComponents[index]); | ||
currentComponents[index].destroy(); | ||
} | ||
diff--; | ||
} | ||
if (!leaveTail) { | ||
currentComponents.length = dataLen; | ||
} | ||
} | ||
let index = 0; | ||
if (debug) | ||
console.log('modified components', modified); | ||
if (debug) | ||
console.log('current components', currentComponents); | ||
if (debug) | ||
console.log('data array', dataArray); | ||
for (const component of currentComponents) { | ||
const data = dataArray[index]; | ||
if (debug) | ||
console.log(`reuse components data at '${index}'`, data); | ||
if (component && !modified.includes(component)) { | ||
if (debug) | ||
console.log('getProps fn result', getProps(data)); | ||
component.change(getProps(data), { leave: leave && index >= leaveStartingAt }); | ||
} | ||
index++; | ||
} | ||
} | ||
createComponent(component, props = {}) { | ||
const instance = component.name + ':' + componentId++; | ||
let vidoInstance; | ||
vidoInstance = new VidoInstance(instance, component.name); | ||
const publicMethods = new PublicComponentMethods(instance, vidoInstance, props); | ||
const internalMethods = new InternalComponentMethods(instance, vidoInstance, component(vidoInstance, props)); | ||
components.set(instance, internalMethods); | ||
components.get(instance).change(props); | ||
if (vidoInstance.debug) { | ||
console.groupCollapsed(`component created ${instance}`); | ||
console.log(clone({ props, components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
return publicMethods; | ||
} | ||
destroyComponent(instance, vidoInstance) { | ||
if (vidoInstance.debug) { | ||
console.groupCollapsed(`destroying component ${instance}...`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
if (actionsByInstance.has(instance)) { | ||
for (const action of actionsByInstance.get(instance)) { | ||
if (typeof action.componentAction.destroy === 'function') { | ||
action.componentAction.destroy(action.element, action.props); | ||
} | ||
} | ||
} | ||
actionsByInstance.delete(instance); | ||
const component = components.get(instance); | ||
if (!component) { | ||
console.warn(`No component to destroy! [${instance}]`); | ||
return; | ||
} | ||
component.destroy(); | ||
components.delete(instance); | ||
if (vidoInstance.debug) { | ||
console.groupCollapsed(`component destroyed ${instance}`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
} | ||
executeActions() { | ||
for (const actions of actionsByInstance.values()) { | ||
for (const action of actions) { | ||
if (action.element.vido === undefined) { | ||
const component = components.get(action.instance); | ||
action.isActive = function isActive() { | ||
return component && component.destroyed === false; | ||
}; | ||
const componentAction = action.componentAction; | ||
const create = componentAction.create; | ||
if (typeof create !== 'undefined') { | ||
let result; | ||
if ((create.prototype && | ||
(create.prototype.isAction || create.prototype.update || create.prototype.destroy)) || | ||
create.isAction) { | ||
result = new create(action.element, action.props); | ||
} | ||
else { | ||
result = create(action.element, action.props); | ||
} | ||
if (result !== undefined) { | ||
if (typeof result === 'function') { | ||
componentAction.destroy = result; | ||
} | ||
else { | ||
if (typeof result.update === 'function') { | ||
componentAction.update = result.update.bind(result); | ||
} | ||
if (typeof result.destroy === 'function') { | ||
componentAction.destroy = result.destroy.bind(result); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
action.element.vido = action.props; | ||
if (typeof action.componentAction.update === 'function' && action.isActive()) { | ||
action.componentAction.update(action.element, action.props); | ||
} | ||
} | ||
} | ||
for (const action of actions) { | ||
action.element.vido = action.props; | ||
} | ||
} | ||
} | ||
updateTemplate(callback = undefined) { | ||
if (callback) | ||
afterUpdateCallbacks.push(callback); | ||
return new Promise((resolve) => { | ||
const currentShouldUpdateCount = ++shouldUpdateCount; | ||
const self = this; | ||
function flush() { | ||
if (currentShouldUpdateCount === shouldUpdateCount) { | ||
shouldUpdateCount = 0; | ||
self.render(); | ||
for (const cb of afterUpdateCallbacks) { | ||
cb(); | ||
} | ||
afterUpdateCallbacks.length = 0; | ||
resolve(null); | ||
} | ||
} | ||
resolved.then(flush); | ||
}); | ||
} | ||
createApp(config) { | ||
element = config.element; | ||
const App = this.createComponent(config.component, config.props); | ||
app = App.instance; | ||
this.render(); | ||
return App; | ||
} | ||
render() { | ||
const appComponent = components.get(app); | ||
if (appComponent) { | ||
w(appComponent.update(), element); | ||
this.executeActions(); | ||
} | ||
else if (element) { | ||
element.remove(); | ||
} | ||
} | ||
} | ||
return new VidoInstance(); | ||
} | ||
Vido.prototype.lithtml = lithtml; | ||
Vido.prototype.Action = Action; | ||
Vido.prototype.Directive = i$1; | ||
Vido.prototype.schedule = schedule; | ||
Vido.prototype.detach = detach; | ||
Vido.prototype.styleMap = i$5; | ||
Vido.prototype.classMap = o$4; | ||
Vido.prototype.PointerAction = PointerAction; | ||
Vido.prototype.asyncAppend = c$2; | ||
Vido.prototype.asyncReplace = h$2; | ||
Vido.prototype.cache = d$2; | ||
Vido.prototype.guard = i$4; | ||
Vido.prototype.live = l$3; | ||
Vido.prototype.ifDefined = l$2; | ||
Vido.prototype.repeat = c$3; | ||
Vido.prototype.unsafeHTML = o$3; | ||
Vido.prototype.until = c$4; | ||
Vido.prototype.Slots = Slots; | ||
function Vido(state, api) { | ||
let componentId = 0; | ||
const components = new Map(); | ||
let actionsByInstance = new Map(); | ||
let app, element; | ||
let shouldUpdateCount = 0; | ||
const afterUpdateCallbacks = []; | ||
const resolved = Promise.resolve(); | ||
const additionalMethods = {}; | ||
const ActionsCollector = getActionsCollector(actionsByInstance); | ||
class InstanceActionsCollector { | ||
constructor(instance) { | ||
this.instance = instance; | ||
} | ||
create(actions, props) { | ||
const actionsInstanceDirective = e$4(ActionsCollector); | ||
const actionsInstance = () => { | ||
return actionsInstanceDirective(this.instance, actions, props); | ||
}; | ||
return actionsInstance; | ||
} | ||
} | ||
const PublicComponentMethods = getPublicComponentMethods(components, actionsByInstance, clone); | ||
const InternalComponentMethods = getInternalComponentMethods(components, actionsByInstance, clone); | ||
class VidoInstance { | ||
constructor(instance = '', name = '') { | ||
this.instance = ''; | ||
this.name = ''; | ||
this.destroyable = []; | ||
this.destroyed = false; | ||
this.onChangeFunctions = []; | ||
this.debug = false; | ||
this.state = state; | ||
this.api = api; | ||
this.lastProps = {}; | ||
this.html = p$1; | ||
this.svg = y; | ||
this.directive = e$4; | ||
this.asyncAppend = c$2; | ||
this.asyncReplace = h$1; | ||
this.cache = d; | ||
this.classMap = o; | ||
this.styleMap = i; | ||
this.guard = i$1; | ||
this.live = l; | ||
this.ifDefined = l$1; | ||
this.repeat = c$1; | ||
this.unsafeHTML = o$1; | ||
this.until = c; | ||
this.schedule = schedule; | ||
this.getElement = e$4(GetElementDirective); | ||
this.actionsByInstance = ( /* componentActions, props */) => { }; | ||
this.detach = detach; | ||
this.PointerAction = PointerAction; | ||
this.Action = Action; | ||
this.Slots = Slots; | ||
this._components = components; | ||
this._actions = actionsByInstance; | ||
this.instance = instance; | ||
this.reuseComponents = this.reuseComponents.bind(this); | ||
this.onDestroy = this.onDestroy.bind(this); | ||
this.onChange = this.onChange.bind(this); | ||
this.update = this.update.bind(this); | ||
this.destroyComponent = this.destroyComponent.bind(this); | ||
for (const name in additionalMethods) { | ||
// @ts-ignore | ||
this[name] = additionalMethods[name].bind(this); | ||
} | ||
this.name = name; | ||
this.Actions = new InstanceActionsCollector(instance); | ||
} | ||
static addMethod(name, body) { | ||
// @ts-ignore | ||
additionalMethods[name] = body; | ||
} | ||
onDestroy(fn) { | ||
this.destroyable.push(fn); | ||
} | ||
onChange(fn) { | ||
this.onChangeFunctions.push(fn); | ||
} | ||
update(callback) { | ||
return this.updateTemplate(callback); | ||
} | ||
/** | ||
* Reuse existing components when your data was changed | ||
* | ||
* @param {array} currentComponents - array of components | ||
* @param {array} dataArray - any data as array for each component | ||
* @param {function} getProps - you can pass params to component from array item ( example: item=>({id:item.id}) ) | ||
* @param {function} component - what kind of components do you want to create? | ||
* @param {boolean} leaveTail - leave last elements and do not destroy corresponding components | ||
* @param {boolean} debug - show debug info | ||
* @returns {array} of components (with updated/destroyed/created ones) | ||
*/ | ||
reuseComponents(currentComponents, dataArray, getProps, component, leaveTail = true, debug = false) { | ||
const modified = []; | ||
const currentLen = currentComponents.length; | ||
const dataLen = dataArray.length; | ||
let leave = false; | ||
if (leaveTail && (dataArray === undefined || dataArray.length === 0)) { | ||
leave = true; | ||
} | ||
let leaveStartingAt = 0; | ||
if (currentLen < dataLen) { | ||
let diff = dataLen - currentLen; | ||
while (diff) { | ||
const item = dataArray[dataLen - diff]; | ||
const newComponent = this.createComponent(component, getProps(item)); | ||
currentComponents.push(newComponent); | ||
modified.push(newComponent); | ||
diff--; | ||
} | ||
} | ||
else if (currentLen > dataLen) { | ||
let diff = currentLen - dataLen; | ||
if (leaveTail) { | ||
leave = true; | ||
leaveStartingAt = currentLen - diff; | ||
} | ||
while (diff) { | ||
const index = currentLen - diff; | ||
if (!leaveTail) { | ||
modified.push(currentComponents[index]); | ||
currentComponents[index].destroy(); | ||
} | ||
diff--; | ||
} | ||
if (!leaveTail) { | ||
currentComponents.length = dataLen; | ||
} | ||
} | ||
let index = 0; | ||
if (debug) | ||
console.log('modified components', modified); | ||
if (debug) | ||
console.log('current components', currentComponents); | ||
if (debug) | ||
console.log('data array', dataArray); | ||
for (const component of currentComponents) { | ||
const data = dataArray[index]; | ||
if (debug) | ||
console.log(`reuse components data at '${index}'`, data); | ||
if (component && !modified.includes(component)) { | ||
if (debug) | ||
console.log('getProps fn result', getProps(data)); | ||
component.change(getProps(data), { leave: leave && index >= leaveStartingAt }); | ||
} | ||
index++; | ||
} | ||
} | ||
createComponent(component, props = {}) { | ||
const instance = component.name + ':' + componentId++; | ||
let vidoInstance; | ||
vidoInstance = new VidoInstance(instance, component.name); | ||
const publicMethods = new PublicComponentMethods(instance, vidoInstance, props); | ||
const internalMethods = new InternalComponentMethods(instance, vidoInstance, component(vidoInstance, props)); | ||
components.set(instance, internalMethods); | ||
components.get(instance).change(props); | ||
if (vidoInstance.debug) { | ||
console.groupCollapsed(`component created ${instance}`); | ||
console.log(clone({ props, components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
return publicMethods; | ||
} | ||
destroyComponent(instance, vidoInstance) { | ||
if (vidoInstance.debug) { | ||
console.groupCollapsed(`destroying component ${instance}...`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
if (actionsByInstance.has(instance)) { | ||
for (const action of actionsByInstance.get(instance)) { | ||
if (typeof action.componentAction.destroy === 'function') { | ||
action.componentAction.destroy(action.element, action.props); | ||
} | ||
} | ||
} | ||
actionsByInstance.delete(instance); | ||
const component = components.get(instance); | ||
if (!component) { | ||
console.warn(`No component to destroy! [${instance}]`); | ||
return; | ||
} | ||
component.destroy(); | ||
components.delete(instance); | ||
if (vidoInstance.debug) { | ||
console.groupCollapsed(`component destroyed ${instance}`); | ||
console.log(clone({ components: components.keys(), actionsByInstance })); | ||
console.trace(); | ||
console.groupEnd(); | ||
} | ||
} | ||
executeActions() { | ||
for (const actions of actionsByInstance.values()) { | ||
for (const action of actions) { | ||
if (action.element.vido === undefined) { | ||
const component = components.get(action.instance); | ||
action.isActive = function isActive() { | ||
return component && component.destroyed === false; | ||
}; | ||
const componentAction = action.componentAction; | ||
const create = componentAction.create; | ||
if (typeof create !== 'undefined') { | ||
let result; | ||
if ((create.prototype && | ||
(create.prototype.isAction || create.prototype.update || create.prototype.destroy)) || | ||
create.isAction) { | ||
result = new create(action.element, action.props); | ||
} | ||
else { | ||
result = create(action.element, action.props); | ||
} | ||
if (result !== undefined) { | ||
if (typeof result === 'function') { | ||
componentAction.destroy = result; | ||
} | ||
else { | ||
if (typeof result.update === 'function') { | ||
componentAction.update = result.update.bind(result); | ||
} | ||
if (typeof result.destroy === 'function') { | ||
componentAction.destroy = result.destroy.bind(result); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
action.element.vido = action.props; | ||
if (typeof action.componentAction.update === 'function' && action.isActive()) { | ||
action.componentAction.update(action.element, action.props); | ||
} | ||
} | ||
} | ||
for (const action of actions) { | ||
action.element.vido = action.props; | ||
} | ||
} | ||
} | ||
updateTemplate(callback = undefined) { | ||
if (callback) | ||
afterUpdateCallbacks.push(callback); | ||
return new Promise((resolve) => { | ||
const currentShouldUpdateCount = ++shouldUpdateCount; | ||
const self = this; | ||
function flush() { | ||
if (currentShouldUpdateCount === shouldUpdateCount) { | ||
shouldUpdateCount = 0; | ||
self.render(); | ||
for (const cb of afterUpdateCallbacks) { | ||
cb(); | ||
} | ||
afterUpdateCallbacks.length = 0; | ||
resolve(null); | ||
} | ||
} | ||
resolved.then(flush); | ||
}); | ||
} | ||
createApp(config) { | ||
element = config.element; | ||
const App = this.createComponent(config.component, config.props); | ||
app = App.instance; | ||
this.render(); | ||
return App; | ||
} | ||
render() { | ||
const appComponent = components.get(app); | ||
if (appComponent) { | ||
w(appComponent.update(), element); | ||
this.executeActions(); | ||
} | ||
else if (element) { | ||
element.remove(); | ||
} | ||
} | ||
} | ||
return new VidoInstance(); | ||
} | ||
Vido.prototype.lithtml = lithtml; | ||
Vido.prototype.Action = Action; | ||
Vido.prototype.Directive = i$4; | ||
Vido.prototype.schedule = schedule; | ||
Vido.prototype.detach = detach; | ||
Vido.prototype.styleMap = i; | ||
Vido.prototype.classMap = o; | ||
Vido.prototype.PointerAction = PointerAction; | ||
Vido.prototype.asyncAppend = c$2; | ||
Vido.prototype.asyncReplace = h$1; | ||
Vido.prototype.cache = d; | ||
Vido.prototype.guard = i$1; | ||
Vido.prototype.live = l; | ||
Vido.prototype.ifDefined = l$1; | ||
Vido.prototype.repeat = c$1; | ||
Vido.prototype.unsafeHTML = o$1; | ||
Vido.prototype.until = c; | ||
Vido.prototype.Slots = Slots; | ||
return Vido; | ||
return Vido; | ||
}))); | ||
})); | ||
//# sourceMappingURL=vido.umd.js.map |
@@ -1,63 +0,63 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("csstype")):"function"==typeof define&&define.amd?define(["csstype"],e):(t=t||self).Vido=e(t.csstype)}(this,(function(t){"use strict"; | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Vido=e()}(this,(function(){"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/var e;const s=globalThis.trustedTypes,n=s?s.createPolicy("lit-html",{createHTML:t=>t}):void 0,i=`lit$${(Math.random()+"").slice(9)}$`,o="?"+i,r=`<${o}>`,h=document,l=(t="")=>h.createComment(t),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,d=t=>{var e;return a(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])},u=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,p=/-->/g,v=/>/g,f=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,m=/'/g,g=/"/g,y=/^(?:script|style|textarea)$/i,$=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),A=$(1),_=$(2),b=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),C=new WeakMap,w=(t,e,s)=>{var n,i;const o=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:e;let r=o._$litPart$;if(void 0===r){const t=null!==(i=null==s?void 0:s.renderBefore)&&void 0!==i?i:null;o._$litPart$=r=new P(e.insertBefore(l(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r},I=h.createTreeWalker(h,129,null,!1),M=(t,e)=>{const s=t.length-1,o=[];let h,l=2===e?"<svg>":"",c=u;for(let e=0;e<s;e++){const s=t[e];let n,a,d=-1,$=0;for(;$<s.length&&(c.lastIndex=$,a=c.exec(s),null!==a);)$=c.lastIndex,c===u?"!--"===a[1]?c=p:void 0!==a[1]?c=v:void 0!==a[2]?(y.test(a[2])&&(h=RegExp("</"+a[2],"g")),c=f):void 0!==a[3]&&(c=f):c===f?">"===a[0]?(c=null!=h?h:u,d=-1):void 0===a[1]?d=-2:(d=c.lastIndex-a[2].length,n=a[1],c=void 0===a[3]?f:'"'===a[3]?g:m):c===g||c===m?c=f:c===p||c===v?c=u:(c=f,h=void 0);const A=c===f&&t[e+1].startsWith("/>")?" ":"";l+=c===u?s+r:d>=0?(o.push(n),s.slice(0,d)+"$lit$"+s.slice(d)+i+A):s+i+(-2===d?(o.push(void 0),e):A)}const a=l+(t[s]||"<?>")+(2===e?"</svg>":"");return[void 0!==n?n.createHTML(a):a,o]};class Y{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let h=0,c=0;const a=t.length-1,d=this.parts,[u,p]=M(t,e);if(this.el=Y.createElement(u,n),I.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(r=I.nextNode())&&d.length<a;){if(1===r.nodeType){if(r.hasAttributes()){const t=[];for(const e of r.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(i)){const s=p[c++];if(t.push(e),void 0!==s){const t=r.getAttribute(s.toLowerCase()+"$lit$").split(i),e=/([.?@])?(.*)/.exec(s);d.push({type:1,index:h,name:e[2],strings:t,ctor:"."===e[1]?H:"?"===e[1]?N:"@"===e[1]?S:T})}else d.push({type:6,index:h})}for(const e of t)r.removeAttribute(e)}if(y.test(r.tagName)){const t=r.textContent.split(i),e=t.length-1;if(e>0){r.textContent=s?s.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],l()),I.nextNode(),d.push({type:2,index:++h});r.append(t[e],l())}}}else if(8===r.nodeType)if(r.data===o)d.push({type:2,index:h});else{let t=-1;for(;-1!==(t=r.data.indexOf(i,t+1));)d.push({type:7,index:h}),t+=i.length-1}h++}}static createElement(t,e){const s=h.createElement("template");return s.innerHTML=t,s}}function X(t,e,s=t,n){var i,o,r,h;if(e===b)return e;let l=void 0!==n?null===(i=s._$Cl)||void 0===i?void 0:i[n]:s._$Cu;const a=c(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==a&&(null===(o=null==l?void 0:l._$AO)||void 0===o||o.call(l,!1),void 0===a?l=void 0:(l=new a(t),l._$AT(t,s,n)),void 0!==n?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[n]=l:s._$Cu=l),void 0!==l&&(e=X(t,l._$AS(t,e.values),l,n)),e}class E{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:s},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:h).importNode(s,!0);I.currentNode=i;let o=I.nextNode(),r=0,l=0,c=n[0];for(;void 0!==c;){if(r===c.index){let e;2===c.type?e=new P(o,o.nextSibling,this,t):1===c.type?e=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(e=new L(o,this,t)),this.v.push(e),c=n[++l]}r!==(null==c?void 0:c.index)&&(o=I.nextNode(),r++)}return i}m(t){let e=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class P{constructor(t,e,s,n){var i;this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cg=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),c(t)?t===x||null==t||""===t?(this._$AH!==x&&this._$AR(),this._$AH=x):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):d(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==x&&c(this._$AH)?this._$AA.nextSibling.data=t:this.S(h.createTextNode(t)),this._$AH=t}T(t){var e;const{values:s,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=Y.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.m(s);else{const t=new E(i,this),e=t.p(this.options);t.m(s),this.S(e),this._$AH=t}}_$AC(t){let e=C.get(t.strings);return void 0===e&&C.set(t.strings,e=new Y(t)),e}M(t){a(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const i of t)n===e.length?e.push(s=new P(this.A(l()),this.A(l()),this,this.options)):s=e[n],s._$AI(i),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class T{constructor(t,e,s,n,i){this.type=1,this._$AH=x,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=X(this,t,e,0),o=!c(t)||t!==this._$AH&&t!==b,o&&(this._$AH=t);else{const n=t;let r,h;for(t=i[0],r=0;r<i.length-1;r++)h=X(this,n[s+r],e,r),h===b&&(h=this._$AH[r]),o||(o=!c(h)||h!==this._$AH[r]),h===x?t=x:t!==x&&(t+=(null!=h?h:"")+i[r+1]),this._$AH[r]=h}o&&!n&&this.k(t)}k(t){t===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class H extends T{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===x?void 0:t}}class N extends T{constructor(){super(...arguments),this.type=4}k(t){t&&t!==x?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}}class S extends T{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){var s;if((t=null!==(s=X(this,t,e,0))&&void 0!==s?s:x)===b)return;const n=this._$AH,i=t===x&&n!==x||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==x&&(n===x||i);i&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class L{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){X(this,t)}}const U={P:"$lit$",V:i,L:o,I:1,N:M,R:E,D:d,j:X,H:P,O:T,F:N,B:S,W:H,Z:L},k=window.litHtmlPolyfillSupport;null==k||k(Y,P),(null!==(e=globalThis.litHtmlVersions)&&void 0!==e?e:globalThis.litHtmlVersions=[]).push("2.0.1");var D=Object.freeze({__proto__:null,_$LH:U,html:A,noChange:b,nothing:x,render:w,svg:_}); | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/var t;const e=globalThis.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,n=`lit$${(Math.random()+"").slice(9)}$`,i="?"+n,o=`<${i}>`,r=document,h=(t="")=>r.createComment(t),l=t=>null===t||"object"!=typeof t&&"function"!=typeof t,c=Array.isArray,a=t=>{var e;return c(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])},d=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,u=/-->/g,p=/>/g,v=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,f=/'/g,m=/"/g,g=/^(?:script|style|textarea)$/i,y=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),$=y(1),A=y(2),_=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),x=new WeakMap,C=(t,e,s)=>{var n,i;const o=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:e;let r=o._$litPart$;if(void 0===r){const t=null!==(i=null==s?void 0:s.renderBefore)&&void 0!==i?i:null;o._$litPart$=r=new E(e.insertBefore(h(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r},w=r.createTreeWalker(r,129,null,!1),I=(t,e)=>{const i=t.length-1,r=[];let h,l=2===e?"<svg>":"",c=d;for(let e=0;e<i;e++){const s=t[e];let i,a,y=-1,$=0;for(;$<s.length&&(c.lastIndex=$,a=c.exec(s),null!==a);)$=c.lastIndex,c===d?"!--"===a[1]?c=u:void 0!==a[1]?c=p:void 0!==a[2]?(g.test(a[2])&&(h=RegExp("</"+a[2],"g")),c=v):void 0!==a[3]&&(c=v):c===v?">"===a[0]?(c=null!=h?h:d,y=-1):void 0===a[1]?y=-2:(y=c.lastIndex-a[2].length,i=a[1],c=void 0===a[3]?v:'"'===a[3]?m:f):c===m||c===f?c=v:c===u||c===p?c=d:(c=v,h=void 0);const A=c===v&&t[e+1].startsWith("/>")?" ":"";l+=c===d?s+o:y>=0?(r.push(i),s.slice(0,y)+"$lit$"+s.slice(y)+n+A):s+n+(-2===y?(r.push(void 0),e):A)}const a=l+(t[i]||"<?>")+(2===e?"</svg>":"");return[void 0!==s?s.createHTML(a):a,r]};class M{constructor({strings:t,_$litType$:s},o){let r;this.parts=[];let l=0,c=0;const a=t.length-1,d=this.parts,[u,p]=I(t,s);if(this.el=M.createElement(u,o),w.currentNode=this.el.content,2===s){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(r=w.nextNode())&&d.length<a;){if(1===r.nodeType){if(r.hasAttributes()){const t=[];for(const e of r.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(n)){const s=p[c++];if(t.push(e),void 0!==s){const t=r.getAttribute(s.toLowerCase()+"$lit$").split(n),e=/([.?@])?(.*)/.exec(s);d.push({type:1,index:l,name:e[2],strings:t,ctor:"."===e[1]?T:"?"===e[1]?H:"@"===e[1]?N:P})}else d.push({type:6,index:l})}for(const e of t)r.removeAttribute(e)}if(g.test(r.tagName)){const t=r.textContent.split(n),s=t.length-1;if(s>0){r.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)r.append(t[e],h()),w.nextNode(),d.push({type:2,index:++l});r.append(t[s],h())}}}else if(8===r.nodeType)if(r.data===i)d.push({type:2,index:l});else{let t=-1;for(;-1!==(t=r.data.indexOf(n,t+1));)d.push({type:7,index:l}),t+=n.length-1}l++}}static createElement(t,e){const s=r.createElement("template");return s.innerHTML=t,s}}function Y(t,e,s=t,n){var i,o,r,h;if(e===_)return e;let c=void 0!==n?null===(i=s._$Cl)||void 0===i?void 0:i[n]:s._$Cu;const a=l(e)?void 0:e._$litDirective$;return(null==c?void 0:c.constructor)!==a&&(null===(o=null==c?void 0:c._$AO)||void 0===o||o.call(c,!1),void 0===a?c=void 0:(c=new a(t),c._$AT(t,s,n)),void 0!==n?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[n]=c:s._$Cu=c),void 0!==c&&(e=Y(t,c._$AS(t,e.values),c,n)),e}class X{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:s},parts:n}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:r).importNode(s,!0);w.currentNode=i;let o=w.nextNode(),h=0,l=0,c=n[0];for(;void 0!==c;){if(h===c.index){let e;2===c.type?e=new E(o,o.nextSibling,this,t):1===c.type?e=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(e=new S(o,this,t)),this.v.push(e),c=n[++l]}h!==(null==c?void 0:c.index)&&(o=w.nextNode(),h++)}return i}m(t){let e=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class E{constructor(t,e,s,n){var i;this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cg=null===(i=null==n?void 0:n.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),l(t)?t===b||null==t||""===t?(this._$AH!==b&&this._$AR(),this._$AH=b):t!==this._$AH&&t!==_&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):a(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==b&&l(this._$AH)?this._$AA.nextSibling.data=t:this.S(r.createTextNode(t)),this._$AH=t}T(t){var e;const{values:s,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=M.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.m(s);else{const t=new X(i,this),e=t.p(this.options);t.m(s),this.S(e),this._$AH=t}}_$AC(t){let e=x.get(t.strings);return void 0===e&&x.set(t.strings,e=new M(t)),e}M(t){c(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const i of t)n===e.length?e.push(s=new E(this.A(h()),this.A(h()),this,this.options)):s=e[n],s._$AI(i),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class P{constructor(t,e,s,n,i){this.type=1,this._$AH=b,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=Y(this,t,e,0),o=!l(t)||t!==this._$AH&&t!==_,o&&(this._$AH=t);else{const n=t;let r,h;for(t=i[0],r=0;r<i.length-1;r++)h=Y(this,n[s+r],e,r),h===_&&(h=this._$AH[r]),o||(o=!l(h)||h!==this._$AH[r]),h===b?t=b:t!==b&&(t+=(null!=h?h:"")+i[r+1]),this._$AH[r]=h}o&&!n&&this.k(t)}k(t){t===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class T extends P{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===b?void 0:t}}class H extends P{constructor(){super(...arguments),this.type=4}k(t){t&&t!==b?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}}class N extends P{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){var s;if((t=null!==(s=Y(this,t,e,0))&&void 0!==s?s:b)===_)return;const n=this._$AH,i=t===b&&n!==b||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==b&&(n===b||i);i&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class S{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const L={P:"$lit$",V:n,L:i,I:1,N:I,R:X,D:a,j:Y,H:E,O:P,F:H,B:N,W:T,Z:S},U=window.litHtmlPolyfillSupport;null==U||U(M,E),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.0.1");var k=Object.freeze({__proto__:null,_$LH:L,html:$,noChange:_,nothing:b,render:C,svg:A}); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const B=1,W=2,j=3,O=4,z=t=>(...e)=>({_$litDirective$:t,values:e});class F{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const D=1,B=2,W=3,j=4,O=t=>(...e)=>({_$litDirective$:t,values:e});class z{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const{H:V}=U,R=(t,e)=>{var s,n;return void 0===e?void 0!==(null===(s=t)||void 0===s?void 0:s._$litType$):(null===(n=t)||void 0===n?void 0:n._$litType$)===e},G=t=>void 0===t.strings,K=()=>document.createComment(""),q=(t,e,s)=>{var n;const i=t._$AA.parentNode,o=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=i.insertBefore(K(),o),n=i.insertBefore(K(),o);s=new V(e,n,t,t.options)}else{const e=s._$AB.nextSibling,r=s._$AM,h=r!==t;if(h){let e;null===(n=s._$AQ)||void 0===n||n.call(s,t),s._$AM=t,void 0!==s._$AP&&(e=t._$AU)!==r._$AU&&s._$AP(e)}if(e!==o||h){let t=s._$AA;for(;t!==e;){const e=t.nextSibling;i.insertBefore(t,o),t=e}}}return s},Z=(t,e,s=t)=>(t._$AI(e,s),t),J={},Q=(t,e=J)=>t._$AH=e,tt=t=>t._$AH,et=t=>{var e;null===(e=t._$AP)||void 0===e||e.call(t,!1,!0);let s=t._$AA;const n=t._$AB.nextSibling;for(;s!==n;){const t=s.nextSibling;s.remove(),s=t}},st=t=>{t._$AR()},nt=(t,e)=>{var s,n;const i=t._$AN;if(void 0===i)return!1;for(const t of i)null===(n=(s=t)._$AO)||void 0===n||n.call(s,e,!1),nt(t,e);return!0},it=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===(null==s?void 0:s.size))},ot=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),lt(e)}}; | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const{H:F}=L,V=(t,e)=>{var s,n;return void 0===e?void 0!==(null===(s=t)||void 0===s?void 0:s._$litType$):(null===(n=t)||void 0===n?void 0:n._$litType$)===e},R=t=>void 0===t.strings,G=()=>document.createComment(""),K=(t,e,s)=>{var n;const i=t._$AA.parentNode,o=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=i.insertBefore(G(),o),n=i.insertBefore(G(),o);s=new F(e,n,t,t.options)}else{const e=s._$AB.nextSibling,r=s._$AM,h=r!==t;if(h){let e;null===(n=s._$AQ)||void 0===n||n.call(s,t),s._$AM=t,void 0!==s._$AP&&(e=t._$AU)!==r._$AU&&s._$AP(e)}if(e!==o||h){let t=s._$AA;for(;t!==e;){const e=t.nextSibling;i.insertBefore(t,o),t=e}}}return s},q=(t,e,s=t)=>(t._$AI(e,s),t),Z={},J=(t,e=Z)=>t._$AH=e,Q=t=>t._$AH,tt=t=>{var e;null===(e=t._$AP)||void 0===e||e.call(t,!1,!0);let s=t._$AA;const n=t._$AB.nextSibling;for(;s!==n;){const t=s.nextSibling;s.remove(),s=t}},et=t=>{t._$AR()},st=(t,e)=>{var s,n;const i=t._$AN;if(void 0===i)return!1;for(const t of i)null===(n=(s=t)._$AO)||void 0===n||n.call(s,e,!1),st(t,e);return!0},nt=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===(null==s?void 0:s.size))},it=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),ht(e)}}; | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/function rt(t){void 0!==this._$AN?(it(this),this._$AM=t,ot(this)):this._$AM=t}function ht(t,e=!1,s=0){const n=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(e)if(Array.isArray(n))for(let t=s;t<n.length;t++)nt(n[t],!1),it(n[t]);else null!=n&&(nt(n,!1),it(n));else nt(this,t)}const lt=t=>{var e,s,n,i;t.type==W&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=ht),null!==(s=(i=t)._$AQ)&&void 0!==s||(i._$AQ=rt))};class ct extends F{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),ot(this),this.isConnected=t._$AU}_$AO(t,e=!0){var s,n;t!==this.isConnected&&(this.isConnected=t,t?null===(s=this.reconnected)||void 0===s||s.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),e&&(nt(this,t),it(this))}setValue(t){if(G(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}} | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/function ot(t){void 0!==this._$AN?(nt(this),this._$AM=t,it(this)):this._$AM=t}function rt(t,e=!1,s=0){const n=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(e)if(Array.isArray(n))for(let t=s;t<n.length;t++)st(n[t],!1),nt(n[t]);else null!=n&&(st(n,!1),nt(n));else st(this,t)}const ht=t=>{var e,s,n,i;t.type==B&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=rt),null!==(s=(i=t)._$AQ)&&void 0!==s||(i._$AQ=ot))};class lt extends z{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),it(this),this.isConnected=t._$AU}_$AO(t,e=!0){var s,n;t!==this.isConnected&&(this.isConnected=t,t?null===(s=this.reconnected)||void 0===s||s.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),e&&(st(this,t),nt(this))}setValue(t){if(R(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}} | ||
/** | ||
* @license | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class at{constructor(t){this.U=t}disconnect(){this.U=void 0}reconnect(t){this.U=t}deref(){return this.U}}class dt{constructor(){this.Y=void 0,this.q=void 0}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise(t=>this.q=t))}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0}} | ||
* @license | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class ct{constructor(t){this.U=t}disconnect(){this.U=void 0}reconnect(t){this.U=t}deref(){return this.U}}class at{constructor(){this.Y=void 0,this.q=void 0}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.q=t)))}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0}} | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class ut extends ct{constructor(){super(...arguments),this._$CG=new at(this),this._$CK=new dt}render(t,e){return b}update(t,[e,s]){if(this.isConnected||this.disconnected(),e===this._$CJ)return;this._$CJ=e;let n=0;const{_$CG:i,_$CK:o}=this;return(async(t,e)=>{for await(const s of t)if(!1===await e(s))return})(e,async t=>{for(;o.get();)await o.get();const r=i.deref();if(void 0!==r){if(r._$CJ!==e)return!1;void 0!==s&&(t=s(t,n)),r.commitValue(t,n),n++}return!0}),b}commitValue(t,e){this.setValue(t)}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}const pt=z(ut),vt=z(class extends ut{constructor(t){if(super(t),t.type!==W)throw Error("asyncAppend can only be used in child expressions")}update(t,e){return this._$CX=t,super.update(t,e)}commitValue(t,e){0===e&&st(this._$CX);const s=q(this._$CX);Z(s,t)}}),ft=z(class extends F{constructor(t){super(t),this.tt=new WeakMap}render(t){return[t]}update(t,[e]){if(R(this.it)&&(!R(e)||this.it.strings!==e.strings)){const e=tt(t).pop();let s=this.tt.get(this.it.strings);if(void 0===s){const t=document.createDocumentFragment();s=w(x,t),s.setConnected(!1),this.tt.set(this.it.strings,s)}Q(s,[e]),q(s,void 0,e)}if(R(e)){if(!R(this.it)||this.it.strings!==e.strings){const s=this.tt.get(e.strings);if(void 0!==s){const e=tt(s).pop();st(t),q(t,void 0,e),Q(t,[e])}}this.it=e}else this.it=void 0;return this.render(e)}}),mt={},gt=z(class extends F{constructor(){super(...arguments),this.ot=mt}render(t,e){return e()}update(t,[e,s]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every((t,e)=>t===this.ot[e]))return b}else if(this.ot===e)return b;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,s)}}),yt=t=>null!=t?t:x | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class dt extends lt{constructor(){super(...arguments),this._$CG=new ct(this),this._$CK=new at}render(t,e){return _}update(t,[e,s]){if(this.isConnected||this.disconnected(),e===this._$CJ)return;this._$CJ=e;let n=0;const{_$CG:i,_$CK:o}=this;return(async(t,e)=>{for await(const s of t)if(!1===await e(s))return})(e,(async t=>{for(;o.get();)await o.get();const r=i.deref();if(void 0!==r){if(r._$CJ!==e)return!1;void 0!==s&&(t=s(t,n)),r.commitValue(t,n),n++}return!0})),_}commitValue(t,e){this.setValue(t)}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}const ut=O(dt),pt=O(class extends dt{constructor(t){if(super(t),t.type!==B)throw Error("asyncAppend can only be used in child expressions")}update(t,e){return this._$CX=t,super.update(t,e)}commitValue(t,e){0===e&&et(this._$CX);const s=K(this._$CX);q(s,t)}}),vt=O(class extends z{constructor(t){super(t),this.tt=new WeakMap}render(t){return[t]}update(t,[e]){if(V(this.it)&&(!V(e)||this.it.strings!==e.strings)){const e=Q(t).pop();let s=this.tt.get(this.it.strings);if(void 0===s){const t=document.createDocumentFragment();s=C(b,t),s.setConnected(!1),this.tt.set(this.it.strings,s)}J(s,[e]),K(s,void 0,e)}if(V(e)){if(!V(this.it)||this.it.strings!==e.strings){const s=this.tt.get(e.strings);if(void 0!==s){const e=Q(s).pop();et(t),K(t,void 0,e),J(t,[e])}}this.it=e}else this.it=void 0;return this.render(e)}}),ft={},mt=O(class extends z{constructor(){super(...arguments),this.ot=ft}render(t,e){return e()}update(t,[e,s]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every(((t,e)=>t===this.ot[e])))return _}else if(this.ot===e)return _;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,s)}}),gt=t=>null!=t?t:b | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/,$t=(t,e,s)=>{const n=new Map;for(let i=e;i<=s;i++)n.set(t[i],i);return n},At=z(class extends F{constructor(t){if(super(t),t.type!==W)throw Error("repeat() can only be used in text expressions")}dt(t,e,s){let n;void 0===s?s=e:void 0!==e&&(n=e);const i=[],o=[];let r=0;for(const e of t)i[r]=n?n(e,r):r,o[r]=s(e,r),r++;return{values:o,keys:i}}render(t,e,s){return this.dt(t,e,s).values}update(t,[e,s,n]){var i;const o=tt(t),{values:r,keys:h}=this.dt(e,s,n);if(!Array.isArray(o))return this.ct=h,r;const l=null!==(i=this.ct)&&void 0!==i?i:this.ct=[],c=[];let a,d,u=0,p=o.length-1,v=0,f=r.length-1;for(;u<=p&&v<=f;)if(null===o[u])u++;else if(null===o[p])p--;else if(l[u]===h[v])c[v]=Z(o[u],r[v]),u++,v++;else if(l[p]===h[f])c[f]=Z(o[p],r[f]),p--,f--;else if(l[u]===h[f])c[f]=Z(o[u],r[f]),q(t,c[f+1],o[u]),u++,f--;else if(l[p]===h[v])c[v]=Z(o[p],r[v]),q(t,o[u],o[p]),p--,v++;else if(void 0===a&&(a=$t(h,v,f),d=$t(l,u,p)),a.has(l[u]))if(a.has(l[p])){const e=d.get(h[v]),s=void 0!==e?o[e]:null;if(null===s){const e=q(t,o[u]);Z(e,r[v]),c[v]=e}else c[v]=Z(s,r[v]),q(t,o[u],s),o[e]=null;v++}else et(o[p]),p--;else et(o[u]),u++;for(;v<=f;){const e=q(t,c[f+1]);Z(e,r[v]),c[v++]=e}for(;u<=p;){const t=o[u++];null!==t&&et(t)}return this.ct=h,Q(t,c),b}}); | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/,yt=(t,e,s)=>{const n=new Map;for(let i=e;i<=s;i++)n.set(t[i],i);return n},$t=O(class extends z{constructor(t){if(super(t),t.type!==B)throw Error("repeat() can only be used in text expressions")}dt(t,e,s){let n;void 0===s?s=e:void 0!==e&&(n=e);const i=[],o=[];let r=0;for(const e of t)i[r]=n?n(e,r):r,o[r]=s(e,r),r++;return{values:o,keys:i}}render(t,e,s){return this.dt(t,e,s).values}update(t,[e,s,n]){var i;const o=Q(t),{values:r,keys:h}=this.dt(e,s,n);if(!Array.isArray(o))return this.ct=h,r;const l=null!==(i=this.ct)&&void 0!==i?i:this.ct=[],c=[];let a,d,u=0,p=o.length-1,v=0,f=r.length-1;for(;u<=p&&v<=f;)if(null===o[u])u++;else if(null===o[p])p--;else if(l[u]===h[v])c[v]=q(o[u],r[v]),u++,v++;else if(l[p]===h[f])c[f]=q(o[p],r[f]),p--,f--;else if(l[u]===h[f])c[f]=q(o[u],r[f]),K(t,c[f+1],o[u]),u++,f--;else if(l[p]===h[v])c[v]=q(o[p],r[v]),K(t,o[u],o[p]),p--,v++;else if(void 0===a&&(a=yt(h,v,f),d=yt(l,u,p)),a.has(l[u]))if(a.has(l[p])){const e=d.get(h[v]),s=void 0!==e?o[e]:null;if(null===s){const e=K(t,o[u]);q(e,r[v]),c[v]=e}else c[v]=q(s,r[v]),K(t,o[u],s),o[e]=null;v++}else tt(o[p]),p--;else tt(o[u]),u++;for(;v<=f;){const e=K(t,c[f+1]);q(e,r[v]),c[v++]=e}for(;u<=p;){const t=o[u++];null!==t&&tt(t)}return this.ct=h,J(t,c),_}}); | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
class _t extends F{constructor(t){if(super(t),this.it=x,t.type!==W)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===x||null==t)return this.vt=void 0,this.it=t;if(t===b)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.vt;this.it=t;const e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}}_t.directiveName="unsafeHTML",_t.resultType=1;const bt=z(_t),xt=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then; | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
class At extends z{constructor(t){if(super(t),this.it=b,t.type!==B)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===b||null==t)return this.vt=void 0,this.it=t;if(t===_)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.vt;this.it=t;const e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}}At.directiveName="unsafeHTML",At.resultType=1;const _t=O(At),bt=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then; | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const Ct=z(class extends ct{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new at(this),this._$CK=new dt}render(...t){var e;return null!==(e=t.find(t=>!xt(t)))&&void 0!==e?e:b}update(t,e){const s=this._$Cwt;let n=s.length;this._$Cwt=e;const i=this._$CG,o=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cft);t++){const r=e[t];if(!xt(r))return this._$Cft=t,r;t<n&&r===s[t]||(this._$Cft=1073741823,n=0,Promise.resolve(r).then(async t=>{for(;o.get();)await o.get();const e=i.deref();if(void 0!==e){const s=e._$Cwt.indexOf(r);s>-1&&s<e._$Cft&&(e._$Cft=s,e.setValue(t))}}))}return b}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}),wt=z(class extends F{constructor(t){if(super(t),t.type!==j&&t.type!==B&&t.type!==O)throw Error("The `live` directive is not allowed on child or event bindings");if(!G(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===b||e===x)return e;const s=t.element,n=t.name;if(t.type===j){if(e===s[n])return b}else if(t.type===O){if(!!e===s.hasAttribute(n))return b}else if(t.type===B&&s.getAttribute(n)===e+"")return b;return Q(t),e}}),It=new WeakMap; | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const xt=O(class extends lt{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new ct(this),this._$CK=new at}render(...t){var e;return null!==(e=t.find((t=>!bt(t))))&&void 0!==e?e:_}update(t,e){const s=this._$Cwt;let n=s.length;this._$Cwt=e;const i=this._$CG,o=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cft);t++){const r=e[t];if(!bt(r))return this._$Cft=t,r;t<n&&r===s[t]||(this._$Cft=1073741823,n=0,Promise.resolve(r).then((async t=>{for(;o.get();)await o.get();const e=i.deref();if(void 0!==e){const s=e._$Cwt.indexOf(r);s>-1&&s<e._$Cft&&(e._$Cft=s,e.setValue(t))}})))}return _}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}),Ct=O(class extends z{constructor(t){if(super(t),t.type!==W&&t.type!==D&&t.type!==j)throw Error("The `live` directive is not allowed on child or event bindings");if(!R(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===_||e===b)return e;const s=t.element,n=t.name;if(t.type===W){if(e===s[n])return _}else if(t.type===j){if(!!e===s.hasAttribute(n))return _}else if(t.type===D&&s.getAttribute(n)===e+"")return _;return J(t),e}}),wt=new WeakMap; | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const Mt=z(class extends F{render(t){return x}update(t,e){if("boolean"!=typeof e[0])throw new Error("[vido] Detach directive argument should be a boolean.");let s=e[0];const n=t.element;if(s)It.has(t)||It.set(t,{element:n,nextSibling:n.nextSibling,previousSibling:n.previousSibling,parent:n.parentNode}),n.remove();else{const e=It.get(t);e&&(e.nextSibling&&e.nextSibling.parentNode?e.nextSibling.parentNode.insertBefore(e.element,e.nextSibling):e.previousSibling&&e.previousSibling.parentNode?e.previousSibling.parentNode.appendChild(e.element):e.parent&&e.parent.appendChild(e.element),It.delete(t))}return this.render(s)}}),Yt=z(class extends F{constructor(t){var e;if(super(t),t.type!==B||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,s)=>{const n=t[s];return null==n?e:e+`${s=s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ut){this.ut=new Set;for(const t in e)this.ut.add(t);return this.render(e)}this.ut.forEach(t=>{null==e[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]="")});for(const t in e){const n=e[t];null!=n&&(this.ut.add(t),t.includes("-")?s.setProperty(t,n):s[t]=n)}return b}}),Xt=z(class extends F{constructor(t){var e;if(super(t),t.type!==B||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var s,n;if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.et=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!(null===(s=this.et)||void 0===s?void 0:s.has(t))&&this.st.add(t);return this.render(e)}const i=t.element.classList;this.st.forEach(t=>{t in e||(i.remove(t),this.st.delete(t))});for(const t in e){const s=!!e[t];s===this.st.has(t)||(null===(n=this.et)||void 0===n?void 0:n.has(t))||(s?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return b}}); | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/const It=O(class extends z{render(t){return b}update(t,e){if("boolean"!=typeof e[0])throw new Error("[vido] Detach directive argument should be a boolean.");let s=e[0];const n=t.element;if(s)wt.has(t)||wt.set(t,{element:n,nextSibling:n.nextSibling,previousSibling:n.previousSibling,parent:n.parentNode}),n.remove();else{const e=wt.get(t);e&&(e.nextSibling&&e.nextSibling.parentNode?e.nextSibling.parentNode.insertBefore(e.element,e.nextSibling):e.previousSibling&&e.previousSibling.parentNode?e.previousSibling.parentNode.appendChild(e.element):e.parent&&e.parent.appendChild(e.element),wt.delete(t))}return this.render(s)}}),Mt=O(class extends z{constructor(t){var e;if(super(t),t.type!==D||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,s)=>{const n=t[s];return null==n?e:e+`${s=s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ut){this.ut=new Set;for(const t in e)this.ut.add(t);return this.render(e)}this.ut.forEach((t=>{null==e[t]&&(this.ut.delete(t),t.includes("-")?s.removeProperty(t):s[t]="")}));for(const t in e){const n=e[t];null!=n&&(this.ut.add(t),t.includes("-")?s.setProperty(t,n):s[t]=n)}return _}}),Yt=O(class extends z{constructor(t){var e;if(super(t),t.type!==D||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var s,n;if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.et=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!(null===(s=this.et)||void 0===s?void 0:s.has(t))&&this.st.add(t);return this.render(e)}const i=t.element.classList;this.st.forEach((t=>{t in e||(i.remove(t),this.st.delete(t))}));for(const t in e){const s=!!e[t];s===this.st.has(t)||(null===(n=this.et)||void 0===n?void 0:n.has(t))||(s?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return _}}); | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class Et{constructor(){this.isAction=!0}}Et.prototype.isAction=!0;const Pt={element:document.createTextNode(""),axis:"xy",threshold:10,onDown(){},onMove(){},onUp(){},onWheel(){}},Tt="undefined"!=typeof PointerEvent;let Ht=0;class Nt extends Et{constructor(t,e){super(),this.moving="",this.initialX=0,this.initialY=0,this.lastY=0,this.lastX=0,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onWheel=this.onWheel.bind(this),this.element=t,this.id=++Ht,this.options=Object.assign(Object.assign({},Pt),e.pointerOptions),Tt?(t.addEventListener("pointerdown",this.onPointerDown),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)):(t.addEventListener("touchstart",this.onPointerDown),document.addEventListener("touchmove",this.onPointerMove,{passive:!1}),document.addEventListener("touchend",this.onPointerUp),document.addEventListener("touchcancel",this.onPointerUp),t.addEventListener("mousedown",this.onPointerDown),document.addEventListener("mousemove",this.onPointerMove,{passive:!1}),document.addEventListener("mouseup",this.onPointerUp))}normalizeMouseWheelEvent(t){let e=t.deltaX||0,s=t.deltaY||0,n=t.deltaZ||0;const i=t.deltaMode,o=parseInt(getComputedStyle(t.target).getPropertyValue("line-height"));let r=1;switch(i){case 1:r=o;break;case 2:r=window.height}return e*=r,s*=r,n*=r,{x:e,y:s,z:n,event:t}}onWheel(t){const e=this.normalizeMouseWheelEvent(t);this.options.onWheel(e)}normalizePointerEvent(t){let e={x:0,y:0,pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0,event:t};switch(t.type){case"wheel":const s=this.normalizeMouseWheelEvent(t);e.x=s.x,e.y=s.y,e.pageX=e.x,e.pageY=e.y,e.screenX=e.x,e.screenY=e.y,e.clientX=e.x,e.clientY=e.y;break;case"touchstart":case"touchmove":case"touchend":case"touchcancel":e.x=t.changedTouches[0].screenX,e.y=t.changedTouches[0].screenY,e.pageX=t.changedTouches[0].pageX,e.pageY=t.changedTouches[0].pageY,e.screenX=t.changedTouches[0].screenX,e.screenY=t.changedTouches[0].screenY,e.clientX=t.changedTouches[0].clientX,e.clientY=t.changedTouches[0].clientY;break;default:e.x=t.x,e.y=t.y,e.pageX=t.pageX,e.pageY=t.pageY,e.screenX=t.screenX,e.screenY=t.screenY,e.clientX=t.clientX,e.clientY=t.clientY}return e}onPointerDown(t){if("mousedown"===t.type&&0!==t.button)return;this.moving="xy";const e=this.normalizePointerEvent(t);this.lastX=e.x,this.lastY=e.y,this.initialX=e.x,this.initialY=e.y,this.options.onDown(e)}handleX(t){let e=t.x-this.lastX;return this.lastY=t.y,this.lastX=t.x,e}handleY(t){let e=t.y-this.lastY;return this.lastY=t.y,this.lastX=t.x,e}onPointerMove(t){if(""===this.moving||"mousemove"===t.type&&0!==t.button)return;const e=this.normalizePointerEvent(t);if("x|y"===this.options.axis){let s=0,n=0;("x"===this.moving||"xy"===this.moving&&Math.abs(e.x-this.initialX)>this.options.threshold)&&(this.moving="x",s=this.handleX(e)),("y"===this.moving||"xy"===this.moving&&Math.abs(e.y-this.initialY)>this.options.threshold)&&(this.moving="y",n=this.handleY(e)),this.options.onMove({movementX:s,movementY:n,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}else if("xy"===this.options.axis){let s=0,n=0;Math.abs(e.x-this.initialX)>this.options.threshold&&(s=this.handleX(e)),Math.abs(e.y-this.initialY)>this.options.threshold&&(n=this.handleY(e)),this.options.onMove({movementX:s,movementY:n,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}else if("x"===this.options.axis)("x"===this.moving||"xy"===this.moving&&Math.abs(e.x-this.initialX)>this.options.threshold)&&(this.moving="x",this.options.onMove({movementX:this.handleX(e),movementY:0,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t}));else if("y"===this.options.axis){let s=0;("y"===this.moving||"xy"===this.moving&&Math.abs(e.y-this.initialY)>this.options.threshold)&&(this.moving="y",s=this.handleY(e)),this.options.onMove({movementX:0,movementY:s,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}}onPointerUp(t){this.moving="";const e=this.normalizePointerEvent(t);this.options.onUp({movementX:0,movementY:0,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t}),this.lastY=0,this.lastX=0}destroy(t){Tt?(t.removeEventListener("pointerdown",this.onPointerDown),document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp)):(t.removeEventListener("mousedown",this.onPointerDown),document.removeEventListener("mousemove",this.onPointerMove),document.removeEventListener("mouseup",this.onPointerUp),t.removeEventListener("touchstart",this.onPointerDown),document.removeEventListener("touchmove",this.onPointerMove),document.removeEventListener("touchend",this.onPointerUp),document.removeEventListener("touchcancel",this.onPointerUp))}}function St(t){let e=0;return function(s){e||(e=requestAnimationFrame((function(){e=0,t.apply(void 0,[s])})))}}function Lt(t){return t&&t.constructor?"Object"===t.constructor.name:"object"==typeof t&&null!==t}function Ut(t){if(void 0!==t.actions){const e=t.actions.map(t=>{const e=Object.assign({},t),s=Object.assign({},e.props);return delete s.state,delete s.api,delete e.element,e.props=s,e});t.actions=e}return function t(e,...s){const n=s.shift();if(Lt(e)&&Lt(n))for(const s in n)if(Lt(n[s]))"function"==typeof n[s].clone?e[s]=n[s].clone():(void 0===e[s]&&(e[s]={}),e[s]=t(e[s],n[s]));else if(Array.isArray(n[s])){e[s]=new Array(n[s].length);let i=0;for(let o of n[s])Lt(o)?"function"==typeof o.clone?e[s][i]=o.clone():e[s][i]=t({},o):e[s][i]=o,i++}else e[s]=n[s];return s.length?t(e,...s):e}({},t)}class kt{constructor(t,e){this.slotInstances={},this.destroyed=!1,this.vido=t,this.props=e,this.destroy=this.destroy.bind(this),this.change=this.change.bind(this),this.html=this.html.bind(this),this.getInstances=this.getInstances.bind(this),this.setComponents=this.setComponents.bind(this),this.vido.onDestroy(()=>{this.destroy()})}setComponents(t){if(t&&!this.destroyed){for(const e in t){const s=t[e];void 0===this.slotInstances[e]&&(this.slotInstances[e]=[]);for(const t of this.slotInstances[e])t.destroy();this.slotInstances[e].length=0;for(const t of s)this.slotInstances[e].push(this.vido.createComponent(t,this.props))}this.vido.update()}}destroy(){if(!this.destroyed){for(const t in this.slotInstances){for(const e of this.slotInstances[t])e.destroy();this.slotInstances[t].length=0}this.destroyed=!0}}change(t,e){if(!this.destroyed)for(const s in this.slotInstances){const n=this.slotInstances[s];for(const s of n)s.change(t,e)}}getInstances(t){return this.destroyed?[]:void 0===t?this.slotInstances:this.slotInstances[t]}html(t,e){if(this.destroyed)return;if(!this.slotInstances[t]||0===this.slotInstances[t].length)return e;let s=e;for(const e of this.slotInstances[t])s=e.html(s);return s}getProps(){return this.props}isDestroyed(){return this.destroyed}}class Dt extends F{update(t,e){if("function"!=typeof e[0])throw new Error("[vido] GetElementDirective argument should be a function.");(0,e[0])(t.element)}render(){return x}}function Bt(t,e){let s=0;const n=new Map;let i,o,r=new Map,h=0;const l=[],c=Promise.resolve(),a={},d=function(t){return class extends F{update(e,s){const n=e.element,i=s[0],o=s[1],r=s[2];for(const e of o)if(void 0!==e){let s;if(t.has(i))for(const o of t.get(i))if(o.componentAction.create===e&&o.element===n){s=o;break}if(s)s.props=r;else{void 0!==n.vido&&delete n.vido;const s={instance:i,componentAction:{create:e,update(){},destroy(){}},element:n,props:r};let o=[];t.has(i)&&(o=t.get(i)),o.push(s),t.set(i,o)}}}render(t,e,s){return x}}}(r);class u{constructor(t){this.instance=t}create(t,e){const s=z(d);return()=>s(this.instance,t,e)}}const p=function(t,e,s){return class{constructor(t,e,s={}){this.destroyed=!1,this.instance=t,this.name=e.name,this.vidoInstance=e,this.props=s,this.destroy=this.destroy.bind(this),this.update=this.update.bind(this),this.change=this.change.bind(this),this.html=this.html.bind(this)}destroy(){this.destroyed||(this.vidoInstance.debug&&(console.groupCollapsed("destroying component "+this.instance),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.vidoInstance.destroyComponent(this.instance,this.vidoInstance),this.destroyed=!0)}update(n){return this.vidoInstance.debug&&(console.groupCollapsed("updating component "+this.instance),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.vidoInstance.updateTemplate(n)}change(n,i={}){this.vidoInstance.debug&&(console.groupCollapsed("changing component "+this.instance),console.log(s({props:this.props,newProps:n,components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd());const o=t.get(this.instance);o&&o.change(n,i)}html(e={}){const s=t.get(this.instance);if(s&&!s.destroyed)return s.update(e,this.vidoInstance)}_getComponents(){return t}_getActions(){return e}}}(n,r,Ut),v=function(t,e,s){return class{constructor(t,e,s){this.destroyed=!1,this.instance=t,this.vidoInstance=e,this.renderFunction=s,this.destroy=this.destroy.bind(this),this.update=this.update.bind(this),this.change=this.change.bind(this)}destroy(){if(!this.destroyed){this.vidoInstance.debug&&(console.groupCollapsed("component destroy method fired "+this.instance),console.log(s({props:this.vidoInstance.props,components:t.keys(),destroyable:this.vidoInstance.destroyable,actionsByInstance:e})),console.trace(),console.groupEnd()),this.content&&"function"==typeof this.content.destroy&&this.content.destroy();for(const t of this.vidoInstance.destroyable)t();this.vidoInstance.onChangeFunctions.length=0,this.vidoInstance.destroyable.length=0,this.vidoInstance.destroyed=!0,this.destroyed=!0,this.vidoInstance.update()}}update(n={}){return this.vidoInstance.debug&&(console.groupCollapsed("component update method fired "+this.instance),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.renderFunction(n)}change(n,i={leave:!1}){const o=n;this.vidoInstance.debug&&(console.groupCollapsed("component change method fired "+this.instance),console.log(s({props:o,components:t.keys(),onChangeFunctions:this.vidoInstance.onChangeFunctions,changedProps:n,actionsByInstance:e})),console.trace(),console.groupEnd());for(const t of this.vidoInstance.onChangeFunctions)t(n,i)}}}(n,r,Ut);class f{constructor(s="",i=""){this.instance="",this.name="",this.destroyable=[],this.destroyed=!1,this.onChangeFunctions=[],this.debug=!1,this.state=t,this.api=e,this.lastProps={},this.html=A,this.svg=_,this.directive=z,this.asyncAppend=vt,this.asyncReplace=pt,this.cache=ft,this.classMap=Xt,this.styleMap=Yt,this.guard=gt,this.live=wt,this.ifDefined=yt,this.repeat=At,this.unsafeHTML=bt,this.until=Ct,this.schedule=St,this.getElement=z(Dt),this.actionsByInstance=()=>{},this.detach=Mt,this.PointerAction=Nt,this.Action=Et,this.Slots=kt,this._components=n,this._actions=r,this.instance=s,this.reuseComponents=this.reuseComponents.bind(this),this.onDestroy=this.onDestroy.bind(this),this.onChange=this.onChange.bind(this),this.update=this.update.bind(this),this.destroyComponent=this.destroyComponent.bind(this);for(const t in a)this[t]=a[t].bind(this);this.name=i,this.Actions=new u(s)}static addMethod(t,e){a[t]=e}onDestroy(t){this.destroyable.push(t)}onChange(t){this.onChangeFunctions.push(t)}update(t){return this.updateTemplate(t)}reuseComponents(t,e,s,n,i=!0,o=!1){const r=[],h=t.length,l=e.length;let c=!1;!i||void 0!==e&&0!==e.length||(c=!0);let a=0;if(h<l){let i=l-h;for(;i;){const o=e[l-i],h=this.createComponent(n,s(o));t.push(h),r.push(h),i--}}else if(h>l){let e=h-l;for(i&&(c=!0,a=h-e);e;){const s=h-e;i||(r.push(t[s]),t[s].destroy()),e--}i||(t.length=l)}let d=0;o&&console.log("modified components",r),o&&console.log("current components",t),o&&console.log("data array",e);for(const n of t){const t=e[d];o&&console.log(`reuse components data at '${d}'`,t),n&&!r.includes(n)&&(o&&console.log("getProps fn result",s(t)),n.change(s(t),{leave:c&&d>=a})),d++}}createComponent(t,e={}){const i=t.name+":"+s++;let o;o=new f(i,t.name);const h=new p(i,o,e),l=new v(i,o,t(o,e));return n.set(i,l),n.get(i).change(e),o.debug&&(console.groupCollapsed("component created "+i),console.log(Ut({props:e,components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd()),h}destroyComponent(t,e){if(e.debug&&(console.groupCollapsed(`destroying component ${t}...`),console.log(Ut({components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd()),r.has(t))for(const e of r.get(t))"function"==typeof e.componentAction.destroy&&e.componentAction.destroy(e.element,e.props);r.delete(t);const s=n.get(t);s?(s.destroy(),n.delete(t),e.debug&&(console.groupCollapsed("component destroyed "+t),console.log(Ut({components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd())):console.warn(`No component to destroy! [${t}]`)}executeActions(){for(const t of r.values()){for(const e of t)if(void 0===e.element.vido){const t=n.get(e.instance);e.isActive=function(){return t&&!1===t.destroyed};const s=e.componentAction,i=s.create;if(void 0!==i){let t;t=i.prototype&&(i.prototype.isAction||i.prototype.update||i.prototype.destroy)||i.isAction?new i(e.element,e.props):i(e.element,e.props),void 0!==t&&("function"==typeof t?s.destroy=t:("function"==typeof t.update&&(s.update=t.update.bind(t)),"function"==typeof t.destroy&&(s.destroy=t.destroy.bind(t))))}}else e.element.vido=e.props,"function"==typeof e.componentAction.update&&e.isActive()&&e.componentAction.update(e.element,e.props);for(const e of t)e.element.vido=e.props}}updateTemplate(t){return t&&l.push(t),new Promise(t=>{const e=++h,s=this;c.then((function(){if(e===h){h=0,s.render();for(const t of l)t();l.length=0,t(null)}}))})}createApp(t){o=t.element;const e=this.createComponent(t.component,t.props);return i=e.instance,this.render(),e}render(){const t=n.get(i);t?(w(t.update(),o),this.executeActions()):o&&o.remove()}}return new f}return Bt.prototype.lithtml=D,Bt.prototype.Action=Et,Bt.prototype.Directive=F,Bt.prototype.schedule=St,Bt.prototype.detach=Mt,Bt.prototype.styleMap=Yt,Bt.prototype.classMap=Xt,Bt.prototype.PointerAction=Nt,Bt.prototype.asyncAppend=vt,Bt.prototype.asyncReplace=pt,Bt.prototype.cache=ft,Bt.prototype.guard=gt,Bt.prototype.live=wt,Bt.prototype.ifDefined=yt,Bt.prototype.repeat=At,Bt.prototype.unsafeHTML=bt,Bt.prototype.until=Ct,Bt.prototype.Slots=kt,Bt})); | ||
* @license | ||
* Copyright 2018 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class Xt{constructor(){this.isAction=!0}}Xt.prototype.isAction=!0;const Et={element:document.createTextNode(""),axis:"xy",threshold:10,onDown(){},onMove(){},onUp(){},onWheel(){}},Pt="undefined"!=typeof PointerEvent;let Tt=0;class Ht extends Xt{constructor(t,e){super(),this.moving="",this.initialX=0,this.initialY=0,this.lastY=0,this.lastX=0,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onWheel=this.onWheel.bind(this),this.element=t,this.id=++Tt,this.options=Object.assign(Object.assign({},Et),e.pointerOptions),Pt?(t.addEventListener("pointerdown",this.onPointerDown),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)):(t.addEventListener("touchstart",this.onPointerDown),document.addEventListener("touchmove",this.onPointerMove,{passive:!1}),document.addEventListener("touchend",this.onPointerUp),document.addEventListener("touchcancel",this.onPointerUp),t.addEventListener("mousedown",this.onPointerDown),document.addEventListener("mousemove",this.onPointerMove,{passive:!1}),document.addEventListener("mouseup",this.onPointerUp))}normalizeMouseWheelEvent(t){let e=t.deltaX||0,s=t.deltaY||0,n=t.deltaZ||0;const i=t.deltaMode,o=parseInt(getComputedStyle(t.target).getPropertyValue("line-height"));let r=1;switch(i){case 1:r=o;break;case 2:r=window.height}return e*=r,s*=r,n*=r,{x:e,y:s,z:n,event:t}}onWheel(t){const e=this.normalizeMouseWheelEvent(t);this.options.onWheel(e)}normalizePointerEvent(t){let e={x:0,y:0,pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0,event:t};switch(t.type){case"wheel":const s=this.normalizeMouseWheelEvent(t);e.x=s.x,e.y=s.y,e.pageX=e.x,e.pageY=e.y,e.screenX=e.x,e.screenY=e.y,e.clientX=e.x,e.clientY=e.y;break;case"touchstart":case"touchmove":case"touchend":case"touchcancel":e.x=t.changedTouches[0].screenX,e.y=t.changedTouches[0].screenY,e.pageX=t.changedTouches[0].pageX,e.pageY=t.changedTouches[0].pageY,e.screenX=t.changedTouches[0].screenX,e.screenY=t.changedTouches[0].screenY,e.clientX=t.changedTouches[0].clientX,e.clientY=t.changedTouches[0].clientY;break;default:e.x=t.x,e.y=t.y,e.pageX=t.pageX,e.pageY=t.pageY,e.screenX=t.screenX,e.screenY=t.screenY,e.clientX=t.clientX,e.clientY=t.clientY}return e}onPointerDown(t){if("mousedown"===t.type&&0!==t.button)return;this.moving="xy";const e=this.normalizePointerEvent(t);this.lastX=e.x,this.lastY=e.y,this.initialX=e.x,this.initialY=e.y,this.options.onDown(e)}handleX(t){let e=t.x-this.lastX;return this.lastY=t.y,this.lastX=t.x,e}handleY(t){let e=t.y-this.lastY;return this.lastY=t.y,this.lastX=t.x,e}onPointerMove(t){if(""===this.moving||"mousemove"===t.type&&0!==t.button)return;const e=this.normalizePointerEvent(t);if("x|y"===this.options.axis){let s=0,n=0;("x"===this.moving||"xy"===this.moving&&Math.abs(e.x-this.initialX)>this.options.threshold)&&(this.moving="x",s=this.handleX(e)),("y"===this.moving||"xy"===this.moving&&Math.abs(e.y-this.initialY)>this.options.threshold)&&(this.moving="y",n=this.handleY(e)),this.options.onMove({movementX:s,movementY:n,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}else if("xy"===this.options.axis){let s=0,n=0;Math.abs(e.x-this.initialX)>this.options.threshold&&(s=this.handleX(e)),Math.abs(e.y-this.initialY)>this.options.threshold&&(n=this.handleY(e)),this.options.onMove({movementX:s,movementY:n,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}else if("x"===this.options.axis)("x"===this.moving||"xy"===this.moving&&Math.abs(e.x-this.initialX)>this.options.threshold)&&(this.moving="x",this.options.onMove({movementX:this.handleX(e),movementY:0,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t}));else if("y"===this.options.axis){let s=0;("y"===this.moving||"xy"===this.moving&&Math.abs(e.y-this.initialY)>this.options.threshold)&&(this.moving="y",s=this.handleY(e)),this.options.onMove({movementX:0,movementY:s,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t})}}onPointerUp(t){this.moving="";const e=this.normalizePointerEvent(t);this.options.onUp({movementX:0,movementY:0,x:e.x,y:e.y,initialX:this.initialX,initialY:this.initialY,lastX:this.lastX,lastY:this.lastY,event:t}),this.lastY=0,this.lastX=0}destroy(t){Pt?(t.removeEventListener("pointerdown",this.onPointerDown),document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp)):(t.removeEventListener("mousedown",this.onPointerDown),document.removeEventListener("mousemove",this.onPointerMove),document.removeEventListener("mouseup",this.onPointerUp),t.removeEventListener("touchstart",this.onPointerDown),document.removeEventListener("touchmove",this.onPointerMove),document.removeEventListener("touchend",this.onPointerUp),document.removeEventListener("touchcancel",this.onPointerUp))}}function Nt(t){let e=0;return function(s){e||(e=requestAnimationFrame((function(){e=0,t.apply(void 0,[s])})))}}function St(t){return t&&t.constructor?"Object"===t.constructor.name:"object"==typeof t&&null!==t}function Lt(t,...e){const s=e.shift();if(St(t)&&St(s))for(const e in s)if(St(s[e]))"function"==typeof s[e].clone?t[e]=s[e].clone():(void 0===t[e]&&(t[e]={}),t[e]=Lt(t[e],s[e]));else if(Array.isArray(s[e])){t[e]=new Array(s[e].length);let n=0;for(let i of s[e])St(i)?"function"==typeof i.clone?t[e][n]=i.clone():t[e][n]=Lt({},i):t[e][n]=i,n++}else t[e]=s[e];return e.length?Lt(t,...e):t}function Ut(t){if(void 0!==t.actions){const e=t.actions.map((t=>{const e=Object.assign({},t),s=Object.assign({},e.props);return delete s.state,delete s.api,delete e.element,e.props=s,e}));t.actions=e}return Lt({},t)}class kt{constructor(t,e){this.slotInstances={},this.destroyed=!1,this.vido=t,this.props=e,this.destroy=this.destroy.bind(this),this.change=this.change.bind(this),this.html=this.html.bind(this),this.getInstances=this.getInstances.bind(this),this.setComponents=this.setComponents.bind(this),this.vido.onDestroy((()=>{this.destroy()}))}setComponents(t){if(t&&!this.destroyed){for(const e in t){const s=t[e];void 0===this.slotInstances[e]&&(this.slotInstances[e]=[]);for(const t of this.slotInstances[e])t.destroy();this.slotInstances[e].length=0;for(const t of s)this.slotInstances[e].push(this.vido.createComponent(t,this.props))}this.vido.update()}}destroy(){if(!this.destroyed){for(const t in this.slotInstances){for(const e of this.slotInstances[t])e.destroy();this.slotInstances[t].length=0}this.destroyed=!0}}change(t,e){if(!this.destroyed)for(const s in this.slotInstances){const n=this.slotInstances[s];for(const s of n)s.change(t,e)}}getInstances(t){return this.destroyed?[]:void 0===t?this.slotInstances:this.slotInstances[t]}html(t,e){if(this.destroyed)return;if(!this.slotInstances[t]||0===this.slotInstances[t].length)return e;let s=e;for(const e of this.slotInstances[t])s=e.html(s);return s}getProps(){return this.props}isDestroyed(){return this.destroyed}}class Dt extends z{update(t,e){if("function"!=typeof e[0])throw new Error("[vido] GetElementDirective argument should be a function.");(0,e[0])(t.element)}render(){return b}}function Bt(t,e){let s=0;const n=new Map;let i,o,r=new Map,h=0;const l=[],c=Promise.resolve(),a={},d=function(t){return class extends z{update(e,s){const n=e.element,i=s[0],o=s[1],r=s[2];for(const e of o)if(void 0!==e){let s;if(t.has(i))for(const o of t.get(i))if(o.componentAction.create===e&&o.element===n){s=o;break}if(s)s.props=r;else{void 0!==n.vido&&delete n.vido;const s={instance:i,componentAction:{create:e,update(){},destroy(){}},element:n,props:r};let o=[];t.has(i)&&(o=t.get(i)),o.push(s),t.set(i,o)}}}render(t,e,s){return b}}}(r);class u{constructor(t){this.instance=t}create(t,e){const s=O(d);return()=>s(this.instance,t,e)}}const p=function(t,e,s){return class{constructor(t,e,s={}){this.destroyed=!1,this.instance=t,this.name=e.name,this.vidoInstance=e,this.props=s,this.destroy=this.destroy.bind(this),this.update=this.update.bind(this),this.change=this.change.bind(this),this.html=this.html.bind(this)}destroy(){this.destroyed||(this.vidoInstance.debug&&(console.groupCollapsed(`destroying component ${this.instance}`),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.vidoInstance.destroyComponent(this.instance,this.vidoInstance),this.destroyed=!0)}update(n){return this.vidoInstance.debug&&(console.groupCollapsed(`updating component ${this.instance}`),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.vidoInstance.updateTemplate(n)}change(n,i={}){this.vidoInstance.debug&&(console.groupCollapsed(`changing component ${this.instance}`),console.log(s({props:this.props,newProps:n,components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd());const o=t.get(this.instance);o&&o.change(n,i)}html(e={}){const s=t.get(this.instance);if(s&&!s.destroyed)return s.update(e,this.vidoInstance)}_getComponents(){return t}_getActions(){return e}}}(n,r,Ut),v=function(t,e,s){return class{constructor(t,e,s){this.destroyed=!1,this.instance=t,this.vidoInstance=e,this.renderFunction=s,this.destroy=this.destroy.bind(this),this.update=this.update.bind(this),this.change=this.change.bind(this)}destroy(){if(!this.destroyed){this.vidoInstance.debug&&(console.groupCollapsed(`component destroy method fired ${this.instance}`),console.log(s({props:this.vidoInstance.props,components:t.keys(),destroyable:this.vidoInstance.destroyable,actionsByInstance:e})),console.trace(),console.groupEnd()),this.content&&"function"==typeof this.content.destroy&&this.content.destroy();for(const t of this.vidoInstance.destroyable)t();this.vidoInstance.onChangeFunctions.length=0,this.vidoInstance.destroyable.length=0,this.vidoInstance.destroyed=!0,this.destroyed=!0,this.vidoInstance.update()}}update(n={}){return this.vidoInstance.debug&&(console.groupCollapsed(`component update method fired ${this.instance}`),console.log(s({components:t.keys(),actionsByInstance:e})),console.trace(),console.groupEnd()),this.renderFunction(n)}change(n,i={leave:!1}){const o=n;this.vidoInstance.debug&&(console.groupCollapsed(`component change method fired ${this.instance}`),console.log(s({props:o,components:t.keys(),onChangeFunctions:this.vidoInstance.onChangeFunctions,changedProps:n,actionsByInstance:e})),console.trace(),console.groupEnd());for(const t of this.vidoInstance.onChangeFunctions)t(n,i)}}}(n,r,Ut);class f{constructor(s="",i=""){this.instance="",this.name="",this.destroyable=[],this.destroyed=!1,this.onChangeFunctions=[],this.debug=!1,this.state=t,this.api=e,this.lastProps={},this.html=$,this.svg=A,this.directive=O,this.asyncAppend=pt,this.asyncReplace=ut,this.cache=vt,this.classMap=Yt,this.styleMap=Mt,this.guard=mt,this.live=Ct,this.ifDefined=gt,this.repeat=$t,this.unsafeHTML=_t,this.until=xt,this.schedule=Nt,this.getElement=O(Dt),this.actionsByInstance=()=>{},this.detach=It,this.PointerAction=Ht,this.Action=Xt,this.Slots=kt,this._components=n,this._actions=r,this.instance=s,this.reuseComponents=this.reuseComponents.bind(this),this.onDestroy=this.onDestroy.bind(this),this.onChange=this.onChange.bind(this),this.update=this.update.bind(this),this.destroyComponent=this.destroyComponent.bind(this);for(const t in a)this[t]=a[t].bind(this);this.name=i,this.Actions=new u(s)}static addMethod(t,e){a[t]=e}onDestroy(t){this.destroyable.push(t)}onChange(t){this.onChangeFunctions.push(t)}update(t){return this.updateTemplate(t)}reuseComponents(t,e,s,n,i=!0,o=!1){const r=[],h=t.length,l=e.length;let c=!1;!i||void 0!==e&&0!==e.length||(c=!0);let a=0;if(h<l){let i=l-h;for(;i;){const o=e[l-i],h=this.createComponent(n,s(o));t.push(h),r.push(h),i--}}else if(h>l){let e=h-l;for(i&&(c=!0,a=h-e);e;){const s=h-e;i||(r.push(t[s]),t[s].destroy()),e--}i||(t.length=l)}let d=0;o&&console.log("modified components",r),o&&console.log("current components",t),o&&console.log("data array",e);for(const n of t){const t=e[d];o&&console.log(`reuse components data at '${d}'`,t),n&&!r.includes(n)&&(o&&console.log("getProps fn result",s(t)),n.change(s(t),{leave:c&&d>=a})),d++}}createComponent(t,e={}){const i=t.name+":"+s++;let o;o=new f(i,t.name);const h=new p(i,o,e),l=new v(i,o,t(o,e));return n.set(i,l),n.get(i).change(e),o.debug&&(console.groupCollapsed(`component created ${i}`),console.log(Ut({props:e,components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd()),h}destroyComponent(t,e){if(e.debug&&(console.groupCollapsed(`destroying component ${t}...`),console.log(Ut({components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd()),r.has(t))for(const e of r.get(t))"function"==typeof e.componentAction.destroy&&e.componentAction.destroy(e.element,e.props);r.delete(t);const s=n.get(t);s?(s.destroy(),n.delete(t),e.debug&&(console.groupCollapsed(`component destroyed ${t}`),console.log(Ut({components:n.keys(),actionsByInstance:r})),console.trace(),console.groupEnd())):console.warn(`No component to destroy! [${t}]`)}executeActions(){for(const t of r.values()){for(const e of t)if(void 0===e.element.vido){const t=n.get(e.instance);e.isActive=function(){return t&&!1===t.destroyed};const s=e.componentAction,i=s.create;if(void 0!==i){let t;t=i.prototype&&(i.prototype.isAction||i.prototype.update||i.prototype.destroy)||i.isAction?new i(e.element,e.props):i(e.element,e.props),void 0!==t&&("function"==typeof t?s.destroy=t:("function"==typeof t.update&&(s.update=t.update.bind(t)),"function"==typeof t.destroy&&(s.destroy=t.destroy.bind(t))))}}else e.element.vido=e.props,"function"==typeof e.componentAction.update&&e.isActive()&&e.componentAction.update(e.element,e.props);for(const e of t)e.element.vido=e.props}}updateTemplate(t){return t&&l.push(t),new Promise((t=>{const e=++h,s=this;c.then((function(){if(e===h){h=0,s.render();for(const t of l)t();l.length=0,t(null)}}))}))}createApp(t){o=t.element;const e=this.createComponent(t.component,t.props);return i=e.instance,this.render(),e}render(){const t=n.get(i);t?(C(t.update(),o),this.executeActions()):o&&o.remove()}}return new f}return Bt.prototype.lithtml=k,Bt.prototype.Action=Xt,Bt.prototype.Directive=z,Bt.prototype.schedule=Nt,Bt.prototype.detach=It,Bt.prototype.styleMap=Mt,Bt.prototype.classMap=Yt,Bt.prototype.PointerAction=Ht,Bt.prototype.asyncAppend=pt,Bt.prototype.asyncReplace=ut,Bt.prototype.cache=vt,Bt.prototype.guard=mt,Bt.prototype.live=Ct,Bt.prototype.ifDefined=gt,Bt.prototype.repeat=$t,Bt.prototype.unsafeHTML=_t,Bt.prototype.until=xt,Bt.prototype.Slots=kt,Bt})); | ||
//# sourceMappingURL=vido.umd.min.js.map |
{ | ||
"name": "@neuronet.io/vido", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "Compilation-less and eval free frontend framework for fast scalable apps.", | ||
@@ -35,2 +35,5 @@ "main": "dist/vido.umd.min.js", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^21.0.0", | ||
"@rollup/plugin-node-resolve": "^13.0.5", | ||
"@rollup/plugin-typescript": "^8.2.5", | ||
"expect": "^27.2.5", | ||
@@ -42,14 +45,10 @@ "jest": "^27.2.5", | ||
"puppeteer": "^10.4.0", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^5.3.0", | ||
"rollup-plugin-typescript": "^1.0.1", | ||
"tslib": "^1.11.1", | ||
"typescript": "^3.8.3" | ||
"rollup": "^2.58.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.4.4" | ||
}, | ||
"dependencies": { | ||
"csstype": "^2.6.10", | ||
"lit-html": "^2.0.1" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import typescript from 'rollup-plugin-typescript'; | ||
import { nodeResolve as resolve } from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
@@ -16,3 +16,2 @@ | ||
plugins: [ | ||
typescript({ target: 'es6' }), | ||
resolve({ | ||
@@ -22,2 +21,3 @@ browser: true, | ||
}), | ||
typescript({ target: 'es6' }), | ||
commonjs({ extensions: ['.js', '.ts'] }), | ||
@@ -35,3 +35,2 @@ ], | ||
plugins: [ | ||
typescript({ target: 'es6' }), | ||
resolve({ | ||
@@ -41,2 +40,3 @@ browser: true, | ||
}), | ||
typescript({ target: 'es6' }), | ||
commonjs({ extensions: ['.js', '.ts'] }), | ||
@@ -55,3 +55,2 @@ terser(), | ||
plugins: [ | ||
typescript({ target: 'es6' }), | ||
resolve({ | ||
@@ -61,2 +60,3 @@ browser: true, | ||
}), | ||
typescript({ target: 'es6' }), | ||
commonjs({ extensions: ['.js', '.ts'] }), | ||
@@ -74,3 +74,2 @@ ], | ||
plugins: [ | ||
typescript({ target: 'es6' }), | ||
resolve({ | ||
@@ -80,2 +79,3 @@ browser: true, | ||
}), | ||
typescript({ target: 'es6' }), | ||
commonjs({ extensions: ['.js', '.ts'] }), | ||
@@ -82,0 +82,0 @@ terser(), |
@@ -1,2 +0,2 @@ | ||
import { Directive, AttributePart } from 'lit-html/directive'; | ||
import { Directive, AttributePart } from 'lit-html/directive.js'; | ||
import { nothing } from 'lit-html'; | ||
@@ -3,0 +3,0 @@ |
import { nothing } from 'lit-html'; | ||
import { AttributePart, directive, Directive } from 'lit-html/directive'; | ||
import { AttributePart, directive, Directive } from 'lit-html/directive.js'; | ||
@@ -4,0 +4,0 @@ const detached: WeakMap<AttributePart, ElementData> = new WeakMap(); |
import { nothing } from 'lit-html'; | ||
import { AttributePart, Directive } from 'lit-html/directive'; | ||
import { AttributePart, Directive } from 'lit-html/directive.js'; | ||
@@ -4,0 +4,0 @@ export default class GetElementDirective extends Directive { |
import { render, html, svg } from 'lit-html'; | ||
import { directive, Directive } from 'lit-html/directive'; | ||
import { asyncAppend } from 'lit-html/directives/async-append'; | ||
import { asyncReplace } from 'lit-html/directives/async-replace'; | ||
import { cache } from 'lit-html/directives/cache'; | ||
import { guard } from 'lit-html/directives/guard'; | ||
import { ifDefined } from 'lit-html/directives/if-defined'; | ||
import { repeat } from 'lit-html/directives/repeat'; | ||
import { unsafeHTML } from 'lit-html/directives/unsafe-html'; | ||
import { until } from 'lit-html/directives/until'; | ||
import { live } from 'lit-html/directives/live'; | ||
import { directive, Directive } from 'lit-html/directive.js'; | ||
import { asyncAppend } from 'lit-html/directives/async-append.js'; | ||
import { asyncReplace } from 'lit-html/directives/async-replace.js'; | ||
import { cache } from 'lit-html/directives/cache.js'; | ||
import { guard } from 'lit-html/directives/guard.js'; | ||
import { ifDefined } from 'lit-html/directives/if-defined.js'; | ||
import { repeat } from 'lit-html/directives/repeat.js'; | ||
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'; | ||
import { until } from 'lit-html/directives/until.js'; | ||
import { live } from 'lit-html/directives/live.js'; | ||
import detach from './Detach'; | ||
import { styleMap } from 'lit-html/directives/style-map'; | ||
import { classMap } from 'lit-html/directives/class-map'; | ||
import { styleMap, StyleInfo } from 'lit-html/directives/style-map.js'; | ||
import { classMap, ClassInfo } from 'lit-html/directives/class-map.js'; | ||
import PointerAction from './PointerAction'; | ||
@@ -24,4 +24,2 @@ import getPublicComponentMethods from './PublicComponentMethods'; | ||
import helpers from './helpers'; | ||
import { PropertiesHyphenFallback as CSSProps } from 'csstype'; | ||
import * as lithtml from 'lit-html'; | ||
@@ -429,4 +427,6 @@ | ||
const lit = lithtml; | ||
export { | ||
lithtml, | ||
lit, | ||
Action, | ||
@@ -449,3 +449,4 @@ Directive, | ||
helpers, | ||
CSSProps, | ||
StyleInfo, | ||
ClassInfo, | ||
}; |
@@ -7,3 +7,3 @@ { | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"strict": false, | ||
"module": "ESNext", | ||
@@ -14,8 +14,5 @@ "downlevelIteration": true, | ||
"target": "ES2015", | ||
"skipLibCheck": true, | ||
"skipDefaultLibCheck": true, | ||
"outDir": "dist", | ||
"declaration": false, | ||
"noImplicitAny": true | ||
"skipLibCheck": false, | ||
"skipDefaultLibCheck": false | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
import { AttributePart } from 'lit-html/directive'; | ||
import { AttributePart } from 'lit-html/directive.js'; | ||
export default function getActionsCollector(actionsByInstance: Map<string, any>): { | ||
new (_partInfo: import("lit-html/directive").PartInfo): { | ||
new (_partInfo: import("lit-html/directive.js").PartInfo): { | ||
update(part: AttributePart, props: unknown[]): void; | ||
@@ -5,0 +5,0 @@ render(instance: string, actions: any[], props: object): symbol; |
@@ -1,2 +0,2 @@ | ||
import { AttributePart, Directive } from 'lit-html/directive'; | ||
import { AttributePart, Directive } from 'lit-html/directive.js'; | ||
export interface ElementData { | ||
@@ -12,3 +12,3 @@ element: Element; | ||
} | ||
declare const detach: (shouldDetach: boolean) => import("lit-html/directive").DirectiveResult<typeof Detach>; | ||
declare const detach: (shouldDetach: boolean) => import("lit-html/directive.js").DirectiveResult<typeof Detach>; | ||
export default detach; |
@@ -1,2 +0,2 @@ | ||
import { AttributePart, Directive } from 'lit-html/directive'; | ||
import { AttributePart, Directive } from 'lit-html/directive.js'; | ||
export default class GetElementDirective extends Directive { | ||
@@ -3,0 +3,0 @@ update(part: AttributePart, props: unknown[]): void; |
import { Directive, Part, AttributePart } from 'lit-html/directive'; | ||
import { PropertiesHyphenFallback as CSSProp } from 'csstype'; | ||
export { CSSProp }; | ||
import { StyleInfo } from './vido'; | ||
export default class StyleMap extends Directive { | ||
style: CSSProp; | ||
style: StyleInfo; | ||
private previous; | ||
@@ -12,4 +11,4 @@ private detach; | ||
update(part: AttributePart, props: unknown[]): void; | ||
render(styleMap: CSSProp, detach?: boolean): void; | ||
setStyle(styleInfo: CSSProp): void; | ||
render(styleMap: StyleInfo, detach?: boolean): void; | ||
setStyle(styleInfo: StyleInfo): void; | ||
setDebug(debug?: boolean): void; | ||
@@ -16,0 +15,0 @@ setDetach(detach: boolean): void; |
@@ -1,14 +0,14 @@ | ||
import { directive, Directive } from 'lit-html/directive'; | ||
import { asyncAppend } from 'lit-html/directives/async-append'; | ||
import { asyncReplace } from 'lit-html/directives/async-replace'; | ||
import { cache } from 'lit-html/directives/cache'; | ||
import { guard } from 'lit-html/directives/guard'; | ||
import { ifDefined } from 'lit-html/directives/if-defined'; | ||
import { repeat } from 'lit-html/directives/repeat'; | ||
import { unsafeHTML } from 'lit-html/directives/unsafe-html'; | ||
import { until } from 'lit-html/directives/until'; | ||
import { live } from 'lit-html/directives/live'; | ||
import { directive, Directive } from 'lit-html/directive.js'; | ||
import { asyncAppend } from 'lit-html/directives/async-append.js'; | ||
import { asyncReplace } from 'lit-html/directives/async-replace.js'; | ||
import { cache } from 'lit-html/directives/cache.js'; | ||
import { guard } from 'lit-html/directives/guard.js'; | ||
import { ifDefined } from 'lit-html/directives/if-defined.js'; | ||
import { repeat } from 'lit-html/directives/repeat.js'; | ||
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'; | ||
import { until } from 'lit-html/directives/until.js'; | ||
import { live } from 'lit-html/directives/live.js'; | ||
import detach from './Detach'; | ||
import { styleMap } from 'lit-html/directives/style-map'; | ||
import { classMap } from 'lit-html/directives/class-map'; | ||
import { styleMap, StyleInfo } from 'lit-html/directives/style-map.js'; | ||
import { classMap, ClassInfo } from 'lit-html/directives/class-map.js'; | ||
import PointerAction from './PointerAction'; | ||
@@ -19,3 +19,2 @@ import { schedule } from './helpers'; | ||
import helpers from './helpers'; | ||
import { PropertiesHyphenFallback as CSSProps } from 'csstype'; | ||
import * as lithtml from 'lit-html'; | ||
@@ -76,2 +75,2 @@ export declare type htmlResult = lithtml.TemplateResult | lithtml.TemplateResult[] | lithtml.SVGTemplateResult | lithtml.SVGTemplateResult[] | undefined | null; | ||
export default function Vido<State, Api>(state: State, api: Api): vido<State, Api>; | ||
export { lithtml, Action, Directive, schedule, detach, styleMap, classMap, PointerAction, asyncAppend, asyncReplace, cache, guard, ifDefined, repeat, unsafeHTML, until, Slots, helpers, CSSProps, }; | ||
export { lithtml, Action, Directive, schedule, detach, styleMap, classMap, PointerAction, asyncAppend, asyncReplace, cache, guard, ifDefined, repeat, unsafeHTML, until, Slots, helpers, StyleInfo, ClassInfo, }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
842927
1
67
6847
0
- Removedcsstype@^2.6.10
- Removedcsstype@2.6.21(transitive)