pageflow 15.2.2 → 15.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pageflow might be problematic. Click here for more details.

Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +338 -85
  3. data/admins/pageflow/accounts.rb +1 -98
  4. data/admins/pageflow/entry.rb +21 -1
  5. data/admins/pageflow/entry_templates.rb +140 -0
  6. data/admins/pageflow/membership.rb +12 -0
  7. data/admins/pageflow/user.rb +5 -3
  8. data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
  9. data/app/assets/javascripts/pageflow/admin/users.js +1 -1
  10. data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
  11. data/app/assets/javascripts/pageflow/base.js +0 -12
  12. data/app/assets/javascripts/pageflow/components.js +2 -6
  13. data/app/assets/javascripts/pageflow/dist/ui.js +47 -14
  14. data/app/assets/javascripts/pageflow/vendor.js +13 -10
  15. data/app/assets/stylesheets/pageflow/base.scss +0 -7
  16. data/app/assets/stylesheets/pageflow/editor/base.scss +2 -0
  17. data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
  18. data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
  19. data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
  20. data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
  21. data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
  22. data/app/helpers/pageflow/structured_data_helper.rb +0 -2
  23. data/app/models/pageflow/account.rb +21 -1
  24. data/app/models/pageflow/entry.rb +9 -2
  25. data/app/models/pageflow/entry_duplicate.rb +1 -0
  26. data/app/models/pageflow/entry_template.rb +16 -2
  27. data/app/policies/pageflow/account_policy.rb +10 -0
  28. data/app/policies/pageflow/entry_template_policy.rb +5 -1
  29. data/app/views/admin/accounts/_entry_template_details.html.arb +7 -5
  30. data/app/views/admin/accounts/_form.html.erb +3 -49
  31. data/app/views/admin/entries/_attributes_table.html.arb +5 -0
  32. data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
  33. data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
  34. data/app/views/admin/entry_templates/_form.html.erb +58 -0
  35. data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
  36. data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
  37. data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
  38. data/config/initializers/admin_resource_tabs.rb +5 -0
  39. data/config/initializers/help_entries.rb +1 -5
  40. data/config/locales/de.yml +88 -155
  41. data/config/locales/en.yml +79 -143
  42. data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
  43. data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
  44. data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
  45. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1479 -1391
  46. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9218 -0
  47. data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
  48. data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
  49. data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
  50. data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
  51. data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +8 -0
  52. data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
  53. data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
  54. data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
  55. data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +2 -2
  56. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +2 -2
  57. data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
  58. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
  59. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
  60. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
  61. data/entry_types/paged/config/initializers/features.rb +1 -1
  62. data/entry_types/paged/config/initializers/help_entries.rb +17 -0
  63. data/entry_types/paged/config/locales/new/help.de.yml +162 -0
  64. data/entry_types/paged/config/locales/new/help.en.yml +153 -0
  65. data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
  66. data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
  67. data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
  68. data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
  69. data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
  70. data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
  71. data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
  72. data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
  73. data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
  74. data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
  75. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  76. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +14 -4
  77. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
  78. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +8 -0
  79. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +6 -0
  80. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -0
  81. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +33 -0
  82. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +8 -0
  83. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +38 -0
  84. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
  85. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
  86. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +19 -3
  87. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
  88. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +7 -0
  89. data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
  90. data/entry_types/scrolled/config/locales/new/de.yml +345 -13
  91. data/entry_types/scrolled/config/locales/new/en.yml +257 -14
  92. data/entry_types/scrolled/config/routes.rb +1 -0
  93. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +28 -0
  94. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
  95. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
  96. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +4 -0
  97. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
  98. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +90 -30
  99. data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +64 -27
  100. data/entry_types/scrolled/package/contentElements-editor.js +242 -183
  101. data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
  102. data/entry_types/scrolled/package/contentElements-frontend.js +624 -279
  103. data/entry_types/scrolled/package/editor.js +2561 -363
  104. data/entry_types/scrolled/package/frontend-server.js +228 -0
  105. data/entry_types/scrolled/package/frontend/EditableText-4264c349.js +1993 -0
  106. data/entry_types/scrolled/package/frontend/Wavesurfer-c3c45324.js +378 -0
  107. data/entry_types/scrolled/package/frontend/components-cfe6a479.js +2115 -0
  108. data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
  109. data/entry_types/scrolled/package/frontend/index.css +9 -0
  110. data/entry_types/scrolled/package/frontend/index.js +4425 -0
  111. data/entry_types/scrolled/package/package.json +17 -6
  112. data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
  113. data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
  114. data/lib/generators/pageflow/initializer/templates/pageflow.rb +20 -9
  115. data/lib/pageflow/ability_mixin.rb +14 -2
  116. data/lib/pageflow/configuration.rb +6 -5
  117. data/lib/pageflow/engine.rb +1 -0
  118. data/lib/pageflow/entry_type_configuration.rb +1 -0
  119. data/lib/pageflow/global_config_api.rb +5 -4
  120. data/lib/pageflow/react.rb +4 -2
  121. data/lib/pageflow/version.rb +1 -1
  122. data/{packages/pageflow → package}/config/jest/index.js +2 -1
  123. data/{packages/pageflow → package}/config/jest/transformers/jst.js +0 -0
  124. data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
  125. data/package/config/webpack.js +22 -0
  126. data/{packages/pageflow → package}/editor.js +480 -1129
  127. data/package/frontend.js +2525 -0
  128. data/{packages/pageflow → package}/package.json +3 -0
  129. data/{packages/pageflow → package}/testHelpers.js +114 -13
  130. data/{packages/pageflow → package}/ui.js +47 -14
  131. data/spec/factories/accounts.rb +3 -1
  132. data/spec/factories/entry_templates.rb +1 -0
  133. data/spec/factories/published_entries.rb +6 -1
  134. metadata +62 -26
  135. data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5800
  136. data/config/initializers/entry_types.rb +0 -4
  137. data/entry_types/scrolled/package/frontend.js +0 -2879
  138. data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
  139. data/packages/pageflow/config/webpack.js +0 -14
