PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.5
YayMail – WooCommerce Email Customizer v4.4.5
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
yaymail / src / Elements / FeaturedProducts.php

FeaturedProducts.php in YayMail – WooCommerce Email Customizer 4.4.5, at src/Elements/FeaturedProducts.php

357 lines 24.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace YayMail\Elements;
3
4 use YayMail\Abstracts\BaseElement;
5 use YayMail\Utils\SingletonTrait;
6
7 /**
8 * Featured Products Elements
9 */
10 class FeaturedProducts extends BaseElement {
11
12 use SingletonTrait;
13
14 protected static $type = 'featured_products';
15
16 public $available_email_ids = [];
17
18 public static function get_data( $attributes = [] ) {
19 self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 20 20">
20 <g>
21 <path d="M7.7,2.7v9.75H2.5V2.7h5.2M8.7,1.2H1.5c-.28,0-.5.22-.5.5v11.75c0,.28.22.5.5.5h7.2c.28,0,.5-.22.5-.5V1.7c0-.28-.22-.5-.5-.5h0Z"/>
22 <g>
23 <path d="M8,16.49H2.21c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h5.79c.41,0,.75.34.75.75s-.34.75-.75.75Z"/>
24 <path d="M7.19,18.95H3.01c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h4.19c.41,0,.75.34.75.75s-.34.75-.75.75Z"/>
25 </g>
26 </g>
27 <g>
28 <path d="M17.5,2.7v9.75h-5.2V2.7h5.2M18.5,1.2h-7.2c-.28,0-.5.22-.5.5v11.75c0,.28.22.5.5.5h7.2c.28,0,.5-.22.5-.5V1.7c0-.28-.22-.5-.5-.5h0Z"/>
29 <path d="M17.79,16.49h-5.79c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h5.79c.41,0,.75.34.75.75s-.34.75-.75.75Z"/>
30 <path d="M16.99,18.95h-4.19c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h4.19c.41,0,.75.34.75.75s-.34.75-.75.75Z"/>
31 </g>
32 </svg>';
33
34 $buy_button_conditions = [
35 [
36 'comparison' => 'contain',
37 'value' => [ 'buy_button' ],
38 'attribute' => 'showing_items',
39 ],
40 ];
41
42 $pro_preview = '';
43
44 return [
45 'id' => uniqid(),
46 'type' => self::$type,
47 'name' => __( 'Featured Products', 'yaymail' ),
48 'icon' => self::$icon,
49 'group' => 'block',
50 'tags' => [ 'woocommerce' ],
51 'available' => false,
52 'disabled_reason' => [
53 'html' => '<svg id="yaymail-featured_products" class="yaymail-element-disabled-icon" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 428 300"><defs><style> #yaymail-featured_products .st0 { fill: #fff; } #yaymail-featured_products .st1 { fill: #edeff3; } #yaymail-featured_products .st2 { fill: none; } #yaymail-featured_products .st3 { fill: #1f2937; } #yaymail-featured_products .st4 { fill: #dee2e9; } #yaymail-featured_products .st5 { fill: #c9ced6; } </style></defs><g id="Layer_1-2"><g><rect class="st0" width="428" height="300"/><g><path class="st3" d="M101.3,31.8h12.7v2.9h-9.2v5.1h8.7v2.9h-8.7v7.8h-3.4v-18.7h0Z"/><path class="st3" d="M119.1,44.2c0,2.1,1.1,3.9,3.1,3.9s2.3-.8,2.7-1.7h3.4c-.5,1.7-2,4.4-6.2,4.4s-6.4-3.5-6.4-7.1,2.2-7.5,6.6-7.5,6.2,3.5,6.2,6.8,0,.8,0,1.2h-9.4,0ZM125.1,42.1c0-1.8-.8-3.4-2.9-3.4s-2.9,1.4-3.1,3.4h6Z"/><path class="st3" d="M142.4,47.1c0,1.3.1,3,.2,3.4h-3.2c-.1-.3-.2-1-.2-1.5-.5.8-1.5,1.8-4,1.8s-4.7-2.2-4.7-4.3c0-3.1,2.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h3.3Z"/><path class="st3" d="M305,36.6h2.2v-3.9h3.4v3.9h2.8v2.6h-2.8v7.3c0,1.2.3,1.7,1.5,1.7s.7,0,1,0v2.4c-.7.2-1.7.3-2.4.3-2.5,0-3.4-1.3-3.4-3.7v-7.8h-2.2v-2.6h0Z"/><path class="st3" d="M318.2,46.4c.3,1.2,1.3,2,2.9,2s2.2-.6,2.2-1.6-.6-1.5-2.8-2c-4.3-1.1-5.1-2.4-5.1-4.3s1.4-4.1,5.4-4.1,5.4,2.2,5.6,4.1h-3.2c-.1-.6-.6-1.7-2.5-1.7s-2,.7-2,1.4.5,1.2,2.8,1.8c4.5,1,5.2,2.6,5.2,4.6s-1.8,4.3-5.8,4.3-5.8-2-6.1-4.4h3.3,0Z"/></g><rect class="st4" x="76.1" y="75.1" width="275.8" height="13.6" rx="6.8" ry="6.8"/><g><path class="st1" d="M41,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8H41c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M52.2,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="31.5" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st4" x="43.4" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><path class="st2" d="M85,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM78.1,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM89.5,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.3-.4,1.6-1.1l1.9-4.8c.2-.5.2-1.1-.2-1.6h0Z"/></g><g><path class="st1" d="M173.4,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-80.7c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M184.6,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="163.9" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st4" x="175.8" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><path class="st2" d="M217.4,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM210.5,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM221.9,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.4-.4,1.6-1.1l1.9-4.8c.2-.5.1-1.1-.2-1.6h0Z"/></g><g><path class="st1" d="M306.3,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-80.7c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M317.6,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="296.8" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st4" x="308.7" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><path class="st2" d="M350.4,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM343.4,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM354.9,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.4-.4,1.6-1.1l1.9-4.8c.2-.5.1-1.1-.2-1.6h0Z"/></g><path class="st5" d="M73.2,139.5c-2.8,0-5.1-2.4-5.1-5.2,0-2.8,2.4-5.1,5.2-5.1,2.8,0,5.2,2.4,5.1,5.2,0,2.8-2.4,5.1-5.2,5.1ZM104.2,162.9c-7.6,0-15.2,0-22.9,0h-23.6c-.7,0-1.5,0-1.8-.7-.4-.7,0-1.4.4-2,3-4.2,6-8.4,9.1-12.5,1.3-1.8,2.9-1.7,4.3,0,.8,1.1,1.6,2.2,2.4,3.3,1.4,1.8,3.2,1.8,4.6,0,.7-.9,1.3-1.7,1.9-2.6,2.5-3.5,5-7,7.6-10.4.8-1.2,1.9-1.5,3.1-1,.6.3,1,.8,1.4,1.4,5.1,7.1,10.3,14.2,15.4,21.3.5.7,1.3,1.5.8,2.5-.5,1.1-1.6.8-2.5.8h0Z"/><path class="st5" d="M205.6,139.5c-2.8,0-5.1-2.4-5.1-5.2,0-2.8,2.4-5.1,5.1-5.1,2.8,0,5.2,2.4,5.1,5.2,0,2.8-2.4,5.1-5.2,5.1ZM236.7,162.9c-7.6,0-15.2,0-22.9,0h-23.6c-.7,0-1.5,0-1.8-.7-.4-.7,0-1.4.4-2,3-4.2,6-8.4,9.1-12.5,1.3-1.8,2.9-1.7,4.3,0,.8,1.1,1.6,2.2,2.4,3.3,1.4,1.8,3.2,1.8,4.6,0,.7-.9,1.3-1.7,1.9-2.6,2.5-3.5,5-7,7.6-10.4.9-1.2,1.9-1.5,3.1-1,.6.3,1,.8,1.4,1.4,5.1,7.1,10.3,14.2,15.4,21.3.5.7,1.3,1.5.8,2.5-.5,1.1-1.6.8-2.5.8h0Z"/><path class="st5" d="M338.5,139.5c-2.8,0-5.1-2.4-5.1-5.2,0-2.8,2.4-5.1,5.1-5.1,2.8,0,5.2,2.4,5.1,5.2,0,2.8-2.4,5.1-5.2,5.1h0ZM369.6,162.9c-7.6,0-15.2,0-22.9,0h-23.6c-.7,0-1.5,0-1.8-.7-.4-.7,0-1.4.4-2,3-4.2,6-8.4,9.1-12.5,1.3-1.8,2.9-1.7,4.3,0,.8,1.1,1.6,2.2,2.4,3.3,1.4,1.8,3.2,1.8,4.6,0,.7-.9,1.3-1.7,1.9-2.6,2.5-3.5,5-7,7.6-10.4.9-1.2,1.9-1.5,3-1,.6.3,1,.8,1.4,1.4,5.1,7.1,10.3,14.2,15.4,21.3.5.7,1.3,1.5.8,2.5-.5,1.1-1.6.8-2.5.8h0Z"/></g></g></svg>'
54 . '<span>'
55 . self::get_pro_upgrade_text()
56 . '</span>',
57 ],
58 'position' => 220,
59 'data' => [
60 'padding' => [
61 'value_path' => 'padding',
62 'component' => 'Spacing',
63 'title' => __( 'Padding', 'yaymail' ),
64 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
65 'top' => '15',
66 'right' => '50',
67 'bottom' => '15',
68 'left' => '50',
69 ],
70 'type' => 'style',
71 ],
72 'background_color' => [
73 'value_path' => 'background_color',
74 'component' => 'Color',
75 'title' => __( 'Background color', 'yaymail' ),
76 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
77 'type' => 'style',
78 ],
79 'text_color' => [
80 'value_path' => 'text_color',
81 'component' => 'Color',
82 'title' => __( 'Text color', 'yaymail' ),
83 'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT,
84 'type' => 'style',
85 ],
86 'font_family' => [
87 'value_path' => 'font_family',
88 'component' => 'FontFamilySelector',
89 'title' => __( 'Font family', 'yaymail' ),
90 'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY,
91 'type' => 'style',
92 ],
93 'content_breaker' => [
94 'component' => 'LineBreaker',
95 ],
96 'content_group_definition' => [
97 'component' => 'GroupDefinition',
98 'title' => __( 'Content', 'yaymail' ),
99 'description' => __( 'Handle block items settings', 'yaymail' ),
100 ],
101 'showing_items' => [
102 'value_path' => 'showing_items',
103 'component' => 'CheckboxGroup',
104 'title' => __( 'Showing items', 'yaymail' ),
105 'default_value' => isset( $attributes['showing_items'] ) ? $attributes['showing_items'] : [ 'top_content', 'product_image', 'product_name', 'product_price', 'product_original_price', 'buy_button' ],
106 'type' => 'content',
107 'options' => [
108 [
109 'label' => __( 'Top content', 'yaymail' ),
110 'value' => 'top_content',
111 ],
112 [
113 'label' => __( 'Product image', 'yaymail' ),
114 'value' => 'product_image',
115 ],
116 [
117 'label' => __( 'Product name', 'yaymail' ),
118 'value' => 'product_name',
119 ],
120 [
121 'label' => __( 'Product price', 'yaymail' ),
122 'value' => 'product_price',
123 ],
124 [
125 'label' => __( 'Product original price', 'yaymail' ),
126 'value' => 'product_original_price',
127 ],
128 [
129 'label' => __( 'Buy button', 'yaymail' ),
130 'value' => 'buy_button',
131 ],
132 ],
133 ],
134 'top_content' => [
135 'value_path' => 'top_content',
136 'component' => 'RichTextEditor',
137 'title' => __( 'Top content', 'yaymail' ),
138 'default_value' => isset( $attributes['top_content'] ) ? $attributes['top_content'] : '<p style="text-align: center;"><span style="font-size: 18px;"><strong>FEATURED PRODUCTS</strong></span></p>
139 <p style="font-size: 14px; text-align: center;">&nbsp;</p>
140 <p style="text-align: center;">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>',
141 'type' => 'content',
142 'conditions' => [
143 [
144 'comparison' => 'contain',
145 'value' => [ 'top_content' ],
146 'attribute' => 'showing_items',
147 ],
148 ]
149 ],
150 'sale_price_color' => [
151 'value_path' => 'sale_price_color',
152 'component' => 'Color',
153 'title' => __( 'Product price color', 'yaymail' ),
154 'default_value' => isset( $attributes['sale_price_color'] ) ? $attributes['sale_price_color'] : '#ec4770',
155 'type' => 'style',
156 'conditions' => [
157 [
158 'comparison' => 'contain',
159 'value' => [ 'product_price' ],
160 'attribute' => 'showing_items',
161 ],
162 ],
163 ],
164 'regular_price_color' => [
165 'value_path' => 'regular_price_color',
166 'component' => 'Color',
167 'title' => __( 'Product original price color', 'yaymail' ),
168 'default_value' => isset( $attributes['regular_price_color'] ) ? $attributes['regular_price_color'] : '#808080',
169 'type' => 'style',
170 'conditions' => [
171 [
172 'comparison' => 'contain',
173 'value' => [ 'product_original_price' ],
174 'attribute' => 'showing_items',
175 ],
176 ],
177 ],
178 'button_breaker' => [
179 'component' => 'LineBreaker',
180 'conditions' => $buy_button_conditions,
181 ],
182 'button_group_definition' => [
183 'component' => 'GroupDefinition',
184 'title' => __( 'Button', 'yaymail' ),
185 'description' => __( 'Handle buy button settings', 'yaymail' ),
186 'conditions' => $buy_button_conditions,
187 ],
188 'buy_button_label' => [
189 'value_path' => 'buy_button_label',
190 'component' => 'TextInput',
191 'title' => __( 'Buy button text', 'yaymail' ),
192 'default_value' => isset( $attributes['buy_button_label'] ) ? $attributes['buy_button_label'] : __( 'BUY NOW', 'yaymail' ),
193 'type' => 'content',
194 'conditions' => $buy_button_conditions,
195 ],
196 'buy_button_background_color' => [
197 'value_path' => 'buy_button_background_color',
198 'component' => 'Color',
199 'title' => __( 'Buy button background color', 'yaymail' ),
200 'default_value' => isset( $attributes['buy_button_background_color'] ) ? $attributes['buy_button_background_color'] : '#ec4770',
201 'type' => 'style',
202 'conditions' => $buy_button_conditions,
203 ],
204 'buy_button_text_color' => [
205 'value_path' => 'buy_button_text_color',
206 'component' => 'Color',
207 'title' => __( 'Buy button text color', 'yaymail' ),
208 'default_value' => isset( $attributes['buy_button_text_color'] ) ? $attributes['buy_button_text_color'] : '#ffffff',
209 'type' => 'style',
210 'conditions' => $buy_button_conditions,
211 ],
212 'products_breaker' => [
213 'component' => 'LineBreaker',
214 ],
215 'products_group_definition' => [
216 'component' => 'GroupDefinition',
217 'title' => __( 'Products', 'yaymail' ),
218 'description' => __( 'Handle products settings', 'yaymail' ),
219 ],
220 'products_per_row' => [
221 'value_path' => 'products_per_row',
222 'component' => 'NumberInput',
223 'title' => __( 'Products per row', 'yaymail' ),
224 'default_value' => isset( $attributes['products_per_row'] ) ? $attributes['products_per_row'] : '3',
225 'min' => 1,
226 'max' => 3,
227 'type' => 'content',
228 ],
229 'product_type' => [
230 'value_path' => 'product_type',
231 'component' => 'Selector',
232 'title' => __( 'Product type', 'yaymail' ),
233 'default_value' => isset( $attributes['product_type'] ) ? $attributes['product_type'] : 'newest',
234 'type' => 'content',
235 'options' => [
236 [
237 'label' => __( 'Newest', 'yaymail' ),
238 'value' => 'newest',
239 ],
240 [
241 'label' => __( 'On sale', 'yaymail' ),
242 'value' => 'on_sale',
243 ],
244 [
245 'label' => __( 'Featured', 'yaymail' ),
246 'value' => 'featured',
247 ],
248 [
249 'label' => __( 'Category selections', 'yaymail' ),
250 'value' => 'category_selections',
251 ],
252 [
253 'label' => __( 'Tag selections', 'yaymail' ),
254 'value' => 'tag_selections',
255 ],
256 [
257 'label' => __( 'Product selections', 'yaymail' ),
258 'value' => 'product_selections',
259 ],
260 ],
261 ],
262 'categories' => [
263 'value_path' => 'categories',
264 'component' => 'EntitiesSelector',
265 'title' => __( 'Product categories', 'yaymail' ),
266 'default_value' => isset( $attributes['categories'] ) ? $attributes['categories'] : [],
267 'type' => 'content',
268 'entity_type' => 'categories',
269 'conditions' => [
270 [
271 'value' => 'category_selections',
272 'attribute' => 'product_type',
273 ],
274 ],
275 ],
276 'tags' => [
277 'value_path' => 'tags',
278 'component' => 'EntitiesSelector',
279 'title' => __( 'Product tags', 'yaymail' ),
280 'default_value' => isset( $attributes['tags'] ) ? $attributes['tags'] : [],
281 'type' => 'content',
282 'entity_type' => 'tags',
283 'conditions' => [
284 [
285 'value' => 'tag_selections',
286 'attribute' => 'product_type',
287 ],
288 ],
289 ],
290 'products' => [
291 'value_path' => 'products',
292 'component' => 'EntitiesSelector',
293 'title' => __( 'Products', 'yaymail' ),
294 'default_value' => isset( $attributes['products'] ) ? $attributes['products'] : [],
295 'type' => 'content',
296 'entity_type' => 'products',
297 'conditions' => [
298 [
299 'value' => 'product_selections',
300 'attribute' => 'product_type',
301 ],
302 ],
303 ],
304 'sorted_by' => [
305 'value_path' => 'sorted_by',
306 'component' => 'Selector',
307 'title' => __( 'Sorted by', 'yaymail' ),
308 'default_value' => isset( $attributes['sorted_by'] ) ? $attributes['sorted_by'] : 'none',
309 'options' => [
310 [
311 'label' => __( 'None', 'yaymail' ),
312 'value' => 'none',
313 ],
314 [
315 'label' => __( 'Name A-Z', 'yaymail' ),
316 'value' => 'name_a_z',
317 ],
318 [
319 'label' => __( 'Name Z-A', 'yaymail' ),
320 'value' => 'name_z_a',
321 ],
322 [
323 'label' => __( 'Ascending Price', 'yaymail' ),
324 'value' => 'price_ascending',
325 ],
326 [
327 'label' => __( 'Descending Price', 'yaymail' ),
328 'value' => 'price_descending',
329 ],
330 [
331 'label' => __( 'Random', 'yaymail' ),
332 'value' => 'random',
333 ],
334 ],
335 'type' => 'content',
336 ],
337 'number_of_products' => [
338 'value_path' => 'number_of_products',
339 'component' => 'NumberInput',
340 'title' => __( 'Number of featured products', 'yaymail' ),
341 'default_value' => isset( $attributes['number_of_products'] ) ? $attributes['number_of_products'] : '5',
342 'type' => 'content',
343 'min' => 1,
344 'max' => 20,
345 'is_debounce' => true,
346 'conditions' => [
347 [
348 'comparison' => '!=',
349 'value' => 'product_selections',
350 'attribute' => 'product_type',
351 ],
352 ],
353 ],
354 ],
355 ];
356 }
357 }