// Polytype 0.6.0-beta.1 – https://github.com/fasttime/Polytype !function(){"use strict";function t(e,n){if(B(e))return!1;if(n.has(e))return!0;n.add(e);const o=z(e);let r=!1;for(const e of o)Y(e)&&t(e,n)&&(r=!0);return r||R(e),!0}function e(e,n){for(let o of e)do{const e=o.constructor;Q(e)&&t(e,n),o=f(o)}while(Y(o))}function n(t,e){const o=z(e);for(const e of o)if(e===t||n(t,e))return!0;return!1}const o=[],r=Function.prototype,s=Map,c=Object,{create:i,defineProperties:u,defineProperty:a,getOwnPropertyDescriptors:l,getPrototypeOf:f,prototype:p,setPrototypeOf:y}=c,d=Proxy,h=Reflect,{construct:w,get:g,ownKeys:m,set:P}=h,b=Set,O=String,v=Symbol.hasInstance,_=TypeError,$=t=>r.call.bind(t),j=$(r.bind),x=$(r[v]),I=$(p.hasOwnProperty),L=$(p.valueOf),M=(t,e)=>{if(t.has(e)){const t=`Duplicate superclass ${tt(e)}`;throw _(t)}},S=t=>{if(!J(t))throw _("Argument is not a function")},k=(...t)=>{if(!t.length)throw _("No superclasses specified");const n=new b,o=new b;for(const e of t){if(M(n,e),!Q(e)){const t=`${tt(e)} is not a constructor`;throw _(t)}const{prototype:t}=e;if(V(t)){const t=`Property 'prototype' of ${tt(e)} is not an object or null`;throw _(t)}n.add(e),null!==t&&o.add(t)}const r=function(t,e){const n=function(t){return N(class{static _(e){if(!t.has(e))throw S(e),_("Argument is not a direct superclass");return K(e,this)}}._,"name","class",!1)}(t),o=C(t),r=function(t){return N(class{static _(e){S(e);const{prototype:n}=e;if(!t.has(n)){const t=Y(n)?"Property 'prototype' of argument does not match any direct superclass":"Property 'prototype' of argument is not an object";throw _(t)}return K(n,this)}}._,"name","class",!1)}(e),c=function(t){const e=function(...e){const n=function(t,e){const n=new s;let o,r;const c=t=>{if(o===!t)throw _("Mixed argument styles");o=t};for(const o of e){if(X(o))throw _("Invalid arguments");let e,s;if(void 0!==o&&Y(e=o.super)){if(c(!0),M(n,e),!t.has(e)){const t=`${tt(e)} is not a direct superclass`;throw _(t)}if(s=o.arguments,X(s)){const t=`Invalid arguments for superclass ${tt(e)}`;throw _(t)}}else c(!1),r||(r=t.values()),e=r.next().value,s=o;const i=void 0!==s?E(s):void 0;n.set(e,i)}return n}(t,e),o=new.target;for(const e of t){const t=n.get(e),r=W(e,t,o),s=m(r);for(const t of s)I(this,t)&&delete r[t];u(this,r)}};return y(e,null),e}(t),a=F(c,t,D),l=i(null,{constructor:T(a,!0,!1,!0),class:T(r)}),f=F(l,e,A),p={class:T(n),name:{get:o},prototype:T(f)};return u(c,p),a}(n,o);{const t=new b;e(n,t),e(o,t)}return r},A={setPrototypeOf:()=>!1},D={__proto__:A,apply:()=>{throw _("Constructor cannot be invoked without 'new'")}},C=t=>()=>`(${[...t].map(({name:t})=>O(t))})`,E=r.apply.bind((...t)=>t,null),F=(t,e,n)=>{const o=((t,e)=>({__proto__:e,get(e,n,o){const r=t.find(nt(n));if(void 0!==r)return g(r,n,o)},has:(e,n)=>t.some(nt(n)),set(e,n,o,r){const s=t.find(nt(n));return void 0!==s?P(s,n,o,r):(N(r,n,o,!0,!0),!0)}}))([t,...e],n),r=new d(t,o);return ot.set(r,e),r},K=(t,e)=>{const n=t=>{const n=t();return y(r,e),n},o=new d(e,{get:(o,r)=>n(()=>g(t,r,e)),set:(o,r,s)=>n(()=>P(t,r,s,e))}),r=i(o);return r},N=(t,e,n,o=!0,r=!1)=>a(t,e,T(n,o,r,!0)),R=t=>N(t,v,G),T=(t,e,n,o)=>({value:t,writable:e,enumerable:n,configurable:o}),W=(t,e=o,n)=>l(w(t,e,n)),{getPrototypeListOf:q}={getPrototypeListOf:t=>{let e;{const n=f(t);if(null!==n){const t=ot.get(n);e=t?[...t]:[n]}else e=[]}return e}},z=t=>{let e=ot.get(t);if(!e){const n=f(t);e=null!==n?[n]:o}return e},B=t=>J(t)&&I(t,"apply")&&I(t,"bind")&&I(t,"call")&&!I(t,"prototype")&&I(t,v),{[v]:G}=class{static[v](t){H=!0;try{if(J(this)){const e=x(this,t);if(!H)return e;if(e||Y(t)&&n(this.prototype,t))return!0}return!1}finally{H=!1}}};let H=!1;const J=t=>"function"==typeof t,Q=t=>{if(J(t)){const e=j(t);N(e,"prototype",null);const n=new d(e,{construct(){return this}});try{return new class extends n{},!0}catch(t){}}return!1},U=t=>!et.includes(typeof t),V=t=>void 0===t||U(t),X=t=>null===t||U(t),Y=t=>null!==t&&!V(t),{isPrototypeOf:Z}=class{static isPrototypeOf(t){return!(!Y(t)||!n(L(this),t))}},tt=t=>{let e;return J(t)&&(({name:e}=t),null!=e&&(e=O(e)))?e:e=O(t)},et=["function","object","undefined"],nt=t=>e=>t in e,ot=new WeakMap;N(k,"name","classes",!1),N(p,"isPrototypeOf",Z),(()=>{const t="undefined"==typeof self?global:self;!t.hasOwnProperty("classes")&&(N(t,"classes",k),N(c,"getPrototypeListOf",q))})()}();