@politie/sherlock-proxy 3.4.21 → 3.4.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@politie/sherlock-proxy",
3
- "version": "3.4.21",
3
+ "version": "3.4.23",
4
4
  "description": "A proxy extension to Sherlock.",
5
5
  "main": "sherlock-proxy.cjs.js",
6
6
  "module": "sherlock-proxy.esm.js",
@@ -38,6 +38,6 @@
38
38
  "tslib": "^2.2.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@politie/sherlock": "3.4.21"
41
+ "@politie/sherlock": "3.4.23"
42
42
  }
43
43
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("@politie/sherlock"),e=Symbol("isDerivableProxy");function n(r){return!0===r[e]}var i=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var r=this.$proxyDescriptor;return r.$$derivable||(r.$$derivable=function(r,e){if(!e)return r;var n=e.get,i=e.set;return i&&t.isSettableDerivable(r)?t.lens({get:n,set:function(t,e){r.set(i.call(this,t,e))}},r).autoCache():r.derive(n).autoCache()}(r.$target,r.$lens&&r.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var r=this.$proxyDescriptor;try{return r.$derivable.get()}catch(e){throw Object.assign(Error("error while getting ".concat(r.$expression||"$value",": ").concat(t._internal.isError(e)&&e.message)),{jse_cause:e})}},set:function(r){var e=this.$proxyDescriptor,n=e.$derivable,i=e.$expression;if(!t.isSettableDerivable(n))throw Error("".concat(i||"$value"," is readonly"));try{n.set(r)}catch(r){throw Object.assign(Error("error while setting ".concat(i||"$value",": ").concat(t._internal.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var r=this.$proxyDescriptor;try{return r.$target.get()}catch(e){throw Object.assign(Error("error while getting ".concat(r.$expression||"$targetValue",": ").concat(t._internal.isError(e)&&e.message)),{jse_cause:e})}},set:function(r){var e=this.$proxyDescriptor,n=e.$target,i=e.$expression;if(!t.isSettableDerivable(n))throw Error("".concat(i||"$targetValue"," is readonly"));try{n.set(r)}catch(r){throw Object.assign(Error("error while setting ".concat(i||"$targetValue",": ").concat(t._internal.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(r,e,n){var i=t.utils.clone(this.$proxyDescriptor);return i.$target=r,Object.getOwnPropertyNames(i).filter((function(r){return r.startsWith("$$")})).forEach((function(r){return i[r]=void 0})),i.$expression=e,i.$path=n,new Proxy(i,o)},e.prototype.$pluck=function(r){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(r),s(t.$expression,r),a(t.$path,r))},e.prototype.$pluckableKeys=function(){var r=this.$proxyDescriptor.$value;return"object"==typeof r?Reflect.ownKeys(r):[]},e.prototype.$length=function(){var r=this.$proxyDescriptor.$targetValue;return Array.isArray(r)?r.length:void 0},e.prototype.$and=function(r){return this.$proxyDescriptor.$derivable.and(u(r))},e.prototype.$or=function(r){return this.$proxyDescriptor.$derivable.or(u(r))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(r){return this.$proxyDescriptor.$derivable.is(u(r))},e.prototype.$derive=function(){var r=this.$proxyDescriptor.$derivable;return r.derive.apply(r,arguments)},e.prototype.$react=function(r,t){return this.$proxyDescriptor.$derivable.react(r,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var t,e,n,i;return r.__generator(this,(function(r){switch(r.label){case 0:if(t=this.$proxyDescriptor,void 0===(e=t.$length()))throw n=t.$expression,Object.assign(Error("".concat(n||"object"," is not iterable")),{value:t.$value,expression:n});i=0,r.label=1;case 1:return i<e?[4,t.$pluck(i)]:[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function u(r){return n(r)?r.$derivable:r}i.prototype[e]=!0;var o={get:function(r,t,e){return"$proxyDescriptor"===t?r:c(r,t)?r.$pluck.call(e,t):Reflect.get(r,t,e)},set:function(r,e,i,u){if(c(r,e)){var o=r.$pluck.call(u,e);return i&&n(i)?o.$targetValue=i.$targetValue:o.$value=i&&t.isDerivable(i)?i.get():i,!0}return Reflect.set(r,e,i,u)},has:function(r,t){return t===Symbol.iterator?void 0!==r.$length():c(r,t)},getOwnPropertyDescriptor:function(r,t){if(c(r,t))return{get:function(){return this[t]},set:function(r){this[t]=r},configurable:!0,enumerable:!0}},ownKeys:function(r){return r.$pluckableKeys()}};function c(r,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(r,t)}function s(r,t){return void 0===r&&(r=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?r+"."+t:"string"==typeof t?r+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':r+"["+t+"]"}function a(r,t){return void 0===r&&(r=[]),r.concat(t)}exports.ProxyDescriptor=i,exports.extendExpression=s,exports.extendPath=a,exports.isDerivableProxy=n,exports.unwrapProxy=u;
1
+ Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("@politie/sherlock"),e=Symbol("isDerivableProxy");function n(r){return!0===r[e]}var i=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var r=this.$proxyDescriptor;return r.$$derivable||(r.$$derivable=function(r,e){if(!e)return r;var n=e.get,i=e.set;return i&&t.isSettableDerivable(r)?t.lens({get:n,set:function(t,e){r.set(i.call(this,t,e))}},r).autoCache():r.derive(n).autoCache()}(r.$target,r.$lens&&r.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var r=this.$proxyDescriptor;try{return r.$derivable.get()}catch(e){throw Object.assign(Error("error while getting ".concat(r.$expression||"$value",": ").concat(t._internal.isError(e)&&e.message)),{jse_cause:e})}},set:function(r){var e=this.$proxyDescriptor,n=e.$derivable,i=e.$expression;if(!t.isSettableDerivable(n))throw Error("".concat(i||"$value"," is readonly"));try{n.set(r)}catch(r){throw Object.assign(Error("error while setting ".concat(i||"$value",": ").concat(t._internal.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var r=this.$proxyDescriptor;try{return r.$target.get()}catch(e){throw Object.assign(Error("error while getting ".concat(r.$expression||"$targetValue",": ").concat(t._internal.isError(e)&&e.message)),{jse_cause:e})}},set:function(r){var e=this.$proxyDescriptor,n=e.$target,i=e.$expression;if(!t.isSettableDerivable(n))throw Error("".concat(i||"$targetValue"," is readonly"));try{n.set(r)}catch(r){throw Object.assign(Error("error while setting ".concat(i||"$targetValue",": ").concat(t._internal.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(r,e,n){var i=t.utils.clone(this.$proxyDescriptor);return i.$target=r,Object.getOwnPropertyNames(i).filter(function(r){return r.startsWith("$$")}).forEach(function(r){return i[r]=void 0}),i.$expression=e,i.$path=n,new Proxy(i,o)},e.prototype.$pluck=function(r){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(r),s(t.$expression,r),a(t.$path,r))},e.prototype.$pluckableKeys=function(){var r=this.$proxyDescriptor.$value;return"object"==typeof r?Reflect.ownKeys(r):[]},e.prototype.$length=function(){var r=this.$proxyDescriptor.$targetValue;return Array.isArray(r)?r.length:void 0},e.prototype.$and=function(r){return this.$proxyDescriptor.$derivable.and(u(r))},e.prototype.$or=function(r){return this.$proxyDescriptor.$derivable.or(u(r))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(r){return this.$proxyDescriptor.$derivable.is(u(r))},e.prototype.$derive=function(){var r=this.$proxyDescriptor.$derivable;return r.derive.apply(r,arguments)},e.prototype.$react=function(r,t){return this.$proxyDescriptor.$derivable.react(r,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var t,e,n,i;return r.__generator(this,function(r){switch(r.label){case 0:if(t=this.$proxyDescriptor,void 0===(e=t.$length()))throw n=t.$expression,Object.assign(Error("".concat(n||"object"," is not iterable")),{value:t.$value,expression:n});i=0,r.label=1;case 1:return i<e?[4,t.$pluck(i)]:[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}})},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function u(r){return n(r)?r.$derivable:r}i.prototype[e]=!0;var o={get:function(r,t,e){return"$proxyDescriptor"===t?r:c(r,t)?r.$pluck.call(e,t):Reflect.get(r,t,e)},set:function(r,e,i,u){if(c(r,e)){var o=r.$pluck.call(u,e);return i&&n(i)?o.$targetValue=i.$targetValue:o.$value=i&&t.isDerivable(i)?i.get():i,!0}return Reflect.set(r,e,i,u)},has:function(r,t){return t===Symbol.iterator?void 0!==r.$length():c(r,t)},getOwnPropertyDescriptor:function(r,t){if(c(r,t))return{get:function(){return this[t]},set:function(r){this[t]=r},configurable:!0,enumerable:!0}},ownKeys:function(r){return r.$pluckableKeys()}};function c(r,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(r,t)}function s(r,t){return void 0===r&&(r=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?r+"."+t:"string"==typeof t?r+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':r+"["+t+"]"}function a(r,t){return void 0===r&&(r=[]),r.concat(t)}exports.ProxyDescriptor=i,exports.extendExpression=s,exports.extendPath=a,exports.isDerivableProxy=n,exports.unwrapProxy=u;
2
2
  //# sourceMappingURL=sherlock-proxy.cjs.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sherlock-proxy.cjs.min.js","names":["IS_DERIVABLE_PROXY","Symbol","isDerivableProxy","obj","ProxyDescriptor","this","$$derivable","undefined","Object","defineProperty","prototype","get","pd","$proxyDescriptor","target","proxyLens","set","isSettableDerivable","lens","newValue","targetValue","call","autoCache","derive","createDerivable","$target","$lens","$derivable","e","assign","Error","concat","$expression","_internal","isError","message","jse_cause","atom","expression","$create","path","descriptor","utils","clone","getOwnPropertyNames","filter","prop","startsWith","forEach","$path","Proxy","proxyHandler","$pluck","pluck","extendExpression","extendPath","$pluckableKeys","value","$value","Reflect","ownKeys","$length","maybeArray","$targetValue","Array","isArray","length","$and","other","and","unwrapProxy","$or","or","$not","not","$is","is","$derive","apply","arguments","$react","reaction","options","react","toJSON","toStringTag","iterator","i","_a","sent","receiver","isPluckableProperty","plucked","isDerivable","has","getOwnPropertyDescriptor","configurable","enumerable","property","test","replace"],"sources":["../../extensions/sherlock-proxy/proxy.ts"],"sourcesContent":["import { Derivable, isDerivable, isSettableDerivable, lens, ReactorOptions, utils, _internal } from '@politie/sherlock';\n\n/**\n * The base interface for DerivableProxies. Defines only the $-properties and $-methods. Any property accessed with a number or\n * that doesn't start with a $-sign returns a new DerivableProxy.\n */\nexport interface DerivableProxy<V> {\n /** The current value that this Proxy represents. Can be expensive to calculate and is often writable. */\n $value: V;\n\n /** A string representation of this proxy's path from the root ProxyDescriptor. */\n $expression?: string;\n\n /**\n * An array representation of this proxy's path from the root ProxyDescriptor. Useful for programatically walking down the root\n * Descriptor's object tree to reacquire a target proxy.\n */\n $path?: Array<string | number>;\n\n /** {@see Derivable#and} */\n $and<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#or} */\n $or<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#not} */\n $not(): Derivable<boolean>;\n\n /** {@see Derivable#is} */\n $is(other: MaybePacked<any>): Derivable<boolean>;\n\n /** {@see Derivable#derive} */\n $derive<R>(f: (v: V) => R): Derivable<R>;\n $derive<R, P1>(f: (v: V, p1: P1) => R, p1: MaybePacked<P1>): Derivable<R>;\n $derive<R, P1, P2>(f: (v: V, p1: P1, p2: P2) => R, p1: MaybePacked<P1>, p2: MaybePacked<P2>): Derivable<R>;\n $derive<R, P>(f: (v: V, ...ps: P[]) => R, ...ps: Array<MaybePacked<P>>): Derivable<R>;\n\n /** {@see Derivable#react} */\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<V>>): () => void;\n}\n\nconst IS_DERIVABLE_PROXY = Symbol('isDerivableProxy');\n\n/**\n * Returns whether obj is a DerivableProxy.\n *\n * @param obj the object to test\n */\nexport function isDerivableProxy(obj: any): obj is DerivableProxy<any> {\n return obj[IS_DERIVABLE_PROXY] === true;\n}\n\n/**\n * A ProxyDescriptor must be used to create DerivableProxies. It can be used in two ways, either create a new descriptor and\n * change any implementation details (if needed) or create a subclass to extend the behavior. Use the {@link #$create} method\n * to create a DerivableProxy.\n *\n * Note that `this` in methods points to the created proxy, so only methods and properties that start with a $-sign can be accessed\n * without trouble.\n *\n * Note also that properties that start with two $-signs are cleared on $create.\n */\nexport class ProxyDescriptor<V = any, T = V> {\n /**\n * The target derivable (the input to the proxy and the {@link #$create} method). The actual values that can be seen by methods\n * on the Proxy can be influenced by providing a {@link #$lens}.\n */\n $target!: Derivable<T>;\n\n /**\n * The expression that represents the path to the current Proxy.\n */\n $expression?: string;\n\n /**\n * The path to the current Proxy.\n */\n $path?: Array<string | number>;\n\n /**\n * The derivable that is the input to all default methods on the Proxy and the {@link #$value} property.\n */\n get $derivable(): Derivable<V> {\n const pd = this.$proxyDescriptor;\n return pd.$$derivable || (pd.$$derivable = createDerivable(pd.$target, pd.$lens && pd.$lens()));\n }\n private $$derivable?: Derivable<V> = undefined;\n\n /**\n * The current value of the DerivableProxy. Can be expensive to calculate. When the target is settable (is an Atom) then $value\n * is writable.\n */\n get $value() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$derivable.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(new Error(`error while getting ${pd.$expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n set $value(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$derivable;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$value'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * The current value of the target Derivable that was used to create the DerivableProxy.\n */\n get $targetValue() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$target.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(\n new Error(`error while getting ${pd.$expression || '$targetValue'}: ${_internal.isError(e) && e.message}`),\n { jse_cause: e },\n );\n }\n }\n set $targetValue(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$target;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$targetValue'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$targetValue'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * In methods of a ProxyDescriptor, `this` is bound to the Proxy Object. Therefore, only $-properties and $-methods can be\n * accessed safely. Use $proxyDescriptor to get access to the ProxyDescriptor Object to prevent the ProxyHandler from messing\n * with your logic.\n */\n protected get $proxyDescriptor() { return this; }\n\n /**\n * An optional method that can return an optional lens to this proxy. Is used to transform the values before accessed by the\n * consumer of the Proxy (either through $value or one of the other methods).\n */\n $lens?(): DerivableProxyLens<T, V> | undefined;\n\n /**\n * Wrap a Derivable as DerivableProxy using this ProxyDescriptor.\n *\n * @param obj the object to wrap\n * @param expression the new expression to the created DerivableProxy\n * @param path the new path to the created DerivableProxy\n */\n $create(obj: Derivable<T>, expression?: string, path?: Array<string | number>): DerivableProxy<V> {\n const descriptor: ProxyDescriptor = utils.clone(this.$proxyDescriptor);\n descriptor.$target = obj;\n Object.getOwnPropertyNames(descriptor)\n .filter(prop => prop.startsWith('$$'))\n .forEach(prop => descriptor[prop] = undefined);\n descriptor.$expression = expression;\n descriptor.$path = path;\n return new Proxy(descriptor, proxyHandler) as any;\n }\n\n /**\n * The $pluck method is the implementation of the pluck mechanism of DerivableProxy. Replace this method to change the\n * pluck behavior. It should return a DerivableProxy.\n *\n * @param prop the property to pluck of the wrapped derivable\n */\n $pluck(prop: string | number): DerivableProxy<V> {\n const pd = this.$proxyDescriptor;\n return pd.$create(pd.$derivable.pluck(prop), extendExpression(pd.$expression, prop), extendPath(pd.$path, prop));\n }\n\n /**\n * The $pluckableKeys returns a list of properties that can be plucked from this object. Returned keys are guaranteed to\n * result in a usable DerivableProxy when used with $pluck. Is used for `for ... in` and `Object.keys(...)` logic.\n */\n $pluckableKeys() {\n const value = this.$proxyDescriptor.$value;\n return typeof value === 'object' ? Reflect.ownKeys(value as any) : [];\n }\n\n /**\n * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration\n * {@link #pluck} is called with indices up to but not including the result of `$length()`.\n */\n $length(): number | undefined {\n const maybeArray = this.$proxyDescriptor.$targetValue;\n return Array.isArray(maybeArray) ? maybeArray.length : undefined;\n }\n\n $and(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.and(unwrapProxy(other));\n }\n\n $or(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.or(unwrapProxy(other));\n }\n\n $not() {\n return this.$proxyDescriptor.$derivable.not();\n }\n\n $is(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.is(unwrapProxy(other));\n }\n\n $derive() {\n const target = this.$proxyDescriptor.$derivable;\n return target.derive.apply(target, arguments as any);\n }\n\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<any>>): () => void {\n return this.$proxyDescriptor.$derivable.react(reaction, options);\n }\n\n toJSON() {\n return this.$proxyDescriptor.$value;\n }\n\n get [Symbol.toStringTag]() {\n return 'DerivableProxy';\n }\n\n *[Symbol.iterator](): IterableIterator<DerivableProxy<V>> {\n const pd = this.$proxyDescriptor;\n const length = pd.$length();\n if (length === undefined) {\n const expression = pd.$expression;\n throw Object.assign(new Error(`${expression || 'object'} is not iterable`), { value: pd.$value, expression });\n }\n for (let i = 0; i < length; i++) {\n yield pd.$pluck(i)!;\n }\n }\n\n get length() {\n return this.$proxyDescriptor.$length();\n }\n}\nProxyDescriptor.prototype[IS_DERIVABLE_PROXY] = true;\n\nfunction createDerivable<V, T>(target: Derivable<T>, proxyLens?: DerivableProxyLens<T, V>): Derivable<V> {\n if (!proxyLens) {\n return target as any;\n }\n const { get, set } = proxyLens;\n if (!set || !isSettableDerivable(target)) {\n return target.derive(get).autoCache();\n }\n return lens({\n get,\n set(newValue, targetValue) {\n target.set(set.call(this, newValue, targetValue));\n }\n }, target).autoCache();\n}\n\nexport interface DerivableProxyLens<T, V> {\n get: (targetValue: T) => V;\n set?: (newValue: V, targetValue: T | undefined) => T;\n}\n\nexport type MaybePacked<T> = T | Derivable<T> | DerivableProxy<T>;\n\nexport function unwrapProxy<W>(obj: MaybePacked<W>): W | Derivable<W> {\n if (isDerivableProxy(obj)) {\n return (obj as any).$derivable;\n }\n return obj;\n}\n\nconst proxyHandler: ProxyHandler<ProxyDescriptor> = {\n get(target, prop, receiver) {\n if (prop === '$proxyDescriptor') {\n return target;\n }\n if (isPluckableProperty(target, prop)) {\n return target.$pluck.call(receiver, prop as string | number);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, newValue, receiver) {\n if (isPluckableProperty(target, prop)) {\n const plucked = target.$pluck.call(receiver, prop as string | number) as ProxyDescriptor;\n if (newValue && isDerivableProxy(newValue)) {\n plucked.$targetValue = (newValue as any).$targetValue;\n } else {\n plucked.$value = newValue && isDerivable(newValue) ? newValue.get() : newValue;\n }\n return true;\n }\n return Reflect.set(target, prop, newValue, receiver);\n },\n has(target, prop) {\n if (prop === Symbol.iterator) {\n return target.$length() !== undefined;\n }\n return isPluckableProperty(target, prop);\n },\n getOwnPropertyDescriptor(target, prop) {\n if (isPluckableProperty(target, prop)) {\n return {\n get() { return this[prop]; },\n set(newValue) { this[prop] = newValue; },\n configurable: true,\n enumerable: true,\n };\n }\n return undefined;\n },\n ownKeys(target) {\n return target.$pluckableKeys();\n },\n};\n\nfunction isPluckableProperty(target: ProxyDescriptor, prop: PropertyKey) {\n return typeof prop === 'number' || typeof prop === 'string' && prop[0] !== '$' && !Reflect.has(target, prop);\n}\n\n/**\n * Extends an expression with a property access. Automatically uses bracket notation where appropriate and escapes\n * strings in brackets to give a realistic combined expression.\n *\n * @param expression the (optional) expression to extend\n * @param property the property that should be appended to the expression\n */\nexport function extendExpression(expression = '', property: string | number) {\n if (typeof property === 'string' && /^[a-z_][a-z_0-9]*$/i.test(property)) {\n return expression + '.' + property;\n }\n if (typeof property === 'string') {\n return expression + '[\"' + property.replace(/\\\\/g, '\\\\\\\\').replace(/\\\"/g, '\\\\\"') + '\"]';\n }\n return expression + '[' + property + ']';\n}\n\n/**\n * Extends a path with a property access.\n *\n * @param path the (optional) path to extend\n * @param property the property that should be appended to the path\n */\nexport function extendPath(path: Array<string | number> = [], property: string | number) {\n return path.concat(property);\n}\n"],"mappings":"6GAyCMA,EAAqBC,OAAO,oBAO5B,SAAUC,EAAiBC,GAC7B,OAAmC,IAA5BA,EAAIH,EACf,CAYA,IAAAI,EAAA,oBAAAA,IAwBYC,KAAWC,iBAAkBC,C,CAsKzC,OA1KIC,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,iBAAb4D,GAAyB,sBAAsBC,KAAKD,GACpD5D,EAAa,IAAM4D,EAEN,iBAAbA,EACA5D,EAAa,KAAO4D,EAASE,QAAQ,MAAO,QAAQA,QAAQ,MAAO,OAAS,KAEhF9D,EAAa,IAAM4D,EAAW,GACzC,CAQgB,SAAA3C,EAAWf,EAAmC0D,GAC1D,YADuB,IAAA1D,MAAiC,IACjDA,EAAKT,OAAOmE,EACvB,C","ignoreList":[]}
1
+ {"version":3,"file":"sherlock-proxy.cjs.min.js","names":["IS_DERIVABLE_PROXY","Symbol","isDerivableProxy","obj","ProxyDescriptor","this","$$derivable","undefined","Object","defineProperty","prototype","get","pd","$proxyDescriptor","target","proxyLens","set","isSettableDerivable","lens","newValue","targetValue","call","autoCache","derive","createDerivable","$target","$lens","$derivable","e","assign","Error","concat","$expression","_internal","isError","message","jse_cause","atom","expression","$create","path","descriptor","utils","clone","getOwnPropertyNames","filter","prop","startsWith","forEach","$path","Proxy","proxyHandler","$pluck","pluck","extendExpression","extendPath","$pluckableKeys","value","$value","Reflect","ownKeys","$length","maybeArray","$targetValue","Array","isArray","length","$and","other","and","unwrapProxy","$or","or","$not","not","$is","is","$derive","apply","arguments","$react","reaction","options","react","toJSON","toStringTag","iterator","i","_a","sent","receiver","isPluckableProperty","plucked","isDerivable","has","getOwnPropertyDescriptor","configurable","enumerable","property","test","replace"],"sources":["../../extensions/sherlock-proxy/proxy.ts"],"sourcesContent":["import { Derivable, isDerivable, isSettableDerivable, lens, ReactorOptions, utils, _internal } from '@politie/sherlock';\n\n/**\n * The base interface for DerivableProxies. Defines only the $-properties and $-methods. Any property accessed with a number or\n * that doesn't start with a $-sign returns a new DerivableProxy.\n */\nexport interface DerivableProxy<V> {\n /** The current value that this Proxy represents. Can be expensive to calculate and is often writable. */\n $value: V;\n\n /** A string representation of this proxy's path from the root ProxyDescriptor. */\n $expression?: string;\n\n /**\n * An array representation of this proxy's path from the root ProxyDescriptor. Useful for programatically walking down the root\n * Descriptor's object tree to reacquire a target proxy.\n */\n $path?: Array<string | number>;\n\n /** {@see Derivable#and} */\n $and<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#or} */\n $or<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#not} */\n $not(): Derivable<boolean>;\n\n /** {@see Derivable#is} */\n $is(other: MaybePacked<any>): Derivable<boolean>;\n\n /** {@see Derivable#derive} */\n $derive<R>(f: (v: V) => R): Derivable<R>;\n $derive<R, P1>(f: (v: V, p1: P1) => R, p1: MaybePacked<P1>): Derivable<R>;\n $derive<R, P1, P2>(f: (v: V, p1: P1, p2: P2) => R, p1: MaybePacked<P1>, p2: MaybePacked<P2>): Derivable<R>;\n $derive<R, P>(f: (v: V, ...ps: P[]) => R, ...ps: Array<MaybePacked<P>>): Derivable<R>;\n\n /** {@see Derivable#react} */\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<V>>): () => void;\n}\n\nconst IS_DERIVABLE_PROXY = Symbol('isDerivableProxy');\n\n/**\n * Returns whether obj is a DerivableProxy.\n *\n * @param obj the object to test\n */\nexport function isDerivableProxy(obj: any): obj is DerivableProxy<any> {\n return obj[IS_DERIVABLE_PROXY] === true;\n}\n\n/**\n * A ProxyDescriptor must be used to create DerivableProxies. It can be used in two ways, either create a new descriptor and\n * change any implementation details (if needed) or create a subclass to extend the behavior. Use the {@link #$create} method\n * to create a DerivableProxy.\n *\n * Note that `this` in methods points to the created proxy, so only methods and properties that start with a $-sign can be accessed\n * without trouble.\n *\n * Note also that properties that start with two $-signs are cleared on $create.\n */\nexport class ProxyDescriptor<V = any, T = V> {\n /**\n * The target derivable (the input to the proxy and the {@link #$create} method). The actual values that can be seen by methods\n * on the Proxy can be influenced by providing a {@link #$lens}.\n */\n $target!: Derivable<T>;\n\n /**\n * The expression that represents the path to the current Proxy.\n */\n $expression?: string;\n\n /**\n * The path to the current Proxy.\n */\n $path?: Array<string | number>;\n\n /**\n * The derivable that is the input to all default methods on the Proxy and the {@link #$value} property.\n */\n get $derivable(): Derivable<V> {\n const pd = this.$proxyDescriptor;\n return pd.$$derivable || (pd.$$derivable = createDerivable(pd.$target, pd.$lens && pd.$lens()));\n }\n private $$derivable?: Derivable<V> = undefined;\n\n /**\n * The current value of the DerivableProxy. Can be expensive to calculate. When the target is settable (is an Atom) then $value\n * is writable.\n */\n get $value() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$derivable.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(new Error(`error while getting ${pd.$expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n set $value(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$derivable;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$value'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * The current value of the target Derivable that was used to create the DerivableProxy.\n */\n get $targetValue() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$target.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(\n new Error(`error while getting ${pd.$expression || '$targetValue'}: ${_internal.isError(e) && e.message}`),\n { jse_cause: e },\n );\n }\n }\n set $targetValue(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$target;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$targetValue'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$targetValue'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * In methods of a ProxyDescriptor, `this` is bound to the Proxy Object. Therefore, only $-properties and $-methods can be\n * accessed safely. Use $proxyDescriptor to get access to the ProxyDescriptor Object to prevent the ProxyHandler from messing\n * with your logic.\n */\n protected get $proxyDescriptor() { return this; }\n\n /**\n * An optional method that can return an optional lens to this proxy. Is used to transform the values before accessed by the\n * consumer of the Proxy (either through $value or one of the other methods).\n */\n $lens?(): DerivableProxyLens<T, V> | undefined;\n\n /**\n * Wrap a Derivable as DerivableProxy using this ProxyDescriptor.\n *\n * @param obj the object to wrap\n * @param expression the new expression to the created DerivableProxy\n * @param path the new path to the created DerivableProxy\n */\n $create(obj: Derivable<T>, expression?: string, path?: Array<string | number>): DerivableProxy<V> {\n const descriptor: ProxyDescriptor = utils.clone(this.$proxyDescriptor);\n descriptor.$target = obj;\n Object.getOwnPropertyNames(descriptor)\n .filter(prop => prop.startsWith('$$'))\n .forEach(prop => descriptor[prop] = undefined);\n descriptor.$expression = expression;\n descriptor.$path = path;\n return new Proxy(descriptor, proxyHandler) as any;\n }\n\n /**\n * The $pluck method is the implementation of the pluck mechanism of DerivableProxy. Replace this method to change the\n * pluck behavior. It should return a DerivableProxy.\n *\n * @param prop the property to pluck of the wrapped derivable\n */\n $pluck(prop: string | number): DerivableProxy<V> {\n const pd = this.$proxyDescriptor;\n return pd.$create(pd.$derivable.pluck(prop), extendExpression(pd.$expression, prop), extendPath(pd.$path, prop));\n }\n\n /**\n * The $pluckableKeys returns a list of properties that can be plucked from this object. Returned keys are guaranteed to\n * result in a usable DerivableProxy when used with $pluck. Is used for `for ... in` and `Object.keys(...)` logic.\n */\n $pluckableKeys() {\n const value = this.$proxyDescriptor.$value;\n return typeof value === 'object' ? Reflect.ownKeys(value as any) : [];\n }\n\n /**\n * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration\n * {@link #pluck} is called with indices up to but not including the result of `$length()`.\n */\n $length(): number | undefined {\n const maybeArray = this.$proxyDescriptor.$targetValue;\n return Array.isArray(maybeArray) ? maybeArray.length : undefined;\n }\n\n $and(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.and(unwrapProxy(other));\n }\n\n $or(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.or(unwrapProxy(other));\n }\n\n $not() {\n return this.$proxyDescriptor.$derivable.not();\n }\n\n $is(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.is(unwrapProxy(other));\n }\n\n $derive() {\n const target = this.$proxyDescriptor.$derivable;\n return target.derive.apply(target, arguments as any);\n }\n\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<any>>): () => void {\n return this.$proxyDescriptor.$derivable.react(reaction, options);\n }\n\n toJSON() {\n return this.$proxyDescriptor.$value;\n }\n\n get [Symbol.toStringTag]() {\n return 'DerivableProxy';\n }\n\n *[Symbol.iterator](): IterableIterator<DerivableProxy<V>> {\n const pd = this.$proxyDescriptor;\n const length = pd.$length();\n if (length === undefined) {\n const expression = pd.$expression;\n throw Object.assign(new Error(`${expression || 'object'} is not iterable`), { value: pd.$value, expression });\n }\n for (let i = 0; i < length; i++) {\n yield pd.$pluck(i)!;\n }\n }\n\n get length() {\n return this.$proxyDescriptor.$length();\n }\n}\nProxyDescriptor.prototype[IS_DERIVABLE_PROXY] = true;\n\nfunction createDerivable<V, T>(target: Derivable<T>, proxyLens?: DerivableProxyLens<T, V>): Derivable<V> {\n if (!proxyLens) {\n return target as any;\n }\n const { get, set } = proxyLens;\n if (!set || !isSettableDerivable(target)) {\n return target.derive(get).autoCache();\n }\n return lens({\n get,\n set(newValue, targetValue) {\n target.set(set.call(this, newValue, targetValue));\n }\n }, target).autoCache();\n}\n\nexport interface DerivableProxyLens<T, V> {\n get: (targetValue: T) => V;\n set?: (newValue: V, targetValue: T | undefined) => T;\n}\n\nexport type MaybePacked<T> = T | Derivable<T> | DerivableProxy<T>;\n\nexport function unwrapProxy<W>(obj: MaybePacked<W>): W | Derivable<W> {\n if (isDerivableProxy(obj)) {\n return (obj as any).$derivable;\n }\n return obj;\n}\n\nconst proxyHandler: ProxyHandler<ProxyDescriptor> = {\n get(target, prop, receiver) {\n if (prop === '$proxyDescriptor') {\n return target;\n }\n if (isPluckableProperty(target, prop)) {\n return target.$pluck.call(receiver, prop as string | number);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, newValue, receiver) {\n if (isPluckableProperty(target, prop)) {\n const plucked = target.$pluck.call(receiver, prop as string | number) as ProxyDescriptor;\n if (newValue && isDerivableProxy(newValue)) {\n plucked.$targetValue = (newValue as any).$targetValue;\n } else {\n plucked.$value = newValue && isDerivable(newValue) ? newValue.get() : newValue;\n }\n return true;\n }\n return Reflect.set(target, prop, newValue, receiver);\n },\n has(target, prop) {\n if (prop === Symbol.iterator) {\n return target.$length() !== undefined;\n }\n return isPluckableProperty(target, prop);\n },\n getOwnPropertyDescriptor(target, prop) {\n if (isPluckableProperty(target, prop)) {\n return {\n get() { return this[prop]; },\n set(newValue) { this[prop] = newValue; },\n configurable: true,\n enumerable: true,\n };\n }\n return undefined;\n },\n ownKeys(target) {\n return target.$pluckableKeys();\n },\n};\n\nfunction isPluckableProperty(target: ProxyDescriptor, prop: PropertyKey) {\n return typeof prop === 'number' || typeof prop === 'string' && prop[0] !== '$' && !Reflect.has(target, prop);\n}\n\n/**\n * Extends an expression with a property access. Automatically uses bracket notation where appropriate and escapes\n * strings in brackets to give a realistic combined expression.\n *\n * @param expression the (optional) expression to extend\n * @param property the property that should be appended to the expression\n */\nexport function extendExpression(expression = '', property: string | number) {\n if (typeof property === 'string' && /^[a-z_][a-z_0-9]*$/i.test(property)) {\n return expression + '.' + property;\n }\n if (typeof property === 'string') {\n return expression + '[\"' + property.replace(/\\\\/g, '\\\\\\\\').replace(/\\\"/g, '\\\\\"') + '\"]';\n }\n return expression + '[' + property + ']';\n}\n\n/**\n * Extends a path with a property access.\n *\n * @param path the (optional) path to extend\n * @param property the property that should be appended to the path\n */\nexport function extendPath(path: Array<string | number> = [], property: string | number) {\n return path.concat(property);\n}\n"],"mappings":"6GAyCMA,EAAqBC,OAAO,oBAO5B,SAAUC,EAAiBC,GAC7B,OAAmC,IAA5BA,EAAIH,EACf,CAYA,IAAAI,EAAA,oBAAAA,IAwBYC,KAAWC,iBAAkBC,C,C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A5D,MAAe,IACpB,iBAAb4D,GAAyB,sBAAsBC,KAAKD,GACpD5D,EAAa,IAAM4D,EAEN,iBAAbA,EACA5D,EAAa,KAAO4D,EAASE,QAAQ,MAAO,QAAQA,QAAQ,MAAO,OAAS,KAEhF9D,EAAa,IAAM4D,EAAW,GACzC,CAQgB,SAAA3C,EAAWf,EAAmC0D,GAC1D,YADuB,IAAA1D,MAAiC,IACjDA,EAAKT,OAAOmE,EACvB,C","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{__generator as r}from"tslib";import{utils as t,isDerivable as e,_internal as n,isSettableDerivable as i,lens as u}from"@politie/sherlock";var o=Symbol("isDerivableProxy");function c(r){return!0===r[o]}var a=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var r=this.$proxyDescriptor;return r.$$derivable||(r.$$derivable=function(r,t){if(!t)return r;var e=t.get,n=t.set;return n&&i(r)?u({get:e,set:function(t,e){r.set(n.call(this,t,e))}},r).autoCache():r.derive(e).autoCache()}(r.$target,r.$lens&&r.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var r=this.$proxyDescriptor;try{return r.$derivable.get()}catch(t){throw Object.assign(Error("error while getting ".concat(r.$expression||"$value",": ").concat(n.isError(t)&&t.message)),{jse_cause:t})}},set:function(r){var t=this.$proxyDescriptor,e=t.$derivable,u=t.$expression;if(!i(e))throw Error("".concat(u||"$value"," is readonly"));try{e.set(r)}catch(r){throw Object.assign(Error("error while setting ".concat(u||"$value",": ").concat(n.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var r=this.$proxyDescriptor;try{return r.$target.get()}catch(t){throw Object.assign(Error("error while getting ".concat(r.$expression||"$targetValue",": ").concat(n.isError(t)&&t.message)),{jse_cause:t})}},set:function(r){var t=this.$proxyDescriptor,e=t.$target,u=t.$expression;if(!i(e))throw Error("".concat(u||"$targetValue"," is readonly"));try{e.set(r)}catch(r){throw Object.assign(Error("error while setting ".concat(u||"$targetValue",": ").concat(n.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(r,e,n){var i=t.clone(this.$proxyDescriptor);return i.$target=r,Object.getOwnPropertyNames(i).filter((function(r){return r.startsWith("$$")})).forEach((function(r){return i[r]=void 0})),i.$expression=e,i.$path=n,new Proxy(i,s)},e.prototype.$pluck=function(r){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(r),h(t.$expression,r),b(t.$path,r))},e.prototype.$pluckableKeys=function(){var r=this.$proxyDescriptor.$value;return"object"==typeof r?Reflect.ownKeys(r):[]},e.prototype.$length=function(){var r=this.$proxyDescriptor.$targetValue;return Array.isArray(r)?r.length:void 0},e.prototype.$and=function(r){return this.$proxyDescriptor.$derivable.and(f(r))},e.prototype.$or=function(r){return this.$proxyDescriptor.$derivable.or(f(r))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(r){return this.$proxyDescriptor.$derivable.is(f(r))},e.prototype.$derive=function(){var r=this.$proxyDescriptor.$derivable;return r.derive.apply(r,arguments)},e.prototype.$react=function(r,t){return this.$proxyDescriptor.$derivable.react(r,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var t,e,n,i;return r(this,(function(r){switch(r.label){case 0:if(t=this.$proxyDescriptor,void 0===(e=t.$length()))throw n=t.$expression,Object.assign(Error("".concat(n||"object"," is not iterable")),{value:t.$value,expression:n});i=0,r.label=1;case 1:return i<e?[4,t.$pluck(i)]:[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function f(r){return c(r)?r.$derivable:r}a.prototype[o]=!0;var s={get:function(r,t,e){return"$proxyDescriptor"===t?r:l(r,t)?r.$pluck.call(e,t):Reflect.get(r,t,e)},set:function(r,t,n,i){if(l(r,t)){var u=r.$pluck.call(i,t);return n&&c(n)?u.$targetValue=n.$targetValue:u.$value=n&&e(n)?n.get():n,!0}return Reflect.set(r,t,n,i)},has:function(r,t){return t===Symbol.iterator?void 0!==r.$length():l(r,t)},getOwnPropertyDescriptor:function(r,t){if(l(r,t))return{get:function(){return this[t]},set:function(r){this[t]=r},configurable:!0,enumerable:!0}},ownKeys:function(r){return r.$pluckableKeys()}};function l(r,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(r,t)}function h(r,t){return void 0===r&&(r=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?r+"."+t:"string"==typeof t?r+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':r+"["+t+"]"}function b(r,t){return void 0===r&&(r=[]),r.concat(t)}export{a as ProxyDescriptor,h as extendExpression,b as extendPath,c as isDerivableProxy,f as unwrapProxy};
1
+ import{__generator as r}from"tslib";import{utils as t,isDerivable as e,_internal as n,isSettableDerivable as i,lens as u}from"@politie/sherlock";var o=Symbol("isDerivableProxy");function c(r){return!0===r[o]}var a=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var r=this.$proxyDescriptor;return r.$$derivable||(r.$$derivable=function(r,t){if(!t)return r;var e=t.get,n=t.set;return n&&i(r)?u({get:e,set:function(t,e){r.set(n.call(this,t,e))}},r).autoCache():r.derive(e).autoCache()}(r.$target,r.$lens&&r.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var r=this.$proxyDescriptor;try{return r.$derivable.get()}catch(t){throw Object.assign(Error("error while getting ".concat(r.$expression||"$value",": ").concat(n.isError(t)&&t.message)),{jse_cause:t})}},set:function(r){var t=this.$proxyDescriptor,e=t.$derivable,u=t.$expression;if(!i(e))throw Error("".concat(u||"$value"," is readonly"));try{e.set(r)}catch(r){throw Object.assign(Error("error while setting ".concat(u||"$value",": ").concat(n.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var r=this.$proxyDescriptor;try{return r.$target.get()}catch(t){throw Object.assign(Error("error while getting ".concat(r.$expression||"$targetValue",": ").concat(n.isError(t)&&t.message)),{jse_cause:t})}},set:function(r){var t=this.$proxyDescriptor,e=t.$target,u=t.$expression;if(!i(e))throw Error("".concat(u||"$targetValue"," is readonly"));try{e.set(r)}catch(r){throw Object.assign(Error("error while setting ".concat(u||"$targetValue",": ").concat(n.isError(r)&&r.message)),{jse_cause:r})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(r,e,n){var i=t.clone(this.$proxyDescriptor);return i.$target=r,Object.getOwnPropertyNames(i).filter(function(r){return r.startsWith("$$")}).forEach(function(r){return i[r]=void 0}),i.$expression=e,i.$path=n,new Proxy(i,s)},e.prototype.$pluck=function(r){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(r),h(t.$expression,r),b(t.$path,r))},e.prototype.$pluckableKeys=function(){var r=this.$proxyDescriptor.$value;return"object"==typeof r?Reflect.ownKeys(r):[]},e.prototype.$length=function(){var r=this.$proxyDescriptor.$targetValue;return Array.isArray(r)?r.length:void 0},e.prototype.$and=function(r){return this.$proxyDescriptor.$derivable.and(f(r))},e.prototype.$or=function(r){return this.$proxyDescriptor.$derivable.or(f(r))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(r){return this.$proxyDescriptor.$derivable.is(f(r))},e.prototype.$derive=function(){var r=this.$proxyDescriptor.$derivable;return r.derive.apply(r,arguments)},e.prototype.$react=function(r,t){return this.$proxyDescriptor.$derivable.react(r,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var t,e,n,i;return r(this,function(r){switch(r.label){case 0:if(t=this.$proxyDescriptor,void 0===(e=t.$length()))throw n=t.$expression,Object.assign(Error("".concat(n||"object"," is not iterable")),{value:t.$value,expression:n});i=0,r.label=1;case 1:return i<e?[4,t.$pluck(i)]:[3,4];case 2:r.sent(),r.label=3;case 3:return i++,[3,1];case 4:return[2]}})},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function f(r){return c(r)?r.$derivable:r}a.prototype[o]=!0;var s={get:function(r,t,e){return"$proxyDescriptor"===t?r:l(r,t)?r.$pluck.call(e,t):Reflect.get(r,t,e)},set:function(r,t,n,i){if(l(r,t)){var u=r.$pluck.call(i,t);return n&&c(n)?u.$targetValue=n.$targetValue:u.$value=n&&e(n)?n.get():n,!0}return Reflect.set(r,t,n,i)},has:function(r,t){return t===Symbol.iterator?void 0!==r.$length():l(r,t)},getOwnPropertyDescriptor:function(r,t){if(l(r,t))return{get:function(){return this[t]},set:function(r){this[t]=r},configurable:!0,enumerable:!0}},ownKeys:function(r){return r.$pluckableKeys()}};function l(r,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(r,t)}function h(r,t){return void 0===r&&(r=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?r+"."+t:"string"==typeof t?r+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':r+"["+t+"]"}function b(r,t){return void 0===r&&(r=[]),r.concat(t)}export{a as ProxyDescriptor,h as extendExpression,b as extendPath,c as isDerivableProxy,f as unwrapProxy};
2
2
  //# sourceMappingURL=sherlock-proxy.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sherlock-proxy.esm.min.js","names":["IS_DERIVABLE_PROXY","Symbol","isDerivableProxy","obj","ProxyDescriptor","this","$$derivable","undefined","Object","defineProperty","prototype","get","pd","$proxyDescriptor","target","proxyLens","set","isSettableDerivable","lens","newValue","targetValue","call","autoCache","derive","createDerivable","$target","$lens","$derivable","e","assign","Error","concat","$expression","_internal","isError","message","jse_cause","atom","expression","$create","path","descriptor","utils","clone","getOwnPropertyNames","filter","prop","startsWith","forEach","$path","Proxy","proxyHandler","$pluck","pluck","extendExpression","extendPath","$pluckableKeys","value","$value","Reflect","ownKeys","$length","maybeArray","$targetValue","Array","isArray","length","$and","other","and","unwrapProxy","$or","or","$not","not","$is","is","$derive","apply","arguments","$react","reaction","options","react","toJSON","toStringTag","iterator","i","_a","sent","receiver","isPluckableProperty","plucked","isDerivable","has","getOwnPropertyDescriptor","configurable","enumerable","property","test","replace"],"sources":["../../extensions/sherlock-proxy/proxy.ts"],"sourcesContent":["import { Derivable, isDerivable, isSettableDerivable, lens, ReactorOptions, utils, _internal } from '@politie/sherlock';\n\n/**\n * The base interface for DerivableProxies. Defines only the $-properties and $-methods. Any property accessed with a number or\n * that doesn't start with a $-sign returns a new DerivableProxy.\n */\nexport interface DerivableProxy<V> {\n /** The current value that this Proxy represents. Can be expensive to calculate and is often writable. */\n $value: V;\n\n /** A string representation of this proxy's path from the root ProxyDescriptor. */\n $expression?: string;\n\n /**\n * An array representation of this proxy's path from the root ProxyDescriptor. Useful for programatically walking down the root\n * Descriptor's object tree to reacquire a target proxy.\n */\n $path?: Array<string | number>;\n\n /** {@see Derivable#and} */\n $and<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#or} */\n $or<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#not} */\n $not(): Derivable<boolean>;\n\n /** {@see Derivable#is} */\n $is(other: MaybePacked<any>): Derivable<boolean>;\n\n /** {@see Derivable#derive} */\n $derive<R>(f: (v: V) => R): Derivable<R>;\n $derive<R, P1>(f: (v: V, p1: P1) => R, p1: MaybePacked<P1>): Derivable<R>;\n $derive<R, P1, P2>(f: (v: V, p1: P1, p2: P2) => R, p1: MaybePacked<P1>, p2: MaybePacked<P2>): Derivable<R>;\n $derive<R, P>(f: (v: V, ...ps: P[]) => R, ...ps: Array<MaybePacked<P>>): Derivable<R>;\n\n /** {@see Derivable#react} */\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<V>>): () => void;\n}\n\nconst IS_DERIVABLE_PROXY = Symbol('isDerivableProxy');\n\n/**\n * Returns whether obj is a DerivableProxy.\n *\n * @param obj the object to test\n */\nexport function isDerivableProxy(obj: any): obj is DerivableProxy<any> {\n return obj[IS_DERIVABLE_PROXY] === true;\n}\n\n/**\n * A ProxyDescriptor must be used to create DerivableProxies. It can be used in two ways, either create a new descriptor and\n * change any implementation details (if needed) or create a subclass to extend the behavior. Use the {@link #$create} method\n * to create a DerivableProxy.\n *\n * Note that `this` in methods points to the created proxy, so only methods and properties that start with a $-sign can be accessed\n * without trouble.\n *\n * Note also that properties that start with two $-signs are cleared on $create.\n */\nexport class ProxyDescriptor<V = any, T = V> {\n /**\n * The target derivable (the input to the proxy and the {@link #$create} method). The actual values that can be seen by methods\n * on the Proxy can be influenced by providing a {@link #$lens}.\n */\n $target!: Derivable<T>;\n\n /**\n * The expression that represents the path to the current Proxy.\n */\n $expression?: string;\n\n /**\n * The path to the current Proxy.\n */\n $path?: Array<string | number>;\n\n /**\n * The derivable that is the input to all default methods on the Proxy and the {@link #$value} property.\n */\n get $derivable(): Derivable<V> {\n const pd = this.$proxyDescriptor;\n return pd.$$derivable || (pd.$$derivable = createDerivable(pd.$target, pd.$lens && pd.$lens()));\n }\n private $$derivable?: Derivable<V> = undefined;\n\n /**\n * The current value of the DerivableProxy. Can be expensive to calculate. When the target is settable (is an Atom) then $value\n * is writable.\n */\n get $value() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$derivable.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(new Error(`error while getting ${pd.$expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n set $value(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$derivable;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$value'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * The current value of the target Derivable that was used to create the DerivableProxy.\n */\n get $targetValue() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$target.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(\n new Error(`error while getting ${pd.$expression || '$targetValue'}: ${_internal.isError(e) && e.message}`),\n { jse_cause: e },\n );\n }\n }\n set $targetValue(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$target;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$targetValue'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$targetValue'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * In methods of a ProxyDescriptor, `this` is bound to the Proxy Object. Therefore, only $-properties and $-methods can be\n * accessed safely. Use $proxyDescriptor to get access to the ProxyDescriptor Object to prevent the ProxyHandler from messing\n * with your logic.\n */\n protected get $proxyDescriptor() { return this; }\n\n /**\n * An optional method that can return an optional lens to this proxy. Is used to transform the values before accessed by the\n * consumer of the Proxy (either through $value or one of the other methods).\n */\n $lens?(): DerivableProxyLens<T, V> | undefined;\n\n /**\n * Wrap a Derivable as DerivableProxy using this ProxyDescriptor.\n *\n * @param obj the object to wrap\n * @param expression the new expression to the created DerivableProxy\n * @param path the new path to the created DerivableProxy\n */\n $create(obj: Derivable<T>, expression?: string, path?: Array<string | number>): DerivableProxy<V> {\n const descriptor: ProxyDescriptor = utils.clone(this.$proxyDescriptor);\n descriptor.$target = obj;\n Object.getOwnPropertyNames(descriptor)\n .filter(prop => prop.startsWith('$$'))\n .forEach(prop => descriptor[prop] = undefined);\n descriptor.$expression = expression;\n descriptor.$path = path;\n return new Proxy(descriptor, proxyHandler) as any;\n }\n\n /**\n * The $pluck method is the implementation of the pluck mechanism of DerivableProxy. Replace this method to change the\n * pluck behavior. It should return a DerivableProxy.\n *\n * @param prop the property to pluck of the wrapped derivable\n */\n $pluck(prop: string | number): DerivableProxy<V> {\n const pd = this.$proxyDescriptor;\n return pd.$create(pd.$derivable.pluck(prop), extendExpression(pd.$expression, prop), extendPath(pd.$path, prop));\n }\n\n /**\n * The $pluckableKeys returns a list of properties that can be plucked from this object. Returned keys are guaranteed to\n * result in a usable DerivableProxy when used with $pluck. Is used for `for ... in` and `Object.keys(...)` logic.\n */\n $pluckableKeys() {\n const value = this.$proxyDescriptor.$value;\n return typeof value === 'object' ? Reflect.ownKeys(value as any) : [];\n }\n\n /**\n * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration\n * {@link #pluck} is called with indices up to but not including the result of `$length()`.\n */\n $length(): number | undefined {\n const maybeArray = this.$proxyDescriptor.$targetValue;\n return Array.isArray(maybeArray) ? maybeArray.length : undefined;\n }\n\n $and(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.and(unwrapProxy(other));\n }\n\n $or(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.or(unwrapProxy(other));\n }\n\n $not() {\n return this.$proxyDescriptor.$derivable.not();\n }\n\n $is(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.is(unwrapProxy(other));\n }\n\n $derive() {\n const target = this.$proxyDescriptor.$derivable;\n return target.derive.apply(target, arguments as any);\n }\n\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<any>>): () => void {\n return this.$proxyDescriptor.$derivable.react(reaction, options);\n }\n\n toJSON() {\n return this.$proxyDescriptor.$value;\n }\n\n get [Symbol.toStringTag]() {\n return 'DerivableProxy';\n }\n\n *[Symbol.iterator](): IterableIterator<DerivableProxy<V>> {\n const pd = this.$proxyDescriptor;\n const length = pd.$length();\n if (length === undefined) {\n const expression = pd.$expression;\n throw Object.assign(new Error(`${expression || 'object'} is not iterable`), { value: pd.$value, expression });\n }\n for (let i = 0; i < length; i++) {\n yield pd.$pluck(i)!;\n }\n }\n\n get length() {\n return this.$proxyDescriptor.$length();\n }\n}\nProxyDescriptor.prototype[IS_DERIVABLE_PROXY] = true;\n\nfunction createDerivable<V, T>(target: Derivable<T>, proxyLens?: DerivableProxyLens<T, V>): Derivable<V> {\n if (!proxyLens) {\n return target as any;\n }\n const { get, set } = proxyLens;\n if (!set || !isSettableDerivable(target)) {\n return target.derive(get).autoCache();\n }\n return lens({\n get,\n set(newValue, targetValue) {\n target.set(set.call(this, newValue, targetValue));\n }\n }, target).autoCache();\n}\n\nexport interface DerivableProxyLens<T, V> {\n get: (targetValue: T) => V;\n set?: (newValue: V, targetValue: T | undefined) => T;\n}\n\nexport type MaybePacked<T> = T | Derivable<T> | DerivableProxy<T>;\n\nexport function unwrapProxy<W>(obj: MaybePacked<W>): W | Derivable<W> {\n if (isDerivableProxy(obj)) {\n return (obj as any).$derivable;\n }\n return obj;\n}\n\nconst proxyHandler: ProxyHandler<ProxyDescriptor> = {\n get(target, prop, receiver) {\n if (prop === '$proxyDescriptor') {\n return target;\n }\n if (isPluckableProperty(target, prop)) {\n return target.$pluck.call(receiver, prop as string | number);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, newValue, receiver) {\n if (isPluckableProperty(target, prop)) {\n const plucked = target.$pluck.call(receiver, prop as string | number) as ProxyDescriptor;\n if (newValue && isDerivableProxy(newValue)) {\n plucked.$targetValue = (newValue as any).$targetValue;\n } else {\n plucked.$value = newValue && isDerivable(newValue) ? newValue.get() : newValue;\n }\n return true;\n }\n return Reflect.set(target, prop, newValue, receiver);\n },\n has(target, prop) {\n if (prop === Symbol.iterator) {\n return target.$length() !== undefined;\n }\n return isPluckableProperty(target, prop);\n },\n getOwnPropertyDescriptor(target, prop) {\n if (isPluckableProperty(target, prop)) {\n return {\n get() { return this[prop]; },\n set(newValue) { this[prop] = newValue; },\n configurable: true,\n enumerable: true,\n };\n }\n return undefined;\n },\n ownKeys(target) {\n return target.$pluckableKeys();\n },\n};\n\nfunction isPluckableProperty(target: ProxyDescriptor, prop: PropertyKey) {\n return typeof prop === 'number' || typeof prop === 'string' && prop[0] !== '$' && !Reflect.has(target, prop);\n}\n\n/**\n * Extends an expression with a property access. Automatically uses bracket notation where appropriate and escapes\n * strings in brackets to give a realistic combined expression.\n *\n * @param expression the (optional) expression to extend\n * @param property the property that should be appended to the expression\n */\nexport function extendExpression(expression = '', property: string | number) {\n if (typeof property === 'string' && /^[a-z_][a-z_0-9]*$/i.test(property)) {\n return expression + '.' + property;\n }\n if (typeof property === 'string') {\n return expression + '[\"' + property.replace(/\\\\/g, '\\\\\\\\').replace(/\\\"/g, '\\\\\"') + '\"]';\n }\n return expression + '[' + property + ']';\n}\n\n/**\n * Extends a path with a property access.\n *\n * @param path the (optional) path to extend\n * @param property the property that should be appended to the path\n */\nexport function extendPath(path: Array<string | number> = [], property: string | number) {\n return path.concat(property);\n}\n"],"mappings":"iJAyCA,IAAMA,EAAqBC,OAAO,oBAO5B,SAAUC,EAAiBC,GAC7B,OAAmC,IAA5BA,EAAIH,EACf,CAYA,IAAAI,EAAA,oBAAAA,IAwBYC,KAAWC,iBAAkBC,C,CAsKzC,OA1KIC,OAAAC,eAAIL,EAAUM,UAAA,cAAdC,IAAA,WACI,IAAMC,EAAKP,KAAKQ,iBAChB,OAAOD,EAAGN,cAAgBM,EAAGN,YA2KrC,SAA+BQ,EAAsBC,GACjD,IAAKA,EACD,OAAOD,EAEH,IAAAH,EAAaI,EAASJ,IAAjBK,EAAQD,EAASC,IAC9B,OAAKA,GAAQC,EAAoBH,GAG1BI,EAAK,CACRP,IAAGA,EACHK,IAAG,SAACG,EAAUC,GACVN,EA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ock-proxy.esm.min.js","names":["IS_DERIVABLE_PROXY","Symbol","isDerivableProxy","obj","ProxyDescriptor","this","$$derivable","undefined","Object","defineProperty","prototype","get","pd","$proxyDescriptor","target","proxyLens","set","isSettableDerivable","lens","newValue","targetValue","call","autoCache","derive","createDerivable","$target","$lens","$derivable","e","assign","Error","concat","$expression","_internal","isError","message","jse_cause","atom","expression","$create","path","descriptor","utils","clone","getOwnPropertyNames","filter","prop","startsWith","forEach","$path","Proxy","proxyHandler","$pluck","pluck","extendExpression","extendPath","$pluckableKeys","value","$value","Reflect","ownKeys","$length","maybeArray","$targetValue","Array","isArray","length","$and","other","and","unwrapProxy","$or","or","$not","not","$is","is","$derive","apply","arguments","$react","reaction","options","react","toJSON","toStringTag","iterator","i","_a","sent","receiver","isPluckableProperty","plucked","isDerivable","has","getOwnPropertyDescriptor","configurable","enumerable","property","test","replace"],"sources":["../../extensions/sherlock-proxy/proxy.ts"],"sourcesContent":["import { Derivable, isDerivable, isSettableDerivable, lens, ReactorOptions, utils, _internal } from '@politie/sherlock';\n\n/**\n * The base interface for DerivableProxies. Defines only the $-properties and $-methods. Any property accessed with a number or\n * that doesn't start with a $-sign returns a new DerivableProxy.\n */\nexport interface DerivableProxy<V> {\n /** The current value that this Proxy represents. Can be expensive to calculate and is often writable. */\n $value: V;\n\n /** A string representation of this proxy's path from the root ProxyDescriptor. */\n $expression?: string;\n\n /**\n * An array representation of this proxy's path from the root ProxyDescriptor. Useful for programatically walking down the root\n * Descriptor's object tree to reacquire a target proxy.\n */\n $path?: Array<string | number>;\n\n /** {@see Derivable#and} */\n $and<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#or} */\n $or<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#not} */\n $not(): Derivable<boolean>;\n\n /** {@see Derivable#is} */\n $is(other: MaybePacked<any>): Derivable<boolean>;\n\n /** {@see Derivable#derive} */\n $derive<R>(f: (v: V) => R): Derivable<R>;\n $derive<R, P1>(f: (v: V, p1: P1) => R, p1: MaybePacked<P1>): Derivable<R>;\n $derive<R, P1, P2>(f: (v: V, p1: P1, p2: P2) => R, p1: MaybePacked<P1>, p2: MaybePacked<P2>): Derivable<R>;\n $derive<R, P>(f: (v: V, ...ps: P[]) => R, ...ps: Array<MaybePacked<P>>): Derivable<R>;\n\n /** {@see Derivable#react} */\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<V>>): () => void;\n}\n\nconst IS_DERIVABLE_PROXY = Symbol('isDerivableProxy');\n\n/**\n * Returns whether obj is a DerivableProxy.\n *\n * @param obj the object to test\n */\nexport function isDerivableProxy(obj: any): obj is DerivableProxy<any> {\n return obj[IS_DERIVABLE_PROXY] === true;\n}\n\n/**\n * A ProxyDescriptor must be used to create DerivableProxies. It can be used in two ways, either create a new descriptor and\n * change any implementation details (if needed) or create a subclass to extend the behavior. Use the {@link #$create} method\n * to create a DerivableProxy.\n *\n * Note that `this` in methods points to the created proxy, so only methods and properties that start with a $-sign can be accessed\n * without trouble.\n *\n * Note also that properties that start with two $-signs are cleared on $create.\n */\nexport class ProxyDescriptor<V = any, T = V> {\n /**\n * The target derivable (the input to the proxy and the {@link #$create} method). The actual values that can be seen by methods\n * on the Proxy can be influenced by providing a {@link #$lens}.\n */\n $target!: Derivable<T>;\n\n /**\n * The expression that represents the path to the current Proxy.\n */\n $expression?: string;\n\n /**\n * The path to the current Proxy.\n */\n $path?: Array<string | number>;\n\n /**\n * The derivable that is the input to all default methods on the Proxy and the {@link #$value} property.\n */\n get $derivable(): Derivable<V> {\n const pd = this.$proxyDescriptor;\n return pd.$$derivable || (pd.$$derivable = createDerivable(pd.$target, pd.$lens && pd.$lens()));\n }\n private $$derivable?: Derivable<V> = undefined;\n\n /**\n * The current value of the DerivableProxy. Can be expensive to calculate. When the target is settable (is an Atom) then $value\n * is writable.\n */\n get $value() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$derivable.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(new Error(`error while getting ${pd.$expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n set $value(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$derivable;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$value'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * The current value of the target Derivable that was used to create the DerivableProxy.\n */\n get $targetValue() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$target.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(\n new Error(`error while getting ${pd.$expression || '$targetValue'}: ${_internal.isError(e) && e.message}`),\n { jse_cause: e },\n );\n }\n }\n set $targetValue(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$target;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$targetValue'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$targetValue'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * In methods of a ProxyDescriptor, `this` is bound to the Proxy Object. Therefore, only $-properties and $-methods can be\n * accessed safely. Use $proxyDescriptor to get access to the ProxyDescriptor Object to prevent the ProxyHandler from messing\n * with your logic.\n */\n protected get $proxyDescriptor() { return this; }\n\n /**\n * An optional method that can return an optional lens to this proxy. Is used to transform the values before accessed by the\n * consumer of the Proxy (either through $value or one of the other methods).\n */\n $lens?(): DerivableProxyLens<T, V> | undefined;\n\n /**\n * Wrap a Derivable as DerivableProxy using this ProxyDescriptor.\n *\n * @param obj the object to wrap\n * @param expression the new expression to the created DerivableProxy\n * @param path the new path to the created DerivableProxy\n */\n $create(obj: Derivable<T>, expression?: string, path?: Array<string | number>): DerivableProxy<V> {\n const descriptor: ProxyDescriptor = utils.clone(this.$proxyDescriptor);\n descriptor.$target = obj;\n Object.getOwnPropertyNames(descriptor)\n .filter(prop => prop.startsWith('$$'))\n .forEach(prop => descriptor[prop] = undefined);\n descriptor.$expression = expression;\n descriptor.$path = path;\n return new Proxy(descriptor, proxyHandler) as any;\n }\n\n /**\n * The $pluck method is the implementation of the pluck mechanism of DerivableProxy. Replace this method to change the\n * pluck behavior. It should return a DerivableProxy.\n *\n * @param prop the property to pluck of the wrapped derivable\n */\n $pluck(prop: string | number): DerivableProxy<V> {\n const pd = this.$proxyDescriptor;\n return pd.$create(pd.$derivable.pluck(prop), extendExpression(pd.$expression, prop), extendPath(pd.$path, prop));\n }\n\n /**\n * The $pluckableKeys returns a list of properties that can be plucked from this object. Returned keys are guaranteed to\n * result in a usable DerivableProxy when used with $pluck. Is used for `for ... in` and `Object.keys(...)` logic.\n */\n $pluckableKeys() {\n const value = this.$proxyDescriptor.$value;\n return typeof value === 'object' ? Reflect.ownKeys(value as any) : [];\n }\n\n /**\n * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration\n * {@link #pluck} is called with indices up to but not including the result of `$length()`.\n */\n $length(): number | undefined {\n const maybeArray = this.$proxyDescriptor.$targetValue;\n return Array.isArray(maybeArray) ? maybeArray.length : undefined;\n }\n\n $and(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.and(unwrapProxy(other));\n }\n\n $or(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.or(unwrapProxy(other));\n }\n\n $not() {\n return this.$proxyDescriptor.$derivable.not();\n }\n\n $is(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.is(unwrapProxy(other));\n }\n\n $derive() {\n const target = this.$proxyDescriptor.$derivable;\n return target.derive.apply(target, arguments as any);\n }\n\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<any>>): () => void {\n return this.$proxyDescriptor.$derivable.react(reaction, options);\n }\n\n toJSON() {\n return this.$proxyDescriptor.$value;\n }\n\n get [Symbol.toStringTag]() {\n return 'DerivableProxy';\n }\n\n *[Symbol.iterator](): IterableIterator<DerivableProxy<V>> {\n const pd = this.$proxyDescriptor;\n const length = pd.$length();\n if (length === undefined) {\n const expression = pd.$expression;\n throw Object.assign(new Error(`${expression || 'object'} is not iterable`), { value: pd.$value, expression });\n }\n for (let i = 0; i < length; i++) {\n yield pd.$pluck(i)!;\n }\n }\n\n get length() {\n return this.$proxyDescriptor.$length();\n }\n}\nProxyDescriptor.prototype[IS_DERIVABLE_PROXY] = true;\n\nfunction createDerivable<V, T>(target: Derivable<T>, proxyLens?: DerivableProxyLens<T, V>): Derivable<V> {\n if (!proxyLens) {\n return target as any;\n }\n const { get, set } = proxyLens;\n if (!set || !isSettableDerivable(target)) {\n return target.derive(get).autoCache();\n }\n return lens({\n get,\n set(newValue, targetValue) {\n target.set(set.call(this, newValue, targetValue));\n }\n }, target).autoCache();\n}\n\nexport interface DerivableProxyLens<T, V> {\n get: (targetValue: T) => V;\n set?: (newValue: V, targetValue: T | undefined) => T;\n}\n\nexport type MaybePacked<T> = T | Derivable<T> | DerivableProxy<T>;\n\nexport function unwrapProxy<W>(obj: MaybePacked<W>): W | Derivable<W> {\n if (isDerivableProxy(obj)) {\n return (obj as any).$derivable;\n }\n return obj;\n}\n\nconst proxyHandler: ProxyHandler<ProxyDescriptor> = {\n get(target, prop, receiver) {\n if (prop === '$proxyDescriptor') {\n return target;\n }\n if (isPluckableProperty(target, prop)) {\n return target.$pluck.call(receiver, prop as string | number);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, newValue, receiver) {\n if (isPluckableProperty(target, prop)) {\n const plucked = target.$pluck.call(receiver, prop as string | number) as ProxyDescriptor;\n if (newValue && isDerivableProxy(newValue)) {\n plucked.$targetValue = (newValue as any).$targetValue;\n } else {\n plucked.$value = newValue && isDerivable(newValue) ? newValue.get() : newValue;\n }\n return true;\n }\n return Reflect.set(target, prop, newValue, receiver);\n },\n has(target, prop) {\n if (prop === Symbol.iterator) {\n return target.$length() !== undefined;\n }\n return isPluckableProperty(target, prop);\n },\n getOwnPropertyDescriptor(target, prop) {\n if (isPluckableProperty(target, prop)) {\n return {\n get() { return this[prop]; },\n set(newValue) { this[prop] = newValue; },\n configurable: true,\n enumerable: true,\n };\n }\n return undefined;\n },\n ownKeys(target) {\n return target.$pluckableKeys();\n },\n};\n\nfunction isPluckableProperty(target: ProxyDescriptor, prop: PropertyKey) {\n return typeof prop === 'number' || typeof prop === 'string' && prop[0] !== '$' && !Reflect.has(target, prop);\n}\n\n/**\n * Extends an expression with a property access. Automatically uses bracket notation where appropriate and escapes\n * strings in brackets to give a realistic combined expression.\n *\n * @param expression the (optional) expression to extend\n * @param property the property that should be appended to the expression\n */\nexport function extendExpression(expression = '', property: string | number) {\n if (typeof property === 'string' && /^[a-z_][a-z_0-9]*$/i.test(property)) {\n return expression + '.' + property;\n }\n if (typeof property === 'string') {\n return expression + '[\"' + property.replace(/\\\\/g, '\\\\\\\\').replace(/\\\"/g, '\\\\\"') + '\"]';\n }\n return expression + '[' + property + ']';\n}\n\n/**\n * Extends a path with a property access.\n *\n * @param path the (optional) path to extend\n * @param property the property that should be appended to the path\n */\nexport function extendPath(path: Array<string | number> = [], property: string | number) {\n return path.concat(property);\n}\n"],"mappings":"iJAyCA,IAAMA,EAAqBC,OAAO,oBAO5B,SAAUC,EAAiBC,GAC7B,OAAmC,IAA5BA,EAAIH,EACf,CAYA,IAAAI,EAAA,oBAAAA,IAwBYC,KAAWC,iBAAkBC,C,CAsKzC,OA1KIC,OAAAC,eAAIL,EAAUM,UAAA,cAAdC,IAAA,WACI,IAAMC,EAAKP,KAAKQ,iBAChB,OAAOD,EAAGN,cAAgBM,EAAGN,YA2KrC,SAA+BQ,EAAsBC,GACjD,IAAKA,EACD,OAAOD,EAEH,IAAAH,EAAaI,EAASJ,IAAjBK,EAAQD,EAASC,IAC9B,OAAKA,GAAQC,EAAoBH,GAG1BI,EAAK,CACRP,IAAGA,EACHK,IAAG,SAAC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 -20,8 +20,8 @@
20
20
  ***************************************************************************** */
21
21
 
22
22
  function __generator(thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
@@ -1 +1 @@
1
- {"version":3,"file":"sherlock-proxy.umd.js","sources":["../../node_modules/tslib/tslib.es6.mjs","../../extensions/sherlock-proxy/proxy.ts"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n","import { Derivable, isDerivable, isSettableDerivable, lens, ReactorOptions, utils, _internal } from '@politie/sherlock';\n\n/**\n * The base interface for DerivableProxies. Defines only the $-properties and $-methods. Any property accessed with a number or\n * that doesn't start with a $-sign returns a new DerivableProxy.\n */\nexport interface DerivableProxy<V> {\n /** The current value that this Proxy represents. Can be expensive to calculate and is often writable. */\n $value: V;\n\n /** A string representation of this proxy's path from the root ProxyDescriptor. */\n $expression?: string;\n\n /**\n * An array representation of this proxy's path from the root ProxyDescriptor. Useful for programatically walking down the root\n * Descriptor's object tree to reacquire a target proxy.\n */\n $path?: Array<string | number>;\n\n /** {@see Derivable#and} */\n $and<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#or} */\n $or<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#not} */\n $not(): Derivable<boolean>;\n\n /** {@see Derivable#is} */\n $is(other: MaybePacked<any>): Derivable<boolean>;\n\n /** {@see Derivable#derive} */\n $derive<R>(f: (v: V) => R): Derivable<R>;\n $derive<R, P1>(f: (v: V, p1: P1) => R, p1: MaybePacked<P1>): Derivable<R>;\n $derive<R, P1, P2>(f: (v: V, p1: P1, p2: P2) => R, p1: MaybePacked<P1>, p2: MaybePacked<P2>): Derivable<R>;\n $derive<R, P>(f: (v: V, ...ps: P[]) => R, ...ps: Array<MaybePacked<P>>): Derivable<R>;\n\n /** {@see Derivable#react} */\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<V>>): () => void;\n}\n\nconst IS_DERIVABLE_PROXY = Symbol('isDerivableProxy');\n\n/**\n * Returns whether obj is a DerivableProxy.\n *\n * @param obj the object to test\n */\nexport function isDerivableProxy(obj: any): obj is DerivableProxy<any> {\n return obj[IS_DERIVABLE_PROXY] === true;\n}\n\n/**\n * A ProxyDescriptor must be used to create DerivableProxies. It can be used in two ways, either create a new descriptor and\n * change any implementation details (if needed) or create a subclass to extend the behavior. Use the {@link #$create} method\n * to create a DerivableProxy.\n *\n * Note that `this` in methods points to the created proxy, so only methods and properties that start with a $-sign can be accessed\n * without trouble.\n *\n * Note also that properties that start with two $-signs are cleared on $create.\n */\nexport class ProxyDescriptor<V = any, T = V> {\n /**\n * The target derivable (the input to the proxy and the {@link #$create} method). The actual values that can be seen by methods\n * on the Proxy can be influenced by providing a {@link #$lens}.\n */\n $target!: Derivable<T>;\n\n /**\n * The expression that represents the path to the current Proxy.\n */\n $expression?: string;\n\n /**\n * The path to the current Proxy.\n */\n $path?: Array<string | number>;\n\n /**\n * The derivable that is the input to all default methods on the Proxy and the {@link #$value} property.\n */\n get $derivable(): Derivable<V> {\n const pd = this.$proxyDescriptor;\n return pd.$$derivable || (pd.$$derivable = createDerivable(pd.$target, pd.$lens && pd.$lens()));\n }\n private $$derivable?: Derivable<V> = undefined;\n\n /**\n * The current value of the DerivableProxy. Can be expensive to calculate. When the target is settable (is an Atom) then $value\n * is writable.\n */\n get $value() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$derivable.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(new Error(`error while getting ${pd.$expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n set $value(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$derivable;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$value'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * The current value of the target Derivable that was used to create the DerivableProxy.\n */\n get $targetValue() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$target.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(\n new Error(`error while getting ${pd.$expression || '$targetValue'}: ${_internal.isError(e) && e.message}`),\n { jse_cause: e },\n );\n }\n }\n set $targetValue(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$target;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$targetValue'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$targetValue'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * In methods of a ProxyDescriptor, `this` is bound to the Proxy Object. Therefore, only $-properties and $-methods can be\n * accessed safely. Use $proxyDescriptor to get access to the ProxyDescriptor Object to prevent the ProxyHandler from messing\n * with your logic.\n */\n protected get $proxyDescriptor() { return this; }\n\n /**\n * An optional method that can return an optional lens to this proxy. Is used to transform the values before accessed by the\n * consumer of the Proxy (either through $value or one of the other methods).\n */\n $lens?(): DerivableProxyLens<T, V> | undefined;\n\n /**\n * Wrap a Derivable as DerivableProxy using this ProxyDescriptor.\n *\n * @param obj the object to wrap\n * @param expression the new expression to the created DerivableProxy\n * @param path the new path to the created DerivableProxy\n */\n $create(obj: Derivable<T>, expression?: string, path?: Array<string | number>): DerivableProxy<V> {\n const descriptor: ProxyDescriptor = utils.clone(this.$proxyDescriptor);\n descriptor.$target = obj;\n Object.getOwnPropertyNames(descriptor)\n .filter(prop => prop.startsWith('$$'))\n .forEach(prop => descriptor[prop] = undefined);\n descriptor.$expression = expression;\n descriptor.$path = path;\n return new Proxy(descriptor, proxyHandler) as any;\n }\n\n /**\n * The $pluck method is the implementation of the pluck mechanism of DerivableProxy. Replace this method to change the\n * pluck behavior. It should return a DerivableProxy.\n *\n * @param prop the property to pluck of the wrapped derivable\n */\n $pluck(prop: string | number): DerivableProxy<V> {\n const pd = this.$proxyDescriptor;\n return pd.$create(pd.$derivable.pluck(prop), extendExpression(pd.$expression, prop), extendPath(pd.$path, prop));\n }\n\n /**\n * The $pluckableKeys returns a list of properties that can be plucked from this object. Returned keys are guaranteed to\n * result in a usable DerivableProxy when used with $pluck. Is used for `for ... in` and `Object.keys(...)` logic.\n */\n $pluckableKeys() {\n const value = this.$proxyDescriptor.$value;\n return typeof value === 'object' ? Reflect.ownKeys(value as any) : [];\n }\n\n /**\n * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration\n * {@link #pluck} is called with indices up to but not including the result of `$length()`.\n */\n $length(): number | undefined {\n const maybeArray = this.$proxyDescriptor.$targetValue;\n return Array.isArray(maybeArray) ? maybeArray.length : undefined;\n }\n\n $and(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.and(unwrapProxy(other));\n }\n\n $or(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.or(unwrapProxy(other));\n }\n\n $not() {\n return this.$proxyDescriptor.$derivable.not();\n }\n\n $is(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.is(unwrapProxy(other));\n }\n\n $derive() {\n const target = this.$proxyDescriptor.$derivable;\n return target.derive.apply(target, arguments as any);\n }\n\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<any>>): () => void {\n return this.$proxyDescriptor.$derivable.react(reaction, options);\n }\n\n toJSON() {\n return this.$proxyDescriptor.$value;\n }\n\n get [Symbol.toStringTag]() {\n return 'DerivableProxy';\n }\n\n *[Symbol.iterator](): IterableIterator<DerivableProxy<V>> {\n const pd = this.$proxyDescriptor;\n const length = pd.$length();\n if (length === undefined) {\n const expression = pd.$expression;\n throw Object.assign(new Error(`${expression || 'object'} is not iterable`), { value: pd.$value, expression });\n }\n for (let i = 0; i < length; i++) {\n yield pd.$pluck(i)!;\n }\n }\n\n get length() {\n return this.$proxyDescriptor.$length();\n }\n}\nProxyDescriptor.prototype[IS_DERIVABLE_PROXY] = true;\n\nfunction createDerivable<V, T>(target: Derivable<T>, proxyLens?: DerivableProxyLens<T, V>): Derivable<V> {\n if (!proxyLens) {\n return target as any;\n }\n const { get, set } = proxyLens;\n if (!set || !isSettableDerivable(target)) {\n return target.derive(get).autoCache();\n }\n return lens({\n get,\n set(newValue, targetValue) {\n target.set(set.call(this, newValue, targetValue));\n }\n }, target).autoCache();\n}\n\nexport interface DerivableProxyLens<T, V> {\n get: (targetValue: T) => V;\n set?: (newValue: V, targetValue: T | undefined) => T;\n}\n\nexport type MaybePacked<T> = T | Derivable<T> | DerivableProxy<T>;\n\nexport function unwrapProxy<W>(obj: MaybePacked<W>): W | Derivable<W> {\n if (isDerivableProxy(obj)) {\n return (obj as any).$derivable;\n }\n return obj;\n}\n\nconst proxyHandler: ProxyHandler<ProxyDescriptor> = {\n get(target, prop, receiver) {\n if (prop === '$proxyDescriptor') {\n return target;\n }\n if (isPluckableProperty(target, prop)) {\n return target.$pluck.call(receiver, prop as string | number);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, newValue, receiver) {\n if (isPluckableProperty(target, prop)) {\n const plucked = target.$pluck.call(receiver, prop as string | number) as ProxyDescriptor;\n if (newValue && isDerivableProxy(newValue)) {\n plucked.$targetValue = (newValue as any).$targetValue;\n } else {\n plucked.$value = newValue && isDerivable(newValue) ? newValue.get() : newValue;\n }\n return true;\n }\n return Reflect.set(target, prop, newValue, receiver);\n },\n has(target, prop) {\n if (prop === Symbol.iterator) {\n return target.$length() !== undefined;\n }\n return isPluckableProperty(target, prop);\n },\n getOwnPropertyDescriptor(target, prop) {\n if (isPluckableProperty(target, prop)) {\n return {\n get() { return this[prop]; },\n set(newValue) { this[prop] = newValue; },\n configurable: true,\n enumerable: true,\n };\n }\n return undefined;\n },\n ownKeys(target) {\n return target.$pluckableKeys();\n },\n};\n\nfunction isPluckableProperty(target: ProxyDescriptor, prop: PropertyKey) {\n return typeof prop === 'number' || typeof prop === 'string' && prop[0] !== '$' && !Reflect.has(target, prop);\n}\n\n/**\n * Extends an expression with a property access. Automatically uses bracket notation where appropriate and escapes\n * strings in brackets to give a realistic combined expression.\n *\n * @param expression the (optional) expression to extend\n * @param property the property that should be appended to the expression\n */\nexport function extendExpression(expression = '', property: string | number) {\n if (typeof property === 'string' && /^[a-z_][a-z_0-9]*$/i.test(property)) {\n return expression + '.' + property;\n }\n if (typeof property === 'string') {\n return expression + '[\"' + property.replace(/\\\\/g, '\\\\\\\\').replace(/\\\"/g, '\\\\\"') + '\"]';\n }\n return expression + '[' + property + ']';\n}\n\n/**\n * Extends a path with a property access.\n *\n * @param path the (optional) path to extend\n * @param property the property that should be appended to the path\n */\nexport function extendPath(path: Array<string | number> = [], property: string | number) {\n return path.concat(property);\n}\n"],"names":["_internal","isSettableDerivable","utils","lens","isDerivable"],"mappings":";;;;;;EAAA;EACA;AACA;EACA;EACA;AACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AA8GA;EACO,SAAS,WAAW,CAAC,OAAO,EAAE,IAA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AAA,KAAA,CAAA,EAAA,EAAA,UAAe,GAAA,EAAA,CAAA,EAAA;EAC5C,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;EACtE,QAAA,OAAO,UAAU,GAAG,GAAG,GAAG,QAAQ,CAAC;OACtC;EACD,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;UAC9B,OAAO,UAAU,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;OAC3F;EACD,IAAA,OAAO,UAAU,GAAG,GAAG,GAAG,QAAQ,GAAG,GAAG,CAAC;EAC7C,CAAC;EAED;;;;;EAKG;EACa,SAAA,UAAU,CAAC,IAAiC,EAAE,QAAyB,EAAA;EAA5D,IAAA,IAAA,IAAA,KAAA,KAAA,CAAA,EAAA,EAAA,IAAiC,GAAA,EAAA,CAAA,EAAA;EACxD,IAAA,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;EACjC;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"sherlock-proxy.umd.js","sources":["../../node_modules/tslib/tslib.es6.mjs","../../extensions/sherlock-proxy/proxy.ts"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","import { Derivable, isDerivable, isSettableDerivable, lens, ReactorOptions, utils, _internal } from '@politie/sherlock';\n\n/**\n * The base interface for DerivableProxies. Defines only the $-properties and $-methods. Any property accessed with a number or\n * that doesn't start with a $-sign returns a new DerivableProxy.\n */\nexport interface DerivableProxy<V> {\n /** The current value that this Proxy represents. Can be expensive to calculate and is often writable. */\n $value: V;\n\n /** A string representation of this proxy's path from the root ProxyDescriptor. */\n $expression?: string;\n\n /**\n * An array representation of this proxy's path from the root ProxyDescriptor. Useful for programatically walking down the root\n * Descriptor's object tree to reacquire a target proxy.\n */\n $path?: Array<string | number>;\n\n /** {@see Derivable#and} */\n $and<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#or} */\n $or<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#not} */\n $not(): Derivable<boolean>;\n\n /** {@see Derivable#is} */\n $is(other: MaybePacked<any>): Derivable<boolean>;\n\n /** {@see Derivable#derive} */\n $derive<R>(f: (v: V) => R): Derivable<R>;\n $derive<R, P1>(f: (v: V, p1: P1) => R, p1: MaybePacked<P1>): Derivable<R>;\n $derive<R, P1, P2>(f: (v: V, p1: P1, p2: P2) => R, p1: MaybePacked<P1>, p2: MaybePacked<P2>): Derivable<R>;\n $derive<R, P>(f: (v: V, ...ps: P[]) => R, ...ps: Array<MaybePacked<P>>): Derivable<R>;\n\n /** {@see Derivable#react} */\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<V>>): () => void;\n}\n\nconst IS_DERIVABLE_PROXY = Symbol('isDerivableProxy');\n\n/**\n * Returns whether obj is a DerivableProxy.\n *\n * @param obj the object to test\n */\nexport function isDerivableProxy(obj: any): obj is DerivableProxy<any> {\n return obj[IS_DERIVABLE_PROXY] === true;\n}\n\n/**\n * A ProxyDescriptor must be used to create DerivableProxies. It can be used in two ways, either create a new descriptor and\n * change any implementation details (if needed) or create a subclass to extend the behavior. Use the {@link #$create} method\n * to create a DerivableProxy.\n *\n * Note that `this` in methods points to the created proxy, so only methods and properties that start with a $-sign can be accessed\n * without trouble.\n *\n * Note also that properties that start with two $-signs are cleared on $create.\n */\nexport class ProxyDescriptor<V = any, T = V> {\n /**\n * The target derivable (the input to the proxy and the {@link #$create} method). The actual values that can be seen by methods\n * on the Proxy can be influenced by providing a {@link #$lens}.\n */\n $target!: Derivable<T>;\n\n /**\n * The expression that represents the path to the current Proxy.\n */\n $expression?: string;\n\n /**\n * The path to the current Proxy.\n */\n $path?: Array<string | number>;\n\n /**\n * The derivable that is the input to all default methods on the Proxy and the {@link #$value} property.\n */\n get $derivable(): Derivable<V> {\n const pd = this.$proxyDescriptor;\n return pd.$$derivable || (pd.$$derivable = createDerivable(pd.$target, pd.$lens && pd.$lens()));\n }\n private $$derivable?: Derivable<V> = undefined;\n\n /**\n * The current value of the DerivableProxy. Can be expensive to calculate. When the target is settable (is an Atom) then $value\n * is writable.\n */\n get $value() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$derivable.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(new Error(`error while getting ${pd.$expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n set $value(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$derivable;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$value'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * The current value of the target Derivable that was used to create the DerivableProxy.\n */\n get $targetValue() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$target.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(\n new Error(`error while getting ${pd.$expression || '$targetValue'}: ${_internal.isError(e) && e.message}`),\n { jse_cause: e },\n );\n }\n }\n set $targetValue(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$target;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$targetValue'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$targetValue'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * In methods of a ProxyDescriptor, `this` is bound to the Proxy Object. Therefore, only $-properties and $-methods can be\n * accessed safely. Use $proxyDescriptor to get access to the ProxyDescriptor Object to prevent the ProxyHandler from messing\n * with your logic.\n */\n protected get $proxyDescriptor() { return this; }\n\n /**\n * An optional method that can return an optional lens to this proxy. Is used to transform the values before accessed by the\n * consumer of the Proxy (either through $value or one of the other methods).\n */\n $lens?(): DerivableProxyLens<T, V> | undefined;\n\n /**\n * Wrap a Derivable as DerivableProxy using this ProxyDescriptor.\n *\n * @param obj the object to wrap\n * @param expression the new expression to the created DerivableProxy\n * @param path the new path to the created DerivableProxy\n */\n $create(obj: Derivable<T>, expression?: string, path?: Array<string | number>): DerivableProxy<V> {\n const descriptor: ProxyDescriptor = utils.clone(this.$proxyDescriptor);\n descriptor.$target = obj;\n Object.getOwnPropertyNames(descriptor)\n .filter(prop => prop.startsWith('$$'))\n .forEach(prop => descriptor[prop] = undefined);\n descriptor.$expression = expression;\n descriptor.$path = path;\n return new Proxy(descriptor, proxyHandler) as any;\n }\n\n /**\n * The $pluck method is the implementation of the pluck mechanism of DerivableProxy. Replace this method to change the\n * pluck behavior. It should return a DerivableProxy.\n *\n * @param prop the property to pluck of the wrapped derivable\n */\n $pluck(prop: string | number): DerivableProxy<V> {\n const pd = this.$proxyDescriptor;\n return pd.$create(pd.$derivable.pluck(prop), extendExpression(pd.$expression, prop), extendPath(pd.$path, prop));\n }\n\n /**\n * The $pluckableKeys returns a list of properties that can be plucked from this object. Returned keys are guaranteed to\n * result in a usable DerivableProxy when used with $pluck. Is used for `for ... in` and `Object.keys(...)` logic.\n */\n $pluckableKeys() {\n const value = this.$proxyDescriptor.$value;\n return typeof value === 'object' ? Reflect.ownKeys(value as any) : [];\n }\n\n /**\n * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration\n * {@link #pluck} is called with indices up to but not including the result of `$length()`.\n */\n $length(): number | undefined {\n const maybeArray = this.$proxyDescriptor.$targetValue;\n return Array.isArray(maybeArray) ? maybeArray.length : undefined;\n }\n\n $and(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.and(unwrapProxy(other));\n }\n\n $or(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.or(unwrapProxy(other));\n }\n\n $not() {\n return this.$proxyDescriptor.$derivable.not();\n }\n\n $is(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.is(unwrapProxy(other));\n }\n\n $derive() {\n const target = this.$proxyDescriptor.$derivable;\n return target.derive.apply(target, arguments as any);\n }\n\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<any>>): () => void {\n return this.$proxyDescriptor.$derivable.react(reaction, options);\n }\n\n toJSON() {\n return this.$proxyDescriptor.$value;\n }\n\n get [Symbol.toStringTag]() {\n return 'DerivableProxy';\n }\n\n *[Symbol.iterator](): IterableIterator<DerivableProxy<V>> {\n const pd = this.$proxyDescriptor;\n const length = pd.$length();\n if (length === undefined) {\n const expression = pd.$expression;\n throw Object.assign(new Error(`${expression || 'object'} is not iterable`), { value: pd.$value, expression });\n }\n for (let i = 0; i < length; i++) {\n yield pd.$pluck(i)!;\n }\n }\n\n get length() {\n return this.$proxyDescriptor.$length();\n }\n}\nProxyDescriptor.prototype[IS_DERIVABLE_PROXY] = true;\n\nfunction createDerivable<V, T>(target: Derivable<T>, proxyLens?: DerivableProxyLens<T, V>): Derivable<V> {\n if (!proxyLens) {\n return target as any;\n }\n const { get, set } = proxyLens;\n if (!set || !isSettableDerivable(target)) {\n return target.derive(get).autoCache();\n }\n return lens({\n get,\n set(newValue, targetValue) {\n target.set(set.call(this, newValue, targetValue));\n }\n }, target).autoCache();\n}\n\nexport interface DerivableProxyLens<T, V> {\n get: (targetValue: T) => V;\n set?: (newValue: V, targetValue: T | undefined) => T;\n}\n\nexport type MaybePacked<T> = T | Derivable<T> | DerivableProxy<T>;\n\nexport function unwrapProxy<W>(obj: MaybePacked<W>): W | Derivable<W> {\n if (isDerivableProxy(obj)) {\n return (obj as any).$derivable;\n }\n return obj;\n}\n\nconst proxyHandler: ProxyHandler<ProxyDescriptor> = {\n get(target, prop, receiver) {\n if (prop === '$proxyDescriptor') {\n return target;\n }\n if (isPluckableProperty(target, prop)) {\n return target.$pluck.call(receiver, prop as string | number);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, newValue, receiver) {\n if (isPluckableProperty(target, prop)) {\n const plucked = target.$pluck.call(receiver, prop as string | number) as ProxyDescriptor;\n if (newValue && isDerivableProxy(newValue)) {\n plucked.$targetValue = (newValue as any).$targetValue;\n } else {\n plucked.$value = newValue && isDerivable(newValue) ? newValue.get() : newValue;\n }\n return true;\n }\n return Reflect.set(target, prop, newValue, receiver);\n },\n has(target, prop) {\n if (prop === Symbol.iterator) {\n return target.$length() !== undefined;\n }\n return isPluckableProperty(target, prop);\n },\n getOwnPropertyDescriptor(target, prop) {\n if (isPluckableProperty(target, prop)) {\n return {\n get() { return this[prop]; },\n set(newValue) { this[prop] = newValue; },\n configurable: true,\n enumerable: true,\n };\n }\n return undefined;\n },\n ownKeys(target) {\n return target.$pluckableKeys();\n },\n};\n\nfunction isPluckableProperty(target: ProxyDescriptor, prop: PropertyKey) {\n return typeof prop === 'number' || typeof prop === 'string' && prop[0] !== '$' && !Reflect.has(target, prop);\n}\n\n/**\n * Extends an expression with a property access. Automatically uses bracket notation where appropriate and escapes\n * strings in brackets to give a realistic combined expression.\n *\n * @param expression the (optional) expression to extend\n * @param property the property that should be appended to the expression\n */\nexport function extendExpression(expression = '', property: string | number) {\n if (typeof property === 'string' && /^[a-z_][a-z_0-9]*$/i.test(property)) {\n return expression + '.' + property;\n }\n if (typeof property === 'string') {\n return expression + '[\"' + property.replace(/\\\\/g, '\\\\\\\\').replace(/\\\"/g, '\\\\\"') + '\"]';\n }\n return expression + '[' + property + ']';\n}\n\n/**\n * Extends a path with a property access.\n *\n * @param path the (optional) path to extend\n * @param property the property that should be appended to the path\n */\nexport function extendPath(path: Array<string | number> = [], property: string | number) {\n return path.concat(property);\n}\n"],"names":["_internal","isSettableDerivable","utils","lens","isDerivable"],"mappings":";;;;;;EAAA;EACA;AACA;EACA;EACA;AACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AA8GA;EACO,SAAS,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE;EAC3C,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,C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A,EAAA;EAC5C,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;EACtE,QAAA,OAAO,UAAU,GAAG,GAAG,GAAG,QAAQ,CAAC;OACtC;EACD,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;UAC9B,OAAO,UAAU,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;OAC3F;EACD,IAAA,OAAO,UAAU,GAAG,GAAG,GAAG,QAAQ,GAAG,GAAG,CAAC;EAC7C,CAAC;EAED;;;;;EAKG;EACa,SAAA,UAAU,CAAC,IAAiC,EAAE,QAAyB,EAAA;EAA5D,IAAA,IAAA,IAAA,KAAA,KAAA,CAAA,EAAA,EAAA,IAAiC,GAAA,EAAA,CAAA,EAAA;EACxD,IAAA,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;EACjC;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@politie/sherlock")):"function"==typeof define&&define.amd?define(["exports","@politie/sherlock"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SherlockProxy={},e.Sherlock)}(this,(function(e,t){"use strict";"function"==typeof SuppressedError&&SuppressedError;var r=Symbol("isDerivableProxy");function n(e){return!0===e[r]}var i=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var e=this.$proxyDescriptor;return e.$$derivable||(e.$$derivable=function(e,r){if(!r)return e;var n=r.get,i=r.set;return i&&t.isSettableDerivable(e)?t.lens({get:n,set:function(t,r){e.set(i.call(this,t,r))}},e).autoCache():e.derive(n).autoCache()}(e.$target,e.$lens&&e.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var e=this.$proxyDescriptor;try{return e.$derivable.get()}catch(r){throw Object.assign(Error("error while getting ".concat(e.$expression||"$value",": ").concat(t._internal.isError(r)&&r.message)),{jse_cause:r})}},set:function(e){var r=this.$proxyDescriptor,n=r.$derivable,i=r.$expression;if(!t.isSettableDerivable(n))throw Error("".concat(i||"$value"," is readonly"));try{n.set(e)}catch(e){throw Object.assign(Error("error while setting ".concat(i||"$value",": ").concat(t._internal.isError(e)&&e.message)),{jse_cause:e})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var e=this.$proxyDescriptor;try{return e.$target.get()}catch(r){throw Object.assign(Error("error while getting ".concat(e.$expression||"$targetValue",": ").concat(t._internal.isError(r)&&r.message)),{jse_cause:r})}},set:function(e){var r=this.$proxyDescriptor,n=r.$target,i=r.$expression;if(!t.isSettableDerivable(n))throw Error("".concat(i||"$targetValue"," is readonly"));try{n.set(e)}catch(e){throw Object.assign(Error("error while setting ".concat(i||"$targetValue",": ").concat(t._internal.isError(e)&&e.message)),{jse_cause:e})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(e,r,n){var i=t.utils.clone(this.$proxyDescriptor);return i.$target=e,Object.getOwnPropertyNames(i).filter((function(e){return e.startsWith("$$")})).forEach((function(e){return i[e]=void 0})),i.$expression=r,i.$path=n,new Proxy(i,u)},e.prototype.$pluck=function(e){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(e),f(t.$expression,e),a(t.$path,e))},e.prototype.$pluckableKeys=function(){var e=this.$proxyDescriptor.$value;return"object"==typeof e?Reflect.ownKeys(e):[]},e.prototype.$length=function(){var e=this.$proxyDescriptor.$targetValue;return Array.isArray(e)?e.length:void 0},e.prototype.$and=function(e){return this.$proxyDescriptor.$derivable.and(o(e))},e.prototype.$or=function(e){return this.$proxyDescriptor.$derivable.or(o(e))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(e){return this.$proxyDescriptor.$derivable.is(o(e))},e.prototype.$derive=function(){var e=this.$proxyDescriptor.$derivable;return e.derive.apply(e,arguments)},e.prototype.$react=function(e,t){return this.$proxyDescriptor.$derivable.react(e,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var e,t,r,n;return function(e,t){var r,n,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(f){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,n=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!((i=(i=u.trys).length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=t.call(e,u)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,f])}}}(this,(function(i){switch(i.label){case 0:if(e=this.$proxyDescriptor,void 0===(t=e.$length()))throw r=e.$expression,Object.assign(Error("".concat(r||"object"," is not iterable")),{value:e.$value,expression:r});n=0,i.label=1;case 1:return n<t?[4,e.$pluck(n)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function o(e){return n(e)?e.$derivable:e}i.prototype[r]=!0;var u={get:function(e,t,r){return"$proxyDescriptor"===t?e:c(e,t)?e.$pluck.call(r,t):Reflect.get(e,t,r)},set:function(e,r,i,o){if(c(e,r)){var u=e.$pluck.call(o,r);return i&&n(i)?u.$targetValue=i.$targetValue:u.$value=i&&t.isDerivable(i)?i.get():i,!0}return Reflect.set(e,r,i,o)},has:function(e,t){return t===Symbol.iterator?void 0!==e.$length():c(e,t)},getOwnPropertyDescriptor:function(e,t){if(c(e,t))return{get:function(){return this[t]},set:function(e){this[t]=e},configurable:!0,enumerable:!0}},ownKeys:function(e){return e.$pluckableKeys()}};function c(e,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(e,t)}function f(e,t){return void 0===e&&(e=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?e+"."+t:"string"==typeof t?e+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':e+"["+t+"]"}function a(e,t){return void 0===e&&(e=[]),e.concat(t)}e.ProxyDescriptor=i,e.extendExpression=f,e.extendPath=a,e.isDerivableProxy=n,e.unwrapProxy=o,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@politie/sherlock")):"function"==typeof define&&define.amd?define(["exports","@politie/sherlock"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SherlockProxy={},e.Sherlock)}(this,function(e,t){"use strict";"function"==typeof SuppressedError&&SuppressedError;var r=Symbol("isDerivableProxy");function n(e){return!0===e[r]}var i=function(){function e(){this.$$derivable=void 0}return Object.defineProperty(e.prototype,"$derivable",{get:function(){var e=this.$proxyDescriptor;return e.$$derivable||(e.$$derivable=function(e,r){if(!r)return e;var n=r.get,i=r.set;return i&&t.isSettableDerivable(e)?t.lens({get:n,set:function(t,r){e.set(i.call(this,t,r))}},e).autoCache():e.derive(n).autoCache()}(e.$target,e.$lens&&e.$lens()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$value",{get:function(){var e=this.$proxyDescriptor;try{return e.$derivable.get()}catch(r){throw Object.assign(Error("error while getting ".concat(e.$expression||"$value",": ").concat(t._internal.isError(r)&&r.message)),{jse_cause:r})}},set:function(e){var r=this.$proxyDescriptor,n=r.$derivable,i=r.$expression;if(!t.isSettableDerivable(n))throw Error("".concat(i||"$value"," is readonly"));try{n.set(e)}catch(e){throw Object.assign(Error("error while setting ".concat(i||"$value",": ").concat(t._internal.isError(e)&&e.message)),{jse_cause:e})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$targetValue",{get:function(){var e=this.$proxyDescriptor;try{return e.$target.get()}catch(r){throw Object.assign(Error("error while getting ".concat(e.$expression||"$targetValue",": ").concat(t._internal.isError(r)&&r.message)),{jse_cause:r})}},set:function(e){var r=this.$proxyDescriptor,n=r.$target,i=r.$expression;if(!t.isSettableDerivable(n))throw Error("".concat(i||"$targetValue"," is readonly"));try{n.set(e)}catch(e){throw Object.assign(Error("error while setting ".concat(i||"$targetValue",": ").concat(t._internal.isError(e)&&e.message)),{jse_cause:e})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$proxyDescriptor",{get:function(){return this},enumerable:!1,configurable:!0}),e.prototype.$create=function(e,r,n){var i=t.utils.clone(this.$proxyDescriptor);return i.$target=e,Object.getOwnPropertyNames(i).filter(function(e){return e.startsWith("$$")}).forEach(function(e){return i[e]=void 0}),i.$expression=r,i.$path=n,new Proxy(i,u)},e.prototype.$pluck=function(e){var t=this.$proxyDescriptor;return t.$create(t.$derivable.pluck(e),f(t.$expression,e),a(t.$path,e))},e.prototype.$pluckableKeys=function(){var e=this.$proxyDescriptor.$value;return"object"==typeof e?Reflect.ownKeys(e):[]},e.prototype.$length=function(){var e=this.$proxyDescriptor.$targetValue;return Array.isArray(e)?e.length:void 0},e.prototype.$and=function(e){return this.$proxyDescriptor.$derivable.and(o(e))},e.prototype.$or=function(e){return this.$proxyDescriptor.$derivable.or(o(e))},e.prototype.$not=function(){return this.$proxyDescriptor.$derivable.not()},e.prototype.$is=function(e){return this.$proxyDescriptor.$derivable.is(o(e))},e.prototype.$derive=function(){var e=this.$proxyDescriptor.$derivable;return e.derive.apply(e,arguments)},e.prototype.$react=function(e,t){return this.$proxyDescriptor.$derivable.react(e,t)},e.prototype.toJSON=function(){return this.$proxyDescriptor.$value},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"DerivableProxy"},enumerable:!1,configurable:!0}),e.prototype[Symbol.iterator]=function(){var e,t,r,n;return function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(f){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,f])}}}(this,function(i){switch(i.label){case 0:if(e=this.$proxyDescriptor,void 0===(t=e.$length()))throw r=e.$expression,Object.assign(Error("".concat(r||"object"," is not iterable")),{value:e.$value,expression:r});n=0,i.label=1;case 1:return n<t?[4,e.$pluck(n)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})},Object.defineProperty(e.prototype,"length",{get:function(){return this.$proxyDescriptor.$length()},enumerable:!1,configurable:!0}),e}();function o(e){return n(e)?e.$derivable:e}i.prototype[r]=!0;var u={get:function(e,t,r){return"$proxyDescriptor"===t?e:c(e,t)?e.$pluck.call(r,t):Reflect.get(e,t,r)},set:function(e,r,i,o){if(c(e,r)){var u=e.$pluck.call(o,r);return i&&n(i)?u.$targetValue=i.$targetValue:u.$value=i&&t.isDerivable(i)?i.get():i,!0}return Reflect.set(e,r,i,o)},has:function(e,t){return t===Symbol.iterator?void 0!==e.$length():c(e,t)},getOwnPropertyDescriptor:function(e,t){if(c(e,t))return{get:function(){return this[t]},set:function(e){this[t]=e},configurable:!0,enumerable:!0}},ownKeys:function(e){return e.$pluckableKeys()}};function c(e,t){return"number"==typeof t||"string"==typeof t&&"$"!==t[0]&&!Reflect.has(e,t)}function f(e,t){return void 0===e&&(e=""),"string"==typeof t&&/^[a-z_][a-z_0-9]*$/i.test(t)?e+"."+t:"string"==typeof t?e+'["'+t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"]':e+"["+t+"]"}function a(e,t){return void 0===e&&(e=[]),e.concat(t)}e.ProxyDescriptor=i,e.extendExpression=f,e.extendPath=a,e.isDerivableProxy=n,e.unwrapProxy=o,Object.defineProperty(e,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=sherlock-proxy.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sherlock-proxy.umd.min.js","names":["SuppressedError","IS_DERIVABLE_PROXY","Symbol","isDerivableProxy","obj","ProxyDescriptor","this","$$derivable","undefined","Object","defineProperty","prototype","get","pd","$proxyDescriptor","target","proxyLens","set","isSettableDerivable","lens","newValue","targetValue","call","autoCache","derive","createDerivable","$target","$lens","$derivable","e","assign","Error","concat","$expression","_internal","isError","message","jse_cause","atom","expression","$create","path","descriptor","utils","clone","getOwnPropertyNames","filter","prop","startsWith","forEach","$path","Proxy","proxyHandler","$pluck","pluck","extendExpression","extendPath","$pluckableKeys","value","$value","Reflect","ownKeys","$length","maybeArray","$targetValue","Array","isArray","length","$and","other","and","unwrapProxy","$or","or","$not","not","$is","is","$derive","apply","arguments","$react","reaction","options","react","toJSON","toStringTag","iterator","thisArg","body","f","y","t","g","_","label","sent","trys","ops","next","verb","throw","return","n","v","op","TypeError","done","pop","push","step","i","_a","receiver","isPluckableProperty","plucked","isDerivable","has","getOwnPropertyDescriptor","configurable","enumerable","property","test","replace"],"sources":["../../node_modules/tslib/tslib.es6.mjs","../../extensions/sherlock-proxy/proxy.ts"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n","import { Derivable, isDerivable, isSettableDerivable, lens, ReactorOptions, utils, _internal } from '@politie/sherlock';\n\n/**\n * The base interface for DerivableProxies. Defines only the $-properties and $-methods. Any property accessed with a number or\n * that doesn't start with a $-sign returns a new DerivableProxy.\n */\nexport interface DerivableProxy<V> {\n /** The current value that this Proxy represents. Can be expensive to calculate and is often writable. */\n $value: V;\n\n /** A string representation of this proxy's path from the root ProxyDescriptor. */\n $expression?: string;\n\n /**\n * An array representation of this proxy's path from the root ProxyDescriptor. Useful for programatically walking down the root\n * Descriptor's object tree to reacquire a target proxy.\n */\n $path?: Array<string | number>;\n\n /** {@see Derivable#and} */\n $and<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#or} */\n $or<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#not} */\n $not(): Derivable<boolean>;\n\n /** {@see Derivable#is} */\n $is(other: MaybePacked<any>): Derivable<boolean>;\n\n /** {@see Derivable#derive} */\n $derive<R>(f: (v: V) => R): Derivable<R>;\n $derive<R, P1>(f: (v: V, p1: P1) => R, p1: MaybePacked<P1>): Derivable<R>;\n $derive<R, P1, P2>(f: (v: V, p1: P1, p2: P2) => R, p1: MaybePacked<P1>, p2: MaybePacked<P2>): Derivable<R>;\n $derive<R, P>(f: (v: V, ...ps: P[]) => R, ...ps: Array<MaybePacked<P>>): Derivable<R>;\n\n /** {@see Derivable#react} */\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<V>>): () => void;\n}\n\nconst IS_DERIVABLE_PROXY = Symbol('isDerivableProxy');\n\n/**\n * Returns whether obj is a DerivableProxy.\n *\n * @param obj the object to test\n */\nexport function isDerivableProxy(obj: any): obj is DerivableProxy<any> {\n return obj[IS_DERIVABLE_PROXY] === true;\n}\n\n/**\n * A ProxyDescriptor must be used to create DerivableProxies. It can be used in two ways, either create a new descriptor and\n * change any implementation details (if needed) or create a subclass to extend the behavior. Use the {@link #$create} method\n * to create a DerivableProxy.\n *\n * Note that `this` in methods points to the created proxy, so only methods and properties that start with a $-sign can be accessed\n * without trouble.\n *\n * Note also that properties that start with two $-signs are cleared on $create.\n */\nexport class ProxyDescriptor<V = any, T = V> {\n /**\n * The target derivable (the input to the proxy and the {@link #$create} method). The actual values that can be seen by methods\n * on the Proxy can be influenced by providing a {@link #$lens}.\n */\n $target!: Derivable<T>;\n\n /**\n * The expression that represents the path to the current Proxy.\n */\n $expression?: string;\n\n /**\n * The path to the current Proxy.\n */\n $path?: Array<string | number>;\n\n /**\n * The derivable that is the input to all default methods on the Proxy and the {@link #$value} property.\n */\n get $derivable(): Derivable<V> {\n const pd = this.$proxyDescriptor;\n return pd.$$derivable || (pd.$$derivable = createDerivable(pd.$target, pd.$lens && pd.$lens()));\n }\n private $$derivable?: Derivable<V> = undefined;\n\n /**\n * The current value of the DerivableProxy. Can be expensive to calculate. When the target is settable (is an Atom) then $value\n * is writable.\n */\n get $value() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$derivable.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(new Error(`error while getting ${pd.$expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n set $value(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$derivable;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$value'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * The current value of the target Derivable that was used to create the DerivableProxy.\n */\n get $targetValue() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$target.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(\n new Error(`error while getting ${pd.$expression || '$targetValue'}: ${_internal.isError(e) && e.message}`),\n { jse_cause: e },\n );\n }\n }\n set $targetValue(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$target;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$targetValue'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$targetValue'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * In methods of a ProxyDescriptor, `this` is bound to the Proxy Object. Therefore, only $-properties and $-methods can be\n * accessed safely. Use $proxyDescriptor to get access to the ProxyDescriptor Object to prevent the ProxyHandler from messing\n * with your logic.\n */\n protected get $proxyDescriptor() { return this; }\n\n /**\n * An optional method that can return an optional lens to this proxy. Is used to transform the values before accessed by the\n * consumer of the Proxy (either through $value or one of the other methods).\n */\n $lens?(): DerivableProxyLens<T, V> | undefined;\n\n /**\n * Wrap a Derivable as DerivableProxy using this ProxyDescriptor.\n *\n * @param obj the object to wrap\n * @param expression the new expression to the created DerivableProxy\n * @param path the new path to the created DerivableProxy\n */\n $create(obj: Derivable<T>, expression?: string, path?: Array<string | number>): DerivableProxy<V> {\n const descriptor: ProxyDescriptor = utils.clone(this.$proxyDescriptor);\n descriptor.$target = obj;\n Object.getOwnPropertyNames(descriptor)\n .filter(prop => prop.startsWith('$$'))\n .forEach(prop => descriptor[prop] = undefined);\n descriptor.$expression = expression;\n descriptor.$path = path;\n return new Proxy(descriptor, proxyHandler) as any;\n }\n\n /**\n * The $pluck method is the implementation of the pluck mechanism of DerivableProxy. Replace this method to change the\n * pluck behavior. It should return a DerivableProxy.\n *\n * @param prop the property to pluck of the wrapped derivable\n */\n $pluck(prop: string | number): DerivableProxy<V> {\n const pd = this.$proxyDescriptor;\n return pd.$create(pd.$derivable.pluck(prop), extendExpression(pd.$expression, prop), extendPath(pd.$path, prop));\n }\n\n /**\n * The $pluckableKeys returns a list of properties that can be plucked from this object. Returned keys are guaranteed to\n * result in a usable DerivableProxy when used with $pluck. Is used for `for ... in` and `Object.keys(...)` logic.\n */\n $pluckableKeys() {\n const value = this.$proxyDescriptor.$value;\n return typeof value === 'object' ? Reflect.ownKeys(value as any) : [];\n }\n\n /**\n * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration\n * {@link #pluck} is called with indices up to but not including the result of `$length()`.\n */\n $length(): number | undefined {\n const maybeArray = this.$proxyDescriptor.$targetValue;\n return Array.isArray(maybeArray) ? maybeArray.length : undefined;\n }\n\n $and(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.and(unwrapProxy(other));\n }\n\n $or(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.or(unwrapProxy(other));\n }\n\n $not() {\n return this.$proxyDescriptor.$derivable.not();\n }\n\n $is(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.is(unwrapProxy(other));\n }\n\n $derive() {\n const target = this.$proxyDescriptor.$derivable;\n return target.derive.apply(target, arguments as any);\n }\n\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<any>>): () => void {\n return this.$proxyDescriptor.$derivable.react(reaction, options);\n }\n\n toJSON() {\n return this.$proxyDescriptor.$value;\n }\n\n get [Symbol.toStringTag]() {\n return 'DerivableProxy';\n }\n\n *[Symbol.iterator](): IterableIterator<DerivableProxy<V>> {\n const pd = this.$proxyDescriptor;\n const length = pd.$length();\n if (length === undefined) {\n const expression = pd.$expression;\n throw Object.assign(new Error(`${expression || 'object'} is not iterable`), { value: pd.$value, expression });\n }\n for (let i = 0; i < length; i++) {\n yield pd.$pluck(i)!;\n }\n }\n\n get length() {\n return this.$proxyDescriptor.$length();\n }\n}\nProxyDescriptor.prototype[IS_DERIVABLE_PROXY] = true;\n\nfunction createDerivable<V, T>(target: Derivable<T>, proxyLens?: DerivableProxyLens<T, V>): Derivable<V> {\n if (!proxyLens) {\n return target as any;\n }\n const { get, set } = proxyLens;\n if (!set || !isSettableDerivable(target)) {\n return target.derive(get).autoCache();\n }\n return lens({\n get,\n set(newValue, targetValue) {\n target.set(set.call(this, newValue, targetValue));\n }\n }, target).autoCache();\n}\n\nexport interface DerivableProxyLens<T, V> {\n get: (targetValue: T) => V;\n set?: (newValue: V, targetValue: T | undefined) => T;\n}\n\nexport type MaybePacked<T> = T | Derivable<T> | DerivableProxy<T>;\n\nexport function unwrapProxy<W>(obj: MaybePacked<W>): W | Derivable<W> {\n if (isDerivableProxy(obj)) {\n return (obj as any).$derivable;\n }\n return obj;\n}\n\nconst proxyHandler: ProxyHandler<ProxyDescriptor> = {\n get(target, prop, receiver) {\n if (prop === '$proxyDescriptor') {\n return target;\n }\n if (isPluckableProperty(target, prop)) {\n return target.$pluck.call(receiver, prop as string | number);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, newValue, receiver) {\n if (isPluckableProperty(target, prop)) {\n const plucked = target.$pluck.call(receiver, prop as string | number) as ProxyDescriptor;\n if (newValue && isDerivableProxy(newValue)) {\n plucked.$targetValue = (newValue as any).$targetValue;\n } else {\n plucked.$value = newValue && isDerivable(newValue) ? newValue.get() : newValue;\n }\n return true;\n }\n return Reflect.set(target, prop, newValue, receiver);\n },\n has(target, prop) {\n if (prop === Symbol.iterator) {\n return target.$length() !== undefined;\n }\n return isPluckableProperty(target, prop);\n },\n getOwnPropertyDescriptor(target, prop) {\n if (isPluckableProperty(target, prop)) {\n return {\n get() { return this[prop]; },\n set(newValue) { this[prop] = newValue; },\n configurable: true,\n enumerable: true,\n };\n }\n return undefined;\n },\n ownKeys(target) {\n return target.$pluckableKeys();\n },\n};\n\nfunction isPluckableProperty(target: ProxyDescriptor, prop: PropertyKey) {\n return typeof prop === 'number' || typeof prop === 'string' && prop[0] !== '$' && !Reflect.has(target, prop);\n}\n\n/**\n * Extends an expression with a property access. Automatically uses bracket notation where appropriate and escapes\n * strings in brackets to give a realistic combined expression.\n *\n * @param expression the (optional) expression to extend\n * @param property the property that should be appended to the expression\n */\nexport function extendExpression(expression = '', property: string | number) {\n if (typeof property === 'string' && /^[a-z_][a-z_0-9]*$/i.test(property)) {\n return expression + '.' + property;\n }\n if (typeof property === 'string') {\n return expression + '[\"' + property.replace(/\\\\/g, '\\\\\\\\').replace(/\\\"/g, '\\\\\"') + '\"]';\n }\n return expression + '[' + property + ']';\n}\n\n/**\n * Extends a path with a property access.\n *\n * @param path the (optional) path to extend\n * @param property the property that should be appended to the path\n */\nexport function extendPath(path: Array<string | number> = [], property: string | number) {\n return path.concat(property);\n}\n"],"mappings":"mTA2TkD,mBAApBA,iBAAiCA,gBClR/D,IAAMC,EAAqBC,OAAO,oBAO5B,SAAUC,EAAiBC,GAC7B,OAAmC,IAA5BA,EAAIH,EACf,CAYA,IAAAI,EAAA,oBAAAA,IAwBYC,KAAWC,iB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,KAAK2F,EAAUlE,GAM7C,OALI3B,GAAYjB,EAAiBiB,GAC7B+F,EAAQnD,aAAgB5C,EAAiB4C,aAEzCmD,EAAQxD,OAASvC,GAAYgG,cAAYhG,GAAYA,EAASR,MAAQQ,GAEnE,C,CAEX,OAAOwC,QAAQ3C,IAAIF,EAAQgC,EAAM3B,EAAU6F,E,EAE/CI,IAAG,SAACtG,EAAQgC,GACR,OAAIA,IAAS7C,OAAOqF,cACY/E,IAArBO,EAAO+C,UAEXoD,EAAoBnG,EAAQgC,E,EAEvCuE,yBAAwB,SAACvG,EAAQgC,GAC7B,GAAImE,EAAoBnG,EAAQgC,GAC5B,MAAO,CACHnC,IAAG,WAAK,OAAON,KAAKyC,EAAM,EAC1B9B,IAAG,SAACG,GAAYd,KAAKyC,GAAQ3B,CAAS,EACtCmG,cAAc,EACdC,YAAY,E,EAKxB3D,QAAO,SAAC9C,GACJ,OAAOA,EAAO0C,gB,GAItB,SAASyD,EAAoBnG,EAAyBgC,GAClD,MAAuB,iBAATA,GAAqC,iBAATA,GAAiC,MAAZA,EAAK,KAAea,QAAQyD,IAAItG,EAAQgC,EAC3G,CASgB,SAAAQ,EAAiBhB,EAAiBkF,GAC9C,YAD6B,IAAAlF,MAAe,IACpB,iBAAbkF,GAAyB,sBAAsBC,KAAKD,GACpDlF,EAAa,IAAMkF,EAEN,iBAAbA,EACAlF,EAAa,KAAOkF,EAASE,QAAQ,MAAO,QAAQA,QAAQ,MAAO,OAAS,KAEhFpF,EAAa,IAAMkF,EAAW,GACzC,CAQgB,SAAAjE,EAAWf,EAAmCgF,GAC1D,YADuB,IAAAhF,MAAiC,IACjDA,EAAKT,OAAOyF,EACvB,C","ignoreList":[]}
1
+ {"version":3,"file":"sherlock-proxy.umd.min.js","names":["SuppressedError","IS_DERIVABLE_PROXY","Symbol","isDerivableProxy","obj","ProxyDescriptor","this","$$derivable","undefined","Object","defineProperty","prototype","get","pd","$proxyDescriptor","target","proxyLens","set","isSettableDerivable","lens","newValue","targetValue","call","autoCache","derive","createDerivable","$target","$lens","$derivable","e","assign","Error","concat","$expression","_internal","isError","message","jse_cause","atom","expression","$create","path","descriptor","utils","clone","getOwnPropertyNames","filter","prop","startsWith","forEach","$path","Proxy","proxyHandler","$pluck","pluck","extendExpression","extendPath","$pluckableKeys","value","$value","Reflect","ownKeys","$length","maybeArray","$targetValue","Array","isArray","length","$and","other","and","unwrapProxy","$or","or","$not","not","$is","is","$derive","apply","arguments","$react","reaction","options","react","toJSON","toStringTag","iterator","thisArg","body","f","y","t","_","label","sent","trys","ops","g","create","Iterator","next","verb","n","v","op","TypeError","done","pop","push","step","i","_a","receiver","isPluckableProperty","plucked","isDerivable","has","getOwnPropertyDescriptor","configurable","enumerable","property","test","replace"],"sources":["../../node_modules/tslib/tslib.es6.mjs","../../extensions/sherlock-proxy/proxy.ts"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","import { Derivable, isDerivable, isSettableDerivable, lens, ReactorOptions, utils, _internal } from '@politie/sherlock';\n\n/**\n * The base interface for DerivableProxies. Defines only the $-properties and $-methods. Any property accessed with a number or\n * that doesn't start with a $-sign returns a new DerivableProxy.\n */\nexport interface DerivableProxy<V> {\n /** The current value that this Proxy represents. Can be expensive to calculate and is often writable. */\n $value: V;\n\n /** A string representation of this proxy's path from the root ProxyDescriptor. */\n $expression?: string;\n\n /**\n * An array representation of this proxy's path from the root ProxyDescriptor. Useful for programatically walking down the root\n * Descriptor's object tree to reacquire a target proxy.\n */\n $path?: Array<string | number>;\n\n /** {@see Derivable#and} */\n $and<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#or} */\n $or<W>(other: MaybePacked<W>): Derivable<V | W>;\n\n /** {@see Derivable#not} */\n $not(): Derivable<boolean>;\n\n /** {@see Derivable#is} */\n $is(other: MaybePacked<any>): Derivable<boolean>;\n\n /** {@see Derivable#derive} */\n $derive<R>(f: (v: V) => R): Derivable<R>;\n $derive<R, P1>(f: (v: V, p1: P1) => R, p1: MaybePacked<P1>): Derivable<R>;\n $derive<R, P1, P2>(f: (v: V, p1: P1, p2: P2) => R, p1: MaybePacked<P1>, p2: MaybePacked<P2>): Derivable<R>;\n $derive<R, P>(f: (v: V, ...ps: P[]) => R, ...ps: Array<MaybePacked<P>>): Derivable<R>;\n\n /** {@see Derivable#react} */\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<V>>): () => void;\n}\n\nconst IS_DERIVABLE_PROXY = Symbol('isDerivableProxy');\n\n/**\n * Returns whether obj is a DerivableProxy.\n *\n * @param obj the object to test\n */\nexport function isDerivableProxy(obj: any): obj is DerivableProxy<any> {\n return obj[IS_DERIVABLE_PROXY] === true;\n}\n\n/**\n * A ProxyDescriptor must be used to create DerivableProxies. It can be used in two ways, either create a new descriptor and\n * change any implementation details (if needed) or create a subclass to extend the behavior. Use the {@link #$create} method\n * to create a DerivableProxy.\n *\n * Note that `this` in methods points to the created proxy, so only methods and properties that start with a $-sign can be accessed\n * without trouble.\n *\n * Note also that properties that start with two $-signs are cleared on $create.\n */\nexport class ProxyDescriptor<V = any, T = V> {\n /**\n * The target derivable (the input to the proxy and the {@link #$create} method). The actual values that can be seen by methods\n * on the Proxy can be influenced by providing a {@link #$lens}.\n */\n $target!: Derivable<T>;\n\n /**\n * The expression that represents the path to the current Proxy.\n */\n $expression?: string;\n\n /**\n * The path to the current Proxy.\n */\n $path?: Array<string | number>;\n\n /**\n * The derivable that is the input to all default methods on the Proxy and the {@link #$value} property.\n */\n get $derivable(): Derivable<V> {\n const pd = this.$proxyDescriptor;\n return pd.$$derivable || (pd.$$derivable = createDerivable(pd.$target, pd.$lens && pd.$lens()));\n }\n private $$derivable?: Derivable<V> = undefined;\n\n /**\n * The current value of the DerivableProxy. Can be expensive to calculate. When the target is settable (is an Atom) then $value\n * is writable.\n */\n get $value() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$derivable.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(new Error(`error while getting ${pd.$expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n set $value(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$derivable;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$value'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$value'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * The current value of the target Derivable that was used to create the DerivableProxy.\n */\n get $targetValue() {\n const pd = this.$proxyDescriptor;\n try {\n return pd.$target.get();\n } catch (e) {\n // istanbul ignore next: for debug purposes\n throw Object.assign(\n new Error(`error while getting ${pd.$expression || '$targetValue'}: ${_internal.isError(e) && e.message}`),\n { jse_cause: e },\n );\n }\n }\n set $targetValue(newValue) {\n const pd = this.$proxyDescriptor;\n const atom = pd.$target;\n const expression = pd.$expression;\n if (!isSettableDerivable(atom)) {\n throw new Error(`${expression || '$targetValue'} is readonly`);\n }\n try {\n atom.set(newValue);\n } catch (e) {\n throw Object.assign(new Error(`error while setting ${expression || '$targetValue'}: ${_internal.isError(e) && e.message}`), { jse_cause: e });\n }\n }\n\n /**\n * In methods of a ProxyDescriptor, `this` is bound to the Proxy Object. Therefore, only $-properties and $-methods can be\n * accessed safely. Use $proxyDescriptor to get access to the ProxyDescriptor Object to prevent the ProxyHandler from messing\n * with your logic.\n */\n protected get $proxyDescriptor() { return this; }\n\n /**\n * An optional method that can return an optional lens to this proxy. Is used to transform the values before accessed by the\n * consumer of the Proxy (either through $value or one of the other methods).\n */\n $lens?(): DerivableProxyLens<T, V> | undefined;\n\n /**\n * Wrap a Derivable as DerivableProxy using this ProxyDescriptor.\n *\n * @param obj the object to wrap\n * @param expression the new expression to the created DerivableProxy\n * @param path the new path to the created DerivableProxy\n */\n $create(obj: Derivable<T>, expression?: string, path?: Array<string | number>): DerivableProxy<V> {\n const descriptor: ProxyDescriptor = utils.clone(this.$proxyDescriptor);\n descriptor.$target = obj;\n Object.getOwnPropertyNames(descriptor)\n .filter(prop => prop.startsWith('$$'))\n .forEach(prop => descriptor[prop] = undefined);\n descriptor.$expression = expression;\n descriptor.$path = path;\n return new Proxy(descriptor, proxyHandler) as any;\n }\n\n /**\n * The $pluck method is the implementation of the pluck mechanism of DerivableProxy. Replace this method to change the\n * pluck behavior. It should return a DerivableProxy.\n *\n * @param prop the property to pluck of the wrapped derivable\n */\n $pluck(prop: string | number): DerivableProxy<V> {\n const pd = this.$proxyDescriptor;\n return pd.$create(pd.$derivable.pluck(prop), extendExpression(pd.$expression, prop), extendPath(pd.$path, prop));\n }\n\n /**\n * The $pluckableKeys returns a list of properties that can be plucked from this object. Returned keys are guaranteed to\n * result in a usable DerivableProxy when used with $pluck. Is used for `for ... in` and `Object.keys(...)` logic.\n */\n $pluckableKeys() {\n const value = this.$proxyDescriptor.$value;\n return typeof value === 'object' ? Reflect.ownKeys(value as any) : [];\n }\n\n /**\n * Method that determines whether the current object is iterable and if so, how many elements it contains. During iteration\n * {@link #pluck} is called with indices up to but not including the result of `$length()`.\n */\n $length(): number | undefined {\n const maybeArray = this.$proxyDescriptor.$targetValue;\n return Array.isArray(maybeArray) ? maybeArray.length : undefined;\n }\n\n $and(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.and(unwrapProxy(other));\n }\n\n $or(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.or(unwrapProxy(other));\n }\n\n $not() {\n return this.$proxyDescriptor.$derivable.not();\n }\n\n $is(other: MaybePacked<any>) {\n return this.$proxyDescriptor.$derivable.is(unwrapProxy(other));\n }\n\n $derive() {\n const target = this.$proxyDescriptor.$derivable;\n return target.derive.apply(target, arguments as any);\n }\n\n $react(reaction: (value: V, stop: () => void) => void, options?: Partial<ReactorOptions<any>>): () => void {\n return this.$proxyDescriptor.$derivable.react(reaction, options);\n }\n\n toJSON() {\n return this.$proxyDescriptor.$value;\n }\n\n get [Symbol.toStringTag]() {\n return 'DerivableProxy';\n }\n\n *[Symbol.iterator](): IterableIterator<DerivableProxy<V>> {\n const pd = this.$proxyDescriptor;\n const length = pd.$length();\n if (length === undefined) {\n const expression = pd.$expression;\n throw Object.assign(new Error(`${expression || 'object'} is not iterable`), { value: pd.$value, expression });\n }\n for (let i = 0; i < length; i++) {\n yield pd.$pluck(i)!;\n }\n }\n\n get length() {\n return this.$proxyDescriptor.$length();\n }\n}\nProxyDescriptor.prototype[IS_DERIVABLE_PROXY] = true;\n\nfunction createDerivable<V, T>(target: Derivable<T>, proxyLens?: DerivableProxyLens<T, V>): Derivable<V> {\n if (!proxyLens) {\n return target as any;\n }\n const { get, set } = proxyLens;\n if (!set || !isSettableDerivable(target)) {\n return target.derive(get).autoCache();\n }\n return lens({\n get,\n set(newValue, targetValue) {\n target.set(set.call(this, newValue, targetValue));\n }\n }, target).autoCache();\n}\n\nexport interface DerivableProxyLens<T, V> {\n get: (targetValue: T) => V;\n set?: (newValue: V, targetValue: T | undefined) => T;\n}\n\nexport type MaybePacked<T> = T | Derivable<T> | DerivableProxy<T>;\n\nexport function unwrapProxy<W>(obj: MaybePacked<W>): W | Derivable<W> {\n if (isDerivableProxy(obj)) {\n return (obj as any).$derivable;\n }\n return obj;\n}\n\nconst proxyHandler: ProxyHandler<ProxyDescriptor> = {\n get(target, prop, receiver) {\n if (prop === '$proxyDescriptor') {\n return target;\n }\n if (isPluckableProperty(target, prop)) {\n return target.$pluck.call(receiver, prop as string | number);\n }\n return Reflect.get(target, prop, receiver);\n },\n set(target, prop, newValue, receiver) {\n if (isPluckableProperty(target, prop)) {\n const plucked = target.$pluck.call(receiver, prop as string | number) as ProxyDescriptor;\n if (newValue && isDerivableProxy(newValue)) {\n plucked.$targetValue = (newValue as any).$targetValue;\n } else {\n plucked.$value = newValue && isDerivable(newValue) ? newValue.get() : newValue;\n }\n return true;\n }\n return Reflect.set(target, prop, newValue, receiver);\n },\n has(target, prop) {\n if (prop === Symbol.iterator) {\n return target.$length() !== undefined;\n }\n return isPluckableProperty(target, prop);\n },\n getOwnPropertyDescriptor(target, prop) {\n if (isPluckableProperty(target, prop)) {\n return {\n get() { return this[prop]; },\n set(newValue) { this[prop] = newValue; },\n configurable: true,\n enumerable: true,\n };\n }\n return undefined;\n },\n ownKeys(target) {\n return target.$pluckableKeys();\n },\n};\n\nfunction isPluckableProperty(target: ProxyDescriptor, prop: PropertyKey) {\n return typeof prop === 'number' || typeof prop === 'string' && prop[0] !== '$' && !Reflect.has(target, prop);\n}\n\n/**\n * Extends an expression with a property access. Automatically uses bracket notation where appropriate and escapes\n * strings in brackets to give a realistic combined expression.\n *\n * @param expression the (optional) expression to extend\n * @param property the property that should be appended to the expression\n */\nexport function extendExpression(expression = '', property: string | number) {\n if (typeof property === 'string' && /^[a-z_][a-z_0-9]*$/i.test(property)) {\n return expression + '.' + property;\n }\n if (typeof property === 'string') {\n return expression + '[\"' + property.replace(/\\\\/g, '\\\\\\\\').replace(/\\\"/g, '\\\\\"') + '\"]';\n }\n return expression + '[' + property + ']';\n}\n\n/**\n * Extends a path with a property access.\n *\n * @param path the (optional) path to extend\n * @param property the property that should be appended to the path\n */\nexport function extendPath(path: Array<string | number> = [], property: string | number) {\n return path.concat(property);\n}\n"],"mappings":"kTAuUkD,mBAApBA,iBAAiCA,gBC9R/D,IAAMC,EAAqBC,OAAO,oBAO5B,SAAUC,EAAiBC,GAC7B,OAAmC,IAA5BA,EAAIH,EACf,CAYA,IAAAI,EAAA,oBAAAA,IAwBYC,KAAWC,iBAAkBC,C,CAsKzC,OA1KIC,OAAAC,eAAIL,EAAUM,UAAA,cAAdC,IAAA,WACI,IAAMC,EAAKP,KAAKQ,iBAChB,OAAOD,EAAGN,cAAgBM,EAAGN,YA2KrC,SAA+BQ,EAAsBC,GACjD,IAAKA,EACD,OAAOD,EAEH,IAAAH,EAAaI,EAASJ,IAAjBK,EAAQD,EAASC,IAC9B,OAAKA,GAAQC,sBAAoBH,GAG1BI,OAAK,CACRP,IAAGA,EACHK,IAAG,SAACG,EAAUC,GACVN,EAAOE,IAAIA,EAAIK,KAAKhB,KAAMc,EAAUC,G,GAEzCN,GAAQQ,YAPAR,EAAOS,OAAOZ,GAAKW,WAQlC,CAzLmDE,CAAgBZ,EAAGa,QAASb,EAAGc,OAASd,EAAGc,S,k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