-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmin.js
5 lines (5 loc) · 10.4 KB
/
min.js
1
2
3
4
5
self.uland=function(e){"use strict";var t=CustomEvent;function n(e){this.observe(e,{subtree:!0,childList:!0})}function r(e){e.type in this&&this[e.type](e)}var s=Promise;let o=null,l=new Set;const c=e=>{const{$:t,r:n,h:r}=e;m(n)&&(i.get(r).delete(e),n()),m(e.r=t())&&i.get(r).add(e)},a=()=>{const e=l;l=new Set,e.forEach((({h:e,c:t,a:n,e:r})=>{r&&e.apply(t,n)}))},i=new WeakMap,u=[],d=[];function h(e,t){return e!==this[t]}const f=e=>{const t=i.get(e);t&&w.then((()=>{t.forEach((e=>{e.r(),e.r=null,e.d=!0})),t.clear()}))},p=()=>o,g=e=>i.has(e),m=e=>"function"==typeof e,y=e=>{const t={h:n,c:null,a:null,e:0,i:0,s:[]};return n;function n(){const n=o;o=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{o=n,u.length&&w.then(u.forEach.bind(u.splice(0),c)),d.length&&d.splice(0).forEach(c)}}},w=new s((e=>e()));function v(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const b=(e,t)=>{const n=p(),{i:r,s:s}=n;return r!==s.length&&t&&!t.some(h,s[r]._)||(s[r]={$:e(),_:t}),s[n.i++].$},E=e=>(t,n)=>{const r=p(),{i:s,s:o,h:l}=r,c=s===o.length;r.i++,c&&(i.has(l)||i.set(l,new Set),o[s]={$:t,_:n,r:null,d:!1,h:l}),(c||!n||o[s].d||n.some(h,o[s]._))&&e.push(o[s]),o[s].$=t,o[s]._=n},x=E(u),k=E(d),C=(e,t)=>m(t)?t(e):t,N=(e,t,n)=>{const r=p(),{i:s,s:o}=r;s===o.length&&o.push({$:m(n)?n(t):C(void 0,t),set:t=>{o[s].$=e(o[s].$,t),(e=>{l.has(e)||(e.e=1,l.add(e),w.then(a))})(r)}});const{$:c,set:i}=o[r.i++];return[c,i]};
/*! (c) Andrea Giammarchi - ISC */
let $=null,A=null,M=null;const S=new WeakMap,T=new WeakMap,_=(e,t,n,r)=>{const s=s=>{S.has(e)||(S.set(e,0),w.then((()=>{S.delete(e),e.apply(t,n)}))),r(s)};return T.set(r,s),s},L=(e,t,n,r)=>e?[r[0],T.get(r[1])||_(e,t,n,r[1])]:r,O=(e,t)=>{const n=y(t?function(){const[t,r,s]=[$,A,M];[$,A,M]=[n,this,arguments];try{return e.apply(A,M)}finally{[$,A,M]=[t,r,s]}}:e);return n},W=((e,t,s,o)=>{const l=new WeakMap,c=new WeakMap,a=new WeakMap,i=e=>l.has(e),u=e=>{i(e)&&(d(e,e.removeEventListener,l.get(e)),l.delete(e))},d=(e,t,n)=>{t.call(e,"disconnected",n),t.call(e,"connected",n)},h=(e,t,n,r)=>{for(let{length:s}=e,o=0;o<s;o++)f(e[o],t,n,r)},f=(e,n,r,o)=>{i(e)&&!r.has(e)&&(o.delete(e),r.set(e,0),e.dispatchEvent(new(s||CustomEvent)(n))),h(e[t||"children"]||[],n,r,o)},p=new(o||MutationObserver)((e=>{for(let{length:t}=e,n=0;n<t;n++){const{removedNodes:t,addedNodes:r}=e[n];h(t,"disconnected",a,c),h(r,"connected",c,a)}}));p.add=n,p.add(e||document);const{attachShadow:g}=Element.prototype;return g&&(Element.prototype.attachShadow=function(e){const t=g.call(this,e);return p.add(t),t}),{has:i,connect:(e,t)=>{u(e),(t||(t={})).handleEvent||(t.handleEvent=r),d(e,e.addEventListener,t),l.set(e,t)},disconnect:u,kill(){p.disconnect()}}})(document,"children",t),j=({firstChild:e})=>{if(e&&1!==e.nodeType&&!(e=e.nextElementSibling))throw"unobservable";return e},B=e=>{const{nodeType:t}=e;if(t)return 1===t?e:j(e);{const t=e.valueOf();return t!==e?B(t):j(t)}},R=(e,t)=>{const n=O(e,t);return function(){const e=n.apply(this,arguments);if(g(n)){const t=B(e);W.has(t)||W.connect(t,{disconnected(){f(n)}})}return e}};var D=e=>({get:t=>e.get(t),set:(t,n)=>(e.set(t,n),n)});const{isArray:z}=Array;class H extends Map{set(e,t){return super.set(e,t),t}}class P extends WeakMap{set(e,t){return super.set(e,t),t}}
/*! (c) Andrea Giammarchi - ISC */const F=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,q=/<([a-z]+[a-z0-9:._-]*)([^>]*?)(\/?)>/g,G=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,I=/[\x01\x02]/g;const J=(e,t)=>111===e.nodeType?1/t<0?t?(({firstChild:e,lastChild:t})=>{const n=document.createRange();return n.setStartAfter(e),n.setEndAfter(t),n.deleteContents(),e})(e):e.lastChild:t?e.valueOf():e.firstChild:e,K=(e,t)=>{let n,r,s=t.slice(2);return!(t in e)&&(r=t.toLowerCase())in e&&(s=r.slice(2)),t=>{const r=z(t)?t:[t,!1];n!==r[0]&&(n&&e.removeEventListener(s,n,r[1]),(n=r[0])&&e.addEventListener(s,n,r[1]))}};const{isArray:Q,prototype:U}=Array,{indexOf:V}=U,{createDocumentFragment:X,createElement:Y,createElementNS:Z,createTextNode:ee,createTreeWalker:te,importNode:ne}=new Proxy(document,{get:(e,t)=>e[t].bind(e)});let re;const se=(e,t)=>t?(e=>{re||(re=Z("http://www.w3.org/2000/svg","svg")),re.innerHTML=e;const t=X();return t.append(...re.childNodes),t})(e):(e=>{const t=Y("template");return t.innerHTML=e,t.content})(e),oe=({childNodes:e},t)=>e[t],le=(e,t,n)=>((e,t,n,r,s)=>{const o=n.length;let l=t.length,c=o,a=0,i=0,u=null;for(;a<l||i<c;)if(l===a){const t=c<o?i?r(n[i-1],-0).nextSibling:r(n[c-i],0):s;for(;i<c;)e.insertBefore(r(n[i++],1),t)}else if(c===i)for(;a<l;)u&&u.has(t[a])||e.removeChild(r(t[a],-1)),a++;else if(t[a]===n[i])a++,i++;else if(t[l-1]===n[c-1])l--,c--;else if(t[a]===n[c-1]&&n[i]===t[l-1]){const s=r(t[--l],-1).nextSibling;e.insertBefore(r(n[i++],1),r(t[a++],-1).nextSibling),e.insertBefore(r(n[--c],1),s),t[l]=n[c]}else{if(!u){u=new Map;let e=i;for(;e<c;)u.set(n[e],e++)}if(u.has(t[a])){const s=u.get(t[a]);if(i<s&&s<c){let o=a,d=1;for(;++o<l&&o<c&&u.get(t[o])===s+d;)d++;if(d>s-i){const o=r(t[a],0);for(;i<s;)e.insertBefore(r(n[i++],1),o)}else e.replaceChild(r(n[i++],1),r(t[a++],-1))}else a++}else e.removeChild(r(t[a++],-1))}return n})(e.parentNode,t,n,J,e),ce=(e,t)=>{switch(t[0]){case"?":return((e,t,n)=>r=>{n!==!!r&&((n=!!r)?e.setAttribute(t,""):e.removeAttribute(t))})(e,t.slice(1),!1);case".":return((e,t)=>"dataset"===t?(({dataset:e})=>t=>{for(const n in t){const r=t[n];null==r?delete e[n]:e[n]=r}})(e):n=>{e[t]=n})(e,t.slice(1));case"@":return K(e,"on"+t.slice(1));case"o":if("n"===t[1])return K(e,t)}switch(t){case"ref":return(e=>{let t;return n=>{t!==n&&(t=n,"function"==typeof n?n(e):n.current=e)}})(e);case"aria":return(e=>t=>{for(const n in t){const r="role"===n?n:`aria-${n}`,s=t[n];null==s?e.removeAttribute(r):e.setAttribute(r,s)}})(e)}return((e,t)=>{let n,r=!0;const s=document.createAttributeNS(null,t);return t=>{if(n!==t)if(n=t,null==n)r||(e.removeAttributeNode(s),r=!0);else{const n=t;null==n?(r||e.removeAttributeNode(s),r=!0):(s.value=n,r&&(e.setAttributeNodeNS(s),r=!1))}}})(e,t)};function ae(e){const{type:t,path:n}=e,r=n.reduceRight(oe,this);return"node"===t?(e=>{let t,n,r=[];const s=o=>{switch(typeof o){case"string":case"number":case"boolean":t!==o&&(t=o,n||(n=ee("")),n.data=o,r=le(e,r,[n]));break;case"object":case"undefined":if(null==o){t!=o&&(t=o,r=le(e,r,[]));break}if(Q(o)){t=o,0===o.length?r=le(e,r,[]):"object"==typeof o[0]?r=le(e,r,o):s(String(o));break}t!==o&&"ELEMENT_NODE"in o&&(t=o,r=le(e,r,11===o.nodeType?[...o.childNodes]:[o]));break;case"function":s(o(e))}};return s})(r):"attr"===t?ce(r,e.name):(e=>{let t;return n=>{t!=n&&(t=n,e.textContent=null==n?"":n)}})(r)}const ie=e=>{const t=[];let{parentNode:n}=e;for(;n;)t.push(V.call(n.childNodes,e)),e=n,({parentNode:n}=e);return t},ue="isµ",de=new P,he=/^(?:textarea|script|style|title|plaintext|xmp)$/,fe=(e,t)=>{const n="svg"===e,r=((e,t,n)=>{let r=0;return e.join("").trim().replace(q,((e,t,r,s)=>{let o=t+r.replace(G,"=$2$1").trimEnd();return s.length&&(o+=n||F.test(t)?" /":"></"+t),"<"+o+">"})).replace(I,(e=>""===e?"\x3c!--"+t+r+++"--\x3e":t+r++))})(t,ue,n),s=se(r,n),o=te(s,129),l=[],c=t.length-1;let a=0,i=`isµ${a}`;for(;a<c;){const e=o.nextNode();if(!e)throw`bad template: ${r}`;if(8===e.nodeType)e.data===i&&(l.push({type:"node",path:ie(e)}),i="isµ"+ ++a);else{for(;e.hasAttribute(i);)l.push({type:"attr",path:ie(e),name:e.getAttribute(i)}),e.removeAttribute(i),i="isµ"+ ++a;he.test(e.localName)&&e.textContent.trim()===`\x3c!--${i}--\x3e`&&(e.textContent="",l.push({type:"text",path:ie(e)}),i="isµ"+ ++a)}}return{content:s,nodes:l}},pe=(e,t)=>{const{content:n,nodes:r}=de.get(t)||de.set(t,fe(e,t)),s=ne(n,!0);return{content:s,updates:r.map(ae,s)}},ge=(e,{type:t,template:n,values:r})=>{const s=me(e,r);let{entry:o}=e;o&&o.template===n&&o.type===t||(e.entry=o=((e,t)=>{const{content:n,updates:r}=pe(e,t);return{type:e,template:t,content:n,updates:r,wire:null}})(t,n));const{content:l,updates:c,wire:a}=o;for(let e=0;e<s;e++)c[e](r[e]);return a||(o.wire=(e=>{const{firstChild:t,lastChild:n}=e;if(t===n)return n||e;const{childNodes:r}=e,s=[...r];return{ELEMENT_NODE:1,nodeType:111,firstChild:t,lastChild:n,valueOf:()=>(r.length!==s.length&&e.append(...s),e)}})(l))},me=({stack:e},t)=>{const{length:n}=t;for(let r=0;r<n;r++){const n=t[r];n instanceof ye?t[r]=ge(e[r]||(e[r]={stack:[],entry:null,wire:null}),n):Q(n)?me(e[r]||(e[r]={stack:[],entry:null,wire:null}),n):e[r]=null}return n<e.length&&e.splice(n),n};class ye{constructor(e,t,n){this.type=e,this.template=t,this.values=n}}const we=e=>{const t=new P;return Object.assign(((t,...n)=>new ye(e,t,n)),{for(n,r){const s=t.get(n)||t.set(n,new H);return s.get(r)||s.set(r,(t=>(n,...r)=>ge(t,{type:e,template:n,values:r}))({stack:[],entry:null,wire:null}))},node:(t,...n)=>ge({stack:[],entry:null,wire:null},new ye(e,t,n)).valueOf()})},ve=new P,be=we("html"),Ee=we("svg"),{create:xe}=Object,ke=(e,...t)=>new ye("html",e,t);ke.for=Oe(be);const Ce=(e,...t)=>new ye("svg",e,t);Ce.for=Oe(Ee);const Ne=D(new WeakMap),$e=(e,t)=>R((function(){const n=t.f.apply(this,arguments);return n instanceof ye?(Se(e,n),t.$=_e(t,n)):t.$=n,t.$})),Ae=()=>({s:[],e:null}),Me=(e,{f:t,c:n,a:r})=>{let{e:s}=e;return s&&s.f===t||(e.e=s={f:t,h:null,$:null},s.h=$e(Ae(),s)),s.h.apply(n,r)},Se=(e,{values:t})=>{Te(e,t)},Te=(e,t)=>{const{s:n}=e,{length:r}=t;for(let e=0;e<r;e++){const r=t[e];r instanceof Le?t[e]=Me(n[e]||(n[e]=Ae()),r):r instanceof ye?Se(n[e]||(n[e]=Ae()),r):z(r)?Te(n[e]||(n[e]=Ae()),r):n[e]=null}r<n.length&&n.splice(r)},_e=(e,{type:t,template:n,values:r})=>("svg"===t?Ee:be).for(e,t)(n,...r);function Le(e,t,n){this.f=e,this.c=t,this.a=n}function Oe(e){const t=D(new WeakMap);return(n,r)=>{const s=t.get(n)||t.set(n,xe(null)),o=s[r]||(s[r]=Ae());return(t,...s)=>(Te(o,s),e.for(n,r)(t,...s))}}return e.Component=function(e){return function(){return new Le(e,this,arguments)}},e.createContext=e=>({_:new Set,provide:v,value:e}),e.html=ke,e.render=(e,t)=>(Ne.get(e)||Ne.set(e,{c:Ae(),h:R((function(t){const n="function"==typeof t?t():t;return((e,t)=>{const n="function"==typeof t?t():t,r=ve.get(e)||ve.set(e,{stack:[],entry:null,wire:null}),s=n instanceof ye?ge(r,n):n;return s!==r.wire&&(r.wire=s,e.replaceChildren(s.valueOf())),e})(e,n instanceof Le?Me(this.c,n):(Se(this.c,n),n))}),e)})).h(t),e.svg=Ce,e.useCallback=(e,t)=>b((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(p()),t),e.useEffect=x,e.useLayoutEffect=k,e.useMemo=b,e.useReducer=(e,t,n)=>L($,A,M,N(e,t,n)),e.useRef=e=>{const t=p(),{i:n,s:r}=t;return n===r.length&&r.push({current:e}),r[t.i++]},e.useState=e=>L($,A,M,(e=>N(C,e))(e))
/*! (c) Andrea Giammarchi - ISC */,e}({});