1
0
forked from osmarks/potatOS
potatOS/copy-cat/persist-7dd7de50.js

12 lines
40 KiB
JavaScript
Raw Normal View History

2023-11-12 14:57:16 +00:00
/**
* copy-cat: Copyright SquidDev 2023
*
* - @squid-dev/cc-web-term: Copyright SquidDev (BSD-3-Clause)
* - preact: Copyright (MIT)
* - setimmediate: Copyright YuzuJS (MIT)
* - style-inject: Copyright EGOIST (MIT)
* - tslib: Copyright Microsoft Corp. (0BSD)
*
* @license
*/define(["require","exports"],function(e,t){"use strict";var r,n,i,s,o,l,a,h={},u=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d=Array.isArray;function f(e,t){for(var r in t)e[r]=t[r];return e}function p(e){var t=e.parentNode;t&&t.removeChild(e)}function _(e,t,n){var i,s,o,l={};for(o in t)"key"==o?i=t[o]:"ref"==o?s=t[o]:l[o]=t[o];if(arguments.length>2&&(l.children=arguments.length>3?r.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===l[o]&&(l[o]=e.defaultProps[o]);return m(e,l,i,s,null)}function m(e,t,r,s,o){var l={type:e,props:t,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++i:o};return null==o&&null!=n.vnode&&n.vnode(l),l}function g(){return{current:null}}function v(e){return e.children}function y(e,t){this.props=e,this.context=t}function b(e,t){if(null==t)return e.__?b(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__d||r.__e;return"function"==typeof e.type?b(e):null}function w(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!k.__r++||o!==n.debounceRendering)&&((o=n.debounceRendering)||l)(k)}function k(){var e,t,r,n,i,o,l,h,u;for(s.sort(a);e=s.shift();)e.__d&&(t=s.length,n=void 0,i=void 0,o=void 0,h=(l=(r=e).__v).__e,(u=r.__P)&&(n=[],i=[],(o=f({},l)).__v=l.__v+1,$(u,l,o,r.__n,void 0!==u.ownerSVGElement,null!=l.__h?[h]:null,n,null==h?b(l):h,l.__h,i),P(n,l,i),l.__e!=h&&function e(t){var r,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,r=0;r<t.__k.length;r++)if(null!=(n=t.__k[r])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return e(t)}}(l)),s.length>t&&s.sort(a));k.__r=0}function E(e,t,r,n,i,s,o,l,a,c,f){var p,_,g,y,w,k,E,x,D,F=0,z=n&&n.__k||u,P=z.length,A=P,K=t.length;for(r.__k=[],p=0;p<K;p++)null!=(y=r.__k[p]=null==(y=t[p])||"boolean"==typeof y||"function"==typeof y?null:"string"==typeof y||"number"==typeof y||"bigint"==typeof y?m(null,y,null,null,y):d(y)?m(v,{children:y},null,null,null):y.__b>0?m(y.type,y.props,y.key,y.ref?y.ref:null,y.__v):y)?(y.__=r,y.__b=r.__b+1,-1===(x=function(e,t,r,n){var i=e.key,s=e.type,o=r-1,l=r+1,a=t[r];if(null===a||a&&i==a.key&&s===a.type)return r;if(n>(null!=a?1:0))for(;o>=0||l<t.length;){if(o>=0){if((a=t[o])&&i==a.key&&s===a.type)return o;o--}if(l<t.length){if((a=t[l])&&i==a.key&&s===a.type)return l;l++}}return -1}(y,z,E=p+F,A))?g=h:(g=z[x]||h,z[x]=void 0,A--),$(e,y,g,i,s,o,l,a,c,f),w=y.__e,(_=y.ref)&&g.ref!=_&&(g.ref&&S(g.ref,null,y),f.push(_,y.__c||w,y)),null!=w&&(null==k&&(k=w),(D=g===h||null===g.__v)?-1==x&&F--:x!==E&&(x===E+1?F++:x>E?A>K-E?F+=x-E:F--:F=x<E&&x==E-1?x-E:0),E=p+F,"function"!=typeof y.type||x===E&&g.__k!==y.__k?"function"!=typeof y.type&&(x!==E||D)?a=C(e,w,a):void 0!==y.__d?(a=y.__d,y.__d=void 0):a=w.nextSibling:a=function e(t,r,n){for(var i,s=t.__k,o=0;s&&o<s.length;o++)(i=s[o])&&(i.__=t,r="function"==typeof i.type?e(i,r,n):C(n,i.__e,r));return r}(y,a,e),"function"==typeof r.type&&(r.__d=a))):(g=z[p])&&null==g.key&&g.__e&&(g.__e==a&&(g.__=n,a=b(g)),q(g,g,!1),z[p]=null);for(r.__e=k,p=P;p--;)null!=z[p]&&("function"==typeof r.type&&null!=z[p].__e&&z[p].__e==r.__d&&(r.__d=z[p].__e.nextSibling),q(z[p],z[p]))}function C(e,t,r){return null==r||r.parentNode!==e?e.insertBefore(t,null):t==r&&null!=t.parentNode||e.insertBefore(t,r),t.nextSibling}function x(e,t,r){"-"===t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||c.test(t)?r:r+"px"}function D(e,t,r,n,i){var s;e:if("style"===t){if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||x(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||x(e.style,t,r[t])}}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase() in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?n?r.u=n.u:(r.u=Date.now(),e.addEventListener(t,s?z:F,s)):e.removeEventListener(t,s?z:F,s);else if("dangerouslySetInnerHTML"!==t){if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t