Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

browser build

  • Loading branch information...
commit e0364c582d057e99a0cc9ea0a7fb92348fe253ff 1 parent 8486651
Brandon Benvie authored

Showing 2 changed files with 89 additions and 42 deletions. Show diff stats Hide diff stats

  1. +88 41 meta-objects.browser.js
  2. +1 1  meta-objects.browser.min.js
129 meta-objects.browser.js
... ... @@ -1,6 +1,10 @@
1   -var meta = function(exports, global){
2   -function require(s){ return exports[s.slice(2)] }
  1 +"meta-objects" in window || (window["meta-objects"] = function(exports, global){
  2 +"use strict";
  3 +function require(s){ s = s.replace(/^[./]*/, ""); return typeof exports[s] === "function" ? exports : exports[s]; }
  4 +!function(){
  5 +
3 6 !function(exports){
  7 +"use strict";
4 8
5 9 var FP = Function.prototype,
6 10 OP = Object.prototype,
@@ -125,12 +129,22 @@ function extend(to, from){
125 129 var desc = value();
126 130
127 131 var fromBuiltin = isBuiltin(from);
128   - (fromBuiltin ? namesOwn : keys)(from).forEach(function(key){
129   - if (!hasOwn(to, key) && !fromBuiltin || typeof from[key] === 'function') {
130   - desc.value = from[key];
131   - define(to, key, desc);
132   - }
133   - });
  132 +
  133 + if (!fromBuiltin && Array.isArray(from)) {
  134 + from.forEach(function(item){
  135 + if (typeof item === 'function' && item.name) {
  136 + desc.value = item;
  137 + define(to, item.name.replace(/_$/, ''), desc);
  138 + }
  139 + });
  140 + } else {
  141 + (fromBuiltin ? namesOwn : keys)(from).forEach(function(key){
  142 + if (!hasOwn(to, key) && !fromBuiltin || typeof from[key] === 'function') {
  143 + desc.value = from[key];
  144 + define(to, key, desc);
  145 + }
  146 + });
  147 + }
134 148 if (arguments.length > 2)
135 149 extend(to, arguments[2]);
136 150 return to;
@@ -301,10 +315,11 @@ forEach(O, function(fn, key){
301 315 });
302 316
303 317
  318 +}(typeof window !== 'undefined' ? (exports.utility = {}) : typeof exports === 'undefined' ? this : exports);
304 319
305   -}(exports.utility={});
  320 +}();
306 321
307   -!function(exports){
  322 +!function(){
308 323
309 324 var _Object = require('./utility').Object;
310 325
@@ -431,9 +446,9 @@ WrapMap.prototype = {
431 446
432 447 exports.WrapMap = WrapMap;
433 448
434   -}(exports.WrapMap={});
  449 +}();
435 450
436   -!function(exports){
  451 +!function(){
437 452
438 453 var _Array = require('./utility').Array;
439 454
@@ -555,13 +570,15 @@ Emitter.prototype = {
555 570 exports.Emitter = Emitter;
556 571 exports.Event = Event;
557 572
558   -}(exports.Emitter={});
  573 +}();
559 574
560   -!function(exports){
  575 +!function(){
561 576
562 577
563 578 var _Function = require('./utility').Function;
564 579 var _Object = require('./utility').Object;
  580 +var _Array = require('./utility').Array;
  581 +var O = require('./utility').O;
565 582 var Descriptor = require('./utility').Descriptor;
566 583
567 584
@@ -778,7 +795,7 @@ function proxy(target, handler, callable){
778 795 if (typeof trapHandler !== 'function')
779 796 return _Function.applying(forwarder[trap], handler, [target].concat(args));
780 797 else
781   - return trapHandler.apply(handler, [makeFwd(args, trap), target].concat(args));
  798 + return _Function.applying(trapHandler, handler, [makeFwd(args, trap), target].concat(args));
782 799 }
783 800 }
784 801 });
@@ -803,9 +820,9 @@ function proxy(target, handler, callable){
803 820
804 821 exports.proxy = proxy;
805 822
806   -}(exports.proxy={});
  823 +}();
807 824
808   -!function(exports){
  825 +!function(){
809 826
810 827 var _Array = require('./utility').Array;
811 828 var _Function = require('./utility').Function;
@@ -892,9 +909,9 @@ function membrane(handlers){
892 909
893 910 exports.membrane = membrane;
894 911
895   -}(exports.membrane={});
  912 +}();
896 913
897   -!function(exports){
  914 +!function(){
898 915
899 916 var proxy = require('./proxy').proxy;
900 917 var _Array = require('./utility').Array;
@@ -1045,9 +1062,9 @@ Multiproto.prototype = function(){
1045 1062
1046 1063 exports.multiherit = multiherit;
1047 1064
1048   -}(exports.multiherit={});
  1065 +}();
1049 1066
1050   -!function(exports){
  1067 +!function(){
1051 1068
1052 1069 var proxy = require('./proxy').proxy;
1053 1070 var membrane = require('./membrane').membrane;
@@ -1114,9 +1131,9 @@ exports.tracer = function tracer(object, name){
1114 1131 exports.TraceEmitter = TraceEmitter;
1115 1132 exports.TraceEvent = TraceEvent;
1116 1133
1117   -}(exports.tracer={});
  1134 +}();
1118 1135
1119   -!function(exports){
  1136 +!function(){
1120 1137
1121 1138 var _Function = require('./utility').Function;
1122 1139 var _Object = require('./utility').Object;
@@ -1154,9 +1171,9 @@ var handler = {
1154 1171
1155 1172 exports.callable = callable;
1156 1173
1157   -}(exports.callable={});
  1174 +}();
1158 1175
1159   -!function(exports){
  1176 +!function(){
1160 1177
1161 1178 var O = require('./utility').O;
1162 1179 var proxy = require('./proxy').proxy;
@@ -1488,9 +1505,9 @@ exports.interceptor = function interceptor(name, Ctor, inherits){
1488 1505 return ctor;
1489 1506 }
1490 1507
1491   -}(exports.interceptor={});
  1508 +}();
1492 1509
1493   -!function(exports){
  1510 +!function(){
1494 1511
1495 1512 var proxy = require('./proxy').proxy;
1496 1513
@@ -1533,12 +1550,40 @@ Doppelganger.prototype = {
1533 1550
1534 1551 exports.doppelganger = doppelganger;
1535 1552
1536   -}(exports.doppelganger={});
  1553 +}();
1537 1554
1538   -!function(exports){
  1555 +!function(){
1539 1556
1540 1557 var _Object = require('./utility').Object;
1541 1558
  1559 +var HashMap = function(){
  1560 + var hashmaps = new WeakMap;
  1561 +
  1562 + function HashMap(){
  1563 + hashmaps.set(this, Object.create(null));
  1564 + }
  1565 +
  1566 + _Object.extend(HashMap.prototype, [
  1567 + function has(key){
  1568 + return key in hashmaps.get(this);
  1569 + },
  1570 + function get(key){
  1571 + return hashmaps.get(this)[key];
  1572 + },
  1573 + function set(key, value){
  1574 + return hashmaps.get(this)[key] = value;
  1575 + },
  1576 + function delete_(key){
  1577 + var ret = this.has(key);
  1578 + if (ret)
  1579 + delete hashmaps.get(this)[key];
  1580 + return ret;
  1581 + }
  1582 + ]);
  1583 +
  1584 + return HashMap;
  1585 +}();
  1586 +
1542 1587
1543 1588 function Store(values){
1544 1589 if (_Object.isObject(values))
@@ -1571,17 +1616,19 @@ Store.prototype = Object.create(null, {
1571 1616
1572 1617
1573 1618 exports.namespace = function namespace(){
1574   - var storage = new WeakMap;
1575   - return function unwrap(obj, values){
1576   - var ret = storage.get(obj);
1577   - if (!ret) {
1578   - ret = new Store(values);
1579   - storage.set(obj, ret);
  1619 + var ostore = new WeakMap
  1620 + var pstore = new HashMap;
  1621 + return function unwrap(target, values){
  1622 + var store = _Object.isObject(target) ? ostore : pstore;
  1623 + var data = store.get(target);
  1624 + if (!data) {
  1625 + data = new Store(values);
  1626 + store.set(target, data);
1580 1627 }
1581   - return ret;
1582   - };
1583   -};
  1628 + return data;
  1629 + }
  1630 +}
1584 1631
1585   -}(exports.namespace={});
1586   -console.log(exports);
1587   -}({}, this);
  1632 +}();
  1633 +return exports;
  1634 +}({}, this));
2  meta-objects.browser.min.js
... ... @@ -1 +1 @@
1   -var meta=function(exports,global){function require(s){return exports[s.slice(2)]}return!function(exports){var FP=Function.prototype,OP=Object.prototype,AP=Array.prototype,bindbind=FP.bind.bind(FP.bind),callbind=bindbind(FP.call),applybind=bindbind(FP.apply),calling=callbind(FP.call),binding=callbind(FP.bind),applying=callbind(FP.apply),hasOwn=callbind(OP.hasOwnProperty),flatten=applybind(AP.concat),concat=callbind(AP.concat),map=callbind(AP.map),define=Object.defineProperty,defines=Object.defineProperties,describeOwn=Object.getOwnPropertyDescriptor,describe=getPropertyDescriptor,describeAllOwn=getOwnPropertyDescriptors,describeAll=getPropertyDescriptors,namesOwn=Object.getOwnPropertyNames,names=getPropertyNames,keys=Object.keys,getProto=Object.getPrototypeOf,create=Object.create,types=[Array,Boolean,Date,Function,Map,Number,Object,RegExp,Set,String,WeakMap];function Descriptor(type,valueOrGet,readonlyOrSet,hidden,frozen){this[type?"setAccessors":"setValue"](valueOrGet,readonlyOrSet),hidden&&(this.enumerable=!1),frozen&&(this.configurable=!1)}Descriptor.VALUE=0,Descriptor.ACCESSOR=1,Descriptor.prototype={constructor:Descriptor,configurable:!0,enumerable:!0,setValue:function setValue(value,readonly){this.value=value,this.writable=!readonly},setAccessors:function setAccessors(get,set){this.get=get,this.set=set}};function value(v,h,r,f){return new Descriptor(0,v,r,h,f)}function hiddenValue(v,r,f){return new Descriptor(0,v,r,!0,f)}function accessor(g,s,h,f){return new Descriptor(1,g,s,h,f)}function hiddenAccessor(g,s,f){return new Descriptor(1,g,s,!0,f)}function isAccessor(desc){return isObject(desc)&&("get"in desc||"set"in desc)&&!("value"in desc)}function isValue(desc){return isObject(desc)&&!("get"in desc||"set"in desc)&&"value"in desc}function isBuiltin(o){return types.indexOf(o)>-1}function forEach(o,callback,context,hidden){context===!0?(hidden=!0,context=o):context=context||o,(hidden===!0?namesOwn:keys)(Object(o)).forEach(function(key){callback.call(context,o[key],key,o)})}function getOwnPropertyDescriptors(o){var out={};return namesOwn(o).forEach(function(key){out[key]=describeOwn(o,key)}),out}function getPropertyDescriptors(o){var out={};return names(o).forEach(function(key){out[key]=describe(o,key)}),out}function extend(to,from){to=Object(to),from=Object(from);if(isBuiltin(to)||keys(to).length===0&&names(to)>0)var desc=hiddenValue();else var desc=value();var fromBuiltin=isBuiltin(from);return(fromBuiltin?namesOwn:keys)(from).forEach(function(key){if(!hasOwn(to,key)&&!fromBuiltin||typeof from[key]=="function")desc.value=from[key],define(to,key,desc)}),arguments.length>2&&extend(to,arguments[2]),to}function make(o,p){return p?extend(create(o),p):create(o)}function clone(o){return create(getProto(o),describeAllOwn(o))}function isObject(o){return o!==null&&typeof o=="object"||typeof o=="function"}function isPrimitive(o){return o==null||typeof o!="object"&&typeof o!="function"}function getPropertyDescriptor(o,n){while(isObject(o)){var desc=describeOwn(o,n);if(desc)return desc;o=getProto(o)}return undefined}function getPropertyNames(o){var out=[];while(isObject(o))out.push(namesOwn(o)),o=getProto(o);return unique(flatten(out))}function parameters(fn){return(fn+="").slice(fn.indexOf("(")+1,fn.indexOf(")")).split(/\s*,\s*/)}function unique(a){return keys(a.reduce(function(r,s){return r[s]=1,r},{}))}var slice=function(){var _slice=[].slice;return function slice(a,o,p){switch(a.length){case 0:return[];case 1:return o?[]:[a[0]];default:return _slice.call(a,o,p);case 2:a=[a[0],a[1]]}return o||p?a.slice(o,p):a}}(),brandName=function(){var brands={};return types.forEach(function(Ctor){hasOwn(Ctor.prototype,"toString")&&define(Ctor,"stringify",hiddenValue(callbind(Ctor.prototype.toString))),brands["[object "+Ctor.name+"]"]=Ctor.prototype}),function brandName(o){var brand=Object.stringify(o);return brand in brands?brands[brand]:brand}}();exports.Descriptor=extend(Descriptor,{value:value,hiddenValue:hiddenValue,accessor:accessor,hiddenAccessor:hiddenAccessor,isValue:isValue,isAccessor:isAccessor}),exports.Object=extend(function Object(o){return global.Object(o)},{isObject:isObject,isPrimitive:isPrimitive,getPropertyDescriptor:getPropertyDescriptor,getPropertyNames:getPropertyNames,getOwnPropertyDescriptors:getOwnPropertyDescriptors,getPropertyDescriptors:getPropertyDescriptors,hasOwn:hasOwn,extend:extend,forEach:forEach,brandName:brandName},Object),exports.Function=extend({parameters:parameters,bindbind:bindbind,callbind:callbind,applybind:applybind,calling:calling,binding:binding,applying:applying},Function),exports.Array=extend(function Array(n){return global.Array.apply(null,global.Array(n))},{unique:unique,slice:slice,flatten:flatten},global.Array),namesOwn(Array.prototype).forEach(function(key){!exports.Array[key]&&typeof Array.prototype[key]=="function"&&(exports.Array[key]=callbind(Array.prototype[key]))}),exports.RegExp=extend(function RegExp(s,t){return new global.RegExp(s,t)},{test:callbind(RegExp.prototype.test),exec:callbind(RegExp.prototype.exec),testable:bindbind(RegExp.prototype.test),execable:bindbind(RegExp.prototype.exec)});function O(o){if(!(this instanceof O))return new O(o);define(this,"o",{value:o})}exports.O=extend(O,{extend:extend,brand:brandName,isObj:isObject,notObj:isPrimitive,create:Object.create,define:Object.defineProperty,defines:Object.defineProperties,getProto:Object.getPrototypeOf,describe:getPropertyDescriptor,describeOwn:Object.getOwnPropertyDescriptor,describeAll:getPropertyDescriptors,describeAllOwn:getOwnPropertyDescriptors,names:getPropertyNames,namesOwn:Object.getOwnPropertyNames,keys:Object.keys,each:forEach,has:hasOwn}),forEach(O,function(fn,key){typeof fn=="function"&&(O.prototype[key]=function(){return fn.apply(null,flatten(this.o,arguments))})})}(exports.utility={}),!function(exports){var _Object=require("./utility").Object;function lookup(o){if(!wrapmaps.has(o))throw new TypeError("WrapMaps are not generic");return wrapmaps.get(o)}var wrapmaps=new WeakMap;function WrapMap(wrapper){var wrapped=new WeakMap,unwrapped=new WeakMap;if(typeof wrapper=="function")var wrap=function wrap(o,isDescriptor){if(isDescriptor===!0)return wrapDescriptor(o);if(_Object.isPrimitive(o)||wrapped.has(o))return o;if(unwrapped.has(o))return unwrapped.get(o);var p=wrapper(o);return _Object.isObject(p)&&(wrapped.set(p,o),unwrapped.set(o,p)),p};else var wrap=function wrap(o,p){return _Object.isPrimitive(o)||wrapped.has(o)?o:unwrapped.has(o)?unwrapped.get(o):(_Object.isObject(p)&&(wrapped.set(p,o),unwrapped.set(o,p)),p)};function unwrap(o,isDescriptor){return isDescriptor===!0?unwrapDescriptor(o):_Object.isPrimitive(o)||!wrapped.has(o)?o:wrapped.get(o)}function has(o){return Object.isObject(o)&&wrapped.has(o)}function remove(o){var p=unwrap(o);return o!==p&&wrapped.delete(o),p}function wrapDescriptor(o){return _Object.isObject(o)&&!wrapped.has(o)&&(o.value&&(o.value=wrap(o.value)),o.set&&(o.set=wrap(o.set)),o.get&&(o.get=wrap(o.get))),o}function unwrapDescriptor(o){return _Object.isObject(o)&&wrapped.has(o)&&(o.value&&(o.value=unwrap(o.value)),o.set&&(o.set=unwrap(o.set)),o.get&&(o.get=unwrap(o.get))),o}var self=this===global?Object.create(WrapMap.prototype):this;return self.wrap=wrap,self.unwrap=unwrap,self.remove=remove,self.has=has,wrapmaps.set(self,{wrap:wrap,unwrap:unwrap,remove:remove,has:has}),self}WrapMap.prototype={constructor:WrapMap,wrap:function wrap(o,p){return lookup(this).wrap(o,p)},unwrap:function unwrap(o){return lookup(this).unwrap(o)},remove:function remove(o){return lookup(this).remove(o)},has:function has(o){return lookup(this).has(o)}},exports.WrapMap=WrapMap}(exports.WrapMap={}),!function(exports){var _Array=require("./utility").Array;function Event(type,target){this.type=type,this.target=target}function ErrorEvent(error,event,target){Event.call(this,"error",target),this.error=error,this.event=event}var emitters=new WeakMap,receivers=new WeakMap;function _(o){if(!emitters.has(o)){var ret={};return receivers.set(o,o),emitters.set(o,ret),ret}return emitters.get(o)}function Emitter(){emitters.set(this,{}),receivers.set(this,this)}Emitter.Event=Event,Emitter.forward=function forward(from,to){emitters.has(to)||(emitters.set(to,{}),receivers.set(to,to)),emitters.set(from,emitters.get(to)),from.on=Emitter.prototype.on.bind(to),from.off=Emitter.prototype.off.bind(to)},Emitter.prototype={constructor:Emitter,on:function on(events,listener){var listeners=_(this);events.split(" ").forEach(function(event){event in listeners?listeners[event].push(listener):listeners[event]=[listener]})},off:function off(events,listener){var listeners=_(this);events.split(" ").forEach(function(event){listeners[event]&&listeners[event].splice(listeners[event].indexOf(listener),1)})},offAll:function offAll(event){delete _(this)[event]},once:function once(event,listener){var self=this;this.on(event,function(){return self.off(event,listener),listener.apply(receivers.get(self),arguments)})},isListened:function isListened(type){var events=_(this),listeners=events[type]||events["*"];return Boolean(listeners&&listeners.length)},emit:function emit(type){var event,events=_(this);typeof type!="string"&&type.type&&(event=type,type=type.type);if(events["*"])var listeners=events[type]?events["*"].concat(events[type]):events["*"];else var listeners=events[type];if(listeners&&listeners.length){event=event||new Event(type,receivers.get(this));var args=[event].concat(_Array.slice(arguments,1));for(var i=0;i<listeners.length;i++)try{listeners[i].apply(this,args)}catch(e){this.emit(new ErrorEvent(e,event,listeners[i]))}}}},exports.Emitter=Emitter,exports.Event=Event}(exports.Emitter={}),!function(exports){var _Function=require("./utility").Function,_Object=require("./utility").Object,Descriptor=require("./utility").Descriptor,createProxyObject=Proxy.create,createProxyFunction=Proxy.createFunction,wmhas=_Function.callbind(WeakMap.prototype.has),wmget=_Function.callbind(WeakMap.prototype.get),wmset=_Function.callbind(WeakMap.prototype.set),wmdelete=_Function.callbind(WeakMap.prototype.delete),wmhasget=function hasget(wm,obj){return _Object.isObject(obj)&&(wm=wmget(wm,obj))===undefined?obj:wm},checkArray=function(){var wrapped=new WeakMap,isArr=Array.isArray;return Array.isArray=function isArray(){var a=arguments[0];return isArr(a)?!0:_Object.isPrimitive(a)?!1:wmhas(wrapped,a)},function(o,p){isArr(o)&&wmset(wrapped,o,!0)}}(),checkToString=function(){var wrapped=new WeakMap;return[Function,RegExp,Object,Date].forEach(function(Ctor){function toString(){return Ctor.stringify(wmhasget(wrapped,this))}wmset(wrapped,toString,Ctor.prototype.toString),Ctor.prototype.toString=toString}),function(o,p){wmset(wrapped,p,o)}}();function definer(o,n,v,newDesc){return o[n]=v,!0}function setter(desc,rcvr,val){var exists=desc.set!=null;return exists&&_Function.calling(desc.set,rcvr,val),exists}function configurable(desc){return desc&&(desc.configurable=!0),desc}var trapMap={getOwnPropertyDescriptor:"describe",getOwnPropertyNames:"names",getPropertyNames:"names",defineProperty:"define","delete":"delete",fix:"fix",keys:"keys",enumerate:"enumerate",hasOwn:"owns",has:"has",get:"get",set:"set",apply:"apply",construct:"construct"},forwarder={proto:function(T){return O.getProto(T)},describe:function(T,N){return configurable(O.describeOwn(T,N))},define:function(T,N,D){return O.define(T,N,D),!0},"delete":function(T,N){return delete T[N]},fix:function(T){return Object.freeze(T)},keys:function(T){return O.keys(T)},names:function(T){return O.namesOwn(T)},enumerate:function(T){var i=0,a=[];for(a[i++]in T);return a},owns:function(T,N){return O.has(T,N)},has:function(T,N){return N in T},get:function(T,N,R){var handler=wmget(proxies,T);if(handler!=null)return wmget(handler,R,N);if(N==="__proto__")return O.getProto(T);try{var desc=O.describeOwn(T,N)}catch(e){return R[N]}if(desc==null){var proto=O.getProto(T);if(proto!=null)return forwarder.get(proto,N,R)}else{if(Descriptor.isValue(desc))return desc.value;if(Descriptor.isAccessor(desc)&&typeof desc.get=="function")return _Function.calling(desc.get,R)}return undefined},set:function(T,N,V,R){var handler=wmget(proxies,T);if(handler!=null)return handler.set(R,N,V);if(N==="__proto__")return _Object.isObject(V)?(T.__proto__=V)&&!0:!1;try{var oDesc=O.describeOwn(T,N)}catch(e){return R[N]=V,!0}if(oDesc)return Descriptor.isAccessor(oDesc)?setter(oDesc,R,V):oDesc.writable?definer(R,N,V,R!==T):!1;var proto=O.getProto(T);return proto===null?definer(R,N,V,!0):forwarder.set(proto,N,V,R)},apply:function(T,A,R){return _Function.applying(T,R,A)},construct:function(T,A){var handler=wmget(proxies,T);if(handler!=null)return handler.construct(T,A);var result=new(_Function.applying(Function.bind,T,[null].concat(A)));return _Object.isObject(result)?result:O.create(T.prototype)}},proxies=new WeakMap,targets=new WeakMap;function proxy(target,handler,callable){if(!_Object.isObject(target))throw new TypeError("Target must be an object");if(!_Object.isObject(handler))throw new TypeError("Handler must be an object");function makeFwd(args,trap){var fwd=function(){return _Function.applying(forwarder[fwd.trap],handler,[fwd.target].concat(fwd.args))};return fwd.target=target,fwd.args=args,fwd.trap=trap,fwd}var metaHandler=createProxyObject({get:function get(R,trap){if(trap==="getPropertyDescriptor")return function(n){return configurable(get(null,"getOwnPropertyDescriptor")(n)||O.describe(O.getProto(target)))};if(trap==="getPropertyNames")return function(){return _Array.unique(get(null,"getOwnPropertyNames")().concat(O.names(O.getProto(target))))};trap=trapMap[trap];var trapHandler=handler[trap];return function finalize(){var args=_Array.slice(arguments);if(trap==="get"||trap==="set")args=_Array.concat(args.slice(1),args[0]),args[0]==="__proto__"&&(trapHandler=handler.proto);return typeof trapHandler!="function"?_Function.applying(forwarder[trap],handler,[target].concat(args)):trapHandler.apply(handler,[makeFwd(args,trap),target].concat(args))}}});if(callable===!0||callable==null&&typeof target=="function")var reflectProxy=createProxyFunction(metaHandler,function(){return metaHandler.apply(_Array.slice(arguments),this)},function(){return metaHandler.construct(_Array.slice(arguments))});else var reflectProxy=createProxyObject(metaHandler,O.getProto(target));return wmset(proxies,reflectProxy,metaHandler),wmset(targets,reflectProxy,target),checkArray(target,reflectProxy),checkToString(target,reflectProxy),reflectProxy}exports.proxy=proxy}(exports.proxy={}),!function(exports){var _Array=require("./utility").Array,_Function=require("./utility").Function,_Object=require("./utility").Object,proxy=require("./proxy").proxy,WrapMap=require("./WrapMap").WrapMap,fakehandler={};function membrane(handlers){if(_Object.isPrimitive(handlers))throw Error("Handlers must be provided");var wrapper=new WrapMap(function(target){return proxy(target,proxy(fakehandler,{get:function membraneHandlerGet(f,t,trap){return function membraneMetaHandler(fwd,faketarget){var handler=handlers[trap],args=_Array.slice(arguments);args[1]=fwd.target=wrapper.unwrap(faketarget);if(handler){var origfwd=fwd;fwd=function fwd(){return _Function.applying(handler,handlers,args)},fwd.args=origfwd.args}return _Function.applying(wrapHandler[trap],null,_Array.concat([fwd],_Array.slice(args,1)))}}}))});function forward(fwd){return fwd()}var wrapHandler={names:forward,enumerate:forward,keys:forward,"delete":forward,owns:forward,has:function has(){return!0},proto:function proto(fwd,target){return wrapper.wrap(fwd())},fix:function fix(fwd,target){throw target},define:function define(fwd,target,name,desc){return wrapper.unwrap(desc,!0),fwd()},describe:function describe(fwd,target,name){return wrapper.wrap(fwd(),!0)},get:function get(fwd,target,name,rcvr){return fwd.args[1]=wrapper.unwrap(rcvr),wrapper.wrap(fwd())},set:function set(fwd,target,name,val,rcvr){return fwd.args[1]=wrapper.unwrap(val),fwd.args[2]=wrapper.unwrap(rcvr),fwd()},apply:function apply(fwd,target,args,rcvr){return fwd.args[0]=_Array.map(args,wrapper.unwrap),fwd.args[1]=wrapper.unwrap(rcvr),wrapper.wrap(fwd())},construct:function construct(fwd,target,args){return fwd.args[0]=_Array.map(args,wrapper.unwrap),wrapper.wrap(fwd())}};return wrapper}exports.membrane=membrane}(exports.membrane={}),!function(exports){var proxy=require("./proxy").proxy,_Array=require("./utility").Array,_Function=require("./utility").Function,O=require("./utility").O;function multiherit(o){o.params=o.params||[];var arglist=o.ctors.map(function(ctor,i){return Array.isArray(o.params[i])?o.params[i]:_Function.parameters(ctor).map(function(param){return o.params.indexOf(param)})}),protos=o.ctors.map(function(ctor){return ctor.prototype});return new MultiCtor(new Multiproto(protos),arglist,o)}function MultiCtor(proto,params,o){var ctors=o.ctors;function Ctor(){var args=arguments;for(var i=0;i<ctors.length;i++)_Function.applying(ctors[i],this,params[i].map(function(i){return args[i]}));return this}return Ctor.prototype=proto,proto.constructor=Ctor,this.name=o.name||ctors.map(function(ctor){return ctor.name}).join(""),this.createInstance=instanceCreator(proto,o.onCall,o.onConstruct),proxy(Ctor,this)}function toString(){return"function "+this.name+"() { [native code] }"}MultiCtor.prototype={get:function(fwd,target,name,rcvr){return name==="name"?this.name:name==="toString"?toString:fwd()},describe:function(fwd,target,name){if(name==="name"){var desc=fwd();return desc.value=this.name,desc}return fwd()},call:function(fwd,target,args,rcvr){return this.construct(fwd,target,args)},construct:function(fwd,target,args){return _Function.applying(target,this.createInstance(),args)}};function instanceCreator(proto,call,construct){if(call||construct){var handler={apply:function(fwd,target,args,rcvr){return _Function.applying(call,rcvr,args)},construct:function(fwd,target,args){return construct?_Function.applying(construct,Object.create(target.prototype),args):_Function.applying(call,global,args)}};return function(){var fake=function(){};return fake.__proto__=proto,proxy(fake,handler)}}return function(){return Object.create(proto)}}function Multiproto(protos){this.protos=protos=Object.freeze(protos.slice());var proto=Object.create(null,{inherits:{configurable:!0,value:protos}});return proxy(proto,this)}Multiproto.prototype=function(){function list(fwd,target){return _Array.unique(this.protos.reduce(function(ret,proto){return fwd.target=proto,ret.concat(fwd())},fwd())).filter(function(s){return!(s in Object.prototype)})}function has(fwd,target,name){if(fwd())return!0;for(var i=0;i<this.protos.length;i++){fwd.target=this.protos[i];if(fwd())return!0}return!1}return{names:list,keys:list,enumerate:list,hasOwn:has,has:has,describe:function(fwd,target,name){var desc=fwd();if(desc)return desc;for(var i=0;i<this.protos.length;i++){fwd.target=this.protos[i],desc=fwd();if(desc)return desc}return undefined},get:function(fwd,target,name,rcvr){var ret,i=0;while(typeof ret=="undefined"&&fwd.target)ret=fwd(),fwd.target=this.protos[i++];return ret}}}(),exports.multiherit=multiherit}(exports.multiherit={}),!function(exports){var proxy=require("./proxy").proxy,membrane=require("./membrane").membrane,Emitter=require("./Emitter").Emitter;function TraceEmitter(object,name){var self=this instanceof TraceEmitter?this:Object.create(TraceEmitter.prototype);name=name||"root",Emitter.call(this);var wrapper=membrane(proxy({},{get:function get(f,t,trap){return function(fwd,target,prop){var ret=fwd();return self.emit(new TraceEvent(trap,target,fwd.args,ret)),ret}}}));this.unwrap=wrapper.unwrap,this[name]=wrapper.wrap(object)}TraceEmitter.prototype=Object.create(Emitter.prototype),TraceEmitter.prototype.constructor=TraceEmitter;function TraceEvent(type,target,args,result){this.type=type,this.target=target,this.result=result;var i=0;switch(type){case"keys":case"names":case"enumerate":case"fix":break;case"set":case"define":this.result===!0&&delete this.result,this.value=args[1];case"get":case"describe":this.property=args[0];break;case"apply":this.context=args[1];case"construct":this.name=target.name,this.args=args[0]}}TraceEvent.prototype=Object.create(Emitter.Event.prototype),TraceEvent.prototype.constructor=TraceEvent,exports.tracer=function tracer(object,name){return new TraceEmitter(object,name)},exports.TraceEmitter=TraceEmitter,exports.TraceEvent=TraceEvent}(exports.tracer={}),!function(exports){var _Function=require("./utility").Function,_Object=require("./utility").Object,proxy=require("./proxy").proxy;function callable(obj){return proxy(obj,handler,!0)}function list(fwd){return fwd().filter(function(s){return s!=="$$call"&&s!=="$$construct"&&!_Object.hasOwn(s)})}var handler={enumerate:list,keys:list,names:list,apply:function(fwd,target,args,rcvr){var call=target.$$call;return call?_Function.applying(call,target,args):undefined},construct:function(fwd,target,args){var construct=target.$$construct,instance=proxy(Object.create(target),handler,!0);if(construct){var result=_Function.applying(construct,instance,args);return _Object.isObject(result)?result:instance}return instance}};exports.callable=callable}(exports.callable={}),!function(exports){var O=require("./utility").O,proxy=require("./proxy").proxy,WrapMap=require("./WrapMap").WrapMap,Descriptor=require("./utility").Descriptor,store=new WrapMap,wrap=store.wrap,unwrap=store.unwrap;function listAccessors(o,p){var out=p||O.create(null);do O.namesOwn(o).forEach(function(prop){var desc=O.describeOwn(o,prop);if(desc.get||desc.set)out[prop]=desc}),o=O.getProto(o);while(o);return out}var Interceptor=function(){function list(fwd,target){return fwd().concat(this.properties)}function owns(fwd,target,prop){return fwd()||prop in this.accessors}function Interceptor(name,accessors,proto){var brand="[object "+name+"]";this.accessors=accessors,this.prototype=proto,this.stringifier=Descriptor.hiddenValue(O.has(proto,"toString")?proto.toString:function toString(){return brand}),this.properties=O.keys(accessors)}return Interceptor.keys=Object.freeze(Object.create(null)),Interceptor.prototype={getter:function(target,prop){return this.accessors[prop].get.call(unwrap(target))},setter:function(target,prop,value){return this.accessors[prop].set.call(unwrap(target),value)},names:list,keys:list,enumerate:list,has:owns,owns:owns,proto:function(fwd,target){return this.fakeproto},describe:function(fwd,target,prop){if(prop==="toString"&&!O.has(target,"toString"))return this.stringifier;if(prop in this.accessors){var desc=O.describeOwn(this.prototype,prop);return{enumerable:desc.enumerable,configurable:!0,writable:Boolean(desc.set),value:desc.get.call(unwrap(target))}}return fwd()},define:function(fwd,target,prop,desc){return prop in this.accessors?this.setter(target,prop,desc.value):fwd()},get:function(fwd,target,prop,rcvr){return prop==="toString"&&!O.has(target,"toString")?this.stringifier.value:prop in this.accessors?this.getter(target,prop):fwd()},set:function(fwd,target,prop,value,rcvr){return prop in this.accessors?this.setter(target,prop,value):fwd()}},Interceptor}(),IndexedInterceptor=function(){var Ceptor=Interceptor.prototype;function numbers(start,end){isFinite(end)||(end=start,start=0);var length=end-start;if(end>numbers.cache.length)while(length--)numbers.cache[length+start]=length+start+"";return numbers.cache.slice(start,end)}numbers.cache=[];function list(fwd,target){return numbers(this.prototype.length.call(unwrap(target))).concat(this.properties,fwd())}function has(fwd,target,prop){return isFinite(prop)?prop<this.prototype.length.call(unwrap(target)):prop in this.accessors||fwd()}function IndexedInterceptor(name,accessors,proto){Interceptor.apply(this,arguments),this.properties.push("length")}var indexed=IndexedInterceptor.keys=Object.create(null);return indexed.get=!0,indexed.set=!0,indexed.length=!0,Object.freeze(indexed),IndexedInterceptor.prototype={__proto__:Ceptor,names:list,keys:list,enumerate:list,has:has,owns:has,describe:function(fwd,target,prop){return isFinite(prop)&&this.prototype.get?Descriptor.value(this.prototype.get.call(unwrap(target),prop)):prop==="length"?Descriptor.hiddenValue(this.prototype.length.call(unwrap(target)),!0):Ceptor.describe.apply(this,arguments)},define:function(fwd,target,prop,desc){return isFinite(prop)&&this.prototype.set?this.prototype.set.call(unwrap(target),prop,value):Ceptor.define.apply(this,arguments)},get:function(fwd,target,prop,rcvr){return isFinite(prop)&&this.prototype.get?this.prototype.get.call(unwrap(target),prop):prop==="length"?this.prototype.length.call(unwrap(target)):Ceptor.get.apply(this,arguments)},set:function(fwd,target,prop,value,rcvr){return isFinite(prop)&&this.prototype.set?this.prototype.set.call(unwrap(target),prop,value):Ceptor.set.apply(this,arguments)}},IndexedInterceptor}(),NamedInterceptor=function(){var Ceptor=Interceptor.prototype;function list(fwd,target){return this.prototype.list.call(unwrap(target)).concat(this.properties,fwd())}function has(fwd,target,prop){return fwd()||this.prototype.has.call(unwrap(target),prop)}function NamedInterceptor(name,accessors,proto){Interceptor.apply(this,arguments)}var named=NamedInterceptor.keys=Object.create(null);return named.get=!0,named.set=!0,named.has=!0,named.list=!0,Object.freeze(named),NamedInterceptor.prototype={__proto__:Ceptor,names:list,keys:list,enumerate:list,has:has,owns:has,describe:function(fwd,target,prop){var inst=unwrap(target);return this.prototype.has.call(inst,prop)?Descriptor.value(this.prototype.get.call(inst,prop)):prop in this.accessors?Ceptor.describe.apply(this,arguments):prop in this.fakeproto?fwd():Descriptor.value(this.prototype.get.call(unwrap(target),prop))},define:function(fwd,target,prop,desc){var inst=unwrap(target);return this.prototype.has.call(inst,prop)?this.prototype.set.call(inst,prop,desc.value):prop in this.accessors?this.setter(target,prop,desc.value):this.prototype.set.call(unwrap(target),prop,value)},get:function(fwd,target,prop,rcvr){var inst=unwrap(target);return this.prototype.has.call(inst,prop)?this.prototype.get.call(inst,prop):prop in this.accessors?this.getter(target,prop):fwd()},set:function(fwd,target,prop,value,rcvr){var inst=unwrap(target);return this.prototype.has.call(inst,prop)?this.prototype.set.call(inst,prop,value):prop in this.accessors?this.setter(target,prop,value):this.prototype.set.call(unwrap(target),prop,value)}},NamedInterceptor}(),Constructor=function(){var stringifier=Descriptor.hiddenValue(function toString(){return"function "+this.name+"() { [native code] }"});function Constructor(name,ctor,template){return this.template=template,this.ctor=ctor,proxy(Function("return function "+name+"(){}")(),this)}return Constructor.prototype={describe:function(fwd,target,prop){return prop==="prototype"?Descriptor.hiddenValue(this.template.fakeproto):prop==="toString"?stringifier:fwd()},get:function(fwd,target,prop,rcvr){return prop==="prototype"?this.template.fakeproto:prop==="toString"?stringifier.value:fwd()},apply:function(fwd,target,args,rcvr){var inst=Object.create(this.template.fakeproto),out=proxy(inst,this.template);return wrap(out,inst),this.ctor.apply(out,args),out},construct:function(fwd,target,args){var inst=Object.create(this.template.fakeproto),out=proxy(inst,this.template);return wrap(out,inst),this.ctor.apply(out,args),out}},Constructor}(),protos=new WeakMap;exports.interceptor=function interceptor(name,Ctor,inherits){typeof name=="function"&&(inherits=Ctor,Ctor=name,name=Ctor.name);var proto=Ctor.prototype,accessors=listAccessors(proto);inherits&&listAccessors(protos.get(inherits),accessors);var Template="length"in proto?IndexedInterceptor:"list"in proto?NamedInterceptor:Interceptor,template=new Template(name,accessors,proto),ctor=new Constructor(name,Ctor,template);return template.fakeproto=O.keys(proto).reduce(function(ret,key){if(!(key in accessors||key in Template.keys)){var desc=O.describe(proto,key);key==="constructor"&&(desc.value=ctor),desc.enumerable=!1,O.define(ret,key,desc)}return ret},O.create(O.getProto(proto))),protos.set(template.fakeproto,proto),ctor}}(exports.interceptor={}),!function(exports){var proxy=require("./proxy").proxy;function doppelganger(callable){var handler=new Doppelganger,doppel=proxy(handler.target,handler,callable);return function changeInfo(into){handler.target=Object(into);if(doppel)return[doppel,doppel=null][0]}}function Doppelganger(){this.target={}}function targeter(fwd){return fwd.target=this.target,fwd()}Doppelganger.prototype={proto:targeter,names:targeter,describe:targeter,define:targeter,"delete":targeter,fix:targeter,keys:targeter,enumerate:targeter,owns:targeter,has:targeter,get:targeter,set:targeter,apply:targeter,construct:targeter},exports.doppelganger=doppelganger}(exports.doppelganger={}),!function(exports){var _Object=require("./utility").Object;function Store(values){_Object.isObject(values)&&this.set(values)}Store.prototype=Object.create(null,{set:{value:function set(key,value){_Object.isObject(key)?Object.keys(key).forEach(function(k){this[k]=key[k]},this):this[key]=value}},get:{value:function get(key){return Array.isArray(key)?key.reduce(function(r,k){return r[k]=this[k],r}.bind(this),{}):this[key]}},toString:{value:function toString(){return"[object Store]"}},valueOf:{value:Object.prototype.valueOf}}),exports.namespace=function namespace(){var storage=new WeakMap;return function unwrap(obj,values){var ret=storage.get(obj);return ret||(ret=new Store(values),storage.set(obj,ret)),ret}}}(exports.namespace={}),exports}({},this)
  1 +"meta-objects"in window||(window["meta-objects"]=function(exports,global){"use strict";function require(s){return s=s.replace(/^[./]*/,""),typeof exports[s]=="function"?exports:exports[s]}return!function(){!function(exports){"use strict";var FP=Function.prototype,OP=Object.prototype,AP=Array.prototype,bindbind=FP.bind.bind(FP.bind),callbind=bindbind(FP.call),applybind=bindbind(FP.apply),calling=callbind(FP.call),binding=callbind(FP.bind),applying=callbind(FP.apply),hasOwn=callbind(OP.hasOwnProperty),flatten=applybind(AP.concat),concat=callbind(AP.concat),map=callbind(AP.map),define=Object.defineProperty,defines=Object.defineProperties,describeOwn=Object.getOwnPropertyDescriptor,describe=getPropertyDescriptor,describeAllOwn=getOwnPropertyDescriptors,describeAll=getPropertyDescriptors,namesOwn=Object.getOwnPropertyNames,names=getPropertyNames,keys=Object.keys,getProto=Object.getPrototypeOf,create=Object.create,types=[Array,Boolean,Date,Function,Map,Number,Object,RegExp,Set,String,WeakMap];function Descriptor(type,valueOrGet,readonlyOrSet,hidden,frozen){this[type?"setAccessors":"setValue"](valueOrGet,readonlyOrSet),hidden&&(this.enumerable=!1),frozen&&(this.configurable=!1)}Descriptor.VALUE=0,Descriptor.ACCESSOR=1,Descriptor.prototype={constructor:Descriptor,configurable:!0,enumerable:!0,setValue:function setValue(value,readonly){this.value=value,this.writable=!readonly},setAccessors:function setAccessors(get,set){this.get=get,this.set=set}};function value(v,h,r,f){return new Descriptor(0,v,r,h,f)}function hiddenValue(v,r,f){return new Descriptor(0,v,r,!0,f)}function accessor(g,s,h,f){return new Descriptor(1,g,s,h,f)}function hiddenAccessor(g,s,f){return new Descriptor(1,g,s,!0,f)}function isAccessor(desc){return isObject(desc)&&("get"in desc||"set"in desc)&&!("value"in desc)}function isValue(desc){return isObject(desc)&&!("get"in desc||"set"in desc)&&"value"in desc}function isBuiltin(o){return types.indexOf(o)>-1}function forEach(o,callback,context,hidden){context===!0?(hidden=!0,context=o):context=context||o,(hidden===!0?namesOwn:keys)(Object(o)).forEach(function(key){callback.call(context,o[key],key,o)})}function getOwnPropertyDescriptors(o){var out={};return namesOwn(o).forEach(function(key){out[key]=describeOwn(o,key)}),out}function getPropertyDescriptors(o){var out={};return names(o).forEach(function(key){out[key]=describe(o,key)}),out}function extend(to,from){to=Object(to),from=Object(from);if(isBuiltin(to)||keys(to).length===0&&names(to)>0)var desc=hiddenValue();else var desc=value();var fromBuiltin=isBuiltin(from);return!fromBuiltin&&Array.isArray(from)?from.forEach(function(item){typeof item=="function"&&item.name&&(desc.value=item,define(to,item.name.replace(/_$/,""),desc))}):(fromBuiltin?namesOwn:keys)(from).forEach(function(key){if(!hasOwn(to,key)&&!fromBuiltin||typeof from[key]=="function")desc.value=from[key],define(to,key,desc)}),arguments.length>2&&extend(to,arguments[2]),to}function make(o,p){return p?extend(create(o),p):create(o)}function clone(o){return create(getProto(o),describeAllOwn(o))}function isObject(o){return o!==null&&typeof o=="object"||typeof o=="function"}function isPrimitive(o){return o==null||typeof o!="object"&&typeof o!="function"}function getPropertyDescriptor(o,n){while(isObject(o)){var desc=describeOwn(o,n);if(desc)return desc;o=getProto(o)}return undefined}function getPropertyNames(o){var out=[];while(isObject(o))out.push(namesOwn(o)),o=getProto(o);return unique(flatten(out))}function parameters(fn){return(fn+="").slice(fn.indexOf("(")+1,fn.indexOf(")")).split(/\s*,\s*/)}function unique(a){return keys(a.reduce(function(r,s){return r[s]=1,r},{}))}var slice=function(){var _slice=[].slice;return function slice(a,o,p){switch(a.length){case 0:return[];case 1:return o?[]:[a[0]];default:return _slice.call(a,o,p);case 2:a=[a[0],a[1]]}return o||p?a.slice(o,p):a}}(),brandName=function(){var brands={};return types.forEach(function(Ctor){hasOwn(Ctor.prototype,"toString")&&define(Ctor,"stringify",hiddenValue(callbind(Ctor.prototype.toString))),brands["[object "+Ctor.name+"]"]=Ctor.prototype}),function brandName(o){var brand=Object.stringify(o);return brand in brands?brands[brand]:brand}}();exports.Descriptor=extend(Descriptor,{value:value,hiddenValue:hiddenValue,accessor:accessor,hiddenAccessor:hiddenAccessor,isValue:isValue,isAccessor:isAccessor}),exports.Object=extend(function Object(o){return global.Object(o)},{isObject:isObject,isPrimitive:isPrimitive,getPropertyDescriptor:getPropertyDescriptor,getPropertyNames:getPropertyNames,getOwnPropertyDescriptors:getOwnPropertyDescriptors,getPropertyDescriptors:getPropertyDescriptors,hasOwn:hasOwn,extend:extend,forEach:forEach,brandName:brandName},Object),exports.Function=extend({parameters:parameters,bindbind:bindbind,callbind:callbind,applybind:applybind,calling:calling,binding:binding,applying:applying},Function),exports.Array=extend(function Array(n){return global.Array.apply(null,global.Array(n))},{unique:unique,slice:slice,flatten:flatten},global.Array),namesOwn(Array.prototype).forEach(function(key){!exports.Array[key]&&typeof Array.prototype[key]=="function"&&(exports.Array[key]=callbind(Array.prototype[key]))}),exports.RegExp=extend(function RegExp(s,t){return new global.RegExp(s,t)},{test:callbind(RegExp.prototype.test),exec:callbind(RegExp.prototype.exec),testable:bindbind(RegExp.prototype.test),execable:bindbind(RegExp.prototype.exec)});function O(o){if(!(this instanceof O))return new O(o);define(this,"o",{value:o})}exports.O=extend(O,{extend:extend,brand:brandName,isObj:isObject,notObj:isPrimitive,create:Object.create,define:Object.defineProperty,defines:Object.defineProperties,getProto:Object.getPrototypeOf,describe:getPropertyDescriptor,describeOwn:Object.getOwnPropertyDescriptor,describeAll:getPropertyDescriptors,describeAllOwn:getOwnPropertyDescriptors,names:getPropertyNames,namesOwn:Object.getOwnPropertyNames,keys:Object.keys,each:forEach,has:hasOwn}),forEach(O,function(fn,key){typeof fn=="function"&&(O.prototype[key]=function(){return fn.apply(null,flatten(this.o,arguments))})})}(typeof window!="undefined"?exports.utility={}:typeof exports=="undefined"?this:exports)}(),!function(){var _Object=require("./utility").Object;function lookup(o){if(!wrapmaps.has(o))throw new TypeError("WrapMaps are not generic");return wrapmaps.get(o)}var wrapmaps=new WeakMap;function WrapMap(wrapper){var wrapped=new WeakMap,unwrapped=new WeakMap;if(typeof wrapper=="function")var wrap=function wrap(o,isDescriptor){if(isDescriptor===!0)return wrapDescriptor(o);if(_Object.isPrimitive(o)||wrapped.has(o))return o;if(unwrapped.has(o))return unwrapped.get(o);var p=wrapper(o);return _Object.isObject(p)&&(wrapped.set(p,o),unwrapped.set(o,p)),p};else var wrap=function wrap(o,p){return _Object.isPrimitive(o)||wrapped.has(o)?o:unwrapped.has(o)?unwrapped.get(o):(_Object.isObject(p)&&(wrapped.set(p,o),unwrapped.set(o,p)),p)};function unwrap(o,isDescriptor){return isDescriptor===!0?unwrapDescriptor(o):_Object.isPrimitive(o)||!wrapped.has(o)?o:wrapped.get(o)}function has(o){return Object.isObject(o)&&wrapped.has(o)}function remove(o){var p=unwrap(o);return o!==p&&wrapped.delete(o),p}function wrapDescriptor(o){return _Object.isObject(o)&&!wrapped.has(o)&&(o.value&&(o.value=wrap(o.value)),o.set&&(o.set=wrap(o.set)),o.get&&(o.get=wrap(o.get))),o}function unwrapDescriptor(o){return _Object.isObject(o)&&wrapped.has(o)&&(o.value&&(o.value=unwrap(o.value)),o.set&&(o.set=unwrap(o.set)),o.get&&(o.get=unwrap(o.get))),o}var self=this===global?Object.create(WrapMap.prototype):this;return self.wrap=wrap,self.unwrap=unwrap,self.remove=remove,self.has=has,wrapmaps.set(self,{wrap:wrap,unwrap:unwrap,remove:remove,has:has}),self}WrapMap.prototype={constructor:WrapMap,wrap:function wrap(o,p){return lookup(this).wrap(o,p)},unwrap:function unwrap(o){return lookup(this).unwrap(o)},remove:function remove(o){return lookup(this).remove(o)},has:function has(o){return lookup(this).has(o)}},exports.WrapMap=WrapMap}(),!function(){var _Array=require("./utility").Array;function Event(type,target){this.type=type,this.target=target}function ErrorEvent(error,event,target){Event.call(this,"error",target),this.error=error,this.event=event}var emitters=new WeakMap,receivers=new WeakMap;function _(o){if(!emitters.has(o)){var ret={};return receivers.set(o,o),emitters.set(o,ret),ret}return emitters.get(o)}function Emitter(){emitters.set(this,{}),receivers.set(this,this)}Emitter.Event=Event,Emitter.forward=function forward(from,to){emitters.has(to)||(emitters.set(to,{}),receivers.set(to,to)),emitters.set(from,emitters.get(to)),from.on=Emitter.prototype.on.bind(to),from.off=Emitter.prototype.off.bind(to)},Emitter.prototype={constructor:Emitter,on:function on(events,listener){var listeners=_(this);events.split(" ").forEach(function(event){event in listeners?listeners[event].push(listener):listeners[event]=[listener]})},off:function off(events,listener){var listeners=_(this);events.split(" ").forEach(function(event){listeners[event]&&listeners[event].splice(listeners[event].indexOf(listener),1)})},offAll:function offAll(event){delete _(this)[event]},once:function once(event,listener){var self=this;this.on(event,function(){return self.off(event,listener),listener.apply(receivers.get(self),arguments)})},isListened:function isListened(type){var events=_(this),listeners=events[type]||events["*"];return Boolean(listeners&&listeners.length)},emit:function emit(type){var event,events=_(this);typeof type!="string"&&type.type&&(event=type,type=type.type);if(events["*"])var listeners=events[type]?events["*"].concat(events[type]):events["*"];else var listeners=events[type];if(listeners&&listeners.length){event=event||new Event(type,receivers.get(this));var args=[event].concat(_Array.slice(arguments,1));for(var i=0;i<listeners.length;i++)try{listeners[i].apply(this,args)}catch(e){this.emit(new ErrorEvent(e,event,listeners[i]))}}}},exports.Emitter=Emitter,exports.Event=Event}(),!function(){var _Function=require("./utility").Function,_Object=require("./utility").Object,_Array=require("./utility").Array,O=require("./utility").O,Descriptor=require("./utility").Descriptor,createProxyObject=Proxy.create,createProxyFunction=Proxy.createFunction,wmhas=_Function.callbind(WeakMap.prototype.has),wmget=_Function.callbind(WeakMap.prototype.get),wmset=_Function.callbind(WeakMap.prototype.set),wmdelete=_Function.callbind(WeakMap.prototype.delete),wmhasget=function hasget(wm,obj){return _Object.isObject(obj)&&(wm=wmget(wm,obj))===undefined?obj:wm},checkArray=function(){var wrapped=new WeakMap,isArr=Array.isArray;return Array.isArray=function isArray(){var a=arguments[0];return isArr(a)?!0:_Object.isPrimitive(a)?!1:wmhas(wrapped,a)},function(o,p){isArr(o)&&wmset(wrapped,o,!0)}}(),checkToString=function(){var wrapped=new WeakMap;return[Function,RegExp,Object,Date].forEach(function(Ctor){function toString(){return Ctor.stringify(wmhasget(wrapped,this))}wmset(wrapped,toString,Ctor.prototype.toString),Ctor.prototype.toString=toString}),function(o,p){wmset(wrapped,p,o)}}();function definer(o,n,v,newDesc){return o[n]=v,!0}function setter(desc,rcvr,val){var exists=desc.set!=null;return exists&&_Function.calling(desc.set,rcvr,val),exists}function configurable(desc){return desc&&(desc.configurable=!0),desc}var trapMap={getOwnPropertyDescriptor:"describe",getOwnPropertyNames:"names",getPropertyNames:"names",defineProperty:"define","delete":"delete",fix:"fix",keys:"keys",enumerate:"enumerate",hasOwn:"owns",has:"has",get:"get",set:"set",apply:"apply",construct:"construct"},forwarder={proto:function(T){return O.getProto(T)},describe:function(T,N){return configurable(O.describeOwn(T,N))},define:function(T,N,D){return O.define(T,N,D),!0},"delete":function(T,N){return delete T[N]},fix:function(T){return Object.freeze(T)},keys:function(T){return O.keys(T)},names:function(T){return O.namesOwn(T)},enumerate:function(T){var i=0,a=[];for(a[i++]in T);return a},owns:function(T,N){return O.has(T,N)},has:function(T,N){return N in T},get:function(T,N,R){var handler=wmget(proxies,T);if(handler!=null)return wmget(handler,R,N);if(N==="__proto__")return O.getProto(T);try{var desc=O.describeOwn(T,N)}catch(e){return R[N]}if(desc==null){var proto=O.getProto(T);if(proto!=null)return forwarder.get(proto,N,R)}else{if(Descriptor.isValue(desc))return desc.value;if(Descriptor.isAccessor(desc)&&typeof desc.get=="function")return _Function.calling(desc.get,R)}return undefined},set:function(T,N,V,R){var handler=wmget(proxies,T);if(handler!=null)return handler.set(R,N,V);if(N==="__proto__")return _Object.isObject(V)?(T.__proto__=V)&&!0:!1;try{var oDesc=O.describeOwn(T,N)}catch(e){return R[N]=V,!0}if(oDesc)return Descriptor.isAccessor(oDesc)?setter(oDesc,R,V):oDesc.writable?definer(R,N,V,R!==T):!1;var proto=O.getProto(T);return proto===null?definer(R,N,V,!0):forwarder.set(proto,N,V,R)},apply:function(T,A,R){return _Function.applying(T,R,A)},construct:function(T,A){var handler=wmget(proxies,T);if(handler!=null)return handler.construct(T,A);var result=new(_Function.applying(Function.bind,T,[null].concat(A)));return _Object.isObject(result)?result:O.create(T.prototype)}},proxies=new WeakMap,targets=new WeakMap;function proxy(target,handler,callable){if(!_Object.isObject(target))throw new TypeError("Target must be an object");if(!_Object.isObject(handler))throw new TypeError("Handler must be an object");function makeFwd(args,trap){var fwd=function(){return _Function.applying(forwarder[fwd.trap],handler,[fwd.target].concat(fwd.args))};return fwd.target=target,fwd.args=args,fwd.trap=trap,fwd}var metaHandler=createProxyObject({get:function get(R,trap){if(trap==="getPropertyDescriptor")return function(n){return configurable(get(null,"getOwnPropertyDescriptor")(n)||O.describe(O.getProto(target)))};if(trap==="getPropertyNames")return function(){return _Array.unique(get(null,"getOwnPropertyNames")().concat(O.names(O.getProto(target))))};trap=trapMap[trap];var trapHandler=handler[trap];return function finalize(){var args=_Array.slice(arguments);if(trap==="get"||trap==="set")args=_Array.concat(args.slice(1),args[0]),args[0]==="__proto__"&&(trapHandler=handler.proto);return typeof trapHandler!="function"?_Function.applying(forwarder[trap],handler,[target].concat(args)):_Function.applying(trapHandler,handler,[makeFwd(args,trap),target].concat(args))}}});if(callable===!0||callable==null&&typeof target=="function")var reflectProxy=createProxyFunction(metaHandler,function(){return metaHandler.apply(_Array.slice(arguments),this)},function(){return metaHandler.construct(_Array.slice(arguments))});else var reflectProxy=createProxyObject(metaHandler,O.getProto(target));return wmset(proxies,reflectProxy,metaHandler),wmset(targets,reflectProxy,target),checkArray(target,reflectProxy),checkToString(target,reflectProxy),reflectProxy}exports.proxy=proxy}(),!function(){var _Array=require("./utility").Array,_Function=require("./utility").Function,_Object=require("./utility").Object,proxy=require("./proxy").proxy,WrapMap=require("./WrapMap").WrapMap,fakehandler={};function membrane(handlers){if(_Object.isPrimitive(handlers))throw Error("Handlers must be provided");var wrapper=new WrapMap(function(target){return proxy(target,proxy(fakehandler,{get:function membraneHandlerGet(f,t,trap){return function membraneMetaHandler(fwd,faketarget){var handler=handlers[trap],args=_Array.slice(arguments);args[1]=fwd.target=wrapper.unwrap(faketarget);if(handler){var origfwd=fwd;fwd=function fwd(){return _Function.applying(handler,handlers,args)},fwd.args=origfwd.args}return _Function.applying(wrapHandler[trap],null,_Array.concat([fwd],_Array.slice(args,1)))}}}))});function forward(fwd){return fwd()}var wrapHandler={names:forward,enumerate:forward,keys:forward,"delete":forward,owns:forward,has:function has(){return!0},proto:function proto(fwd,target){return wrapper.wrap(fwd())},fix:function fix(fwd,target){throw target},define:function define(fwd,target,name,desc){return wrapper.unwrap(desc,!0),fwd()},describe:function describe(fwd,target,name){return wrapper.wrap(fwd(),!0)},get:function get(fwd,target,name,rcvr){return fwd.args[1]=wrapper.unwrap(rcvr),wrapper.wrap(fwd())},set:function set(fwd,target,name,val,rcvr){return fwd.args[1]=wrapper.unwrap(val),fwd.args[2]=wrapper.unwrap(rcvr),fwd()},apply:function apply(fwd,target,args,rcvr){return fwd.args[0]=_Array.map(args,wrapper.unwrap),fwd.args[1]=wrapper.unwrap(rcvr),wrapper.wrap(fwd())},construct:function construct(fwd,target,args){return fwd.args[0]=_Array.map(args,wrapper.unwrap),wrapper.wrap(fwd())}};return wrapper}exports.membrane=membrane}(),!function(){var proxy=require("./proxy").proxy,_Array=require("./utility").Array,_Function=require("./utility").Function,O=require("./utility").O;function multiherit(o){o.params=o.params||[];var arglist=o.ctors.map(function(ctor,i){return Array.isArray(o.params[i])?o.params[i]:_Function.parameters(ctor).map(function(param){return o.params.indexOf(param)})}),protos=o.ctors.map(function(ctor){return ctor.prototype});return new MultiCtor(new Multiproto(protos),arglist,o)}function MultiCtor(proto,params,o){var ctors=o.ctors;function Ctor(){var args=arguments;for(var i=0;i<ctors.length;i++)_Function.applying(ctors[i],this,params[i].map(function(i){return args[i]}));return this}return Ctor.prototype=proto,proto.constructor=Ctor,this.name=o.name||ctors.map(function(ctor){return ctor.name}).join(""),this.createInstance=instanceCreator(proto,o.onCall,o.onConstruct),proxy(Ctor,this)}function toString(){return"function "+this.name+"() { [native code] }"}MultiCtor.prototype={get:function(fwd,target,name,rcvr){return name==="name"?this.name:name==="toString"?toString:fwd()},describe:function(fwd,target,name){if(name==="name"){var desc=fwd();return desc.value=this.name,desc}return fwd()},call:function(fwd,target,args,rcvr){return this.construct(fwd,target,args)},construct:function(fwd,target,args){return _Function.applying(target,this.createInstance(),args)}};function instanceCreator(proto,call,construct){if(call||construct){var handler={apply:function(fwd,target,args,rcvr){return _Function.applying(call,rcvr,args)},construct:function(fwd,target,args){return construct?_Function.applying(construct,Object.create(target.prototype),args):_Function.applying(call,global,args)}};return function(){var fake=function(){};return fake.__proto__=proto,proxy(fake,handler)}}return function(){return Object.create(proto)}}function Multiproto(protos){this.protos=protos=Object.freeze(protos.slice());var proto=Object.create(null,{inherits:{configurable:!0,value:protos}});return proxy(proto,this)}Multiproto.prototype=function(){function list(fwd,target){return _Array.unique(this.protos.reduce(function(ret,proto){return fwd.target=proto,ret.concat(fwd())},fwd())).filter(function(s){return!(s in Object.prototype)})}function has(fwd,target,name){if(fwd())return!0;for(var i=0;i<this.protos.length;i++){fwd.target=this.protos[i];if(fwd())return!0}return!1}return{names:list,keys:list,enumerate:list,hasOwn:has,has:has,describe:function(fwd,target,name){var desc=fwd();if(desc)return desc;for(var i=0;i<this.protos.length;i++){fwd.target=this.protos[i],desc=fwd();if(desc)return desc}return undefined},get:function(fwd,target,name,rcvr){var ret,i=0;while(typeof ret=="undefined"&&fwd.target)ret=fwd(),fwd.target=this.protos[i++];return ret}}}(),exports.multiherit=multiherit}(),!function(){var proxy=require("./proxy").proxy,membrane=require("./membrane").membrane,Emitter=require("./Emitter").Emitter;function TraceEmitter(object,name){var self=this instanceof TraceEmitter?this:Object.create(TraceEmitter.prototype);name=name||"root",Emitter.call(this);var wrapper=membrane(proxy({},{get:function get(f,t,trap){return function(fwd,target,prop){var ret=fwd();return self.emit(new TraceEvent(trap,target,fwd.args,ret)),ret}}}));this.unwrap=wrapper.unwrap,this[name]=wrapper.wrap(object)}TraceEmitter.prototype=Object.create(Emitter.prototype),TraceEmitter.prototype.constructor=TraceEmitter;function TraceEvent(type,target,args,result){this.type=type,this.target=target,this.result=result;var i=0;switch(type){case"keys":case"names":case"enumerate":case"fix":break;case"set":case"define":this.result===!0&&delete this.result,this.value=args[1];case"get":case"describe":this.property=args[0];break;case"apply":this.context=args[1];case"construct":this.name=target.name,this.args=args[0]}}TraceEvent.prototype=Object.create(Emitter.Event.prototype),TraceEvent.prototype.constructor=TraceEvent,exports.tracer=function tracer(object,name){return new TraceEmitter(object,name)},exports.TraceEmitter=TraceEmitter,exports.TraceEvent=TraceEvent}(),!function(){var _Function=require("./utility").Function,_Object=require("./utility").Object,proxy=require("./proxy").proxy;function callable(obj){return proxy(obj,handler,!0)}function list(fwd){return fwd().filter(function(s){return s!=="$$call"&&s!=="$$construct"&&!_Object.hasOwn(s)})}var handler={enumerate:list,keys:list,names:list,apply:function(fwd,target,args,rcvr){var call=target.$$call;return call?_Function.applying(call,target,args):undefined},construct:function(fwd,target,args){var construct=target.$$construct,instance=proxy(Object.create(target),handler,!0);if(construct){var result=_Function.applying(construct,instance,args);return _Object.isObject(result)?result:instance}return instance}};exports.callable=callable}(),!function(){var O=require("./utility").O,proxy=require("./proxy").proxy,WrapMap=require("./WrapMap").WrapMap,Descriptor=require("./utility").Descriptor,store=new WrapMap,wrap=store.wrap,unwrap=store.unwrap;function listAccessors(o,p){var out=p||O.create(null);do O.namesOwn(o).forEach(function(prop){var desc=O.describeOwn(o,prop);if(desc.get||desc.set)out[prop]=desc}),o=O.getProto(o);while(o);return out}var Interceptor=function(){function list(fwd,target){return fwd().concat(this.properties)}function owns(fwd,target,prop){return fwd()||prop in this.accessors}function Interceptor(name,accessors,proto){var brand="[object "+name+"]";this.accessors=accessors,this.prototype=proto,this.stringifier=Descriptor.hiddenValue(O.has(proto,"toString")?proto.toString:function toString(){return brand}),this.properties=O.keys(accessors)}return Interceptor.keys=Object.freeze(Object.create(null)),Interceptor.prototype={getter:function(target,prop){return this.accessors[prop].get.call(unwrap(target))},setter:function(target,prop,value){return this.accessors[prop].set.call(unwrap(target),value)},names:list,keys:list,enumerate:list,has:owns,owns:owns,proto:function(fwd,target){return this.fakeproto},describe:function(fwd,target,prop){if(prop==="toString"&&!O.has(target,"toString"))return this.stringifier;if(prop in this.accessors){var desc=O.describeOwn(this.prototype,prop);return{enumerable:desc.enumerable,configurable:!0,writable:Boolean(desc.set),value:desc.get.call(unwrap(target))}}return fwd()},define:function(fwd,target,prop,desc){return prop in this.accessors?this.setter(target,prop,desc.value):fwd()},get:function(fwd,target,prop,rcvr){return prop==="toString"&&!O.has(target,"toString")?this.stringifier.value:prop in this.accessors?this.getter(target,prop):fwd()},set:function(fwd,target,prop,value,rcvr){return prop in this.accessors?this.setter(target,prop,value):fwd()}},Interceptor}(),IndexedInterceptor=function(){var Ceptor=Interceptor.prototype;function numbers(start,end){isFinite(end)||(end=start,start=0);var length=end-start;if(end>numbers.cache.length)while(length--)numbers.cache[length+start]=length+start+"";return numbers.cache.slice(start,end)}numbers.cache=[];function list(fwd,target){return numbers(this.prototype.length.call(unwrap(target))).concat(this.properties,fwd())}function has(fwd,target,prop){return isFinite(prop)?prop<this.prototype.length.call(unwrap(target)):prop in this.accessors||fwd()}function IndexedInterceptor(name,accessors,proto){Interceptor.apply(this,arguments),this.properties.push("length")}var indexed=IndexedInterceptor.keys=Object.create(null);return indexed.get=!0,indexed.set=!0,indexed.length=!0,Object.freeze(indexed),IndexedInterceptor.prototype={__proto__:Ceptor,names:list,keys:list,enumerate:list,has:has,owns:has,describe:function(fwd,target,prop){return isFinite(prop)&&this.prototype.get?Descriptor.value(this.prototype.get.call(unwrap(target),prop)):prop==="length"?Descriptor.hiddenValue(this.prototype.length.call(unwrap(target)),!0):Ceptor.describe.apply(this,arguments)},define:function(fwd,target,prop,desc){return isFinite(prop)&&this.prototype.set?this.prototype.set.call(unwrap(target),prop,value):Ceptor.define.apply(this,arguments)},get:function(fwd,target,prop,rcvr){return isFinite(prop)&&this.prototype.get?this.prototype.get.call(unwrap(target),prop):prop==="length"?this.prototype.length.call(unwrap(target)):Ceptor.get.apply(this,arguments)},set:function(fwd,target,prop,value,rcvr){return isFinite(prop)&&this.prototype.set?this.prototype.set.call(unwrap(target),prop,value):Ceptor.set.apply(this,arguments)}},IndexedInterceptor}(),NamedInterceptor=function(){var Ceptor=Interceptor.prototype;function list(fwd,target){return this.prototype.list.call(unwrap(target)).concat(this.properties,fwd())}function has(fwd,target,prop){return fwd()||this.prototype.has.call(unwrap(target),prop)}function NamedInterceptor(name,accessors,proto){Interceptor.apply(this,arguments)}var named=NamedInterceptor.keys=Object.create(null);return named.get=!0,named.set=!0,named.has=!0,named.list=!0,Object.freeze(named),NamedInterceptor.prototype={__proto__:Ceptor,names:list,keys:list,enumerate:list,has:has,owns:has,describe:function(fwd,target,prop){var inst=unwrap(target);return this.prototype.has.call(inst,prop)?Descriptor.value(this.prototype.get.call(inst,prop)):prop in this.accessors?Ceptor.describe.apply(this,arguments):prop in this.fakeproto?fwd():Descriptor.value(this.prototype.get.call(unwrap(target),prop))},define:function(fwd,target,prop,desc){var inst=unwrap(target);return this.prototype.has.call(inst,prop)?this.prototype.set.call(inst,prop,desc.value):prop in this.accessors?this.setter(target,prop,desc.value):this.prototype.set.call(unwrap(target),prop,value)},get:function(fwd,target,prop,rcvr){var inst=unwrap(target);return this.prototype.has.call(inst,prop)?this.prototype.get.call(inst,prop):prop in this.accessors?this.getter(target,prop):fwd()},set:function(fwd,target,prop,value,rcvr){var inst=unwrap(target);return this.prototype.has.call(inst,prop)?this.prototype.set.call(inst,prop,value):prop in this.accessors?this.setter(target,prop,value):this.prototype.set.call(unwrap(target),prop,value)}},NamedInterceptor}(),Constructor=function(){var stringifier=Descriptor.hiddenValue(function toString(){return"function "+this.name+"() { [native code] }"});function Constructor(name,ctor,template){return this.template=template,this.ctor=ctor,proxy(Function("return function "+name+"(){}")(),this)}return Constructor.prototype={describe:function(fwd,target,prop){return prop==="prototype"?Descriptor.hiddenValue(this.template.fakeproto):prop==="toString"?stringifier:fwd()},get:function(fwd,target,prop,rcvr){return prop==="prototype"?this.template.fakeproto:prop==="toString"?stringifier.value:fwd()},apply:function(fwd,target,args,rcvr){var inst=Object.create(this.template.fakeproto),out=proxy(inst,this.template);return wrap(out,inst),this.ctor.apply(out,args),out},construct:function(fwd,target,args){var inst=Object.create(this.template.fakeproto),out=proxy(inst,this.template);return wrap(out,inst),this.ctor.apply(out,args),out}},Constructor}(),protos=new WeakMap;exports.interceptor=function interceptor(name,Ctor,inherits){typeof name=="function"&&(inherits=Ctor,Ctor=name,name=Ctor.name);var proto=Ctor.prototype,accessors=listAccessors(proto);inherits&&listAccessors(protos.get(inherits),accessors);var Template="length"in proto?IndexedInterceptor:"list"in proto?NamedInterceptor:Interceptor,template=new Template(name,accessors,proto),ctor=new Constructor(name,Ctor,template);return template.fakeproto=O.keys(proto).reduce(function(ret,key){if(!(key in accessors||key in Template.keys)){var desc=O.describe(proto,key);key==="constructor"&&(desc.value=ctor),desc.enumerable=!1,O.define(ret,key,desc)}return ret},O.create(O.getProto(proto))),protos.set(template.fakeproto,proto),ctor}}(),!function(){var proxy=require("./proxy").proxy;function doppelganger(callable){var handler=new Doppelganger,doppel=proxy(handler.target,handler,callable);return function changeInfo(into){handler.target=Object(into);if(doppel)return[doppel,doppel=null][0]}}function Doppelganger(){this.target={}}function targeter(fwd){return fwd.target=this.target,fwd()}Doppelganger.prototype={proto:targeter,names:targeter,describe:targeter,define:targeter,"delete":targeter,fix:targeter,keys:targeter,enumerate:targeter,owns:targeter,has:targeter,get:targeter,set:targeter,apply:targeter,construct:targeter},exports.doppelganger=doppelganger}(),!function(){var _Object=require("./utility").Object,HashMap=function(){var hashmaps=new WeakMap;function HashMap(){hashmaps.set(this,Object.create(null))}return _Object.extend(HashMap.prototype,[function has(key){return key in hashmaps.get(this)},function get(key){return hashmaps.get(this)[key]},function set(key,value){return hashmaps.get(this)[key]=value},function delete_(key){var ret=this.has(key);return ret&&delete hashmaps.get(this)[key],ret}]),HashMap}();function Store(values){_Object.isObject(values)&&this.set(values)}Store.prototype=Object.create(null,{set:{value:function set(key,value){_Object.isObject(key)?Object.keys(key).forEach(function(k){this[k]=key[k]},this):this[key]=value}},get:{value:function get(key){return Array.isArray(key)?key.reduce(function(r,k){return r[k]=this[k],r}.bind(this),{}):this[key]}},toString:{value:function toString(){return"[object Store]"}},valueOf:{value:Object.prototype.valueOf}}),exports.namespace=function namespace(){var ostore=new WeakMap,pstore=new HashMap;return function unwrap(target,values){var store=_Object.isObject(target)?ostore:pstore,data=store.get(target);return data||(data=new Store(values),store.set(target,data)),data}}}(),exports}({},this))

0 comments on commit e0364c5

Please sign in to comment.
Something went wrong with that request. Please try again.