@@ -0,0 +1,228 @@
1
+ import 'core-js/modules/es.symbol';
2
+ import 'core-js/modules/es.symbol.description';
3
+ import 'core-js/modules/es.symbol.async-iterator';
4
+ import 'core-js/modules/es.symbol.has-instance';
5
+ import 'core-js/modules/es.symbol.is-concat-spreadable';
6
+ import 'core-js/modules/es.symbol.iterator';
7
+ import 'core-js/modules/es.symbol.match';
8
+ import 'core-js/modules/es.symbol.replace';
9
+ import 'core-js/modules/es.symbol.search';
10
+ import 'core-js/modules/es.symbol.species';
11
+ import 'core-js/modules/es.symbol.split';
12
+ import 'core-js/modules/es.symbol.to-primitive';
13
+ import 'core-js/modules/es.symbol.to-string-tag';
14
+ import 'core-js/modules/es.symbol.unscopables';
15
+ import 'core-js/modules/es.array.concat';
16
+ import 'core-js/modules/es.array.copy-within';
17
+ import 'core-js/modules/es.array.every';
18
+ import 'core-js/modules/es.array.fill';
19
+ import 'core-js/modules/es.array.filter';
20
+ import 'core-js/modules/es.array.find';
21
+ import 'core-js/modules/es.array.find-index';
22
+ import 'core-js/modules/es.array.flat';
23
+ import 'core-js/modules/es.array.flat-map';
24
+ import 'core-js/modules/es.array.for-each';
25
+ import 'core-js/modules/es.array.from';
26
+ import 'core-js/modules/es.array.includes';
27
+ import 'core-js/modules/es.array.index-of';
28
+ import 'core-js/modules/es.array.is-array';
29
+ import 'core-js/modules/es.array.iterator';
30
+ import 'core-js/modules/es.array.join';
31
+ import 'core-js/modules/es.array.last-index-of';
32
+ import 'core-js/modules/es.array.map';
33
+ import 'core-js/modules/es.array.of';
34
+ import 'core-js/modules/es.array.reduce';
35
+ import 'core-js/modules/es.array.reduce-right';
36
+ import 'core-js/modules/es.array.reverse';
37
+ import 'core-js/modules/es.array.slice';
38
+ import 'core-js/modules/es.array.some';
39
+ import 'core-js/modules/es.array.sort';
40
+ import 'core-js/modules/es.array.species';
41
+ import 'core-js/modules/es.array.splice';
42
+ import 'core-js/modules/es.array.unscopables.flat';
43
+ import 'core-js/modules/es.array.unscopables.flat-map';
44
+ import 'core-js/modules/es.array-buffer.constructor';
45
+ import 'core-js/modules/es.array-buffer.is-view';
46
+ import 'core-js/modules/es.array-buffer.slice';
47
+ import 'core-js/modules/es.data-view';
48
+ import 'core-js/modules/es.date.now';
49
+ import 'core-js/modules/es.date.to-iso-string';
50
+ import 'core-js/modules/es.date.to-json';
51
+ import 'core-js/modules/es.date.to-primitive';
52
+ import 'core-js/modules/es.date.to-string';
53
+ import 'core-js/modules/es.function.bind';
54
+ import 'core-js/modules/es.function.has-instance';
55
+ import 'core-js/modules/es.function.name';
56
+ import 'core-js/modules/es.json.to-string-tag';
57
+ import 'core-js/modules/es.map';
58
+ import 'core-js/modules/es.math.acosh';
59
+ import 'core-js/modules/es.math.asinh';
60
+ import 'core-js/modules/es.math.atanh';
61
+ import 'core-js/modules/es.math.cbrt';
62
+ import 'core-js/modules/es.math.clz32';
63
+ import 'core-js/modules/es.math.cosh';
64
+ import 'core-js/modules/es.math.expm1';
65
+ import 'core-js/modules/es.math.fround';
66
+ import 'core-js/modules/es.math.hypot';
67
+ import 'core-js/modules/es.math.imul';
68
+ import 'core-js/modules/es.math.log10';
69
+ import 'core-js/modules/es.math.log1p';
70
+ import 'core-js/modules/es.math.log2';
71
+ import 'core-js/modules/es.math.sign';
72
+ import 'core-js/modules/es.math.sinh';
73
+ import 'core-js/modules/es.math.tanh';
74
+ import 'core-js/modules/es.math.to-string-tag';
75
+ import 'core-js/modules/es.math.trunc';
76
+ import 'core-js/modules/es.number.constructor';
77
+ import 'core-js/modules/es.number.epsilon';
78
+ import 'core-js/modules/es.number.is-finite';
79
+ import 'core-js/modules/es.number.is-integer';
80
+ import 'core-js/modules/es.number.is-nan';
81
+ import 'core-js/modules/es.number.is-safe-integer';
82
+ import 'core-js/modules/es.number.max-safe-integer';
83
+ import 'core-js/modules/es.number.min-safe-integer';
84
+ import 'core-js/modules/es.number.parse-float';
85
+ import 'core-js/modules/es.number.parse-int';
86
+ import 'core-js/modules/es.number.to-fixed';
87
+ import 'core-js/modules/es.number.to-precision';
88
+ import 'core-js/modules/es.object.assign';
89
+ import 'core-js/modules/es.object.create';
90
+ import 'core-js/modules/es.object.define-getter';
91
+ import 'core-js/modules/es.object.define-properties';
92
+ import 'core-js/modules/es.object.define-property';
93
+ import 'core-js/modules/es.object.define-setter';
94
+ import 'core-js/modules/es.object.entries';
95
+ import 'core-js/modules/es.object.freeze';
96
+ import 'core-js/modules/es.object.from-entries';
97
+ import 'core-js/modules/es.object.get-own-property-descriptor';
98
+ import 'core-js/modules/es.object.get-own-property-descriptors';
99
+ import 'core-js/modules/es.object.get-own-property-names';
100
+ import 'core-js/modules/es.object.get-prototype-of';
101
+ import 'core-js/modules/es.object.is';
102
+ import 'core-js/modules/es.object.is-extensible';
103
+ import 'core-js/modules/es.object.is-frozen';
104
+ import 'core-js/modules/es.object.is-sealed';
105
+ import 'core-js/modules/es.object.keys';
106
+ import 'core-js/modules/es.object.lookup-getter';
107
+ import 'core-js/modules/es.object.lookup-setter';
108
+ import 'core-js/modules/es.object.prevent-extensions';
109
+ import 'core-js/modules/es.object.seal';
110
+ import 'core-js/modules/es.object.set-prototype-of';
111
+ import 'core-js/modules/es.object.to-string';
112
+ import 'core-js/modules/es.object.values';
113
+ import 'core-js/modules/es.parse-float';
114
+ import 'core-js/modules/es.parse-int';
115
+ import 'core-js/modules/es.promise';
116
+ import 'core-js/modules/es.promise.finally';
117
+ import 'core-js/modules/es.reflect.apply';
118
+ import 'core-js/modules/es.reflect.construct';
119
+ import 'core-js/modules/es.reflect.define-property';
120
+ import 'core-js/modules/es.reflect.delete-property';
121
+ import 'core-js/modules/es.reflect.get';
122
+ import 'core-js/modules/es.reflect.get-own-property-descriptor';
123
+ import 'core-js/modules/es.reflect.get-prototype-of';
124
+ import 'core-js/modules/es.reflect.has';
125
+ import 'core-js/modules/es.reflect.is-extensible';
126
+ import 'core-js/modules/es.reflect.own-keys';
127
+ import 'core-js/modules/es.reflect.prevent-extensions';
128
+ import 'core-js/modules/es.reflect.set';
129
+ import 'core-js/modules/es.reflect.set-prototype-of';
130
+ import 'core-js/modules/es.regexp.constructor';
131
+ import 'core-js/modules/es.regexp.exec';
132
+ import 'core-js/modules/es.regexp.flags';
133
+ import 'core-js/modules/es.regexp.to-string';
134
+ import 'core-js/modules/es.set';
135
+ import 'core-js/modules/es.string.code-point-at';
136
+ import 'core-js/modules/es.string.ends-with';
137
+ import 'core-js/modules/es.string.from-code-point';
138
+ import 'core-js/modules/es.string.includes';
139
+ import 'core-js/modules/es.string.iterator';
140
+ import 'core-js/modules/es.string.match';
141
+ import 'core-js/modules/es.string.pad-end';
142
+ import 'core-js/modules/es.string.pad-start';
143
+ import 'core-js/modules/es.string.raw';
144
+ import 'core-js/modules/es.string.repeat';
145
+ import 'core-js/modules/es.string.replace';
146
+ import 'core-js/modules/es.string.search';
147
+ import 'core-js/modules/es.string.split';
148
+ import 'core-js/modules/es.string.starts-with';
149
+ import 'core-js/modules/es.string.trim';
150
+ import 'core-js/modules/es.string.trim-end';
151
+ import 'core-js/modules/es.string.trim-start';
152
+ import 'core-js/modules/es.string.anchor';
153
+ import 'core-js/modules/es.string.big';
154
+ import 'core-js/modules/es.string.blink';
155
+ import 'core-js/modules/es.string.bold';
156
+ import 'core-js/modules/es.string.fixed';
157
+ import 'core-js/modules/es.string.fontcolor';
158
+ import 'core-js/modules/es.string.fontsize';
159
+ import 'core-js/modules/es.string.italics';
160
+ import 'core-js/modules/es.string.link';
161
+ import 'core-js/modules/es.string.small';
162
+ import 'core-js/modules/es.string.strike';
163
+ import 'core-js/modules/es.string.sub';
164
+ import 'core-js/modules/es.string.sup';
165
+ import 'core-js/modules/es.typed-array.float32-array';
166
+ import 'core-js/modules/es.typed-array.float64-array';
167
+ import 'core-js/modules/es.typed-array.int8-array';
168
+ import 'core-js/modules/es.typed-array.int16-array';
169
+ import 'core-js/modules/es.typed-array.int32-array';
170
+ import 'core-js/modules/es.typed-array.uint8-array';
171
+ import 'core-js/modules/es.typed-array.uint8-clamped-array';
172
+ import 'core-js/modules/es.typed-array.uint16-array';
173
+ import 'core-js/modules/es.typed-array.uint32-array';
174
+ import 'core-js/modules/es.typed-array.copy-within';
175
+ import 'core-js/modules/es.typed-array.every';
176
+ import 'core-js/modules/es.typed-array.fill';
177
+ import 'core-js/modules/es.typed-array.filter';
178
+ import 'core-js/modules/es.typed-array.find';
179
+ import 'core-js/modules/es.typed-array.find-index';
180
+ import 'core-js/modules/es.typed-array.for-each';
181
+ import 'core-js/modules/es.typed-array.from';
182
+ import 'core-js/modules/es.typed-array.includes';
183
+ import 'core-js/modules/es.typed-array.index-of';
184
+ import 'core-js/modules/es.typed-array.iterator';
185
+ import 'core-js/modules/es.typed-array.join';
186
+ import 'core-js/modules/es.typed-array.last-index-of';
187
+ import 'core-js/modules/es.typed-array.map';
188
+ import 'core-js/modules/es.typed-array.of';
189
+ import 'core-js/modules/es.typed-array.reduce';
190
+ import 'core-js/modules/es.typed-array.reduce-right';
191
+ import 'core-js/modules/es.typed-array.reverse';
192
+ import 'core-js/modules/es.typed-array.set';
193
+ import 'core-js/modules/es.typed-array.slice';
194
+ import 'core-js/modules/es.typed-array.some';
195
+ import 'core-js/modules/es.typed-array.sort';
196
+ import 'core-js/modules/es.typed-array.subarray';
197
+ import 'core-js/modules/es.typed-array.to-locale-string';
198
+ import 'core-js/modules/es.typed-array.to-string';
199
+ import 'core-js/modules/es.weak-map';
200
+ import 'core-js/modules/es.weak-set';
201
+ import 'core-js/modules/web.dom-collections.for-each';
202
+ import 'core-js/modules/web.dom-collections.iterator';
203
+ import 'core-js/modules/web.immediate';
204
+ import 'core-js/modules/web.queue-microtask';
205
+ import 'core-js/modules/web.timers';
206
+ import 'core-js/modules/web.url';
207
+ import 'core-js/modules/web.url.to-json';
208
+ import 'core-js/modules/web.url-search-params';
209
+ import React from 'react';
210
+ import ReactRailsUJS from 'react_ujs';
211
+ import { setupI18n, Root } from 'pageflow-scrolled/frontend';
212
+
213
+ ReactRailsUJS.getConstructor = function () {
214
+ // Normally this function receives the name of a component, but we
215
+ // only need to render one type of component.
216
+ return ServerRenderedRoot;
217
+ };
218
+
219
+ function ServerRenderedRoot(_ref) {
220
+ var seed = _ref.seed;
221
+ setupI18n(seed.i18n);
222
+ return (
223
+ /*#__PURE__*/
224
+ React.createElement(Root, {
225
+ seed: seed
226
+ })
227
+ );
228
+ }
@@ -0,0 +1,1993 @@
1
+ import React, { useReducer, useMemo, useContext, createContext, useState, useEffect, useRef } from 'react';
2
+ import classNames from 'classnames';
3
+ import I18n from 'i18n-js';
4
+ import { _ as _createClass, a as _classCallCheck, b as _inherits, c as _getPrototypeOf, d as _possibleConstructorReturn } from './getPrototypeOf-63c7c8e8.js';
5
+
6
+ function _defineProperty(obj, key, value) {
7
+ if (key in obj) {
8
+ Object.defineProperty(obj, key, {
9
+ value: value,
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true
13
+ });
14
+ } else {
15
+ obj[key] = value;
16
+ }
17
+
18
+ return obj;
19
+ }
20
+
21
+ function _arrayWithHoles(arr) {
22
+ if (Array.isArray(arr)) return arr;
23
+ }
24
+
25
+ function _iterableToArrayLimit(arr, i) {
26
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
27
+ var _arr = [];
28
+ var _n = true;
29
+ var _d = false;
30
+ var _e = undefined;
31
+
32
+ try {
33
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
34
+ _arr.push(_s.value);
35
+
36
+ if (i && _arr.length === i) break;
37
+ }
38
+ } catch (err) {
39
+ _d = true;
40
+ _e = err;
41
+ } finally {
42
+ try {
43
+ if (!_n && _i["return"] != null) _i["return"]();
44
+ } finally {
45
+ if (_d) throw _e;
46
+ }
47
+ }
48
+
49
+ return _arr;
50
+ }
51
+
52
+ function _arrayLikeToArray(arr, len) {
53
+ if (len == null || len > arr.length) len = arr.length;
54
+
55
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
56
+ arr2[i] = arr[i];
57
+ }
58
+
59
+ return arr2;
60
+ }
61
+
62
+ function _unsupportedIterableToArray(o, minLen) {
63
+ if (!o) return;
64
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
65
+ var n = Object.prototype.toString.call(o).slice(8, -1);
66
+ if (n === "Object" && o.constructor) n = o.constructor.name;
67
+ if (n === "Map" || n === "Set") return Array.from(n);
68
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
69
+ }
70
+
71
+ function _nonIterableRest() {
72
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
73
+ }
74
+
75
+ function _slicedToArray(arr, i) {
76
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
77
+ }
78
+
79
+ function ownKeys(object, enumerableOnly) {
80
+ var keys = Object.keys(object);
81
+
82
+ if (Object.getOwnPropertySymbols) {
83
+ var symbols = Object.getOwnPropertySymbols(object);
84
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
85
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
86
+ });
87
+ keys.push.apply(keys, symbols);
88
+ }
89
+
90
+ return keys;
91
+ }
92
+
93
+ function _objectSpread2(target) {
94
+ for (var i = 1; i < arguments.length; i++) {
95
+ var source = arguments[i] != null ? arguments[i] : {};
96
+
97
+ if (i % 2) {
98
+ ownKeys(Object(source), true).forEach(function (key) {
99
+ _defineProperty(target, key, source[key]);
100
+ });
101
+ } else if (Object.getOwnPropertyDescriptors) {
102
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
103
+ } else {
104
+ ownKeys(Object(source)).forEach(function (key) {
105
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
106
+ });
107
+ }
108
+ }
109
+
110
+ return target;
111
+ }
112
+
113
+ var PREFIX = 'PAGEFLOW_SCROLLED_COLLECTION';
114
+ var RESET = "".concat(PREFIX, "_RESET");
115
+ var ADD = "".concat(PREFIX, "_ADD");
116
+ var CHANGE = "".concat(PREFIX, "_CHANGE");
117
+ var PATCH = "".concat(PREFIX, "_PATCH");
118
+ var REMOVE = "".concat(PREFIX, "_REMOVE");
119
+ var SORT = "".concat(PREFIX, "_SORT");
120
+ function useCollections() {
121
+ var seed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
122
+
123
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
124
+ keyAttribute = _ref.keyAttribute;
125
+
126
+ return useReducer(reducer, Object.keys(seed).reduce(function (result, key) {
127
+ result[key] = init(seed[key], keyAttribute);
128
+ return result;
129
+ }, {}));
130
+ }
131
+
132
+ function reducer(state, action) {
133
+ var collectionName = action.payload.collectionName;
134
+ var keyAttribute = action.payload.keyAttribute;
135
+
136
+ switch (action.type) {
137
+ case RESET:
138
+ return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, init(action.payload.items, keyAttribute)));
139
+
140
+ case ADD:
141
+ return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
142
+ order: action.payload.order,
143
+ items: _objectSpread2(_objectSpread2({}, state[collectionName].items), {}, _defineProperty({}, action.payload.attributes[keyAttribute], action.payload.attributes))
144
+ }));
145
+
146
+ case CHANGE:
147
+ return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
148
+ order: state[collectionName].order,
149
+ items: _objectSpread2(_objectSpread2({}, state[collectionName].items), {}, _defineProperty({}, action.payload.attributes[keyAttribute], action.payload.attributes))
150
+ }));
151
+
152
+ case PATCH:
153
+ var key = action.payload.key;
154
+ return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
155
+ order: state[collectionName].order,
156
+ items: _objectSpread2(_objectSpread2({}, state[collectionName].items), {}, _defineProperty({}, key, _objectSpread2(_objectSpread2({}, state[collectionName].items[key]), action.payload.attributes)))
157
+ }));
158
+
159
+ case REMOVE:
160
+ var clonedItems = _objectSpread2({}, state[collectionName].items);
161
+
162
+ delete clonedItems[action.payload.key];
163
+ return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
164
+ order: action.payload.order,
165
+ items: clonedItems
166
+ }));
167
+
168
+ case SORT:
169
+ return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, collectionName, {
170
+ order: action.payload.order,
171
+ items: state[collectionName].items
172
+ }));
173
+
174
+ default:
175
+ return state;
176
+ }
177
+ }
178
+
179
+ function init(items) {
180
+ var keyAttribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
181
+ items = items.filter(function (item) {
182
+ return item[keyAttribute];
183
+ });
184
+ return {
185
+ order: items.map(function (item) {
186
+ return item[keyAttribute];
187
+ }),
188
+ items: items.reduce(function (result, item) {
189
+ result[item[keyAttribute]] = item;
190
+ return result;
191
+ }, {})
192
+ };
193
+ }
194
+
195
+ function updateConfiguration(_ref2) {
196
+ var dispatch = _ref2.dispatch,
197
+ name = _ref2.name,
198
+ key = _ref2.key,
199
+ configuration = _ref2.configuration;
200
+ dispatch({
201
+ type: PATCH,
202
+ payload: {
203
+ collectionName: name,
204
+ key: key,
205
+ attributes: {
206
+ configuration: configuration
207
+ }
208
+ }
209
+ });
210
+ }
211
+
212
+ function getItems(state, collectionName) {
213
+ if (state[collectionName]) {
214
+ var items = state[collectionName].items;
215
+ return state[collectionName].order.map(function (key) {
216
+ return items[key];
217
+ });
218
+ } else {
219
+ return [];
220
+ }
221
+ }
222
+ function getItem(state, collectionName, key) {
223
+ if (state[collectionName]) {
224
+ return state[collectionName].items[key];
225
+ }
226
+ }
227
+
228
+ var Context = React.createContext();
229
+ function EntryStateProvider(_ref) {
230
+ var seed = _ref.seed,
231
+ children = _ref.children;
232
+
233
+ var _useCollections = useCollections(seed.collections, {
234
+ keyAttribute: 'permaId'
235
+ }),
236
+ _useCollections2 = _slicedToArray(_useCollections, 2),
237
+ collections = _useCollections2[0],
238
+ dispatch = _useCollections2[1];
239
+
240
+ var value = useMemo(function () {
241
+ return {
242
+ entryState: {
243
+ collections: collections,
244
+ config: seed.config
245
+ },
246
+ dispatch: dispatch
247
+ };
248
+ }, [collections, dispatch, seed]);
249
+ return (
250
+ /*#__PURE__*/
251
+ React.createElement(Context.Provider, {
252
+ value: value
253
+ }, children)
254
+ );
255
+ }
256
+ function useEntryState() {
257
+ var value = useContext(Context);
258
+ return value.entryState;
259
+ }
260
+ function useEntryStateDispatch() {
261
+ var value = useContext(Context);
262
+ return value.dispatch;
263
+ }
264
+
265
+ /**
266
+ * Returns a nested data structure representing the metadata of the entry.
267
+ *
268
+ * @example
269
+ *
270
+ * const metaData = useEntryMetadata();
271
+ * metaData // =>
272
+ * {
273
+ * id: 5,
274
+ * locale: 'en',
275
+ * shareProviders: {email: false, facebook: true},
276
+ * share_url: 'http://test.host/test',
277
+ * credits: 'Credits: Pageflow'
278
+ * }
279
+ */
280
+
281
+ function useEntryMetadata() {
282
+ var entryState = useEntryState();
283
+ return useMemo(function () {
284
+ return getItems(entryState.collections, 'entries')[0];
285
+ }, [entryState]);
286
+ }
287
+
288
+ function _objectWithoutPropertiesLoose(source, excluded) {
289
+ if (source == null) return {};
290
+ var target = {};
291
+ var sourceKeys = Object.keys(source);
292
+ var key, i;
293
+
294
+ for (i = 0; i < sourceKeys.length; i++) {
295
+ key = sourceKeys[i];
296
+ if (excluded.indexOf(key) >= 0) continue;
297
+ target[key] = source[key];
298
+ }
299
+
300
+ return target;
301
+ }
302
+
303
+ function _objectWithoutProperties(source, excluded) {
304
+ if (source == null) return {};
305
+ var target = _objectWithoutPropertiesLoose(source, excluded);
306
+ var key, i;
307
+
308
+ if (Object.getOwnPropertySymbols) {
309
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
310
+
311
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
312
+ key = sourceSymbolKeys[i];
313
+ if (excluded.indexOf(key) >= 0) continue;
314
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
315
+ target[key] = source[key];
316
+ }
317
+ }
318
+
319
+ return target;
320
+ }
321
+
322
+ function _extends() {
323
+ _extends = Object.assign || function (target) {
324
+ for (var i = 1; i < arguments.length; i++) {
325
+ var source = arguments[i];
326
+
327
+ for (var key in source) {
328
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
329
+ target[key] = source[key];
330
+ }
331
+ }
332
+ }
333
+
334
+ return target;
335
+ };
336
+
337
+ return _extends.apply(this, arguments);
338
+ }
339
+ var EmailIcon = (function (_ref) {
340
+ var _ref$styles = _ref.styles,
341
+ props = _objectWithoutProperties(_ref, ["styles"]);
342
+
343
+ return React.createElement("svg", _extends({
344
+ xmlns: "http://www.w3.org/2000/svg",
345
+ viewBox: "0 0 612 612"
346
+ }, props), React.createElement("path", {
347
+ d: "M573.75 57.375H38.25C17.136 57.375 0 74.511 0 95.625v420.75c0 21.133 17.136 38.25 38.25 38.25h535.5c21.133 0 38.25-17.117 38.25-38.25V95.625c0-21.114-17.117-38.25-38.25-38.25zM554.625 497.25H57.375V204.657l224.03 187.999c7.134 5.967 15.874 8.97 24.595 8.97 8.74 0 17.461-3.003 24.595-8.97l224.03-187.999V497.25zm0-367.487L306 338.379 57.375 129.763V114.75h497.25v15.013z"
348
+ }));
349
+ });
350
+
351
+ function _extends$1() {
352
+ _extends$1 = Object.assign || function (target) {
353
+ for (var i = 1; i < arguments.length; i++) {
354
+ var source = arguments[i];
355
+
356
+ for (var key in source) {
357
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
358
+ target[key] = source[key];
359
+ }
360
+ }
361
+ }
362
+
363
+ return target;
364
+ };
365
+
366
+ return _extends$1.apply(this, arguments);
367
+ }
368
+ var FacebookIcon = (function (_ref) {
369
+ var _ref$styles = _ref.styles,
370
+ props = _objectWithoutProperties(_ref, ["styles"]);
371
+
372
+ return React.createElement("svg", _extends$1({
373
+ xmlns: "http://www.w3.org/2000/svg",
374
+ viewBox: "0 0 430.113 430.114"
375
+ }, props), React.createElement("path", {
376
+ d: "M158.081 83.3v59.218h-43.385v72.412h43.385v215.183h89.122V214.936h59.805s5.601-34.721 8.316-72.685H247.54V92.74c0-7.4 9.717-17.354 19.321-17.354h48.557V.001h-66.021C155.878-.004 158.081 72.48 158.081 83.3z"
377
+ }));
378
+ });
379
+
380
+ function _extends$2() {
381
+ _extends$2 = Object.assign || function (target) {
382
+ for (var i = 1; i < arguments.length; i++) {
383
+ var source = arguments[i];
384
+
385
+ for (var key in source) {
386
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
387
+ target[key] = source[key];
388
+ }
389
+ }
390
+ }
391
+
392
+ return target;
393
+ };
394
+
395
+ return _extends$2.apply(this, arguments);
396
+ }
397
+ var LinkedInIcon = (function (_ref) {
398
+ var _ref$styles = _ref.styles,
399
+ props = _objectWithoutProperties(_ref, ["styles"]);
400
+
401
+ return React.createElement("svg", _extends$2({
402
+ xmlns: "http://www.w3.org/2000/svg",
403
+ viewBox: "0 0 430.117 430.117"
404
+ }, props), React.createElement("path", {
405
+ d: "M430.117 261.543V420.56h-92.188V272.193c0-37.271-13.334-62.707-46.703-62.707-25.473 0-40.632 17.142-47.301 33.724-2.432 5.928-3.058 14.179-3.058 22.477V420.56h-92.219s1.242-251.285 0-277.32h92.21v39.309c-.187.294-.43.611-.606.896h.606v-.896c12.251-18.869 34.13-45.824 83.102-45.824 60.673-.001 106.157 39.636 106.157 124.818zM52.183 9.558C20.635 9.558 0 30.251 0 57.463c0 26.619 20.038 47.94 50.959 47.94h.616c32.159 0 52.159-21.317 52.159-47.94-.606-27.212-20-47.905-51.551-47.905zM5.477 420.56h92.184V143.24H5.477v277.32z"
406
+ }));
407
+ });
408
+
409
+ function _extends$3() {
410
+ _extends$3 = Object.assign || function (target) {
411
+ for (var i = 1; i < arguments.length; i++) {
412
+ var source = arguments[i];
413
+
414
+ for (var key in source) {
415
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
416
+ target[key] = source[key];
417
+ }
418
+ }
419
+ }
420
+
421
+ return target;
422
+ };
423
+
424
+ return _extends$3.apply(this, arguments);
425
+ }
426
+ var TelegramIcon = (function (_ref) {
427
+ var _ref$styles = _ref.styles,
428
+ props = _objectWithoutProperties(_ref, ["styles"]);
429
+
430
+ return React.createElement("svg", _extends$3({
431
+ xmlns: "http://www.w3.org/2000/svg",
432
+ viewBox: "0 0 512.004 512.004"
433
+ }, props), React.createElement("path", {
434
+ d: "M508.194 20.517c-4.43-4.96-11.42-6.29-17.21-3.76l-482 211a15.01 15.01 0 00-8.98 13.41 15.005 15.005 0 008.38 13.79l115.09 56.6 28.68 172.06c.93 6.53 6.06 11.78 12.74 12.73 4.8.69 9.57-1 12.87-4.4l90.86-90.86 129.66 92.62a15.02 15.02 0 0014.24 1.74 15.01 15.01 0 009.19-11.01l90-451c.89-4.47-.26-9.26-3.52-12.92zm-372.84 263.45l-84.75-41.68 334.82-146.57-250.07 188.25zm46.94 44.59l-13.95 69.75-15.05-90.3 183.97-138.49-150.88 151.39c-2.12 2.12-3.53 4.88-4.09 7.65zm9.13 107.3l15.74-78.67 36.71 26.22-52.45 52.45zm205.41 19.94l-176.73-126.23 252.47-253.31-75.74 379.54z"
435
+ }));
436
+ });
437
+
438
+ function _extends$4() {
439
+ _extends$4 = Object.assign || function (target) {
440
+ for (var i = 1; i < arguments.length; i++) {
441
+ var source = arguments[i];
442
+
443
+ for (var key in source) {
444
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
445
+ target[key] = source[key];
446
+ }
447
+ }
448
+ }
449
+
450
+ return target;
451
+ };
452
+
453
+ return _extends$4.apply(this, arguments);
454
+ }
455
+ var TwitterIcon = (function (_ref) {
456
+ var _ref$styles = _ref.styles,
457
+ props = _objectWithoutProperties(_ref, ["styles"]);
458
+
459
+ return React.createElement("svg", _extends$4({
460
+ xmlns: "http://www.w3.org/2000/svg",
461
+ viewBox: "0 0 612 612"
462
+ }, props), React.createElement("path", {
463
+ d: "M612 116.258a250.714 250.714 0 01-72.088 19.772c25.929-15.527 45.777-40.155 55.184-69.411-24.322 14.379-51.169 24.82-79.775 30.48-22.907-24.437-55.49-39.658-91.63-39.658-69.334 0-125.551 56.217-125.551 125.513 0 9.828 1.109 19.427 3.251 28.606-104.326-5.24-196.835-55.223-258.75-131.174-10.823 18.51-16.98 40.078-16.98 63.101 0 43.559 22.181 81.993 55.835 104.479a125.556 125.556 0 01-56.867-15.756v1.568c0 60.806 43.291 111.554 100.693 123.104-10.517 2.83-21.607 4.398-33.08 4.398-8.107 0-15.947-.803-23.634-2.333 15.985 49.907 62.336 86.199 117.253 87.194-42.947 33.654-97.099 53.655-155.916 53.655-10.134 0-20.116-.612-29.944-1.721 55.567 35.681 121.536 56.485 192.438 56.485 230.948 0 357.188-191.291 357.188-357.188l-.421-16.253c24.666-17.593 46.005-39.697 62.794-64.861z"
464
+ }));
465
+ });
466
+
467
+ function _extends$5() {
468
+ _extends$5 = Object.assign || function (target) {
469
+ for (var i = 1; i < arguments.length; i++) {
470
+ var source = arguments[i];
471
+
472
+ for (var key in source) {
473
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
474
+ target[key] = source[key];
475
+ }
476
+ }
477
+ }
478
+
479
+ return target;
480
+ };
481
+
482
+ return _extends$5.apply(this, arguments);
483
+ }
484
+ var WhatsAppIcon = (function (_ref) {
485
+ var _ref$styles = _ref.styles,
486
+ props = _objectWithoutProperties(_ref, ["styles"]);
487
+
488
+ return React.createElement("svg", _extends$5({
489
+ xmlns: "http://www.w3.org/2000/svg",
490
+ viewBox: "0 0 90 90"
491
+ }, props), React.createElement("path", {
492
+ d: "M90 43.841c0 24.213-19.779 43.841-44.182 43.841a44.256 44.256 0 01-21.357-5.455L0 90l7.975-23.522a43.38 43.38 0 01-6.34-22.637C1.635 19.628 21.416 0 45.818 0 70.223 0 90 19.628 90 43.841zM45.818 6.982c-20.484 0-37.146 16.535-37.146 36.859 0 8.065 2.629 15.534 7.076 21.61L11.107 79.14l14.275-4.537A37.122 37.122 0 0045.819 80.7c20.481 0 37.146-16.533 37.146-36.857S66.301 6.982 45.818 6.982zm22.311 46.956c-.273-.447-.994-.717-2.076-1.254-1.084-.537-6.41-3.138-7.4-3.495-.993-.358-1.717-.538-2.438.537-.721 1.076-2.797 3.495-3.43 4.212-.632.719-1.263.809-2.347.271-1.082-.537-4.571-1.673-8.708-5.333-3.219-2.848-5.393-6.364-6.025-7.441-.631-1.075-.066-1.656.475-2.191.488-.482 1.084-1.255 1.625-1.882.543-.628.723-1.075 1.082-1.793.363-.717.182-1.344-.09-1.883-.27-.537-2.438-5.825-3.34-7.977-.902-2.15-1.803-1.792-2.436-1.792-.631 0-1.354-.09-2.076-.09s-1.896.269-2.889 1.344c-.992 1.076-3.789 3.676-3.789 8.963 0 5.288 3.879 10.397 4.422 11.113.541.716 7.49 11.92 18.5 16.223C58.2 65.771 58.2 64.336 60.186 64.156c1.984-.179 6.406-2.599 7.312-5.107.9-2.512.9-4.663.631-5.111z"
493
+ }));
494
+ });
495
+
496
+ /**
497
+ * Returns a list of attributes (icon, name and url) of all configured share providers of the entry.
498
+ * The url provides a %{url} placeholder where the link can be inserted.
499
+ *
500
+ * @example
501
+ *
502
+ * const shareProviders = useShareProviders(options);
503
+ * shareProviders // =>
504
+ * [
505
+ * {
506
+ * icon: <FacebookSVGIcon />,
507
+ * name: 'Facebook',
508
+ * url: http://www.facebook.com/sharer/sharer.php?u=%{url}
509
+ * },
510
+ * {
511
+ * icon: <TwitterSVGIcon />,
512
+ * name: 'Twitter',
513
+ * url: https://twitter.com/intent/tweet?url=%{url}
514
+ * }
515
+ * ]
516
+ */
517
+
518
+ function useShareProviders(_ref) {
519
+ var isPhonePlatform = _ref.isPhonePlatform;
520
+ var entryState = useEntryState();
521
+ var entryMetadata = useEntryMetadata();
522
+ var shareProviders = entryMetadata ? entryMetadata.shareProviders : {};
523
+ var urlTemplates = entryState.config.shareUrlTemplates;
524
+ var sharing = {
525
+ email: {
526
+ icon: EmailIcon,
527
+ name: 'Email',
528
+ url: urlTemplates.email
529
+ },
530
+ facebook: {
531
+ icon: FacebookIcon,
532
+ name: 'Facebook',
533
+ url: urlTemplates.facebook
534
+ },
535
+ linked_in: {
536
+ icon: LinkedInIcon,
537
+ name: 'LinkedIn',
538
+ url: urlTemplates.linked_in
539
+ },
540
+ telegram: {
541
+ icon: TelegramIcon,
542
+ name: 'Telegram',
543
+ url: urlTemplates.telegram
544
+ },
545
+ twitter: {
546
+ icon: TwitterIcon,
547
+ name: 'Twitter',
548
+ url: urlTemplates.twitter
549
+ },
550
+ whats_app: {
551
+ icon: WhatsAppIcon,
552
+ name: 'WhatsApp',
553
+ url: urlTemplates.whats_app
554
+ }
555
+ };
556
+ return useMemo(function () {
557
+ return activeShareProviders(shareProviders, isPhonePlatform).map(function (provider) {
558
+ var config = sharing[provider];
559
+ return {
560
+ name: config.name,
561
+ icon: config.icon,
562
+ url: config.url
563
+ };
564
+ });
565
+ }, [shareProviders, isPhonePlatform]);
566
+ }
567
+
568
+ function activeShareProviders(shareProvidersConfig, isPhonePlatform) {
569
+ var providers = filterShareProviders(shareProvidersConfig, isPhonePlatform);
570
+ return providers.filter(function (provider) {
571
+ return shareProvidersConfig[provider] !== false;
572
+ });
573
+ }
574
+
575
+ function filterShareProviders(shareProvidersConfig, isPhonePlatform) {
576
+ if (!isPhonePlatform) {
577
+ return Object.keys(shareProvidersConfig).filter(function (provider) {
578
+ return provider !== 'telegram' && provider !== 'whats_app';
579
+ });
580
+ }
581
+
582
+ return Object.keys(shareProvidersConfig);
583
+ }
584
+ /**
585
+ * Returns the share url of the entry.
586
+ *
587
+ * @example
588
+ *
589
+ * const shareUrl = useShareUrl();
590
+ * shareUrl // => "http://test.host/test"
591
+ */
592
+
593
+
594
+ function useShareUrl() {
595
+ var entryMetadata = useEntryMetadata();
596
+ var entryState = useEntryState();
597
+
598
+ if (entryMetadata) {
599
+ return entryMetadata.shareUrl ? entryMetadata.shareUrl : entryState.config.prettyUrl;
600
+ } else {
601
+ return entryState.config.shareUrl;
602
+ }
603
+ }
604
+
605
+ /**
606
+ * Returns a nested data structure representing the chapters, sections
607
+ * and content elements of the entry.
608
+ *
609
+ * @example
610
+ *
611
+ * const structure = useEntryStructure();
612
+ * structure // =>
613
+ * [
614
+ * {
615
+ * permaId: 5,
616
+ * title: 'Chapter 1',
617
+ * summary: 'An introductory chapter',
618
+ * sections: [
619
+ * {
620
+ * permaId: 101,
621
+ * sectionIndex: 0,
622
+ * transition: 'scroll',
623
+ *
624
+ * // references to adjacent section objects
625
+ * previousSection: { ... },
626
+ * nextSection: { ... },
627
+ *
628
+ * foreground: [
629
+ * {
630
+ * type: 'heading',
631
+ * props: {
632
+ * children: 'Heading'
633
+ * }
634
+ * },
635
+ * {
636
+ * type: 'textBlock',
637
+ * props: {
638
+ * children: 'Some text'
639
+ * }
640
+ * }
641
+ * ]
642
+ * }
643
+ * ],
644
+ * }
645
+ * ]
646
+ */
647
+
648
+ function useEntryStructure() {
649
+ var entryState = useEntryState();
650
+ return useMemo(function () {
651
+ var sections = [];
652
+ var chapters = getItems(entryState.collections, 'chapters').map(function (chapter) {
653
+ return _objectSpread2(_objectSpread2({
654
+ permaId: chapter.permaId
655
+ }, chapter.configuration), {}, {
656
+ sections: getItems(entryState.collections, 'sections').filter(function (item) {
657
+ return item.chapterId === chapter.id;
658
+ }).map(function (section) {
659
+ var result = sectionStructure(entryState.collections, section);
660
+ sections.push(result);
661
+ return result;
662
+ })
663
+ });
664
+ });
665
+ sections.forEach(function (section, index) {
666
+ section.sectionIndex = index;
667
+ section.previousSection = sections[index - 1];
668
+ section.nextSection = sections[index + 1];
669
+ });
670
+ return chapters;
671
+ }, [entryState]);
672
+ }
673
+ /**
674
+ * Returns a nested data structure representing the content elements
675
+ * of section.
676
+ *
677
+ * @param {Object} options
678
+ * @param {number} options.sectionPermaId
679
+ *
680
+ * @example
681
+ *
682
+ * const section = useSectionStructure({sectionPermaId: 4});
683
+ * section // =>
684
+ * {
685
+ * permaId: 4,
686
+ * transition: 'scroll',
687
+ * foreground: [
688
+ * {
689
+ * type: 'heading',
690
+ * props: {
691
+ * children: 'Heading'
692
+ * }
693
+ * },
694
+ * {
695
+ * type: 'textBlock',
696
+ * props: {
697
+ * children: 'Some text'
698
+ * }
699
+ * }
700
+ * ]
701
+ * }
702
+ */
703
+
704
+ function useSectionStructure(_ref) {
705
+ var sectionPermaId = _ref.sectionPermaId;
706
+ var entryState = useEntryState();
707
+ var section = getItem(entryState.collections, 'sections', sectionPermaId);
708
+ return sectionStructure(entryState.collections, section);
709
+ }
710
+
711
+ function sectionStructure(collections, section) {
712
+ return section && _objectSpread2(_objectSpread2({
713
+ permaId: section.permaId,
714
+ id: section.id
715
+ }, section.configuration), {}, {
716
+ foreground: getItems(collections, 'contentElements').filter(function (item) {
717
+ return item.sectionId === section.id;
718
+ }).map(function (item) {
719
+ return {
720
+ id: item.id,
721
+ permaId: item.permaId,
722
+ type: item.typeName,
723
+ position: item.configuration.position,
724
+ props: item.configuration
725
+ };
726
+ })
727
+ });
728
+ }
729
+
730
+ function extendFile(collectionName, file, entryState) {
731
+ return addModelType(collectionName, expandUrls(collectionName, file, entryState.config.fileUrlTemplates), entryState.config.fileModelTypes);
732
+ }
733
+
734
+ function addModelType(collectionName, file, modelTypes) {
735
+ if (!file) {
736
+ return null;
737
+ }
738
+
739
+ if (!modelTypes[collectionName]) {
740
+ throw new Error("Could not find model type for collection name ".concat(collectionName));
741
+ }
742
+
743
+ return _objectSpread2(_objectSpread2({}, file), {}, {
744
+ modelType: modelTypes[collectionName]
745
+ });
746
+ }
747
+
748
+ function expandUrls(collectionName, file, urlTemplates) {
749
+ if (!file) {
750
+ return null;
751
+ }
752
+
753
+ if (!urlTemplates[collectionName]) {
754
+ throw new Error("No file url templates found for ".concat(collectionName));
755
+ }
756
+
757
+ var variants = file.variants || Object.keys(urlTemplates[collectionName]);
758
+ var urls = variants.reduce(function (result, variant) {
759
+ var url = getFileUrl(collectionName, file, variant, urlTemplates);
760
+
761
+ if (url) {
762
+ result[variant] = url;
763
+ }
764
+
765
+ return result;
766
+ }, {});
767
+ return _objectSpread2({
768
+ urls: urls
769
+ }, file);
770
+ }
771
+
772
+ function getFileUrl(collectionName, file, quality, urlTemplates) {
773
+ var templates = urlTemplates[collectionName];
774
+ var template = templates[quality];
775
+
776
+ if (template) {
777
+ return template.replace(':id_partition', idPartition(file.id)).replace(':basename', file.basename);
778
+ }
779
+ }
780
+
781
+ function idPartition(id) {
782
+ return partition(pad(id, 9));
783
+ }
784
+
785
+ function partition(string, separator) {
786
+ return string.replace(/./g, function (c, i, a) {
787
+ return i && (a.length - i) % 3 === 0 ? '/' + c : c;
788
+ });
789
+ }
790
+
791
+ function pad(string, size) {
792
+ return (Array(size).fill(0).join('') + string).slice(-size);
793
+ }
794
+
795
+ /**
796
+ * Look up a file by its collection and perma id.
797
+ *
798
+ * @param {Object} options
799
+ * @param {String} options.collectionName - Collection name of file type to look for (in camel case).
800
+ * @param {String} options.permaId - Perma id of file look up
801
+ *
802
+ * @example
803
+ * const imageFile = useFile({collectionName: 'imageFiles', permaId: 5});
804
+ * imageFile // =>
805
+ * {
806
+ * id: 102,
807
+ * permaId: 5,
808
+ * width: 1000,
809
+ * height: 500,
810
+ * urls: {
811
+ * large: 'https://...'
812
+ * },
813
+ * configuration: {
814
+ * alt: '...'
815
+ * }
816
+ * }
817
+ */
818
+
819
+ function useFile(_ref) {
820
+ var collectionName = _ref.collectionName,
821
+ permaId = _ref.permaId;
822
+ var entryState = useEntryState();
823
+ return extendFile(collectionName, getItem(entryState.collections, collectionName, permaId), entryState);
824
+ }
825
+
826
+ function useNestedFiles(_ref) {
827
+ var collectionName = _ref.collectionName,
828
+ parent = _ref.parent;
829
+ var entryState = useEntryState();
830
+
831
+ if (!parent) {
832
+ return [];
833
+ }
834
+
835
+ return getItems(entryState.collections, collectionName).filter(function (file) {
836
+ return file.parentFileId === parent.id && file.parentFileModelType === parent.modelType;
837
+ }).map(function (file) {
838
+ return extendFile(collectionName, file, entryState);
839
+ });
840
+ }
841
+
842
+ /**
843
+ * Returns a string (comma-separated list) of copyrights of
844
+ * all images used in the entry.
845
+ * If none of the images has a rights attribute configured,
846
+ * it falls back to the default file rights of the entry's account,
847
+ * otherwise returns an empty string
848
+ *
849
+ * @example
850
+ *
851
+ * const fileRights = useFileRights();
852
+ * fileRights // => "author of image 1, author of image 2"
853
+ */
854
+
855
+ function useFileRights() {
856
+ var entryState = useEntryState();
857
+ var defaultFileRights = entryState.config.defaultFileRights;
858
+ var imageFiles = getItems(entryState.collections, 'imageFiles');
859
+ var imageFileRights = imageFiles.reduce(function (result, imageConfig) {
860
+ if (imageConfig && imageConfig.rights) {
861
+ result.push(imageConfig.rights.trim());
862
+ }
863
+
864
+ return result;
865
+ }, []).filter(Boolean).join(', ');
866
+ var fileRights = !!imageFileRights ? imageFileRights : defaultFileRights.trim();
867
+ var fileRightsString = !!fileRights ? 'Bildrechte: ' + fileRights : '';
868
+ return fileRightsString;
869
+ }
870
+ /**
871
+ * Returns a nested data structure representing the legal info of the entry.
872
+ * Each legal info is separated into label and url to use in links.
873
+ * Both label and url can be blank, depending on the configuration.
874
+ *
875
+ * @example
876
+ *
877
+ * const legalInfo = useLegalInfo();
878
+ * legalInfo // =>
879
+ * {
880
+ * imprint: {
881
+ * label: '',
882
+ * url: ''
883
+ * },
884
+ * copyright: {
885
+ * label: '',
886
+ * url: ''
887
+ * },
888
+ * privacy: {
889
+ * label: '',
890
+ * url: ''
891
+ * }
892
+ * }
893
+ */
894
+
895
+ function useLegalInfo() {
896
+ var entryState = useEntryState();
897
+ return entryState.config.legalInfo;
898
+ }
899
+ /**
900
+ * Returns the credits string (rich text) of the entry.
901
+ *
902
+ * @example
903
+ *
904
+ * const credits = useCredits();
905
+ * credits // => "Credits: <a href="http://pageflow.com">pageflow.com</a>"
906
+ */
907
+
908
+ function useCredits() {
909
+ var entryMetadata = useEntryMetadata();
910
+ var credits = '';
911
+
912
+ if (entryMetadata) {
913
+ credits = entryMetadata.credits;
914
+ }
915
+
916
+ return credits;
917
+ }
918
+
919
+ function _arrayWithoutHoles(arr) {
920
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
921
+ }
922
+
923
+ function _iterableToArray(iter) {
924
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
925
+ }
926
+
927
+ function _nonIterableSpread() {
928
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
929
+ }
930
+
931
+ function _toConsumableArray(arr) {
932
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
933
+ }
934
+
935
+ var qualities = ['medium', 'fullhd', '4k'];
936
+ function useAvailableQualities(file) {
937
+ if (!file) {
938
+ return [];
939
+ }
940
+
941
+ return ['auto'].concat(_toConsumableArray(qualities.filter(function (name) {
942
+ return file.variants.includes(name);
943
+ })));
944
+ }
945
+
946
+ /**
947
+ * Returns an object containing theme asset paths.
948
+ *
949
+ * @example
950
+ *
951
+ * const theme = useTheme();
952
+ * theme // =>
953
+ * {
954
+ * assets: {
955
+ * logoDesktop: 'path/to/logoDesktop.svg',
956
+ * logoMobile: 'path/to/logoMobile.svg'
957
+ * },
958
+ * options: {
959
+ * // options passed to `themes.register` in `pageflow.rb` initializer
960
+ * // with camleized keys.
961
+ * }
962
+ * }
963
+ */
964
+
965
+ function useTheme() {
966
+ var entryState = useEntryState();
967
+ return entryState.config.theme;
968
+ }
969
+
970
+ function updateContentElementConfiguration(_ref) {
971
+ var dispatch = _ref.dispatch,
972
+ permaId = _ref.permaId,
973
+ configuration = _ref.configuration;
974
+ updateConfiguration({
975
+ dispatch: dispatch,
976
+ name: 'contentElements',
977
+ key: permaId,
978
+ configuration: configuration
979
+ });
980
+ }
981
+
982
+ var LocaleContext = createContext('en');
983
+ function setupI18n(_ref) {
984
+ var defaultLocale = _ref.defaultLocale,
985
+ locale = _ref.locale,
986
+ translations = _ref.translations;
987
+ I18n.defaultLocale = defaultLocale;
988
+ I18n.locale = locale;
989
+ I18n.translations = translations;
990
+ }
991
+ function LocaleProvider(_ref2) {
992
+ var children = _ref2.children;
993
+
994
+ var _ref3 = useEntryMetadata() || {},
995
+ locale = _ref3.locale;
996
+
997
+ return (
998
+ /*#__PURE__*/
999
+ React.createElement(LocaleContext.Provider, {
1000
+ value: locale
1001
+ }, children)
1002
+ );
1003
+ }
1004
+ function useLocale() {
1005
+ return useContext(LocaleContext);
1006
+ }
1007
+ /**
1008
+ * Use translations in frontend elements. Uses the configured locale
1009
+ * of the current entry by default. Note that only translation keys
1010
+ * from the `pageflow_scrolled.public` scope are universally
1011
+ * available.
1012
+ *
1013
+ * to render translations for inline editing controls in the editor
1014
+ * preview, you can pass `"ui"` as `locale` option and use
1015
+ * translations from the `pageflow_scrolled.inline_editing` scope.
1016
+ *
1017
+ * @param {Object} [options]
1018
+ * @param {string} [locale="entry"] -
1019
+ * Pass `"ui"` to use the locale of the editor interface instead.
1020
+ *
1021
+ * @example
1022
+ * const {t} = useI18n();
1023
+ * t('pageflow_scrolled.public.some.key')
1024
+ *
1025
+ * const {t} = useI18n({locale: 'ui'});
1026
+ * t('pageflow_scrolled.inline_editing.some.key')
1027
+ */
1028
+
1029
+ function useI18n() {
1030
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1031
+ scope = _ref4.locale;
1032
+
1033
+ var locale = useLocale();
1034
+ return {
1035
+ t: function t(key, options) {
1036
+ return I18n.t(key, _objectSpread2(_objectSpread2({}, options), {}, {
1037
+ locale: scope !== 'ui' && locale
1038
+ }));
1039
+ }
1040
+ };
1041
+ }
1042
+
1043
+ var PhonePlatformContext = React.createContext(false);
1044
+
1045
+ function useOnScreen(ref) {
1046
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1047
+ rootMargin = _ref.rootMargin,
1048
+ onIntersecting = _ref.onIntersecting,
1049
+ skipIframeFix = _ref.skipIframeFix;
1050
+
1051
+ var _useState = useState(false),
1052
+ _useState2 = _slicedToArray(_useState, 2),
1053
+ isIntersecting = _useState2[0],
1054
+ setIntersecting = _useState2[1];
1055
+
1056
+ useEffect(function () {
1057
+ var current = ref.current;
1058
+ var observer = createIntersectionObserver(function (_ref2) {
1059
+ var _ref3 = _slicedToArray(_ref2, 1),
1060
+ entry = _ref3[0];
1061
+
1062
+ setIntersecting(entry.isIntersecting);
1063
+
1064
+ if (entry.isIntersecting && onIntersecting) {
1065
+ onIntersecting();
1066
+ }
1067
+ }, {
1068
+ rootMargin: rootMargin
1069
+ }, skipIframeFix);
1070
+
1071
+ if (ref.current) {
1072
+ observer.observe(current);
1073
+ }
1074
+
1075
+ return function () {
1076
+ observer.unobserve(current);
1077
+ };
1078
+ }, [ref, rootMargin, onIntersecting, skipIframeFix]);
1079
+ return isIntersecting;
1080
+ }
1081
+
1082
+ function createIntersectionObserver(callback, options, skipIframeFix) {
1083
+ if (skipIframeFix) {
1084
+ return new IntersectionObserver(callback, options);
1085
+ } // Positive root margins are ignored in iframes [1] (i.e. in
1086
+ // the Pageflow editor). To make it work, the iframe document
1087
+ // needs to be passed as `root` [2].
1088
+ // This leads to a `TypeError`, though, in browers that do not
1089
+ // support this yet (e.g. Chrome 80). We catch the error and
1090
+ // skip passing the `root` option.
1091
+ //
1092
+ // [1] https://github.com/w3c/IntersectionObserver/issues/283
1093
+ // [2] https://github.com/w3c/IntersectionObserver/issues/372
1094
+
1095
+
1096
+ try {
1097
+ var optionsWithIframeFix = options;
1098
+
1099
+ if (options.rootMargin && window.parent !== window) {
1100
+ optionsWithIframeFix = _objectSpread2(_objectSpread2({}, options), {}, {
1101
+ root: window.document
1102
+ });
1103
+ }
1104
+
1105
+ return new IntersectionObserver(callback, optionsWithIframeFix);
1106
+ } catch (e) {
1107
+ // Normally we would check for TypeError here. Since the polyfill
1108
+ // throws a generic error, we retry either way and trust that the
1109
+ // error will happen again if it is not related to the `root`
1110
+ // option.
1111
+ return createIntersectionObserver(callback, options, true);
1112
+ }
1113
+ }
1114
+
1115
+ var styles = {"wrapper":"useScrollPositionLifecycle-module_wrapper__1a6Kr","isActiveProbe":"useScrollPositionLifecycle-module_isActiveProbe__3VKB5"};
1116
+
1117
+ var StaticPreviewContext = createContext(false);
1118
+ function StaticPreview(_ref) {
1119
+ var children = _ref.children;
1120
+ return (
1121
+ /*#__PURE__*/
1122
+ React.createElement(StaticPreviewContext.Provider, {
1123
+ value: true
1124
+ }, children)
1125
+ );
1126
+ }
1127
+ function createScrollPositionLifecycleProvider(Context) {
1128
+ return function ScrollPositionLifecycleProvider(_ref2) {
1129
+ var children = _ref2.children,
1130
+ onActivate = _ref2.onActivate;
1131
+ var ref = useRef();
1132
+ var isActiveProbeRef = useRef();
1133
+ var isStaticPreview = useContext(StaticPreviewContext);
1134
+ var isPrepared = useOnScreen(ref, {
1135
+ rootMargin: '25% 0px 25% 0px'
1136
+ });
1137
+ var isVisible = useOnScreen(ref) && !isStaticPreview;
1138
+ var isActive = useOnScreen(isActiveProbeRef, {
1139
+ rootMargin: '-50% 0px -50% 0px',
1140
+ onIntersecting: onActivate
1141
+ }) && !isStaticPreview;
1142
+ var value = useMemo(function () {
1143
+ return {
1144
+ isPrepared: isPrepared,
1145
+ isVisible: isVisible,
1146
+ isActive: isActive
1147
+ };
1148
+ }, [isPrepared, isVisible, isActive]);
1149
+ return (
1150
+ /*#__PURE__*/
1151
+ React.createElement("div", {
1152
+ ref: ref,
1153
+ className: classNames(styles.wrapper)
1154
+ },
1155
+ /*#__PURE__*/
1156
+ React.createElement("div", {
1157
+ ref: isActiveProbeRef,
1158
+ className: styles.isActiveProbe
1159
+ }),
1160
+ /*#__PURE__*/
1161
+ React.createElement(Context.Provider, {
1162
+ value: value
1163
+ }, children))
1164
+ );
1165
+ };
1166
+ }
1167
+ function createScrollPositionLifecycleHook(Context) {
1168
+ return function useScrollPositionLifecycle() {
1169
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1170
+ onActivate = _ref3.onActivate,
1171
+ onDeactivate = _ref3.onDeactivate,
1172
+ onVisible = _ref3.onVisible,
1173
+ onInvisible = _ref3.onInvisible;
1174
+
1175
+ var result = useContext(Context);
1176
+ var wasActive = useRef();
1177
+ var wasVisible = useRef();
1178
+
1179
+ var _ref4 = result || {},
1180
+ isActive = _ref4.isActive,
1181
+ isVisible = _ref4.isVisible;
1182
+
1183
+ useEffect(function () {
1184
+ if (!wasVisible.current && isVisible && onVisible) {
1185
+ onVisible();
1186
+ }
1187
+
1188
+ if (!wasActive.current && isActive && onActivate) {
1189
+ onActivate();
1190
+ } else if (wasActive.current && !isActive && onDeactivate) {
1191
+ onDeactivate();
1192
+ }
1193
+
1194
+ if (wasVisible.current && !isVisible && onInvisible) {
1195
+ onInvisible();
1196
+ }
1197
+
1198
+ wasActive.current = isActive;
1199
+ wasVisible.current = isVisible;
1200
+ });
1201
+ return result;
1202
+ };
1203
+ }
1204
+
1205
+ function useMediaQuery(query) {
1206
+ var _useState = useState(false),
1207
+ _useState2 = _slicedToArray(_useState, 2),
1208
+ doesMatch = _useState2[0],
1209
+ onSetDoesMatch = _useState2[1];
1210
+
1211
+ useEffect(function () {
1212
+ var onUpdateMatch = function onUpdateMatch(_ref) {
1213
+ var matches = _ref.matches;
1214
+ onSetDoesMatch(matches);
1215
+ };
1216
+
1217
+ var matcher = window.matchMedia(query);
1218
+ var isModern = 'addEventListener' in matcher;
1219
+
1220
+ if (isModern) {
1221
+ matcher.addEventListener('change', onUpdateMatch);
1222
+ } else {
1223
+ matcher.addListener(onUpdateMatch);
1224
+ }
1225
+
1226
+ onUpdateMatch(matcher);
1227
+ return function () {
1228
+ if (isModern) {
1229
+ matcher.removeEventListener('change', onUpdateMatch);
1230
+ } else {
1231
+ matcher.removeListener(onUpdateMatch);
1232
+ }
1233
+ };
1234
+ }, [query, onSetDoesMatch]);
1235
+ return doesMatch;
1236
+ }
1237
+
1238
+ var styles$1 = {"Foreground":"Foreground-module_Foreground__13ODU","fullFadeHeight":"Foreground-module_fullFadeHeight__2p9dx","fullHeight":"Foreground-module_fullHeight__1vMXb","paddingBottom":"Foreground-module_paddingBottom__3OtY4"};
1239
+
1240
+ var ForcePaddingContext = createContext(false);
1241
+ function Foreground(props) {
1242
+ var forcePadding = useContext(ForcePaddingContext);
1243
+ return (
1244
+ /*#__PURE__*/
1245
+ React.createElement("div", {
1246
+ className: className(props, forcePadding)
1247
+ }, props.children)
1248
+ );
1249
+ }
1250
+
1251
+ function className(props, forcePadding) {
1252
+ return classNames(styles$1.Foreground, props.transitionStyles.foreground, props.transitionStyles["foreground-".concat(props.state)], _defineProperty({}, styles$1.paddingBottom, props.paddingBottom || forcePadding), styles$1["".concat(props.heightMode, "Height")]);
1253
+ }
1254
+
1255
+ /**
1256
+ * Register new types of content elements.
1257
+ * @name frontend_contentElementTypes
1258
+ */
1259
+ var ContentElementTypeRegistry =
1260
+ /*#__PURE__*/
1261
+ function () {
1262
+ function ContentElementTypeRegistry() {
1263
+ _classCallCheck(this, ContentElementTypeRegistry);
1264
+
1265
+ this.types = {};
1266
+ }
1267
+ /**
1268
+ * Register a new type of content element.
1269
+ *
1270
+ * @param {string} typeName - Name of the content element type.
1271
+ * @param {Object} options
1272
+ * @param {React.Component} options.component
1273
+ * @memberof frontend_contentElementTypes
1274
+ *
1275
+ * @example
1276
+ *
1277
+ * // frontend.js
1278
+ *
1279
+ * import {frontend} from 'pageflow-scrolled/frontend';
1280
+ * import {InlineImage} from './InlineImage';
1281
+ *
1282
+ * frontend.contentElementTypes.register('inlineImage', {
1283
+ * component: InlineImage
1284
+ * });
1285
+ */
1286
+
1287
+
1288
+ _createClass(ContentElementTypeRegistry, [{
1289
+ key: "register",
1290
+ value: function register(typeName, options) {
1291
+ this.types[typeName] = options;
1292
+ }
1293
+ }, {
1294
+ key: "getComponent",
1295
+ value: function getComponent(typeName) {
1296
+ return this.types[typeName] && this.types[typeName].component;
1297
+ }
1298
+ }, {
1299
+ key: "getOptions",
1300
+ value: function getOptions(typeName) {
1301
+ return this.types[typeName];
1302
+ }
1303
+ }]);
1304
+
1305
+ return ContentElementTypeRegistry;
1306
+ }();
1307
+
1308
+ var api = {
1309
+ contentElementTypes: new ContentElementTypeRegistry()
1310
+ };
1311
+
1312
+ // For reasons that are beyond me, Storybook's Webpack build fails
1313
+ // with a "JavaScript heap out of memory" error if this import
1314
+ // expression lives in inlineEditing/index.js directly. I originally
1315
+ // intended to hide the import from Webpack by using
1316
+ // file-replace-loader in Storybook's Webpack config to replace this
1317
+ // file with an empty one, but found out that extracting the import
1318
+ // to a separate file apparently is enough.
1319
+ function importComponents() {
1320
+ return import('./components-cfe6a479.js');
1321
+ }
1322
+
1323
+ var components = {};
1324
+ function loadInlineEditingComponents() {
1325
+ return importComponents().then(function (importedComponents) {
1326
+ components = importedComponents;
1327
+ });
1328
+ }
1329
+ function withInlineEditingDecorator(name, Component) {
1330
+ return function InlineEditingDecorator(props) {
1331
+ var Decorator = components[name];
1332
+
1333
+ if (Decorator) {
1334
+ return (
1335
+ /*#__PURE__*/
1336
+ React.createElement(Decorator, props,
1337
+ /*#__PURE__*/
1338
+ React.createElement(Component, props))
1339
+ );
1340
+ } else {
1341
+ return (
1342
+ /*#__PURE__*/
1343
+ React.createElement(Component, props)
1344
+ );
1345
+ }
1346
+ };
1347
+ }
1348
+ function withInlineEditingAlternative(name, Component) {
1349
+ return function InlineEditingDecorator(props) {
1350
+ var Alternative = components[name];
1351
+
1352
+ if (Alternative) {
1353
+ return (
1354
+ /*#__PURE__*/
1355
+ React.createElement(Alternative, props)
1356
+ );
1357
+ } else {
1358
+ return (
1359
+ /*#__PURE__*/
1360
+ React.createElement(Component, props)
1361
+ );
1362
+ }
1363
+ };
1364
+ }
1365
+
1366
+ var ContentElementAttributesContext = createContext({});
1367
+ function ContentElementAttributesProvider(_ref) {
1368
+ var id = _ref.id,
1369
+ children = _ref.children;
1370
+ var attributes = useMemo(function () {
1371
+ return {
1372
+ contentElementId: id
1373
+ };
1374
+ }, [id]);
1375
+ return (
1376
+ /*#__PURE__*/
1377
+ React.createElement(ContentElementAttributesContext.Provider, {
1378
+ value: attributes
1379
+ }, children)
1380
+ );
1381
+ }
1382
+ function useContentElementAttributes() {
1383
+ return useContext(ContentElementAttributesContext);
1384
+ }
1385
+
1386
+ var ContentElementLifecycleContext = createContext();
1387
+ var LifecycleProvider = createScrollPositionLifecycleProvider(ContentElementLifecycleContext);
1388
+ var useLifecycle = createScrollPositionLifecycleHook(ContentElementLifecycleContext);
1389
+ function ContentElementLifecycleProvider(_ref) {
1390
+ var type = _ref.type,
1391
+ children = _ref.children;
1392
+
1393
+ var _api$contentElementTy = api.contentElementTypes.getOptions(type),
1394
+ lifecycle = _api$contentElementTy.lifecycle;
1395
+
1396
+ if (lifecycle) {
1397
+ return (
1398
+ /*#__PURE__*/
1399
+ React.createElement(LifecycleProvider, null, children)
1400
+ );
1401
+ } else {
1402
+ return children;
1403
+ }
1404
+ }
1405
+ /**
1406
+ * Returns an object containing information about the scroll position
1407
+ * related lifecylce of the content element. Requires the `lifecycle`
1408
+ * option to be set to true in the `frontend.contentElements.register`
1409
+ * call for the content element's type.
1410
+ *
1411
+ * * `isPrepared is true if the content element is near the viewport.
1412
+ *
1413
+ * * `isActive` is true if the content element is completely in the
1414
+ * viewport.
1415
+ *
1416
+ * @param {Function} onActivate -
1417
+ * Invoked when content element has entered the viewport.
1418
+ *
1419
+ * @param {Function} onDeactivate -
1420
+ * Invoked when content element has left the viewport.
1421
+ *
1422
+ * @example
1423
+ *
1424
+ * const {isActive, isPrepared} = useContentElementLifecycle();
1425
+ */
1426
+
1427
+ function useContentElementLifecycle(options) {
1428
+ var result = useLifecycle(options);
1429
+
1430
+ if (!result) {
1431
+ throw new Error('useContentElementLifecycle is only available in ' + 'content elements for which `lifecycle: true` has ' + 'been passed to frontend.contentElements.register');
1432
+ }
1433
+
1434
+ return result;
1435
+ }
1436
+
1437
+ var styles$2 = {"wrapper":"ContentElementMargin-module_wrapper__20kIk"};
1438
+
1439
+ function ContentElementMargin(_ref) {
1440
+ var position = _ref.position,
1441
+ children = _ref.children;
1442
+
1443
+ if (position === 'full') {
1444
+ return children;
1445
+ }
1446
+
1447
+ return (
1448
+ /*#__PURE__*/
1449
+ React.createElement("div", {
1450
+ className: styles$2.wrapper
1451
+ }, children)
1452
+ );
1453
+ }
1454
+
1455
+ var styles$3 = {"missing":"ContentElement-module_missing__2_1j9"};
1456
+
1457
+ function _createSuper(Derived) {
1458
+ function isNativeReflectConstruct() {
1459
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1460
+ if (Reflect.construct.sham) return false;
1461
+ if (typeof Proxy === "function") return true;
1462
+
1463
+ try {
1464
+ Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
1465
+ return true;
1466
+ } catch (e) {
1467
+ return false;
1468
+ }
1469
+ }
1470
+
1471
+ return function () {
1472
+ var Super = _getPrototypeOf(Derived),
1473
+ result;
1474
+
1475
+ if (isNativeReflectConstruct()) {
1476
+ var NewTarget = _getPrototypeOf(this).constructor;
1477
+
1478
+ result = Reflect.construct(Super, arguments, NewTarget);
1479
+ } else {
1480
+ result = Super.apply(this, arguments);
1481
+ }
1482
+
1483
+ return _possibleConstructorReturn(this, result);
1484
+ };
1485
+ }
1486
+ var ContentElementErrorBoundary =
1487
+ /*#__PURE__*/
1488
+ function (_React$Component) {
1489
+ _inherits(ContentElementErrorBoundary, _React$Component);
1490
+
1491
+ var _super = _createSuper(ContentElementErrorBoundary);
1492
+
1493
+ function ContentElementErrorBoundary(props) {
1494
+ var _this;
1495
+
1496
+ _classCallCheck(this, ContentElementErrorBoundary);
1497
+
1498
+ _this = _super.call(this, props);
1499
+ _this.state = {
1500
+ hasError: false
1501
+ };
1502
+ return _this;
1503
+ }
1504
+
1505
+ _createClass(ContentElementErrorBoundary, [{
1506
+ key: "render",
1507
+ value: function render() {
1508
+ if (this.state.hasError) {
1509
+ return (
1510
+ /*#__PURE__*/
1511
+ React.createElement("div", {
1512
+ className: styles$3.missing
1513
+ }, "Error rendering element of type \"", this.props.type, "\"")
1514
+ );
1515
+ }
1516
+
1517
+ return this.props.children;
1518
+ }
1519
+ }], [{
1520
+ key: "getDerivedStateFromError",
1521
+ value: function getDerivedStateFromError(error) {
1522
+ return {
1523
+ hasError: true
1524
+ };
1525
+ }
1526
+ }]);
1527
+
1528
+ return ContentElementErrorBoundary;
1529
+ }(React.Component);
1530
+
1531
+ var ContentElement = withInlineEditingDecorator('ContentElementDecorator', function ContentElement(props) {
1532
+ var Component = api.contentElementTypes.getComponent(props.type);
1533
+
1534
+ if (Component) {
1535
+ return (
1536
+ /*#__PURE__*/
1537
+ React.createElement(ContentElementAttributesProvider, {
1538
+ id: props.id
1539
+ },
1540
+ /*#__PURE__*/
1541
+ React.createElement(ContentElementLifecycleProvider, {
1542
+ type: props.type
1543
+ },
1544
+ /*#__PURE__*/
1545
+ React.createElement(ContentElementMargin, {
1546
+ position: props.itemProps.position
1547
+ },
1548
+ /*#__PURE__*/
1549
+ React.createElement(ContentElementErrorBoundary, {
1550
+ type: props.type
1551
+ },
1552
+ /*#__PURE__*/
1553
+ React.createElement(Component, {
1554
+ sectionProps: props.sectionProps,
1555
+ configuration: props.itemProps,
1556
+ contentElementId: props.id
1557
+ })))))
1558
+ );
1559
+ } else {
1560
+ return (
1561
+ /*#__PURE__*/
1562
+ React.createElement("div", {
1563
+ className: styles$3.missing
1564
+ }, "Element of unknown type \"", props.type, "\"")
1565
+ );
1566
+ }
1567
+ });
1568
+ ContentElement.defaultProps = {
1569
+ itemProps: {}
1570
+ };
1571
+
1572
+ function ContentElements(props) {
1573
+ return (
1574
+ /*#__PURE__*/
1575
+ React.createElement(React.Fragment, null, props.items.map(function (item, index) {
1576
+ return props.children(item,
1577
+ /*#__PURE__*/
1578
+ React.createElement(ContentElement, {
1579
+ key: item.id,
1580
+ id: item.id,
1581
+ permaId: item.permaId,
1582
+ type: item.type,
1583
+ first: index === 0,
1584
+ position: item.position,
1585
+ itemProps: item.props,
1586
+ sectionProps: props.sectionProps
1587
+ }), index);
1588
+ }))
1589
+ );
1590
+ }
1591
+ ContentElements.defaultProps = {
1592
+ children: function children(item, child) {
1593
+ return child;
1594
+ }
1595
+ };
1596
+
1597
+ function useNarrowViewport() {
1598
+ return useMediaQuery('(max-width: 950px)');
1599
+ }
1600
+
1601
+ var styles$4 = {"root":"TwoColumn-module_root__37EqL","group":"TwoColumn-module_group__3Hg2y","group-full":"TwoColumn-module_group-full__2OT4o","sticky":"TwoColumn-module_sticky__4LCDO","inline":"TwoColumn-module_inline__1fPfM","right":"TwoColumn-module_right__Fr52a","narrow":"TwoColumn-module_narrow__qAgnL","wide":"TwoColumn-module_wide__xdF_t"};
1602
+
1603
+ function availablePositions(narrow) {
1604
+ if (narrow) {
1605
+ return ['inline', 'full'];
1606
+ } else {
1607
+ return ['inline', 'sticky', 'full'];
1608
+ }
1609
+ }
1610
+
1611
+ function TwoColumn(props) {
1612
+ var narrow = useNarrowViewport();
1613
+ return (
1614
+ /*#__PURE__*/
1615
+ React.createElement("div", {
1616
+ className: classNames(styles$4.root, styles$4[props.align], narrow ? styles$4.narrow : styles$4.wide)
1617
+ },
1618
+ /*#__PURE__*/
1619
+ React.createElement("div", {
1620
+ className: styles$4.inline,
1621
+ ref: props.contentAreaRef
1622
+ }), renderItems(props, narrow), renderPlaceholder(props.placeholder))
1623
+ );
1624
+ }
1625
+ TwoColumn.defaultProps = {
1626
+ align: 'left'
1627
+ };
1628
+
1629
+ function renderItems(props, narrow) {
1630
+ return groupItemsByPosition(props.items, availablePositions(narrow)).map(function (group, index) {
1631
+ return (
1632
+ /*#__PURE__*/
1633
+ React.createElement("div", {
1634
+ key: index,
1635
+ className: classNames(styles$4.group, styles$4["group-".concat(group.position)])
1636
+ }, renderItemGroup(props, group, 'sticky'), renderItemGroup(props, group, 'inline'), renderItemGroup(props, group, 'full'))
1637
+ );
1638
+ });
1639
+ }
1640
+
1641
+ function renderItemGroup(props, group, position) {
1642
+ if (group[position].length) {
1643
+ return (
1644
+ /*#__PURE__*/
1645
+ React.createElement("div", {
1646
+ className: styles$4[position]
1647
+ }, props.children(
1648
+ /*#__PURE__*/
1649
+ React.createElement(ContentElements, {
1650
+ sectionProps: props.sectionProps,
1651
+ items: group[position]
1652
+ }), {
1653
+ position: position,
1654
+ openStart: position === 'inline' && group.openStart,
1655
+ openEnd: position === 'inline' && group.openEnd
1656
+ }))
1657
+ );
1658
+ }
1659
+ }
1660
+
1661
+ function groupItemsByPosition(items, availablePositions) {
1662
+ var groups = [];
1663
+ var currentGroup;
1664
+ items.reduce(function (previousItemPosition, item, index) {
1665
+ var position = availablePositions.indexOf(item.position) >= 0 ? item.position : 'inline';
1666
+
1667
+ if (!previousItemPosition || previousItemPosition !== position && !(previousItemPosition === 'sticky' && position === 'inline')) {
1668
+ currentGroup = {
1669
+ position: position,
1670
+ sticky: [],
1671
+ inline: [],
1672
+ full: []
1673
+ };
1674
+ groups = [].concat(_toConsumableArray(groups), [currentGroup]);
1675
+ }
1676
+
1677
+ currentGroup[position].push(item);
1678
+ return position;
1679
+ }, null);
1680
+ groups.forEach(function (group, index) {
1681
+ var previous = groups[index - 1];
1682
+ var next = groups[index + 1];
1683
+ group.openStart = previous && !previous.full.length;
1684
+ group.openEnd = next && next.inline.length > 0;
1685
+ });
1686
+ return groups;
1687
+ }
1688
+
1689
+ function renderPlaceholder(placeholder) {
1690
+ if (!placeholder) {
1691
+ return null;
1692
+ }
1693
+
1694
+ return (
1695
+ /*#__PURE__*/
1696
+ React.createElement("div", {
1697
+ className: classNames(styles$4.group)
1698
+ },
1699
+ /*#__PURE__*/
1700
+ React.createElement("div", {
1701
+ className: styles$4.inline
1702
+ }, placeholder))
1703
+ );
1704
+ }
1705
+
1706
+ var styles$5 = {"outer":"Center-module_outer__3Rr0H","outer-full":"Center-module_outer-full__3dknO","item":"Center-module_item__1KSs3","item-full":"Center-module_item-full__1cEuv","inner-left":"Center-module_inner-left__2z9Ea","inner-right":"Center-module_inner-right__KBkVt"};
1707
+
1708
+ function Center(props) {
1709
+ return (
1710
+ /*#__PURE__*/
1711
+ React.createElement("div", {
1712
+ className: classNames(styles$5.root)
1713
+ },
1714
+ /*#__PURE__*/
1715
+ React.createElement("div", {
1716
+ ref: props.contentAreaRef
1717
+ }),
1718
+ /*#__PURE__*/
1719
+ React.createElement(ContentElements, {
1720
+ sectionProps: props.sectionProps,
1721
+ items: props.items
1722
+ }, function (item, child, index) {
1723
+ return (
1724
+ /*#__PURE__*/
1725
+ React.createElement("div", {
1726
+ key: item.id,
1727
+ className: classNames(styles$5.outer, styles$5["outer-".concat(item.position)])
1728
+ },
1729
+ /*#__PURE__*/
1730
+ React.createElement("div", {
1731
+ className: classNames(styles$5.item, styles$5["item-".concat(item.position)])
1732
+ }, props.children(
1733
+ /*#__PURE__*/
1734
+ React.createElement("div", {
1735
+ className: styles$5["inner-".concat(item.position)]
1736
+ }, child), boxProps(props.items, item, index))))
1737
+ );
1738
+ }), renderPlaceholder$1(props.placeholder))
1739
+ );
1740
+ }
1741
+
1742
+ function boxProps(items, item, index) {
1743
+ var previous = items[index - 1];
1744
+ var next = items[index + 1];
1745
+ return {
1746
+ position: item.position,
1747
+ openStart: previous && item.position !== 'full' && previous.position !== 'full',
1748
+ openEnd: next && item.position !== 'full' && next.position !== 'full'
1749
+ };
1750
+ }
1751
+
1752
+ function renderPlaceholder$1(placeholder) {
1753
+ if (!placeholder) {
1754
+ return null;
1755
+ }
1756
+
1757
+ return (
1758
+ /*#__PURE__*/
1759
+ React.createElement("div", {
1760
+ className: classNames(styles$5.outer)
1761
+ },
1762
+ /*#__PURE__*/
1763
+ React.createElement("div", {
1764
+ className: classNames(styles$5.item)
1765
+ }, placeholder))
1766
+ );
1767
+ }
1768
+
1769
+ var Layout = withInlineEditingAlternative('LayoutWithPlaceholder', LayoutWithoutInlineEditing);
1770
+ function LayoutWithoutInlineEditing(props) {
1771
+ if (props.sectionProps.layout === 'center') {
1772
+ return (
1773
+ /*#__PURE__*/
1774
+ React.createElement(Center, props)
1775
+ );
1776
+ } else if (props.sectionProps.layout === 'right') {
1777
+ return (
1778
+ /*#__PURE__*/
1779
+ React.createElement(TwoColumn, Object.assign({
1780
+ align: "right"
1781
+ }, props))
1782
+ );
1783
+ } else {
1784
+ return (
1785
+ /*#__PURE__*/
1786
+ React.createElement(TwoColumn, props)
1787
+ );
1788
+ }
1789
+ }
1790
+ Layout.defaultProps = {
1791
+ layout: 'left'
1792
+ };
1793
+
1794
+ function usePostMessageListener(receiveData) {
1795
+ useEffect(function () {
1796
+ if (window.parent !== window) {
1797
+ window.addEventListener('message', receive);
1798
+ }
1799
+
1800
+ return function () {
1801
+ return window.removeEventListener('message', receive);
1802
+ };
1803
+
1804
+ function receive(message) {
1805
+ if (window.location.href.indexOf(message.origin) === 0) {
1806
+ receiveData(message.data);
1807
+ }
1808
+ }
1809
+ }, [receiveData]);
1810
+ }
1811
+
1812
+ var styles$6 = {"text-s":"20px","text-base":"22px","text-l":"40px","text-xl":"66px","text-2xl":"110px","h2":"Text-module_h2__34chJ","h1":"Text-module_h1__2_5kX","body":"Text-module_body__4oWD-","caption":"Text-module_caption__3_6Au"};
1813
+
1814
+ /**
1815
+ * Render some text using the default typography scale.
1816
+ *
1817
+ * @param {Object} props
1818
+ * @param {string} props.scaleCategory - One of the styles `'h1'`, `'h2'`, `'body'`, `'caption'`.
1819
+ * @param {string} [props.inline] - Render a span instread of a div.
1820
+ * @param {string} props.children - Nodes to render with specified typography.
1821
+ */
1822
+
1823
+ function Text(_ref) {
1824
+ var inline = _ref.inline,
1825
+ scaleCategory = _ref.scaleCategory,
1826
+ children = _ref.children;
1827
+ return React.createElement(inline ? 'span' : 'div', {
1828
+ className: styles$6[scaleCategory]
1829
+ }, children);
1830
+ }
1831
+
1832
+ var ContentElementConfigurationUpdateContext = React.createContext(function () {});
1833
+ function useContentElementConfigurationUpdate() {
1834
+ return useContext(ContentElementConfigurationUpdateContext);
1835
+ }
1836
+
1837
+ var ContentElementEditorCommandEmitterContext = createContext({
1838
+ on: function on() {},
1839
+ off: function off() {}
1840
+ });
1841
+ function useContentElementEditorCommandSubscription(callback) {
1842
+ var _useContentElementAtt = useContentElementAttributes(),
1843
+ contentElementId = _useContentElementAtt.contentElementId;
1844
+
1845
+ var emitter = useContext(ContentElementEditorCommandEmitterContext);
1846
+ useEffect(function () {
1847
+ emitter.on("command:".concat(contentElementId), callback);
1848
+ return function () {
1849
+ return emitter.off("command:".concat(contentElementId), callback);
1850
+ };
1851
+ }, [emitter, callback, contentElementId]);
1852
+ }
1853
+
1854
+ var ContentElementEditorStateContext = createContext({
1855
+ isSelected: false,
1856
+ isEditable: false,
1857
+ setTransientState: function setTransientState() {}
1858
+ });
1859
+ /**
1860
+ * Use inside a content element component to determine whether the
1861
+ * component is being rendered inside the editor and whether the
1862
+ * content element is currently selected. This can be used to
1863
+ * implement simple inline editing capabilities like displaying extra
1864
+ * information when the content element is selected.
1865
+ *
1866
+ * @example
1867
+ * const {isEditable, isSelected} = useContentElementEditorState();
1868
+ */
1869
+
1870
+ function useContentElementEditorState() {
1871
+ return useContext(ContentElementEditorStateContext);
1872
+ }
1873
+
1874
+ var EditableText = withInlineEditingAlternative('EditableText', function EditableText(_ref) {
1875
+ var value = _ref.value;
1876
+ return (
1877
+ /*#__PURE__*/
1878
+ React.createElement(Text, {
1879
+ scaleCategory: "body"
1880
+ }, render(value))
1881
+ );
1882
+ });
1883
+
1884
+ function render() {
1885
+ var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1886
+ return children.map(function (element, index) {
1887
+ if (element.type) {
1888
+ return renderElement({
1889
+ attributes: {
1890
+ key: index
1891
+ },
1892
+ element: element,
1893
+ children: render(element.children)
1894
+ });
1895
+ } else {
1896
+ return renderLeaf({
1897
+ attributes: {
1898
+ key: index
1899
+ },
1900
+ leaf: element,
1901
+ children: element.text.trim() === '' ? "\uFEFF" : element.text
1902
+ });
1903
+ }
1904
+ });
1905
+ }
1906
+
1907
+ function renderElement(_ref2) {
1908
+ var attributes = _ref2.attributes,
1909
+ children = _ref2.children,
1910
+ element = _ref2.element;
1911
+
1912
+ switch (element.type) {
1913
+ case 'block-quote':
1914
+ return (
1915
+ /*#__PURE__*/
1916
+ React.createElement("blockquote", attributes, children)
1917
+ );
1918
+
1919
+ case 'bulleted-list':
1920
+ return (
1921
+ /*#__PURE__*/
1922
+ React.createElement("ul", attributes, children)
1923
+ );
1924
+
1925
+ case 'numbered-list':
1926
+ return (
1927
+ /*#__PURE__*/
1928
+ React.createElement("ol", attributes, children)
1929
+ );
1930
+
1931
+ case 'list-item':
1932
+ return (
1933
+ /*#__PURE__*/
1934
+ React.createElement("li", attributes, children)
1935
+ );
1936
+
1937
+ case 'heading':
1938
+ return (
1939
+ /*#__PURE__*/
1940
+ React.createElement("h2", attributes, children)
1941
+ );
1942
+
1943
+ case 'link':
1944
+ return (
1945
+ /*#__PURE__*/
1946
+ React.createElement("a", Object.assign({}, attributes, {
1947
+ href: element.href
1948
+ }), children)
1949
+ );
1950
+
1951
+ default:
1952
+ return (
1953
+ /*#__PURE__*/
1954
+ React.createElement("p", attributes, children)
1955
+ );
1956
+ }
1957
+ }
1958
+ function renderLeaf(_ref3) {
1959
+ var attributes = _ref3.attributes,
1960
+ children = _ref3.children,
1961
+ leaf = _ref3.leaf;
1962
+
1963
+ if (leaf.bold) {
1964
+ children =
1965
+ /*#__PURE__*/
1966
+ React.createElement("strong", null, children);
1967
+ }
1968
+
1969
+ if (leaf.italic) {
1970
+ children =
1971
+ /*#__PURE__*/
1972
+ React.createElement("em", null, children);
1973
+ }
1974
+
1975
+ if (leaf.underline) {
1976
+ children =
1977
+ /*#__PURE__*/
1978
+ React.createElement("u", null, children);
1979
+ }
1980
+
1981
+ if (leaf.strikethrough) {
1982
+ children =
1983
+ /*#__PURE__*/
1984
+ React.createElement("s", null, children);
1985
+ }
1986
+
1987
+ return (
1988
+ /*#__PURE__*/
1989
+ React.createElement("span", attributes, children)
1990
+ );
1991
+ }
1992
+
1993
+ export { loadInlineEditingComponents as A, api as B, useContentElementConfigurationUpdate as C, useContentElementEditorCommandSubscription as D, EntryStateProvider as E, Foreground as F, useContentElementEditorState as G, useContentElementLifecycle as H, EditableText as I, useOnScreen as J, useLocale as K, Layout as L, ContentElementEditorCommandEmitterContext as M, ForcePaddingContext as N, updateContentElementConfiguration as O, PhonePlatformContext as P, ContentElementConfigurationUpdateContext as Q, ContentElementEditorStateContext as R, StaticPreview as S, Text as T, LayoutWithoutInlineEditing as U, renderElement as V, renderLeaf as W, _defineProperty as _, _objectWithoutProperties as a, useFileRights as b, useLegalInfo as c, useCredits as d, useShareUrl as e, useShareProviders as f, useTheme as g, _slicedToArray as h, useEntryStructure as i, createScrollPositionLifecycleProvider as j, createScrollPositionLifecycleHook as k, _objectSpread2 as l, useEntryMetadata as m, useNestedFiles as n, useFile as o, useMediaQuery as p, usePostMessageListener as q, withInlineEditingAlternative as r, LocaleProvider as s, _toConsumableArray as t, useI18n as u, useAvailableQualities as v, withInlineEditingDecorator as w, useEntryStateDispatch as x, useSectionStructure as y, setupI18n as z };