@egjs/svelte-infinitegrid 4.7.0 → 4.8.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.
Files changed (34) hide show
  1. package/.DS_Store +0 -0
  2. package/.gitignore +4 -0
  3. package/.npmignore +3 -0
  4. package/CHANGELOG.md +78 -0
  5. package/dist/infinitegrid.cjs.js +24 -138
  6. package/dist/infinitegrid.cjs.js.map +1 -1
  7. package/dist/infinitegrid.esm.js +24 -138
  8. package/dist/infinitegrid.esm.js.map +1 -1
  9. package/package.json +8 -3
  10. package/.storybook/main.js +0 -32
  11. package/.storybook/manager.js +0 -5
  12. package/.storybook/preview.js +0 -25
  13. package/public/favicon.png +0 -0
  14. package/public/global.css +0 -63
  15. package/public/index.html +0 -18
  16. package/stories/1-MasonryInfiniteGrid/0-MasonryInfiniteGrid.stories.ts +0 -4
  17. package/stories/1-MasonryInfiniteGrid/1-MasonryInfiniteGrid.stories.ts +0 -27
  18. package/stories/1-MasonryInfiniteGrid/apps/SvelteMasonryInfiniteGridApp.svelte +0 -42
  19. package/stories/2-JustifiedInfiniteGrid/0-JustifiedInfiniteGrid.stories.ts +0 -5
  20. package/stories/2-JustifiedInfiniteGrid/1-JustifiedInfiniteGrid.stories.ts +0 -10
  21. package/stories/2-JustifiedInfiniteGrid/apps/SvelteJustifiedInfiniteGridApp.svelte +0 -43
  22. package/stories/3-FrameInfiniteGrid/0-FrameInfiniteGrid.stories.ts +0 -5
  23. package/stories/3-FrameInfiniteGrid/1-FrameInfiniteGrid.stories.ts +0 -10
  24. package/stories/3-FrameInfiniteGrid/apps/SvelteFrameInfiniteGridApp.svelte +0 -44
  25. package/stories/4-PackingInfiniteGrid/0-PackingInfiniteGrid.stories.ts +0 -5
  26. package/stories/4-PackingInfiniteGrid/1-PackingInfiniteGrid.stories.ts +0 -10
  27. package/stories/4-PackingInfiniteGrid/apps/SveltePackingInfiniteGridApp.svelte +0 -40
  28. package/stories/5-DataLoading/0-DataLoading.stories.ts +0 -7
  29. package/stories/5-DataLoading/1-WaitNReady.stories.ts +0 -10
  30. package/stories/5-DataLoading/2-Placeholder.stories.ts +0 -10
  31. package/stories/5-DataLoading/3-Loading.stories.ts +0 -10
  32. package/stories/5-DataLoading/apps/SvelteLoadingApp.svelte +0 -54
  33. package/stories/5-DataLoading/apps/SveltePlaceholderApp.svelte +0 -54
  34. package/stories/5-DataLoading/apps/SvelteWaitNReadyApp.svelte +0 -47
