@cesdk/engine 1.14.0-rc.1 → 1.15.0-rc.0
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/ThirdPartyLicenses.md +878 -779
- package/assets/core/{cesdk-v1.14.0-rc.1-a4d8e67d3d3f05a30b6b.wasm → cesdk-v1.15.0-rc.0-65f1844a3f5f1a8d57e3.wasm} +0 -0
- package/assets/core/{cesdk-v1.14.0-rc.1-9a6bc3ff1760df174440.data → cesdk-v1.15.0-rc.0-7a4b44a70a18a86d7978.data} +0 -0
- package/index.d.ts +68 -98
- package/index.js +1 -1
- package/integrations/react.d.ts +145 -0
- package/integrations/react.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type CreativeEngine from '@cesdk/engine';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Takes a selector function and returns its result. The selector function will
|
|
5
|
+
* be re-run whenever the values returned by the engine api methods inside it change.
|
|
6
|
+
* If the value returned from the selector function changes, the component this hook
|
|
7
|
+
* is used in will be re-rendered.
|
|
8
|
+
*
|
|
9
|
+
* For determining whether a value has changed, objects are compared deeply,
|
|
10
|
+
* using lodash's isEqual function.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* function MyComponent() {
|
|
16
|
+
* // Get the engine instance from the context.
|
|
17
|
+
* // You could also pass it in via props.
|
|
18
|
+
* const engine = useEngine();
|
|
19
|
+
*
|
|
20
|
+
* const type = useEngineSelector(engine, () => {
|
|
21
|
+
* const selectedBlock = engine.block.findAllSelected()[0];
|
|
22
|
+
* return selectedBlock ? engine.block.getType(selectedBlock) : null;
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* return <div>Current block type {type}</div>
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param engine - An instance of the engine. This instance is passed to the selector
|
|
30
|
+
* @param selector - A method that retrieves values from the engine.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare function useEngineSelector<T>(
|
|
35
|
+
engine: CreativeEngine,
|
|
36
|
+
selector: (engine: CreativeEngine) => T,
|
|
37
|
+
options?: {
|
|
38
|
+
/** A string that is used internally for debugging */
|
|
39
|
+
debugName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* A method that compares two results of the selector
|
|
42
|
+
* and returns true if they are considered equal.
|
|
43
|
+
*/
|
|
44
|
+
equals?: (value: T, lastValue: T | undefined) => boolean;
|
|
45
|
+
}
|
|
46
|
+
): T;
|
|
47
|
+
export declare function useEngineSelector<T>(
|
|
48
|
+
engine: CreativeEngine | undefined,
|
|
49
|
+
selector: (engine: CreativeEngine | undefined) => T,
|
|
50
|
+
options?: {
|
|
51
|
+
/** A string that is used internally for debugging */
|
|
52
|
+
debugName?: string;
|
|
53
|
+
/**
|
|
54
|
+
* A method that compares two results of the selector
|
|
55
|
+
* and returns true if they are considered equal.
|
|
56
|
+
*/
|
|
57
|
+
equals?: (value: T, lastValue: T | undefined) => boolean;
|
|
58
|
+
}
|
|
59
|
+
): T | undefined;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Higher-order component for use with ReactJS
|
|
63
|
+
*
|
|
64
|
+
* Wrap your component with this function to make it reactive to changes in the engine.
|
|
65
|
+
* Inside your component, access the engine API normally. Whenever the values returned
|
|
66
|
+
* by the engine API change, your component will be re-rendered.
|
|
67
|
+
*
|
|
68
|
+
* For determining whether a value has changed, objects are compared deeply,
|
|
69
|
+
* using lodash's isEqual function.
|
|
70
|
+
*
|
|
71
|
+
* This HOC needs access to a CreativeEngine instance.
|
|
72
|
+
* This instance can be providedin two ways:
|
|
73
|
+
*
|
|
74
|
+
* - As a prop called `engine`
|
|
75
|
+
* - Via a function called `useEngine` that is passed in via the options object.
|
|
76
|
+
* This function will be called during rendering to get a CreativeEngine instance.
|
|
77
|
+
* This is useful if you want to use the component in an app where the engine is
|
|
78
|
+
* available via the context, since you can use hooks inside the `useEngine` function.
|
|
79
|
+
*
|
|
80
|
+
* In both cases the engine instance will be passed to your decorated component
|
|
81
|
+
* via the `engine` prop.
|
|
82
|
+
*
|
|
83
|
+
* If you pass neither an `engine` prop nor provide a `useEngine` function,
|
|
84
|
+
* the component will
|
|
85
|
+
* - render normally
|
|
86
|
+
* - not be reactive to changes in the engine
|
|
87
|
+
* - receive `undefined` in the `engine` prop
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* function MyComponent({engine}) {
|
|
92
|
+
* const selectedBlock = engine.block.findAllSelected()[0];
|
|
93
|
+
* const type = selectedBlock ? engine.block.getType(selectedBlock) : null;
|
|
94
|
+
* return <div>Current block type {type}</div>
|
|
95
|
+
* }
|
|
96
|
+
*
|
|
97
|
+
* const MyComponentWithEngine = withEngine(MyComponent)
|
|
98
|
+
*
|
|
99
|
+
* // When no `useEngine` is provided, you need to pass the engine in via props
|
|
100
|
+
* <MyComponentWithEngine engine={engine}/>
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* If a function is provided via the `useEngine` option, that function will be used
|
|
104
|
+
* to retrieve the engine instance. This is useful if you want to use the component
|
|
105
|
+
* in an app where the engine is not available via the context.
|
|
106
|
+
*
|
|
107
|
+
* ```tsx
|
|
108
|
+
* import useEngine from './hooks/useEngine'
|
|
109
|
+
*
|
|
110
|
+
* function MyComponent({ engine }) {
|
|
111
|
+
* const selectedBlock = engine.block.findAllSelected()[0];
|
|
112
|
+
* const type = selectedBlock ? engine.block.getType(selectedBlock) : null;
|
|
113
|
+
* return <div>Current block type {type}</div>
|
|
114
|
+
* }
|
|
115
|
+
*
|
|
116
|
+
* const MyComponentWithEngine = withEngine(MyComponent, {useEngine})
|
|
117
|
+
*
|
|
118
|
+
* // Since `useEngine` has been provided, engine does not need to be passed in via props
|
|
119
|
+
* <MyComponentWithEngine/>
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @param Component - the component you want to make reactive
|
|
123
|
+
* @param options - If you pass `useEngine` in this object, that function will
|
|
124
|
+
* be called during rendering to obtain the engine instance.
|
|
125
|
+
* This instance will be passed to your component via the
|
|
126
|
+
* `engine` prop. Since `useEngine` is called during rendering,
|
|
127
|
+
* you can use hooks inside it to retrieve the engine instance
|
|
128
|
+
* from your app's context.
|
|
129
|
+
*
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
export function withEngine<
|
|
133
|
+
P extends { engine?: CreativeEngine },
|
|
134
|
+
O extends WithEngineOptions
|
|
135
|
+
>(
|
|
136
|
+
Component: React.FunctionComponent<P>,
|
|
137
|
+
options?: O
|
|
138
|
+
): O extends { useEngine: () => CreativeEngine }
|
|
139
|
+
? React.FunctionComponent<Omit<P, 'engine'>>
|
|
140
|
+
: React.FunctionComponent<P>;
|
|
141
|
+
|
|
142
|
+
export interface WithEngineOptions {
|
|
143
|
+
debugName?: string;
|
|
144
|
+
useEngine?: () => CreativeEngine;
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";var e={7278:(t,e,r)=>{var n=r(489)(r(4818),"DataView");t.exports=n},7643:(t,e,r)=>{var n=r(5557),o=r(4349),a=r(407),s=r(5134),i=r(9951);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},3872:(t,e,r)=>{var n=r(2470),o=r(7289),a=r(7614),s=r(3067),i=r(9346);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},5674:(t,e,r)=>{var n=r(489)(r(4818),"Map");t.exports=n},2462:(t,e,r)=>{var n=r(6290),o=r(4951),a=r(440),s=r(6180),i=r(7719);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=a,u.prototype.has=s,u.prototype.set=i,t.exports=u},2160:(t,e,r)=>{var n=r(489)(r(4818),"Promise");t.exports=n},4390:(t,e,r)=>{var n=r(489)(r(4818),"Set");t.exports=n},9264:(t,e,r)=>{var n=r(2462),o=r(236),a=r(1957);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=a,t.exports=s},4691:(t,e,r)=>{var n=r(3872),o=r(1490),a=r(2594),s=r(5953),i=r(4667),u=r(4615);function c(t){var e=this.__data__=new n(t);this.size=e.size}c.prototype.clear=o,c.prototype.delete=a,c.prototype.get=s,c.prototype.has=i,c.prototype.set=u,t.exports=c},9652:(t,e,r)=>{var n=r(4818).Symbol;t.exports=n},4600:(t,e,r)=>{var n=r(4818).Uint8Array;t.exports=n},2403:(t,e,r)=>{var n=r(489)(r(4818),"WeakMap");t.exports=n},7554:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,a=[];++r<n;){var s=t[r];e(s,r,t)&&(a[o++]=s)}return a}},1998:(t,e,r)=>{var n=r(1453),o=r(5664),a=r(5860),s=r(9571),i=r(8347),u=r(1859),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=a(t),p=!r&&o(t),f=!r&&!p&&s(t),l=!r&&!p&&!f&&u(t),v=r||p||f||l,h=v?n(t.length,String):[],_=h.length;for(var b in t)!e&&!c.call(t,b)||v&&("length"==b||f&&("offset"==b||"parent"==b)||l&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||i(b,_))||h.push(b);return h}},4656:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},8193:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},8620:(t,e,r)=>{var n=r(3355);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},6367:(t,e,r)=>{var n=r(4656),o=r(5860);t.exports=function(t,e,r){var a=e(t);return o(t)?a:n(a,r(t))}},2759:(t,e,r)=>{var n=r(9652),o=r(5135),a=r(3744),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):a(t)}},6651:(t,e,r)=>{var n=r(2759),o=r(1408);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},2500:(t,e,r)=>{var n=r(5930),o=r(1408);t.exports=function t(e,r,a,s,i){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,a,s,t,i))}},5930:(t,e,r)=>{var n=r(4691),o=r(7557),a=r(2e3),s=r(2032),i=r(5006),u=r(5860),c=r(9571),p=r(1859),f="[object Arguments]",l="[object Array]",v="[object Object]",h=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,_,b,y){var d=u(t),x=u(e),j=d?l:i(t),g=x?l:i(e),O=(j=j==f?v:j)==v,w=(g=g==f?v:g)==v,m=j==g;if(m&&c(t)){if(!c(e))return!1;d=!0,O=!1}if(m&&!O)return y||(y=new n),d||p(t)?o(t,e,r,_,b,y):a(t,e,j,r,_,b,y);if(!(1&r)){var A=O&&h.call(t,"__wrapped__"),z=w&&h.call(e,"__wrapped__");if(A||z){var S=A?t.value():t,E=z?e.value():e;return y||(y=new n),b(S,E,r,_,y)}}return!!m&&(y||(y=new n),s(t,e,r,_,b,y))}},3216:(t,e,r)=>{var n=r(830),o=r(931),a=r(4820),s=r(1304),i=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,p=u.toString,f=c.hasOwnProperty,l=RegExp("^"+p.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!a(t)||o(t))&&(n(t)?l:i).test(s(t))}},9920:(t,e,r)=>{var n=r(2759),o=r(7906),a=r(1408),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return a(t)&&o(t.length)&&!!s[n(t)]}},7588:(t,e,r)=>{var n=r(7839),o=r(2809),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))a.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1453:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},8275:t=>{t.exports=function(t){return function(e){return t(e)}}},8094:t=>{t.exports=function(t,e){return t.has(e)}},8940:(t,e,r)=>{var n=r(4818)["__core-js_shared__"];t.exports=n},7557:(t,e,r)=>{var n=r(9264),o=r(8193),a=r(8094);t.exports=function(t,e,r,s,i,u){var c=1&r,p=t.length,f=e.length;if(p!=f&&!(c&&f>p))return!1;var l=u.get(t),v=u.get(e);if(l&&v)return l==e&&v==t;var h=-1,_=!0,b=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++h<p;){var y=t[h],d=e[h];if(s)var x=c?s(d,y,h,e,t,u):s(y,d,h,t,e,u);if(void 0!==x){if(x)continue;_=!1;break}if(b){if(!o(e,(function(t,e){if(!a(b,e)&&(y===t||i(y,t,r,s,u)))return b.push(e)}))){_=!1;break}}else if(y!==d&&!i(y,d,r,s,u)){_=!1;break}}return u.delete(t),u.delete(e),_}},2e3:(t,e,r)=>{var n=r(9652),o=r(4600),a=r(3355),s=r(7557),i=r(8759),u=r(1924),c=n?n.prototype:void 0,p=c?c.valueOf:void 0;t.exports=function(t,e,r,n,c,f,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!f(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var v=i;case"[object Set]":var h=1&n;if(v||(v=u),t.size!=e.size&&!h)return!1;var _=l.get(t);if(_)return _==e;n|=2,l.set(t,e);var b=s(v(t),v(e),n,c,f,l);return l.delete(t),b;case"[object Symbol]":if(p)return p.call(t)==p.call(e)}return!1}},2032:(t,e,r)=>{var n=r(1723),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,a,s,i){var u=1&r,c=n(t),p=c.length;if(p!=n(e).length&&!u)return!1;for(var f=p;f--;){var l=c[f];if(!(u?l in e:o.call(e,l)))return!1}var v=i.get(t),h=i.get(e);if(v&&h)return v==e&&h==t;var _=!0;i.set(t,e),i.set(e,t);for(var b=u;++f<p;){var y=t[l=c[f]],d=e[l];if(a)var x=u?a(d,y,l,e,t,i):a(y,d,l,t,e,i);if(!(void 0===x?y===d||s(y,d,r,a,i):x)){_=!1;break}b||(b="constructor"==l)}if(_&&!b){var j=t.constructor,g=e.constructor;j==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof j&&j instanceof j&&"function"==typeof g&&g instanceof g||(_=!1)}return i.delete(t),i.delete(e),_}},3566:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},1723:(t,e,r)=>{var n=r(6367),o=r(5253),a=r(8022);t.exports=function(t){return n(t,a,o)}},6330:(t,e,r)=>{var n=r(5513);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},489:(t,e,r)=>{var n=r(3216),o=r(3626);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},5135:(t,e,r)=>{var n=r(9652),o=Object.prototype,a=o.hasOwnProperty,s=o.toString,i=n?n.toStringTag:void 0;t.exports=function(t){var e=a.call(t,i),r=t[i];try{t[i]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[i]=r:delete t[i]),o}},5253:(t,e,r)=>{var n=r(7554),o=r(3117),a=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,i=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return a.call(t,e)})))}:o;t.exports=i},5006:(t,e,r)=>{var n=r(7278),o=r(5674),a=r(2160),s=r(4390),i=r(2403),u=r(2759),c=r(1304),p="[object Map]",f="[object Promise]",l="[object Set]",v="[object WeakMap]",h="[object DataView]",_=c(n),b=c(o),y=c(a),d=c(s),x=c(i),j=u;(n&&j(new n(new ArrayBuffer(1)))!=h||o&&j(new o)!=p||a&&j(a.resolve())!=f||s&&j(new s)!=l||i&&j(new i)!=v)&&(j=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?c(r):"";if(n)switch(n){case _:return h;case b:return p;case y:return f;case d:return l;case x:return v}return e}),t.exports=j},3626:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},5557:(t,e,r)=>{var n=r(2037);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},4349:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},407:(t,e,r)=>{var n=r(2037),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},5134:(t,e,r)=>{var n=r(2037),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},9951:(t,e,r)=>{var n=r(2037);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},8347:t=>{var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},5513:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},931:(t,e,r)=>{var n,o=r(8940),a=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!a&&a in t}},7839:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},2470:t=>{t.exports=function(){this.__data__=[],this.size=0}},7289:(t,e,r)=>{var n=r(8620),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},7614:(t,e,r)=>{var n=r(8620);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},3067:(t,e,r)=>{var n=r(8620);t.exports=function(t){return n(this.__data__,t)>-1}},9346:(t,e,r)=>{var n=r(8620);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},6290:(t,e,r)=>{var n=r(7643),o=r(3872),a=r(5674);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(a||o),string:new n}}},4951:(t,e,r)=>{var n=r(6330);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},440:(t,e,r)=>{var n=r(6330);t.exports=function(t){return n(this,t).get(t)}},6180:(t,e,r)=>{var n=r(6330);t.exports=function(t){return n(this,t).has(t)}},7719:(t,e,r)=>{var n=r(6330);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8759:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},2037:(t,e,r)=>{var n=r(489)(Object,"create");t.exports=n},2809:(t,e,r)=>{var n=r(6148)(Object.keys,Object);t.exports=n},9693:(t,e,r)=>{t=r.nmd(t);var n=r(3566),o=e&&!e.nodeType&&e,a=o&&t&&!t.nodeType&&t,s=a&&a.exports===o&&n.process,i=function(){try{return a&&a.require&&a.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=i},3744:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},6148:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},4818:(t,e,r)=>{var n=r(3566),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();t.exports=a},236:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},1957:t=>{t.exports=function(t){return this.__data__.has(t)}},1924:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},1490:(t,e,r)=>{var n=r(3872);t.exports=function(){this.__data__=new n,this.size=0}},2594:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},5953:t=>{t.exports=function(t){return this.__data__.get(t)}},4667:t=>{t.exports=function(t){return this.__data__.has(t)}},4615:(t,e,r)=>{var n=r(3872),o=r(5674),a=r(2462);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new a(s)}return r.set(t,e),this.size=r.size,this}},1304:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},3355:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},5664:(t,e,r)=>{var n=r(6651),o=r(1408),a=Object.prototype,s=a.hasOwnProperty,i=a.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!i.call(t,"callee")};t.exports=u},5860:t=>{var e=Array.isArray;t.exports=e},8809:(t,e,r)=>{var n=r(830),o=r(7906);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},9571:(t,e,r)=>{t=r.nmd(t);var n=r(4818),o=r(8585),a=e&&!e.nodeType&&e,s=a&&t&&!t.nodeType&&t,i=s&&s.exports===a?n.Buffer:void 0,u=(i?i.isBuffer:void 0)||o;t.exports=u},2822:(t,e,r)=>{var n=r(2500);t.exports=function(t,e){return n(t,e)}},830:(t,e,r)=>{var n=r(2759),o=r(4820);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},7906:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},4820:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},1408:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},1859:(t,e,r)=>{var n=r(9920),o=r(8275),a=r(9693),s=a&&a.isTypedArray,i=s?o(s):n;t.exports=i},8022:(t,e,r)=>{var n=r(1998),o=r(7588),a=r(8809);t.exports=function(t){return a(t)?n(t):o(t)}},3117:t=>{t.exports=function(){return[]}},8585:t=>{t.exports=function(){return!1}}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var a=r[t]={id:t,loaded:!1,exports:{}};return e[t](a,a.exports,n),a.loaded=!0,a.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var o={};(()=>{n.d(o,{j:()=>u,k:()=>c});var e=n(2822),r=n.n(e);const a=(s={useEffect:()=>t.useEffect,useMemo:()=>t.useMemo,useRef:()=>t.useRef,useState:()=>t.useState},i={},n.d(i,s),i);var s,i;function u(t,e,n={equals:r()}){const{debugName:o,equals:s}=n,i=(0,a.useRef)(e);i.current=e;const u=(0,a.useRef)({reaction:f,engine:void 0}),[,c]=(0,a.useState)(0);if(u.current.engine!==t)if(t){const e=t.reactor.createReaction(o);u.current={reaction:e,engine:t}}else u.current={reaction:f,engine:t};const p=u.current.reaction,l=(0,a.useMemo)((()=>{const e=()=>(0,i.current)(t);return function(t,e){if(!e)return t;let r;return(...n)=>{const o=t(...n);return e(o,r)||(r=o),r}}((()=>p.track(e)),s)}),[p,s,t]),v=l();return(0,a.useEffect)((()=>p.subscribe((function(){c((t=>t+1))}))),[p]),v}function c(t,e){const r=null==e?void 0:e.debugName,n=null==e?void 0:e.useEngine;let o=0;function s(e,...s){var i,c;const f=null!==(i=null==n?void 0:n())&&void 0!==i?i:e.engine,l=(0,a.useRef)();return void 0===l.current&&null!=r&&(l.current=r+o++),null!==(c=u(f,t.bind(void 0,Object.assign(Object.assign({},e),{engine:f}),...s),{debugName:l.current,equals:p}))&&void 0!==c?c:null}return s.displayName=`withEngine(${t.displayName||t.name})`,s}const p=(t,e)=>t===e,f={track:t=>t(),subscribe:()=>function(){}}})();var a=o.j,s=o.k;export{a as useEngineSelector,s as withEngine};
|