-
Notifications
You must be signed in to change notification settings - Fork 0
/
min.js
1 lines (1 loc) · 5.41 KB
/
min.js
1
var hookedElements=function(e){"use strict";var t="function"==typeof Promise?Promise:function(e){var t,n=[],r=0;return e((function(e){t=e,r=1,n.splice(0).forEach(u)})),{then:u};function u(e){return r?setTimeout(e,0,t):n.push(e),this}},n=null,r=new Set,u=function(e){var t=e.$,n=e.r,r=e.h;s(n)&&(o.get(r).delete(e),n()),s(e.r=t())&&o.get(r).add(e)},i=function(){var e=r;r=new Set,e.forEach((function(e){var t=e.h,n=e.c,r=e.a;e.e&&t.apply(n,r)}))},o=new WeakMap,a=[],c=[];function l(e,t){return e!==this[t]}var f=function(){return n},s=function(e){return"function"==typeof e},d=new t((function(e){return e()}));function h(e){var t=this._;this.value!==e&&(this._=new Set,this.value=e,t.forEach((function(e){var t=e.h,n=e.c,r=e.a;t.apply(n,r)})))}var v=function(e,t){var n=f(),r=n.i,u=n.s;return r!==u.length&&t&&!t.some(l,u[r]._)||(u[r]={$:e(),_:t}),u[n.i++].$},p=function(e){return function(t,n){var r=f(),u=r.i,i=r.s,a=r.h,c=u===i.length;r.i++,c&&(o.has(a)||o.set(a,new Set),i[u]={$:t,_:n,r:null,h:a}),(c||!n||n.some(l,i[u]._))&&e.push(i[u]),i[u].$=t,i[u]._=n}},g=p(a),b=p(c),w=function(e,t){return s(t)?t(e):t},m=function(e,t,n){var u=f(),o=u.i,a=u.s;o===a.length&&a.push({$:s(n)?n(t):w(void 0,t),set:function(t){a[o].$=e(a[o].$,t),function(e){r.has(e)||(e.e=1,r.add(e),d.then(i))}(u)}});var c=a[u.i++];return[c.$,c.set]},y=!0,S=!1,E="querySelectorAll";function $(e){this.observe(e,{subtree:y,childList:y})}var _="querySelectorAll",M=self,O=M.document,k=M.Element,A=M.MutationObserver,C=M.Set,q=M.WeakMap,L=function(e){return _ in e},N=[].filter,x=Object.create,W=Object.keys,R=new WeakMap,j=new Set,P=[],V={},D={},F=function(e,t){for(var n=R.get(t),r=0,u=e.length;r<u;r++){var i=e[r],o=i.target,a=i.attributeName,c=i.oldValue,l=o.getAttribute(a);n.attributeChanged(a,c,l)}},T=function(e){var t=new q,n=function(n,r){var i;if(r)for(var o,a=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector}(n),c=0,l=u.length;c<l;c++)a.call(n,o=u[c])&&(t.has(n)||t.set(n,new C),(i=t.get(n)).has(o)||(i.add(o),e.handle(n,r,o)));else t.has(n)&&(i=t.get(n),t.delete(n),i.forEach((function(t){e.handle(n,r,t)})))},r=function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,u=e.length;r<u;r++)n(e[r],t)},u=e.query,i=e.root||O,o=function(e,t,n){var r=function t(n,r,u,i,o){for(var a=0,c=n.length;a<c;a++){var l=n[a];(o||E in l)&&(i?r.has(l)||(r.add(l),u.delete(l),e(l,i)):u.has(l)||(u.add(l),r.delete(l),e(l,i)),o||t(l[E]("*"),r,u,i,y))}},u=new(n||MutationObserver)((function(e){for(var t=new Set,n=new Set,u=0,i=e.length;u<i;u++){var o=e[u],a=o.addedNodes,c=o.removedNodes;r(c,t,n,S,S),r(a,t,n,y,S)}}));return u.add=$,u.add(t||document),u}(n,i,A),a=k.prototype.attachShadow;return a&&(k.prototype.attachShadow=function(e){var t=a.call(this,e);return o.add(t),t}),u.length&&r(i[_](u)),{drop:function(e){for(var n=0,r=e.length;n<r;n++)t.delete(e[n])},flush:function(){for(var e=o.takeRecords(),t=0,n=e.length;t<n;t++)r(N.call(e[t].removedNodes,L),!1),r(N.call(e[t].addedNodes,L),!0)},observer:o,parse:r}}({query:P,handle:function(e,t,n){var r=V[n],u=r.m,i=r.l,o=r.o,a=u.get(e)||function(e,t,n,r){for(var u=x(r,{element:{enumerable:!0,value:e}}),i=0,o=n.length;i<o;i++)e.addEventListener(n[i].t,u,n[i].o);t.set(e,u),u.init&&u.init();var a=r.observedAttributes;if(a){var c=new MutationObserver(F);c.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:a.map((function(t){return e.hasAttribute(t)&&u.attributeChanged(t,null,e.getAttribute(t)),t}))}),R.set(c,u)}return u}(e,u,i,o),c=t?"connected":"disconnected";c in a&&a[c]()}}),z=T.drop,B=T.flush,G=T.parse,H=function(e,t){if(-1<P.indexOf(e))throw new Error("duplicated: "+e);B();for(var n=[],r=x(null),u=W(t),i=0,o=u.length;i<o;i++){var a=u[i];if(/^on/.test(a)&&!/Options$/.test(a)){var c=t[a+"Options"]||!1,l=a.toLowerCase(),f=l.slice(2);n.push({t:f,o:c}),r[f]=a,l!==a&&(f=a.slice(2,3).toLowerCase()+a.slice(3),r[f]=a,n.push({t:f,o:c}))}}n.length&&(t.handleEvent=function(e){this[r[e.type]](e)}),P.push(e),V[e]={m:new WeakMap,l:n,o:t},G(document.querySelectorAll(e)),I(e),j.has(e)||D[e]._()},I=function(e){if(!(e in D)){var n,r=new t((function(e){n=e}));D[e]={_:n,$:r}}return D[e].$};function J(){Q(this)}var K=function(e,t){H(e,"function"==typeof t?{init:J,render:t}:(t.init||(t.init=J),t))},Q=function(e){var t=e.disconnected,r=e.element,i=e.render,l=function(e){var t={h:r,c:null,a:null,e:0,i:0,s:[]};return r;function r(){var r=n;n=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{n=r,a.length&&d.then(a.forEach.bind(a.splice(0),u)),c.length&&c.splice(0).forEach(u)}}}(i.bind(e,r));return e.disconnected=function(){(function(e){return o.has(e)})(l)&&function(e){var t=o.get(e);t&&d.then((function(){t.forEach((function(e){e.r(),e.r=null})),t.clear()}))}(l),t&&t.call(e)},(e.render=l)()};return e.createContext=function(e){return{_:new Set,provide:h,value:e}},e.define=K,e.defineAsync=function(e,t){!function(e,t,n){j.add(e),H(e,{init:function(){j.has(e)&&(j.delete(e),t().then((function(t){var r=t.default;P.splice(P.indexOf(e),1),z(document.querySelectorAll(e)),(n||H)(e,r)})))}})}(e,t,K)},e.get=function(e){return(V[e]||R).o},e.render=Q,e.upgrade=function(e){P.length&&(B(),G([e]))},e.useCallback=function(e,t){return v((function(){return e}),t)},e.useContext=function(e){var t=e._,n=e.value;return t.add(f()),n},e.useEffect=g,e.useLayoutEffect=b,e.useMemo=v,e.useReducer=m,e.useRef=function(e){var t=f(),n=t.i,r=t.s;return n===r.length&&r.push({current:e}),r[t.i++]},e.useState=function(e){return m(w,e)},e.whenDefined=I,e}({});