package/.DS_Store ADDED
Binary file
package/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ /node_modules/
2
+ /public/build/
3
+
4
+ .DS_Store
package/.npmignore ADDED
@@ -0,0 +1,3 @@
1
+ .storybook
2
+ stories/
3
+ public/
package/CHANGELOG.md CHANGED
@@ -3,6 +3,84 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 4.7.1 (2022-09-08)
7
+
8
+
9
+ ### :rocket: New Features
10
+
11
+ * add storybook (#321) ([a726015](https://github.com/naver/egjs-infinitegrid/commit/a726015066824842ef2ba05cd53e1f7a3514d8ae))
12
+ * add svelte-infinitegrid@3.0.0 (#301) ([8c878c9](https://github.com/naver/egjs-infinitegrid/commit/8c878c9e8d4a43ab2e98f21cb124677c7fd8f0b4))
13
+ * support ResizeObserver#464 (#470) ([4400701](https://github.com/naver/egjs-infinitegrid/commit/4400701b5eafc52b41eb9d496bad48f551bcf96e))
14
+
15
+
16
+ ### :bug: Bug Fix
17
+
18
+ * change afterUpdate lifecycle (#304) ([4851854](https://github.com/naver/egjs-infinitegrid/commit/4851854348524ffb247316c8bd5ddc71b7deb678))
19
+ * fix error in multiple groups (#387) ([02df50f](https://github.com/naver/egjs-infinitegrid/commit/02df50f52644c461e2397458bef428dcb868f02f))
20
+ * fix setStatus method's default value (#373) ([5f8f9a2](https://github.com/naver/egjs-infinitegrid/commit/5f8f9a27a6bc8e55e49247dd6455713b77efeaf1))
21
+ * fix setStatus' getter (#377) ([16fa80c](https://github.com/naver/egjs-infinitegrid/commit/16fa80c042579c9766b5143b1787980930405d78))
22
+ * fix svelte types (#460) ([cace348](https://github.com/naver/egjs-infinitegrid/commit/cace34814d65c53562648da5713d4191242e61bd))
23
+ * fix svelte version issue (#315) ([bee5b3d](https://github.com/naver/egjs-infinitegrid/commit/bee5b3d272261b69c9366079f028560c43c30f63))
24
+ * fix svelte-infinitegrid's typo ([6fe14d5](https://github.com/naver/egjs-infinitegrid/commit/6fe14d5deba9922fe3864b2ed758cdaaa73a9fa0))
25
+ * fix types (#457) ([f402d62](https://github.com/naver/egjs-infinitegrid/commit/f402d62ca0335c00e6bff2f68b1c343cfc6a285d))
26
+ * fix types (#510) ([96adfd7](https://github.com/naver/egjs-infinitegrid/commit/96adfd7bd66c6d77015818417990339da1b59311))
27
+ * support svelte SSR (#430) ([1518182](https://github.com/naver/egjs-infinitegrid/commit/1518182c36483574ac4a9c4ef5896d45f9c5ed05))
28
+
29
+
30
+ ### :memo: Documentation
31
+
32
+ * fix README ([a512be4](https://github.com/naver/egjs-infinitegrid/commit/a512be426af33ed949fa07c3e790a705f90ae655))
33
+
34
+
35
+ ### :mega: Other
36
+
37
+ * release 4.2.0-rc ([110b5d4](https://github.com/naver/egjs-infinitegrid/commit/110b5d4ae845d7812da1cf5727366c22840ed82a))
38
+ * Release 4.3.0 ([d18031e](https://github.com/naver/egjs-infinitegrid/commit/d18031ee3e9bf7f012e7bf1b0157572ba78f70b0))
39
+ * Release 4.3.1 ([165e354](https://github.com/naver/egjs-infinitegrid/commit/165e354bb6382cba61e0670ab16096193fdf2a2b))
40
+ * Release 4.4.0 ([2b066a8](https://github.com/naver/egjs-infinitegrid/commit/2b066a83470719fc78940317fe0ab44fa21fc378))
41
+ * Release 4.5.0 ([23e0885](https://github.com/naver/egjs-infinitegrid/commit/23e0885c2ae29130b34613227291ee6f0b102c75))
42
+ * Release 4.6.0 ([d529854](https://github.com/naver/egjs-infinitegrid/commit/d529854917ef31afbbb138dec8af98ef8c3c1d47))
43
+ * Release 4.7.0 ([9a1c5a0](https://github.com/naver/egjs-infinitegrid/commit/9a1c5a0985381a632c00cae94481cb1a50425aa0))
44
+ * **release:** Release 3.6.2 ([7e0201b](https://github.com/naver/egjs-infinitegrid/commit/7e0201ba39ec4989ca02b81d84594ae1967c5488))
45
+ * **release:** Release 3.6.3 ([91d264c](https://github.com/naver/egjs-infinitegrid/commit/91d264c22142828ea9c26d19cb747c42c65773d7))
46
+ * **release:** Release 3.7.0 ([83982dd](https://github.com/naver/egjs-infinitegrid/commit/83982dd04cf2a52c0d165925de0a3ec14d4acb0a))
47
+ * **release:** Release 3.7.1 ([e89e4a3](https://github.com/naver/egjs-infinitegrid/commit/e89e4a386a577dc2deffb822a56b6fdfb9808525))
48
+ * **release:** Release 3.8.0 ([0318d41](https://github.com/naver/egjs-infinitegrid/commit/0318d416acb63611890dc752815386af7497ca19))
49
+ * **release:** Release 3.8.1 ([578263b](https://github.com/naver/egjs-infinitegrid/commit/578263bd36356f1e976dbf78d8eab423cf84a4ef))
50
+ * **release:** Release 3.8.2 ([bc043cc](https://github.com/naver/egjs-infinitegrid/commit/bc043ccd840bdbd28907d6c5592bc86cf3722c95))
51
+ * **release:** Release 3.8.3 ([dbb97ee](https://github.com/naver/egjs-infinitegrid/commit/dbb97ee7e368ee0a3bf512e20c3cd7f2c33b2e7a))
52
+ * **release:** Release 3.8.4 ([67f5300](https://github.com/naver/egjs-infinitegrid/commit/67f53003f0faa58039fd560682097f6ecf4534c1))
53
+ * **release:** Release 3.9.0 ([9d2dca7](https://github.com/naver/egjs-infinitegrid/commit/9d2dca76591a7b033108641783418e2dc183edf3))
54
+ * **release:** Release 4.0.0 ([7b77f77](https://github.com/naver/egjs-infinitegrid/commit/7b77f77e3e0444fc1162458133db1303c6531903))
55
+ * **release:** Release 4.1.0 ([57dc167](https://github.com/naver/egjs-infinitegrid/commit/57dc167b7a1e6fc60a39d8fa990c28294ef4722b))
56
+ * **release:** Release 4.1.1 ([ad36273](https://github.com/naver/egjs-infinitegrid/commit/ad3627396d64c421100d9623c3bfaf6a3c1bc40d))
57
+ * **release:** Release 4.2.1 ([414faa6](https://github.com/naver/egjs-infinitegrid/commit/414faa683fe5e60d746d99ba1944b086ff4b23e4))
58
+ * update @egjs/infinitegrid to frameworks ([cc2458d](https://github.com/naver/egjs-infinitegrid/commit/cc2458dc59229865041c22d0c40068813779d132))
59
+ * update package.json ([c9d1faa](https://github.com/naver/egjs-infinitegrid/commit/c9d1faa896d84672771caccb086f0002bd282370))
60
+ * update packages versions ([212d1bc](https://github.com/naver/egjs-infinitegrid/commit/212d1bcf22c60fde09989f373d61738a195d9902))
61
+ * update packages versions ([e438c00](https://github.com/naver/egjs-infinitegrid/commit/e438c00929ba28bd001d6174bd57efd918144686))
62
+ * update packages versions ([d4aa615](https://github.com/naver/egjs-infinitegrid/commit/d4aa615a8cd3e25b621500e2a7b243dcc9696eef))
63
+ * update packages versions ([171bb74](https://github.com/naver/egjs-infinitegrid/commit/171bb74f708110a2fd986276c9b8d65472fa64ab))
64
+ * update packages versions ([29bdea0](https://github.com/naver/egjs-infinitegrid/commit/29bdea08f334113e4a73180dd5f9e803c4befc99))
65
+ * update packages versions ([47f9348](https://github.com/naver/egjs-infinitegrid/commit/47f9348042e19c789b986ec936ed042a3838afc8))
66
+ * update packages versions ([bc07e37](https://github.com/naver/egjs-infinitegrid/commit/bc07e37a5fb40e94f87cd1b07f1f7a843ddbe7e8))
67
+
68
+
69
+
70
+ ## [4.7.0](https://github.com/naver/egjs-infinitegrid/compare/@egjs/svelte-infinitegrid@4.6.0...@egjs/svelte-infinitegrid@4.7.0) (2022-09-02)
71
+
72
+
73
+ ### :bug: Bug Fix
74
+
75
+ * fix types (#510) ([96adfd7](https://github.com/naver/egjs-infinitegrid/commit/96adfd7bd66c6d77015818417990339da1b59311))
76
+
77
+
78
+ ### :mega: Other
79
+
80
+ * update packages versions ([e438c00](https://github.com/naver/egjs-infinitegrid/commit/e438c00929ba28bd001d6174bd57efd918144686))
81
+
82
+
83
+
6
84
  ## [4.6.0](https://github.com/naver/egjs-infinitegrid/compare/@egjs/svelte-infinitegrid@4.5.0...@egjs/svelte-infinitegrid@4.6.0) (2022-07-26)
7
85
 
8
86
 
@@ -4,7 +4,7 @@ name: @egjs/svelte-infinitegrid
4
4
  license: MIT
5
5
  author: NAVER Corp.
6
6
  repository: https://github.com/naver/egjs-infinitegrid
7
- version: 4.7.0
7
+ version: 4.8.0
8
8
  */
9
9
  'use strict';
10
10
 
@@ -14,156 +14,103 @@ var infinitegrid = require('@egjs/infinitegrid');
14
14
 
15
15
  const SVELTE_INFINITEGRID_PROPS = ["status", "useFirstRender", "useLoading", "usePlaceholder", "items", "itemBy", "groupBy"];
16
16
 
17
- /* src/InfiniteGrid.svelte generated by Svelte v3.49.0 */
18
-
17
+ /* src/InfiniteGrid.svelte generated by Svelte v3.52.0 */
19
18
  const get_default_slot_changes_1 = dirty => ({
20
- visibleItems: dirty &
21
- /*visibleItems*/
22
- 8
19
+ visibleItems: dirty & /*visibleItems*/8
23
20
  });
24
-
25
21
  const get_default_slot_context_1 = ctx => ({
26
- visibleItems:
27
- /*visibleItems*/
28
- ctx[3]
22
+ visibleItems: /*visibleItems*/ctx[3]
29
23
  });
30
-
31
24
  const get_default_slot_changes = dirty => ({
32
- visibleItems: dirty &
33
- /*visibleItems*/
34
- 8
25
+ visibleItems: dirty & /*visibleItems*/8
35
26
  });
36
-
37
27
  const get_default_slot_context = ctx => ({
38
- visibleItems:
39
- /*visibleItems*/
40
- ctx[3]
41
- }); // (138:2) {:else}
42
-
28
+ visibleItems: /*visibleItems*/ctx[3]
29
+ });
43
30
 
31
+ // (138:2) {:else}
44
32
  function create_else_block(ctx) {
45
33
  let current;
46
- const default_slot_template =
47
- /*#slots*/
48
- ctx[9].default;
49
- const default_slot = internal.create_slot(default_slot_template, ctx,
50
- /*$$scope*/
51
- ctx[8], get_default_slot_context_1);
34
+ const default_slot_template = /*#slots*/ctx[9].default;
35
+ const default_slot = internal.create_slot(default_slot_template, ctx, /*$$scope*/ctx[8], get_default_slot_context_1);
52
36
  return {
53
37
  c() {
54
38
  if (default_slot) default_slot.c();
55
39
  },
56
-
57
40
  m(target, anchor) {
58
41
  if (default_slot) {
59
42
  default_slot.m(target, anchor);
60
43
  }
61
-
62
44
  current = true;
63
45
  },
64
-
65
46
  p(ctx, dirty) {
66
47
  if (default_slot) {
67
- if (default_slot.p && (!current || dirty &
68
- /*$$scope, visibleItems*/
69
- 264)) {
70
- internal.update_slot_base(default_slot, default_slot_template, ctx,
71
- /*$$scope*/
72
- ctx[8], !current ? internal.get_all_dirty_from_scope(
73
- /*$$scope*/
74
- ctx[8]) : internal.get_slot_changes(default_slot_template,
75
- /*$$scope*/
76
- ctx[8], dirty, get_default_slot_changes_1), get_default_slot_context_1);
48
+ if (default_slot.p && (!current || dirty & /*$$scope, visibleItems*/264)) {
49
+ internal.update_slot_base(default_slot, default_slot_template, ctx, /*$$scope*/ctx[8], !current ? internal.get_all_dirty_from_scope( /*$$scope*/ctx[8]) : internal.get_slot_changes(default_slot_template, /*$$scope*/ctx[8], dirty, get_default_slot_changes_1), get_default_slot_context_1);
77
50
  }
78
51
  }
79
52
  },
80
-
81
53
  i(local) {
82
54
  if (current) return;
83
55
  internal.transition_in(default_slot, local);
84
56
  current = true;
85
57
  },
86
-
87
58
  o(local) {
88
59
  internal.transition_out(default_slot, local);
89
60
  current = false;
90
61
  },
91
-
92
62
  d(detaching) {
93
63
  if (default_slot) default_slot.d(detaching);
94
64
  }
95
-
96
65
  };
97
- } // (134:2) {#if $$props.container === true}
98
-
66
+ }
99
67
 
68
+ // (134:2) {#if $$props.container === true}
100
69
  function create_if_block(ctx) {
101
70
  let div;
102
71
  let current;
103
- const default_slot_template =
104
- /*#slots*/
105
- ctx[9].default;
106
- const default_slot = internal.create_slot(default_slot_template, ctx,
107
- /*$$scope*/
108
- ctx[8], get_default_slot_context);
72
+ const default_slot_template = /*#slots*/ctx[9].default;
73
+ const default_slot = internal.create_slot(default_slot_template, ctx, /*$$scope*/ctx[8], get_default_slot_context);
109
74
  return {
110
75
  c() {
111
76
  div = internal.element("div");
112
77
  if (default_slot) default_slot.c();
113
78
  internal.attr(div, "class", infinitegrid.CONTAINER_CLASS_NAME);
114
79
  },
115
-
116
80
  m(target, anchor) {
117
81
  internal.insert(target, div, anchor);
118
-
119
82
  if (default_slot) {
120
83
  default_slot.m(div, null);
121
84
  }
122
- /*div_binding*/
123
-
124
85
 
86
+ /*div_binding*/
125
87
  ctx[10](div);
126
88
  current = true;
127
89
  },
128
-
129
90
  p(ctx, dirty) {
130
91
  if (default_slot) {
131
- if (default_slot.p && (!current || dirty &
132
- /*$$scope, visibleItems*/
133
- 264)) {
134
- internal.update_slot_base(default_slot, default_slot_template, ctx,
135
- /*$$scope*/
136
- ctx[8], !current ? internal.get_all_dirty_from_scope(
137
- /*$$scope*/
138
- ctx[8]) : internal.get_slot_changes(default_slot_template,
139
- /*$$scope*/
140
- ctx[8], dirty, get_default_slot_changes), get_default_slot_context);
92
+ if (default_slot.p && (!current || dirty & /*$$scope, visibleItems*/264)) {
93
+ internal.update_slot_base(default_slot, default_slot_template, ctx, /*$$scope*/ctx[8], !current ? internal.get_all_dirty_from_scope( /*$$scope*/ctx[8]) : internal.get_slot_changes(default_slot_template, /*$$scope*/ctx[8], dirty, get_default_slot_changes), get_default_slot_context);
141
94
  }
142
95
  }
143
96
  },
144
-
145
97
  i(local) {
146
98
  if (current) return;
147
99
  internal.transition_in(default_slot, local);
148
100
  current = true;
149
101
  },
150
-
151
102
  o(local) {
152
103
  internal.transition_out(default_slot, local);
153
104
  current = false;
154
105
  },
155
-
156
106
  d(detaching) {
157
107
  if (detaching) internal.detach(div);
158
108
  if (default_slot) default_slot.d(detaching);
159
109
  /*div_binding*/
160
-
161
110
  ctx[10](null);
162
111
  }
163
-
164
112
  };
165
113
  }
166
-
167
114
  function create_fragment(ctx) {
168
115
  let div;
169
116
  let current_block_type_index;
@@ -171,45 +118,33 @@ function create_fragment(ctx) {
171
118
  let current;
172
119
  const if_block_creators = [create_if_block, create_else_block];
173
120
  const if_blocks = [];
174
-
175
121
  function select_block_type(ctx, dirty) {
176
- if (
177
- /*$$props*/
178
- ctx[4].container === true) return 0;
122
+ if ( /*$$props*/ctx[4].container === true) return 0;
179
123
  return 1;
180
124
  }
181
-
182
125
  current_block_type_index = select_block_type(ctx);
183
126
  if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
184
- let div_levels = [
185
- /*attributes*/
186
- ctx[2]];
127
+ let div_levels = [/*attributes*/ctx[2]];
187
128
  let div_data = {};
188
-
189
129
  for (let i = 0; i < div_levels.length; i += 1) {
190
130
  div_data = internal.assign(div_data, div_levels[i]);
191
131
  }
192
-
193
132
  return {
194
133
  c() {
195
134
  div = internal.element("div");
196
135
  if_block.c();
197
136
  internal.set_attributes(div, div_data);
198
137
  },
199
-
200
138
  m(target, anchor) {
201
139
  internal.insert(target, div, anchor);
202
140
  if_blocks[current_block_type_index].m(div, null);
203
141
  /*div_binding_1*/
204
-
205
142
  ctx[11](div);
206
143
  current = true;
207
144
  },
208
-
209
145
  p(ctx, [dirty]) {
210
146
  let previous_block_index = current_block_type_index;
211
147
  current_block_type_index = select_block_type(ctx);
212
-
213
148
  if (current_block_type_index === previous_block_index) {
214
149
  if_blocks[current_block_type_index].p(ctx, dirty);
215
150
  } else {
@@ -219,47 +154,34 @@ function create_fragment(ctx) {
219
154
  });
220
155
  internal.check_outros();
221
156
  if_block = if_blocks[current_block_type_index];
222
-
223
157
  if (!if_block) {
224
158
  if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
225
159
  if_block.c();
226
160
  } else {
227
161
  if_block.p(ctx, dirty);
228
162
  }
229
-
230
163
  internal.transition_in(if_block, 1);
231
164
  if_block.m(div, null);
232
165
  }
233
-
234
- internal.set_attributes(div, div_data = internal.get_spread_update(div_levels, [dirty &
235
- /*attributes*/
236
- 4 &&
237
- /*attributes*/
238
- ctx[2]]));
166
+ internal.set_attributes(div, div_data = internal.get_spread_update(div_levels, [dirty & /*attributes*/4 && /*attributes*/ctx[2]]));
239
167
  },
240
-
241
168
  i(local) {
242
169
  if (current) return;
243
170
  internal.transition_in(if_block);
244
171
  current = true;
245
172
  },
246
-
247
173
  o(local) {
248
174
  internal.transition_out(if_block);
249
175
  current = false;
250
176
  },
251
-
252
177
  d(detaching) {
253
178
  if (detaching) internal.detach(div);
254
179
  if_blocks[current_block_type_index].d();
255
180
  /*div_binding_1*/
256
-
257
181
  ctx[11](null);
258
182
  }
259
-
260
183
  };
261
184
  }
262
-
263
185
  function instance($$self, $$props, $$invalidate) {
264
186
  let {
265
187
  $$slots: slots = {},
@@ -277,29 +199,23 @@ function instance($$self, $$props, $$invalidate) {
277
199
  let container;
278
200
  let attributes = {};
279
201
  let visibleItems = [];
280
-
281
202
  function updateAttributes(props) {
282
- $$invalidate(2, attributes = { ...props
203
+ $$invalidate(2, attributes = {
204
+ ...props
283
205
  });
284
206
  const defaultOptions = GridClass.defaultOptions;
285
207
  delete attributes["GridClass"];
286
-
287
208
  for (const name in defaultOptions) {
288
209
  delete attributes[name];
289
210
  }
290
-
291
211
  SVELTE_INFINITEGRID_PROPS.forEach(name => {
292
212
  delete attributes[name];
293
213
  });
294
214
  }
295
-
296
215
  function getItemInfos() {
297
216
  const items = $$props.items || [];
298
-
299
217
  const itemBy = $$props.itemBy || (item => item.key);
300
-
301
218
  const groupBy = $$props.groupBy || (item => item.groupKey);
302
-
303
219
  return items.map((item, i) => {
304
220
  return {
305
221
  groupKey: groupBy(item, i),
@@ -308,7 +224,6 @@ function instance($$self, $$props, $$invalidate) {
308
224
  };
309
225
  });
310
226
  }
311
-
312
227
  function updateVisibleChildren(props) {
313
228
  $$invalidate(3, visibleItems = infinitegrid.getRenderingItems(getItemInfos(), {
314
229
  grid: vanillaGrid,
@@ -319,7 +234,6 @@ function instance($$self, $$props, $$invalidate) {
319
234
  horizontal: props.horizontal
320
235
  }));
321
236
  }
322
-
323
237
  svelte.beforeUpdate(() => {
324
238
  updateAttributes($$props);
325
239
  updateVisibleChildren($$props);
@@ -327,27 +241,22 @@ function instance($$self, $$props, $$invalidate) {
327
241
  svelte.onMount(() => {
328
242
  const defaultOptions = GridClass.defaultOptions;
329
243
  const options = {};
330
-
331
244
  for (const name in defaultOptions) {
332
245
  if (name in $$props) {
333
246
  options[name] = $$props[name];
334
247
  }
335
248
  }
336
-
337
249
  if (container) {
338
250
  options.container = container;
339
251
  }
340
-
341
252
  options.renderer = renderer;
342
253
  $$invalidate(5, vanillaGrid = new GridClass(wrapper, options));
343
-
344
254
  for (const name in infinitegrid.INFINITEGRID_EVENTS) {
345
255
  const eventName = infinitegrid.INFINITEGRID_EVENTS[name];
346
256
  vanillaGrid.on(eventName, e => {
347
257
  dispatch(eventName, e);
348
258
  });
349
259
  }
350
-
351
260
  renderer.on("requestUpdate", () => {
352
261
  updateVisibleChildren($$props);
353
262
  });
@@ -362,50 +271,41 @@ function instance($$self, $$props, $$invalidate) {
362
271
  renderer.updated();
363
272
  });
364
273
  svelte.afterUpdate(() => {
365
-
366
274
  const propertyTypes = GridClass.propertyTypes;
367
-
368
275
  for (const name in propertyTypes) {
369
276
  if (name in $$props) {
370
277
  $$invalidate(5, vanillaGrid[name] = $$props[name], vanillaGrid);
371
278
  }
372
279
  }
373
-
374
280
  renderer.updated();
375
281
  });
376
282
  svelte.onDestroy(() => {
377
283
  vanillaGrid && vanillaGrid.destroy();
378
284
  });
379
-
380
285
  function getInstance() {
381
286
  return vanillaGrid;
382
287
  }
383
-
384
288
  function div_binding($$value) {
385
289
  internal.binding_callbacks[$$value ? 'unshift' : 'push'](() => {
386
290
  container = $$value;
387
291
  $$invalidate(1, container);
388
292
  });
389
293
  }
390
-
391
294
  function div_binding_1($$value) {
392
295
  internal.binding_callbacks[$$value ? 'unshift' : 'push'](() => {
393
296
  wrapper = $$value;
394
297
  $$invalidate(0, wrapper);
395
298
  });
396
299
  }
397
-
398
300
  $$self.$$set = $$new_props => {
399
301
  $$invalidate(4, $$props = internal.assign(internal.assign({}, $$props), internal.exclude_internal_props($$new_props)));
400
302
  if ('GridClass' in $$new_props) $$invalidate(6, GridClass = $$new_props.GridClass);
401
303
  if ('vanillaGrid' in $$new_props) $$invalidate(5, vanillaGrid = $$new_props.vanillaGrid);
402
304
  if ('$$scope' in $$new_props) $$invalidate(8, $$scope = $$new_props.$$scope);
403
305
  };
404
-
405
306
  $$props = internal.exclude_internal_props($$props);
406
307
  return [wrapper, container, attributes, visibleItems, $$props, vanillaGrid, GridClass, getInstance, $$scope, slots, div_binding, div_binding_1];
407
308
  }
408
-
409
309
  class InfiniteGrid$1 extends internal.SvelteComponent {
410
310
  constructor(options) {
411
311
  super();
@@ -415,11 +315,9 @@ class InfiniteGrid$1 extends internal.SvelteComponent {
415
315
  getInstance: 7
416
316
  });
417
317
  }
418
-
419
318
  get getInstance() {
420
319
  return this.$$.ctx[7];
421
320
  }
422
-
423
321
  }
424
322
 
425
323
  /**
@@ -429,17 +327,14 @@ class InfiniteGrid$1 extends internal.SvelteComponent {
429
327
  */
430
328
  var InfiniteGrid = /*#__PURE__*/(() => {
431
329
  const prototype = InfiniteGrid$1.prototype;
432
-
433
330
  if (prototype) {
434
331
  infinitegrid.INFINITEGRID_METHODS.forEach(name => {
435
332
  if (name in prototype) {
436
333
  return;
437
334
  }
438
-
439
335
  prototype[name] = function (...args) {
440
336
  const self = this.getInstance();
441
337
  const result = self[name](...args);
442
-
443
338
  if (result === self) {
444
339
  return this;
445
340
  } else {
@@ -448,12 +343,10 @@ var InfiniteGrid = /*#__PURE__*/(() => {
448
343
  };
449
344
  });
450
345
  }
451
-
452
346
  return InfiniteGrid$1;
453
347
  })();
454
348
 
455
349
  let MasonryInfiniteGrid;
456
-
457
350
  if (typeof InfiniteGrid === "object") {
458
351
  MasonryInfiniteGrid = InfiniteGrid;
459
352
  } else {
@@ -462,12 +355,10 @@ if (typeof InfiniteGrid === "object") {
462
355
  options.props.GridClass = infinitegrid.MasonryInfiniteGrid;
463
356
  super(options);
464
357
  }
465
-
466
358
  };
467
359
  }
468
360
 
469
361
  let JustifiedInfiniteGrid;
470
-
471
362
  if (typeof InfiniteGrid === "object") {
472
363
  JustifiedInfiniteGrid = InfiniteGrid;
473
364
  } else {
@@ -476,12 +367,10 @@ if (typeof InfiniteGrid === "object") {
476
367
  options.props.GridClass = infinitegrid.JustifiedInfiniteGrid;
477
368
  super(options);
478
369
  }
479
-
480
370
  };
481
371
  }
482
372
 
483
373
  let FrameInfiniteGrid;
484
-
485
374
  if (typeof InfiniteGrid === "object") {
486
375
  FrameInfiniteGrid = InfiniteGrid;
487
376
  } else {
@@ -490,12 +379,10 @@ if (typeof InfiniteGrid === "object") {
490
379
  options.props.GridClass = infinitegrid.FrameInfiniteGrid;
491
380
  super(options);
492
381
  }
493
-
494
382
  };
495
383
  }
496
384
 
497
385
  let PackingInfiniteGrid;
498
-
499
386
  if (typeof InfiniteGrid === "object") {
500
387
  PackingInfiniteGrid = InfiniteGrid;
501
388
  } else {
@@ -504,7 +391,6 @@ if (typeof InfiniteGrid === "object") {
504
391
  options.props.GridClass = infinitegrid.PackingInfiniteGrid;
505
392
  super(options);
506
393
  }
507
-
508
394
  };
509
395
  }
510
396
 
@@ -1 +1 @@
1
- {"version":3,"file":"infinitegrid.cjs.js","sources":["../src/consts.js","../src/InfiniteGrid.svelte","../src/InfiniteGrid.js","../src/grids/MasonryInfiniteGrid.js","../src/grids/JustifiedInfiniteGrid.js","../src/grids/FrameInfiniteGrid.js","../src/grids/PackingInfiniteGrid.js"],"sourcesContent":["export const SVELTE_INFINITEGRID_PROPS = [\n \"status\",\n \"useFirstRender\",\n \"useLoading\",\n \"usePlaceholder\",\n \"items\",\n \"itemBy\",\n \"groupBy\",\n];\n","<script>\n /**\n * egjs-infinitegrid\n * Copyright (c) 2021-present NAVER Corp.\n * MIT license\n */\n import {\n onMount,\n beforeUpdate,\n createEventDispatcher,\n onDestroy,\n afterUpdate,\n } from \"svelte\";\n import {\n INFINITEGRID_EVENTS,\n Renderer,\n CONTAINER_CLASS_NAME,\n getRenderingItems,\n mountRenderingItems,\n } from \"@egjs/infinitegrid\";\n import { SVELTE_INFINITEGRID_PROPS } from \"./consts\";\n export let GridClass;\n export let vanillaGrid = null;\n\n const dispatch = createEventDispatcher();\n const renderer = new Renderer();\n let wrapper;\n let container;\n let isFirstMount = false;\n let attributes = {};\n let visibleItems = [];\n\n function updateAttributes(props) {\n attributes = { ...props };\n\n const defaultOptions = GridClass.defaultOptions;\n\n delete attributes[\"GridClass\"];\n for (const name in defaultOptions) {\n delete attributes[name];\n }\n SVELTE_INFINITEGRID_PROPS.forEach((name) => {\n delete attributes[name];\n });\n }\n function getItemInfos() {\n const items = $$props.items || [];\n const itemBy = $$props.itemBy || ((item) => item.key);\n const groupBy = $$props.groupBy || ((item) => item.groupKey);\n\n return items.map((item, i) => {\n return {\n groupKey: groupBy(item, i),\n key: itemBy(item, i),\n data: item,\n };\n });\n }\n function updateVisibleChildren(props) {\n visibleItems = getRenderingItems(getItemInfos(), {\n grid: vanillaGrid,\n status: props.status,\n usePlaceholder: props.usePlaceholder,\n useFirstRender: props.useFirstRender,\n useLoading: props.useLoading,\n horizontal: props.horizontal,\n });\n }\n\n beforeUpdate(() => {\n updateAttributes($$props);\n updateVisibleChildren($$props);\n });\n\n onMount(() => {\n const defaultOptions = GridClass.defaultOptions;\n const options = {};\n\n for (const name in defaultOptions) {\n if (name in $$props) {\n options[name] = $$props[name];\n }\n }\n if (container) {\n options.container = container;\n }\n options.renderer = renderer;\n vanillaGrid = new GridClass(wrapper, options);\n\n for (const name in INFINITEGRID_EVENTS) {\n const eventName = INFINITEGRID_EVENTS[name];\n\n vanillaGrid.on(eventName, (e) => {\n dispatch(eventName, e);\n });\n }\n renderer.on(\"requestUpdate\", () => {\n updateVisibleChildren($$props);\n });\n\n mountRenderingItems(getItemInfos(), {\n grid: vanillaGrid,\n status: $$props.status,\n usePlaceholder: $$props.usePlaceholder,\n useFirstRender: $$props.useFirstRender,\n useLoading: $$props.useLoading,\n horizontal: $$props.horizontal,\n });\n renderer.updated();\n });\n afterUpdate(() => {\n if (isFirstMount) {\n isFirstMount = false;\n return;\n }\n const propertyTypes = GridClass.propertyTypes;\n\n for (const name in propertyTypes) {\n if (name in $$props) {\n vanillaGrid[name] = $$props[name];\n }\n }\n renderer.updated();\n });\n onDestroy(() => {\n vanillaGrid && vanillaGrid.destroy();\n });\n export function getInstance() {\n return vanillaGrid;\n }\n</script>\n\n<div bind:this={wrapper} {...attributes}>\n {#if $$props.container === true}\n <div class={CONTAINER_CLASS_NAME} bind:this={container}>\n <slot {visibleItems} />\n </div>\n {:else}\n <slot {visibleItems} />\n {/if}\n</div>\n","/**\n * egjs-infinitegrid\n * Copyright (c) 2021-present NAVER Corp.\n * MIT license\n */\nimport InfiniteGrid from \"./InfiniteGrid.svelte\";\nimport { INFINITEGRID_METHODS } from \"@egjs/infinitegrid\";\n\nexport default /*#__PURE__*/ (() => {\n const prototype = InfiniteGrid.prototype;\n\n if (prototype) {\n INFINITEGRID_METHODS.forEach(name => {\n if (name in prototype) {\n return;\n }\n prototype[name] = function (...args) {\n const self = this.getInstance();\n const result = self[name](...args);\n\n if (result === self) {\n return this;\n } else {\n return result;\n }\n };\n });\n }\n return InfiniteGrid;\n})();\n","import InfiniteGrid from \"../InfiniteGrid.js\";\nimport { MasonryInfiniteGrid as GridClass } from \"@egjs/infinitegrid\";\n\n\nlet MasonryInfiniteGrid;\n\nif (typeof InfiniteGrid === \"object\") {\n MasonryInfiniteGrid = InfiniteGrid;\n} else {\n MasonryInfiniteGrid = class MasonryInfiniteGrid extends InfiniteGrid {\n constructor(options) {\n options.props.GridClass = GridClass;\n super(options);\n }\n }\n}\nexport { MasonryInfiniteGrid };\n","import InfiniteGrid from \"../InfiniteGrid.js\";\nimport { JustifiedInfiniteGrid as GridClass } from \"@egjs/infinitegrid\";\n\n\nlet JustifiedInfiniteGrid;\n\nif (typeof InfiniteGrid === \"object\") {\n JustifiedInfiniteGrid = InfiniteGrid;\n} else {\n JustifiedInfiniteGrid = class JustifiedInfiniteGrid extends InfiniteGrid {\n constructor(options) {\n options.props.GridClass = GridClass;\n super(options);\n }\n }\n}\nexport { JustifiedInfiniteGrid };\n","import InfiniteGrid from \"../InfiniteGrid.js\";\nimport { FrameInfiniteGrid as GridClass } from \"@egjs/infinitegrid\";\n\n\nlet FrameInfiniteGrid;\n\nif (typeof InfiniteGrid === \"object\") {\n FrameInfiniteGrid = InfiniteGrid;\n} else {\n FrameInfiniteGrid = class FrameInfiniteGrid extends InfiniteGrid {\n constructor(options) {\n options.props.GridClass = GridClass;\n super(options);\n }\n }\n}\nexport { FrameInfiniteGrid };\n","import InfiniteGrid from \"../InfiniteGrid.js\";\nimport { PackingInfiniteGrid as GridClass } from \"@egjs/infinitegrid\";\n\n\nlet PackingInfiniteGrid;\n\nif (typeof InfiniteGrid === \"object\") {\n PackingInfiniteGrid = InfiniteGrid;\n} else {\n PackingInfiniteGrid = class PackingInfiniteGrid extends InfiniteGrid {\n constructor(options) {\n options.props.GridClass = GridClass;\n super(options);\n }\n }\n}\nexport { PackingInfiniteGrid };\n"],"names":["SVELTE_INFINITEGRID_PROPS","CONTAINER_CLASS_NAME","insert","target","div","anchor","ctx","container","GridClass","$$props","vanillaGrid","dispatch","createEventDispatcher","renderer","Renderer","wrapper","attributes","visibleItems","updateAttributes","props","$$invalidate","defaultOptions","name","forEach","getItemInfos","items","itemBy","item","key","groupBy","groupKey","map","i","data","updateVisibleChildren","getRenderingItems","grid","status","usePlaceholder","useFirstRender","useLoading","horizontal","beforeUpdate","onMount","options","INFINITEGRID_EVENTS","eventName","on","e","mountRenderingItems","updated","afterUpdate","propertyTypes","onDestroy","destroy","getInstance","$$value","prototype","InfiniteGrid","INFINITEGRID_METHODS","args","self","result","MasonryInfiniteGrid","constructor","JustifiedInfiniteGrid","FrameInfiniteGrid","PackingInfiniteGrid"],"mappings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AI,OAAOT,YAAP,KAAwB,QAA5B,EAAsC;AACpCS,EAAAA,mBAAmB,GAAGT,YAAtB,CAAA;AACD,CAFD,MAEO;AACLS,EAAAA,mBAAmB,GAAG,MAAMA,mBAAN,SAAkCT,YAAlC,CAA+C;IACnEM,WAAW,CAACpB,OAAD,EAAU;AACnBA,MAAAA,OAAO,CAACzB,KAAR,CAAcX,SAAd,GAA0BA,gCAA1B,CAAA;AACA,MAAA,KAAA,CAAMoC,OAAN,CAAA,CAAA;AACD,KAAA;;GAJH,CAAA;AAMD;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"infinitegrid.cjs.js","sources":["../src/consts.js","../src/InfiniteGrid.svelte","../src/InfiniteGrid.js","../src/grids/MasonryInfiniteGrid.js","../src/grids/JustifiedInfiniteGrid.js","../src/grids/FrameInfiniteGrid.js","../src/grids/PackingInfiniteGrid.js"],"sourcesContent":["export const SVELTE_INFINITEGRID_PROPS = [\n \"status\",\n \"useFirstRender\",\n \"useLoading\",\n \"usePlaceholder\",\n \"items\",\n \"itemBy\",\n \"groupBy\",\n];\n","<script>\n /**\n * egjs-infinitegrid\n * Copyright (c) 2021-present NAVER Corp.\n * MIT license\n */\n import {\n onMount,\n beforeUpdate,\n createEventDispatcher,\n onDestroy,\n afterUpdate,\n } from \"svelte\";\n import {\n INFINITEGRID_EVENTS,\n Renderer,\n CONTAINER_CLASS_NAME,\n getRenderingItems,\n mountRenderingItems,\n } from \"@egjs/infinitegrid\";\n import { SVELTE_INFINITEGRID_PROPS } from \"./consts\";\n export let GridClass;\n export let vanillaGrid = null;\n\n const dispatch = createEventDispatcher();\n const renderer = new Renderer();\n let wrapper;\n let container;\n let isFirstMount = false;\n let attributes = {};\n let visibleItems = [];\n\n function updateAttributes(props) {\n attributes = { ...props };\n\n const defaultOptions = GridClass.defaultOptions;\n\n delete attributes[\"GridClass\"];\n for (const name in defaultOptions) {\n delete attributes[name];\n }\n SVELTE_INFINITEGRID_PROPS.forEach((name) => {\n delete attributes[name];\n });\n }\n function getItemInfos() {\n const items = $$props.items || [];\n const itemBy = $$props.itemBy || ((item) => item.key);\n const groupBy = $$props.groupBy || ((item) => item.groupKey);\n\n return items.map((item, i) => {\n return {\n groupKey: groupBy(item, i),\n key: itemBy(item, i),\n data: item,\n };\n });\n }\n function updateVisibleChildren(props) {\n visibleItems = getRenderingItems(getItemInfos(), {\n grid: vanillaGrid,\n status: props.status,\n usePlaceholder: props.usePlaceholder,\n useFirstRender: props.useFirstRender,\n useLoading: props.useLoading,\n horizontal: props.horizontal,\n });\n }\n\n beforeUpdate(() => {\n updateAttributes($$props);\n updateVisibleChildren($$props);\n });\n\n onMount(() => {\n const defaultOptions = GridClass.defaultOptions;\n const options = {};\n\n for (const name in defaultOptions) {\n if (name in $$props) {\n options[name] = $$props[name];\n }\n }\n if (container) {\n options.container = container;\n }\n options.renderer = renderer;\n vanillaGrid = new GridClass(wrapper, options);\n\n for (const name in INFINITEGRID_EVENTS) {\n const eventName = INFINITEGRID_EVENTS[name];\n\n vanillaGrid.on(eventName, (e) => {\n dispatch(eventName, e);\n });\n }\n renderer.on(\"requestUpdate\", () => {\n updateVisibleChildren($$props);\n });\n\n mountRenderingItems(getItemInfos(), {\n grid: vanillaGrid,\n status: $$props.status,\n usePlaceholder: $$props.usePlaceholder,\n useFirstRender: $$props.useFirstRender,\n useLoading: $$props.useLoading,\n horizontal: $$props.horizontal,\n });\n renderer.updated();\n });\n afterUpdate(() => {\n if (isFirstMount) {\n isFirstMount = false;\n return;\n }\n const propertyTypes = GridClass.propertyTypes;\n\n for (const name in propertyTypes) {\n if (name in $$props) {\n vanillaGrid[name] = $$props[name];\n }\n }\n renderer.updated();\n });\n onDestroy(() => {\n vanillaGrid && vanillaGrid.destroy();\n });\n export function getInstance() {\n return vanillaGrid;\n }\n</script>\n\n<div bind:this={wrapper} {...attributes}>\n {#if $$props.container === true}\n <div class={CONTAINER_CLASS_NAME} bind:this={container}>\n <slot {visibleItems} />\n </div>\n {:else}\n <slot {visibleItems} />\n {/if}\n</div>\n","/**\n * egjs-infinitegrid\n * Copyright (c) 2021-present NAVER Corp.\n * MIT license\n */\nimport InfiniteGrid from \"./InfiniteGrid.svelte\";\nimport { INFINITEGRID_METHODS } from \"@egjs/infinitegrid\";\n\nexport default /*#__PURE__*/ (() => {\n const prototype = InfiniteGrid.prototype;\n\n if (prototype) {\n INFINITEGRID_METHODS.forEach(name => {\n if (name in prototype) {\n return;\n }\n prototype[name] = function (...args) {\n const self = this.getInstance();\n const result = self[name](...args);\n\n if (result === self) {\n return this;\n } else {\n return result;\n }\n };\n });\n }\n return InfiniteGrid;\n})();\n","import InfiniteGrid from \"../InfiniteGrid.js\";\nimport { MasonryInfiniteGrid as GridClass } from \"@egjs/infinitegrid\";\n\n\nlet MasonryInfiniteGrid;\n\nif (typeof InfiniteGrid === \"object\") {\n MasonryInfiniteGrid = InfiniteGrid;\n} else {\n MasonryInfiniteGrid = class MasonryInfiniteGrid extends InfiniteGrid {\n constructor(options) {\n options.props.GridClass = GridClass;\n super(options);\n }\n }\n}\nexport { MasonryInfiniteGrid };\n","import InfiniteGrid from \"../InfiniteGrid.js\";\nimport { JustifiedInfiniteGrid as GridClass } from \"@egjs/infinitegrid\";\n\n\nlet JustifiedInfiniteGrid;\n\nif (typeof InfiniteGrid === \"object\") {\n JustifiedInfiniteGrid = InfiniteGrid;\n} else {\n JustifiedInfiniteGrid = class JustifiedInfiniteGrid extends InfiniteGrid {\n constructor(options) {\n options.props.GridClass = GridClass;\n super(options);\n }\n }\n}\nexport { JustifiedInfiniteGrid };\n","import InfiniteGrid from \"../InfiniteGrid.js\";\nimport { FrameInfiniteGrid as GridClass } from \"@egjs/infinitegrid\";\n\n\nlet FrameInfiniteGrid;\n\nif (typeof InfiniteGrid === \"object\") {\n FrameInfiniteGrid = InfiniteGrid;\n} else {\n FrameInfiniteGrid = class FrameInfiniteGrid extends InfiniteGrid {\n constructor(options) {\n options.props.GridClass = GridClass;\n super(options);\n }\n }\n}\nexport { FrameInfiniteGrid };\n","import InfiniteGrid from \"../InfiniteGrid.js\";\nimport { PackingInfiniteGrid as GridClass } from \"@egjs/infinitegrid\";\n\n\nlet PackingInfiniteGrid;\n\nif (typeof InfiniteGrid === \"object\") {\n PackingInfiniteGrid = InfiniteGrid;\n} else {\n PackingInfiniteGrid = class PackingInfiniteGrid extends InfiniteGrid {\n constructor(options) {\n options.props.GridClass = GridClass;\n super(options);\n }\n }\n}\nexport { PackingInfiniteGrid };\n"],"names":["SVELTE_INFINITEGRID_PROPS","CONTAINER_CLASS_NAME","insert","target","div","anchor","ctx","container","GridClass","$$props","vanillaGrid","dispatch","createEventDispatcher","renderer","Renderer","wrapper","attributes","visibleItems","updateAttributes","props","$$invalidate","defaultOptions","name","forEach","getItemInfos","items","itemBy","item","key","groupBy","groupKey","map","i","data","updateVisibleChildren","getRenderingItems","grid","status","usePlaceholder","useFirstRender","useLoading","horizontal","beforeUpdate","onMount","options","INFINITEGRID_EVENTS","eventName","on","e","mountRenderingItems","updated","afterUpdate","propertyTypes","onDestroy","destroy","getInstance","$$value","prototype","InfiniteGrid","INFINITEGRID_METHODS","args","self","result","MasonryInfiniteGrid","constructor","JustifiedInfiniteGrid","FrameInfiniteGrid","PackingInfiniteGrid"],"mappings":";;;;;;;;;;;;;;AAAO,MAAMA,yBAAyB,GAAG,CACvC,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,SAAS,CACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCC8HeC,iCAAoB,CAAA,CAAA;;;AAAhCC,MAAAA,eAEK,CAAAC,MAAA,EAAAC,GAAA,EAAAC,MAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAHFC,GAAO,CAAA,CAAA,CAAA,CAACC,SAAS,KAAK,IAAI,EAAA,OAAA,CAAA,CAAA;;;;;kCADJD,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