1
+ /*[process-shim]*/
2
+ ( function ( global , env ) {
3
+ // jshint ignore:line
4
+ if ( typeof process === "undefined" ) {
5
+ global . process = {
6
+ argv : [ ] ,
7
+ cwd : function ( ) {
8
+ return "" ;
9
+ } ,
10
+ browser : true ,
11
+ env : {
12
+ NODE_ENV : env || "development"
13
+ } ,
14
+ version : "" ,
15
+ platform :
16
+ global . navigator &&
17
+ global . navigator . userAgent &&
18
+ / W i n d o w s / . test ( global . navigator . userAgent )
19
+ ? "win"
20
+ : ""
21
+ } ;
22
+ }
23
+ } ) (
24
+ typeof self == "object" && self . Object == Object
25
+ ? self
26
+ : typeof process === "object" &&
27
+ Object . prototype . toString . call ( process ) === "[object process]"
28
+ ? global
29
+ : window ,
30
+ "development"
31
+ ) ;
32
+
33
+ /*[global-shim-start]*/
34
+ ( function ( exports , global , doEval ) {
35
+ // jshint ignore:line
36
+ var origDefine = global . define ;
37
+
38
+ var get = function ( name ) {
39
+ var parts = name . split ( "." ) ,
40
+ cur = global ,
41
+ i ;
42
+ for ( i = 0 ; i < parts . length ; i ++ ) {
43
+ if ( ! cur ) {
44
+ break ;
45
+ }
46
+ cur = cur [ parts [ i ] ] ;
47
+ }
48
+ return cur ;
49
+ } ;
50
+ var set = function ( name , val ) {
51
+ var parts = name . split ( "." ) ,
52
+ cur = global ,
53
+ i ,
54
+ part ,
55
+ next ;
56
+ for ( i = 0 ; i < parts . length - 1 ; i ++ ) {
57
+ part = parts [ i ] ;
58
+ next = cur [ part ] ;
59
+ if ( ! next ) {
60
+ next = cur [ part ] = { } ;
61
+ }
62
+ cur = next ;
63
+ }
64
+ part = parts [ parts . length - 1 ] ;
65
+ cur [ part ] = val ;
66
+ } ;
67
+ var useDefault = function ( mod ) {
68
+ if ( ! mod || ! mod . __esModule ) return false ;
69
+ var esProps = { __esModule : true , default : true } ;
70
+ for ( var p in mod ) {
71
+ if ( ! esProps [ p ] ) return false ;
72
+ }
73
+ return true ;
74
+ } ;
75
+
76
+ var hasCjsDependencies = function ( deps ) {
77
+ return (
78
+ deps [ 0 ] === "require" && deps [ 1 ] === "exports" && deps [ 2 ] === "module"
79
+ ) ;
80
+ } ;
81
+
82
+ var modules =
83
+ ( global . define && global . define . modules ) ||
84
+ ( global . _define && global . _define . modules ) ||
85
+ { } ;
86
+ var ourDefine = ( global . define = function ( moduleName , deps , callback ) {
87
+ var module ;
88
+ if ( typeof deps === "function" ) {
89
+ callback = deps ;
90
+ deps = [ ] ;
91
+ }
92
+ var args = [ ] ,
93
+ i ;
94
+ for ( i = 0 ; i < deps . length ; i ++ ) {
95
+ args . push (
96
+ exports [ deps [ i ] ]
97
+ ? get ( exports [ deps [ i ] ] )
98
+ : modules [ deps [ i ] ] || get ( deps [ i ] )
99
+ ) ;
100
+ }
101
+ // CJS has no dependencies but 3 callback arguments
102
+ if ( hasCjsDependencies ( deps ) || ( ! deps . length && callback . length ) ) {
103
+ module = { exports : { } } ;
104
+ args [ 0 ] = function ( name ) {
105
+ return exports [ name ] ? get ( exports [ name ] ) : modules [ name ] ;
106
+ } ;
107
+ args [ 1 ] = module . exports ;
108
+ args [ 2 ] = module ;
109
+ }
110
+ // Babel uses the exports and module object.
111
+ else if ( ! args [ 0 ] && deps [ 0 ] === "exports" ) {
112
+ module = { exports : { } } ;
113
+ args [ 0 ] = module . exports ;
114
+ if ( deps [ 1 ] === "module" ) {
115
+ args [ 1 ] = module ;
116
+ }
117
+ } else if ( ! args [ 0 ] && deps [ 0 ] === "module" ) {
118
+ args [ 0 ] = { id : moduleName } ;
119
+ }
120
+
121
+ global . define = origDefine ;
122
+ var result = callback ? callback . apply ( null , args ) : undefined ;
123
+ global . define = ourDefine ;
124
+
125
+ // Favor CJS module.exports over the return value
126
+ result = module && module . exports ? module . exports : result ;
127
+ modules [ moduleName ] = result ;
128
+
129
+ // Set global exports
130
+ var globalExport = exports [ moduleName ] ;
131
+ if ( globalExport && ! get ( globalExport ) ) {
132
+ if ( useDefault ( result ) ) {
133
+ result = result [ "default" ] ;
134
+ }
135
+ set ( globalExport , result ) ;
136
+ }
137
+ } ) ;
138
+ global . define . orig = origDefine ;
139
+ global . define . modules = modules ;
140
+ global . define . amd = true ;
141
+ ourDefine ( "@loader" , [ ] , function ( ) {
142
+ // shim for @@global -helpers
143
+ var noop = function ( ) { } ;
144
+ return {
145
+ get : function ( ) {
146
+ return { prepareGlobal : noop , retrieveGlobal : noop } ;
147
+ } ,
148
+ global : global ,
149
+ __exec : function ( __load ) {
150
+ doEval ( __load . source , global ) ;
151
+ }
152
+ } ;
153
+ } ) ;
154
+ } ) (
155
+ { "react-to-webcomponent" : "reactToWebComponent" } ,
156
+ typeof self == "object" && self . Object == Object
157
+ ? self
158
+ : typeof process === "object" &&
159
+ Object . prototype . toString . call ( process ) === "[object process]"
160
+ ? global
161
+ : window ,
162
+ function ( __$source__ , __$global__ ) {
163
+ // jshint ignore:line
164
+ eval ( "(function() { " + __$source__ + " \n }).call(__$global__);" ) ;
165
+ }
166
+ ) ;
167
+
168
+ /*[email protected] #react-to-webcomponent*/
169
+ define ( 'react-to-webcomponent' , [ 'exports' ] , function ( exports ) {
170
+ 'use strict' ;
171
+ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
172
+ exports . default = function ( ReactComponent , React , ReactDOM ) {
173
+ var options = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : { } ;
174
+ var renderAddedProperties = { isConnected : 'isConnected' in HTMLElement . prototype } ;
175
+ var rendering = false ;
176
+ var WebComponent = function WebComponent ( ) {
177
+ var self = Reflect . construct ( HTMLElement , arguments , this . constructor ) ;
178
+ self . attachShadow ( { mode : 'open' } ) ;
179
+ return self ;
180
+ } ;
181
+ var targetPrototype = Object . create ( HTMLElement . prototype ) ;
182
+ targetPrototype . constructor = WebComponent ;
183
+ var proxyPrototype = new Proxy ( targetPrototype , {
184
+ has : function has ( target , key ) {
185
+ return key in ReactComponent . propTypes || key in targetPrototype ;
186
+ } ,
187
+ set : function set ( target , key , value , receiver ) {
188
+ if ( rendering ) {
189
+ renderAddedProperties [ key ] = true ;
190
+ }
191
+ if ( ( typeof key === 'undefined' ? 'undefined' : _typeof ( key ) ) === 'symbol' || renderAddedProperties [ key ] || key in target ) {
192
+ return Reflect . set ( target , key , value , receiver ) ;
193
+ } else {
194
+ define . expando ( receiver , key , value ) ;
195
+ }
196
+ return true ;
197
+ } ,
198
+ getOwnPropertyDescriptor : function getOwnPropertyDescriptor ( target , key ) {
199
+ var own = Reflect . getOwnPropertyDescriptor ( target , key ) ;
200
+ if ( own ) {
201
+ return own ;
202
+ }
203
+ if ( key in ReactComponent . propTypes ) {
204
+ return {
205
+ configurable : true ,
206
+ enumerable : true ,
207
+ writable : true ,
208
+ value : undefined
209
+ } ;
210
+ }
211
+ }
212
+ } ) ;
213
+ WebComponent . prototype = proxyPrototype ;
214
+ targetPrototype . connectedCallback = function ( ) {
215
+ this [ shouldRenderSymbol ] = true ;
216
+ this [ renderSymbol ] ( ) ;
217
+ } ;
218
+ targetPrototype [ renderSymbol ] = function ( ) {
219
+ if ( this [ shouldRenderSymbol ] === true ) {
220
+ var data = { } ;
221
+ Object . keys ( this ) . forEach ( function ( key ) {
222
+ if ( renderAddedProperties [ key ] !== false ) {
223
+ data [ key ] = this [ key ] ;
224
+ }
225
+ } , this ) ;
226
+ rendering = true ;
227
+ var container = options . shadow ? this . shadowRoot : this ;
228
+ this [ reactComponentSymbol ] = ReactDOM . render ( React . createElement ( ReactComponent , data ) , container ) ;
229
+ rendering = false ;
230
+ }
231
+ } ;
232
+ if ( ReactComponent . propTypes ) {
233
+ WebComponent . observedAttributes = Object . keys ( ReactComponent . propTypes ) ;
234
+ targetPrototype . attributeChangedCallback = function ( name , oldValue , newValue ) {
235
+ this [ name ] = newValue ;
236
+ } ;
237
+ }
238
+ return WebComponent ;
239
+ } ;
240
+ var _typeof = typeof Symbol === 'function' && typeof Symbol . iterator === 'symbol' ? function ( obj ) {
241
+ return typeof obj ;
242
+ } : function ( obj ) {
243
+ return obj && typeof Symbol === 'function' && obj . constructor === Symbol && obj !== Symbol . prototype ? 'symbol' : typeof obj ;
244
+ } ;
245
+ var reactComponentSymbol = Symbol . for ( 'r2wc.reactComponent' ) ;
246
+ var renderSymbol = Symbol . for ( 'r2wc.reactRender' ) ;
247
+ var shouldRenderSymbol = Symbol . for ( 'r2wc.shouldRender' ) ;
248
+ var define = {
249
+ expando : function expando ( receiver , key , value ) {
250
+ Object . defineProperty ( receiver , key , {
251
+ enumerable : true ,
252
+ get : function get ( ) {
253
+ return value ;
254
+ } ,
255
+ set : function set ( newValue ) {
256
+ value = newValue ;
257
+ this [ renderSymbol ] ( ) ;
258
+ }
259
+ } ) ;
260
+ receiver [ renderSymbol ] ( ) ;
261
+ }
262
+ } ;
263
+ } ) ;
264
+ /*[global-shim-end]*/
265
+ ( function ( global ) { // jshint ignore:line
266
+ global . _define = global . define ;
267
+ global . define = global . define . orig ;
268
+ }
269
+ ) ( typeof self == "object" && self . Object == Object ? self : ( typeof process === "object" && Object . prototype . toString . call ( process ) === "[object process]" ) ? global : window ) ;
0 commit comments