4fc6e1b7491455f337fb90fd11d8bb2b623b30b0
[lhc/web/wiklou.git] / includes / Content.php
1 <?php
2
3 /**
4 * A content object represents page content, e.g. the text to show on a page.
5 * Content objects have no knowledge about how they relate to Wiki pages.
6 *
7 * @since 1.WD
8 */
9 abstract class Content {
10
11 /**
12 * Name of the content model this Content object represents.
13 * Use with CONTENT_MODEL_XXX constants
14 *
15 * @var String $model_id
16 */
17 protected $model_id;
18
19 /**
20 * @since WD.1
21 *
22 * @return String a string representing the content in a way useful for building a full text search index.
23 * If no useful representation exists, this method returns an empty string.
24 */
25 public abstract function getTextForSearchIndex( );
26
27 /**
28 * @since WD.1
29 *
30 * @return String the wikitext to include when another page includes this content, or false if the content is not
31 * includable in a wikitext page.
32 *
33 * @TODO: allow native handling, bypassing wikitext representation, like for includable special pages.
34 * @TODO: use in parser, etc!
35 */
36 public abstract function getWikitextForTransclusion( );
37
38 /**
39 * Returns a textual representation of the content suitable for use in edit summaries and log messages.
40 *
41 * @since WD.1
42 *
43 * @param int $maxlength maximum length of the summary text
44 * @return String the summary text
45 */
46 public abstract function getTextForSummary( $maxlength = 250 );
47
48 /**
49 * Returns native represenation of the data. Interpretation depends on the data model used,
50 * as given by getDataModel().
51 *
52 * @since WD.1
53 *
54 * @return mixed the native representation of the content. Could be a string, a nested array
55 * structure, an object, a binary blob... anything, really.
56 *
57 * @NOTE: review all calls carefully, caller must be aware of content model!
58 */
59 public abstract function getNativeData( );
60
61 /**
62 * returns the content's nominal size in bogo-bytes.
63 *
64 * @return int
65 */
66 public abstract function getSize( );
67
68 /**
69 * @param int $model_id
70 */
71 public function __construct( $model_id = null ) {
72 $this->model_id = $model_id;
73 }
74
75 /**
76 * Returns the id of the content model used by this content objects.
77 * Corresponds to the CONTENT_MODEL_XXX constants.
78 *
79 * @since WD.1
80 *
81 * @return int the model id
82 */
83 public function getModel() {
84 return $this->model_id;
85 }
86
87 /**
88 * Throws an MWException if $model_id is not the id of the content model
89 * supported by this Content object.
90 *
91 * @param int $model_id the model to check
92 */
93 protected function checkModelID( $model_id ) {
94 if ( $model_id !== $this->model_id ) {
95 $model_name = ContentHandler::getContentModelName( $model_id );
96 $own_model_name = ContentHandler::getContentModelName( $this->model_id );
97
98 throw new MWException( "Bad content model: expected {$this->model_id} ($own_model_name) but got found $model_id ($model_name)." );
99 }
100 }
101
102 /**
103 * Conveniance method that returns the ContentHandler singleton for handling the content
104 * model this Content object uses.
105 *
106 * Shorthand for ContentHandler::getForContent( $this )
107 *
108 * @since WD.1
109 *
110 * @return ContentHandler
111 */
112 public function getContentHandler() {
113 return ContentHandler::getForContent( $this );
114 }
115
116 /**
117 * Conveniance method that returns the default serialization format for the content model
118 * model this Content object uses.
119 *
120 * Shorthand for $this->getContentHandler()->getDefaultFormat()
121 *
122 * @since WD.1
123 *
124 * @return ContentHandler
125 */
126 public function getDefaultFormat() {
127 return $this->getContentHandler()->getDefaultFormat();
128 }
129
130 /**
131 * Conveniance method that returns the list of serialization formats supported
132 * for the content model model this Content object uses.
133 *
134 * Shorthand for $this->getContentHandler()->getSupportedFormats()
135 *
136 * @since WD.1
137 *
138 * @return array of supported serialization formats
139 */
140 public function getSupportedFormats() {
141 return $this->getContentHandler()->getSupportedFormats();
142 }
143
144 /**
145 * Returns true if $format is a supported serialization format for this Content object,
146 * false if it isn't.
147 *
148 * Note that this will always return true if $format is null, because null stands for the
149 * default serialization.
150 *
151 * Shorthand for $this->getContentHandler()->isSupportedFormat( $format )
152 *
153 * @since WD.1
154 *
155 * @param String $format the format to check
156 * @return bool whether the format is supported
157 */
158 public function isSupportedFormat( $format ) {
159 if ( !$format ) {
160 return true; // this means "use the default"
161 }
162
163 return $this->getContentHandler()->isSupportedFormat( $format );
164 }
165
166 /**
167 * Throws an MWException if $this->isSupportedFormat( $format ) doesn't return true.
168 *
169 * @param $format
170 * @throws MWException
171 */
172 protected function checkFormat( $format ) {
173 if ( !$this->isSupportedFormat( $format ) ) {
174 throw new MWException( "Format $format is not supported for content model " . $this->getModel() );
175 }
176 }
177
178 /**
179 * Conveniance method for serializing this Content object.
180 *
181 * Shorthand for $this->getContentHandler()->serializeContent( $this, $format )
182 *
183 * @since WD.1
184 *
185 * @param null|String $format the desired serialization format (or null for the default format).
186 * @return String serialized form of this Content object
187 */
188 public function serialize( $format = null ) {
189 return $this->getContentHandler()->serializeContent( $this, $format );
190 }
191
192 /**
193 * Returns true if this Content object represents empty content.
194 *
195 * @since WD.1
196 *
197 * @return bool whether this Content object is empty
198 */
199 public function isEmpty() {
200 return $this->getSize() == 0;
201 }
202
203 /**
204 * Returns if the content is valid.
205 * It needs to be valid before it can be saved.
206 *
207 * @since WD.1
208 *
209 * @return boolean
210 */
211 public function isValid() {
212 // TODO
213 return true;
214 }
215
216 /**
217 * Diff the content object with what is currently stored in the database.
218 * If it is not currently stored, it will be diffed with an empty object.
219 *
220 * @since WD.diff
221 *
222 * @return ContentDiff
223 */
224 public function diffToDatabase() {
225 // TODO
226 }
227
228 /**
229 * Returns true if this Content objects is conceptually equivalent to the given Content object.
230 *
231 * Will returns false if $that is null.
232 * Will return true if $that === $this.
233 * Will return false if $that->getModleName() != $this->getModel().
234 * Will return false if $that->getNativeData() is not equal to $this->getNativeData(),
235 * where the meaning of "equal" depends on the actual data model.
236 *
237 * Implementations should be careful to make equals() transitive and reflexive:
238 *
239 * * $a->equals( $b ) <=> $b->equals( $b )
240 * * $a->equals( $b ) && $b->equals( $c ) ==> $a->equals( $c )
241 *
242 * @since WD.1
243 *
244 * @param Content $that the Content object to compare to
245 * @return bool true if this Content object is euqual to $that, false otherwise.
246 */
247 public function equals( Content $that = null ) {
248 if ( is_null( $that ) ){
249 return false;
250 }
251
252 if ( $that === $this ) {
253 return true;
254 }
255
256 if ( $that->getModel() !== $this->getModel() ) {
257 return false;
258 }
259
260 return $this->getNativeData() === $that->getNativeData();
261 }
262
263 /**
264 * Return a copy of this Content object. The following must be true for the object returned
265 * if $copy = $original->copy()
266 *
267 * * get_class($original) === get_class($copy)
268 * * $original->getModel() === $copy->getModel()
269 * * $original->equals( $copy )
270 *
271 * If and only if the Content object is imutable, the copy() method can and should
272 * return $this. That is, $copy === $original may be true, but only for imutable content
273 * objects.
274 *
275 * @since WD.1
276 *
277 * @return Content. A copy of this object
278 */
279 public abstract function copy( );
280
281 /**
282 * Returns true if this content is countable as a "real" wiki page, provided
283 * that it's also in a countable location (e.g. a current revision in the main namespace).
284 *
285 * @since WD.1
286 *
287 * @param $hasLinks Bool: if it is known whether this content contains links, provide this information here,
288 * to avoid redundant parsing to find out.
289 * @return boolean
290 */
291 public abstract function isCountable( $hasLinks = null ) ;
292
293 /**
294 * @param IContextSource $context
295 * @param null $revId
296 * @param null|ParserOptions $options
297 * @param Boolean $generateHtml whether to generate Html (default: true). If false,
298 * the result of calling getText() on the ParserOutput object returned by
299 * this method is undefined.
300 *
301 * @since WD.1
302 *
303 * @return ParserOutput
304 */
305 public abstract function getParserOutput( IContextSource $context, $revId = null, ParserOptions $options = NULL, $generateHtml = true );
306
307 /**
308 * Construct the redirect destination from this content and return an
309 * array of Titles, or null if this content doesn't represent a redirect.
310 * The last element in the array is the final destination after all redirects
311 * have been resolved (up to $wgMaxRedirects times).
312 *
313 * @since WD.1
314 *
315 * @return Array of Titles, with the destination last
316 */
317 public function getRedirectChain() {
318 return null;
319 }
320
321 /**
322 * Construct the redirect destination from this content and return an
323 * array of Titles, or null if this content doesn't represent a redirect.
324 * This will only return the immediate redirect target, useful for
325 * the redirect table and other checks that don't need full recursion.
326 *
327 * @since WD.1
328 *
329 * @return Title: The corresponding Title
330 */
331 public function getRedirectTarget() {
332 return null;
333 }
334
335 /**
336 * Construct the redirect destination from this content and return the
337 * Title, or null if this content doesn't represent a redirect.
338 * This will recurse down $wgMaxRedirects times or until a non-redirect target is hit
339 * in order to provide (hopefully) the Title of the final destination instead of another redirect.
340 *
341 * @since WD.1
342 *
343 * @return Title
344 */
345 public function getUltimateRedirectTarget() {
346 return null;
347 }
348
349 /**
350 * @since WD.1
351 *
352 * @return bool
353 */
354 public function isRedirect() {
355 return $this->getRedirectTarget() !== null;
356 }
357
358 /**
359 * Returns the section with the given id.
360 *
361 * The default implementation returns null.
362 *
363 * @since WD.1
364 *
365 * @param String $sectionId the section's id, given as a numeric string. The id "0" retrieves the section before
366 * the first heading, "1" the text between the first heading (inluded) and the second heading (excluded), etc.
367 * @return Content|Boolean|null the section, or false if no such section exist, or null if sections are not supported
368 */
369 public function getSection( $sectionId ) {
370 return null;
371 }
372
373 /**
374 * Replaces a section of the content and returns a Content object with the section replaced.
375 *
376 * @since WD.1
377 *
378 * @param $section empty/null/false or a section number (0, 1, 2, T1, T2...), or "new"
379 * @param $with Content: new content of the section
380 * @param $sectionTitle String: new section's subject, only if $section is 'new'
381 * @return string Complete article text, or null if error
382 */
383 public function replaceSection( $section, Content $with, $sectionTitle = '' ) {
384 return null;
385 }
386
387 /**
388 * Returns a Content object with pre-save transformations applied (or this object if no transformations apply).
389 *
390 * @since WD.1
391 *
392 * @param Title $title
393 * @param User $user
394 * @param null|ParserOptions $popts
395 * @return Content
396 */
397 public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
398 return $this;
399 }
400
401 /**
402 * Returns a new WikitextContent object with the given section heading prepended, if supported.
403 * The default implementation just returns this Content object unmodified, ignoring the section header.
404 *
405 * @since WD.1
406 *
407 * @param $header String
408 * @return Content
409 */
410 public function addSectionHeader( $header ) {
411 return $this;
412 }
413
414 /**
415 * Returns a Content object with preload transformations applied (or this object if no transformations apply).
416 *
417 * @since WD.1
418 *
419 * @param Title $title
420 * @param null|ParserOptions $popts
421 * @return Content
422 */
423 public function preloadTransform( Title $title, ParserOptions $popts ) {
424 return $this;
425 }
426
427 # TODO: handle ImagePage and CategoryPage
428 # TODO: make sure we cover lucene search / wikisearch.
429 # TODO: make sure ReplaceTemplates still works
430 # FUTURE: nice&sane integration of GeSHi syntax highlighting
431 # [11:59] <vvv> Hooks are ugly; make CodeHighlighter interface and a config to set the class which handles syntax highlighting
432 # [12:00] <vvv> And default it to a DummyHighlighter
433
434 # TODO: make sure we cover the external editor interface (does anyone actually use that?!)
435
436 # TODO: tie into API to provide contentModel for Revisions
437 # TODO: tie into API to provide serialized version and contentFormat for Revisions
438 # TODO: tie into API edit interface
439 # FUTURE: make EditForm plugin for EditPage
440 }
441 # FUTURE: special type for redirects?!
442 # FUTURE: MultipartMultipart < WikipageContent (Main + Links + X)
443 # FUTURE: LinksContent < LanguageLinksContent, CategoriesContent
444
445 /**
446 * Content object implementation for representing flat text.
447 *
448 * TextContent instances are imutable
449 *
450 * @since WD.1
451 */
452 abstract class TextContent extends Content {
453
454 public function __construct( $text, $model_id = null ) {
455 parent::__construct( $model_id );
456
457 $this->mText = $text;
458 }
459
460 public function copy() {
461 return $this; #NOTE: this is ok since TextContent are imutable.
462 }
463
464 public function getTextForSummary( $maxlength = 250 ) {
465 global $wgContLang;
466
467 $text = $this->getNativeData();
468
469 $truncatedtext = $wgContLang->truncate(
470 preg_replace( "/[\n\r]/", ' ', $text ),
471 max( 0, $maxlength ) );
472
473 return $truncatedtext;
474 }
475
476 /**
477 * returns the text's size in bytes.
478 *
479 * @return int the size
480 */
481 public function getSize( ) {
482 $text = $this->getNativeData( );
483 return strlen( $text );
484 }
485
486 /**
487 * Returns true if this content is not a redirect, and $wgArticleCountMethod is "any".
488 *
489 * @param $hasLinks Bool: if it is known whether this content contains links, provide this information here,
490 * to avoid redundant parsing to find out.
491 *
492 * @return bool true if the content is countable
493 */
494 public function isCountable( $hasLinks = null ) {
495 global $wgArticleCountMethod;
496
497 if ( $this->isRedirect( ) ) {
498 return false;
499 }
500
501 if ( $wgArticleCountMethod === 'any' ) {
502 return true;
503 }
504
505 return false;
506 }
507
508 /**
509 * Returns the text represented by this Content object, as a string.
510 *
511 * @return String the raw text
512 */
513 public function getNativeData( ) {
514 $text = $this->mText;
515 return $text;
516 }
517
518 /**
519 * Returns the text represented by this Content object, as a string.
520 *
521 * @return String the raw text
522 */
523 public function getTextForSearchIndex( ) {
524 return $this->getNativeData();
525 }
526
527 /**
528 * Returns the text represented by this Content object, as a string.
529 *
530 * @return String the raw text
531 */
532 public function getWikitextForTransclusion( ) {
533 return $this->getNativeData();
534 }
535
536 /**
537 * Returns a generic ParserOutput object, wrapping the HTML returned by getHtml().
538 *
539 * @return ParserOutput representing the HTML form of the text
540 */
541 public function getParserOutput( IContextSource $context, $revId = null, ParserOptions $options = null, $generateHtml = true ) {
542 # generic implementation, relying on $this->getHtml()
543
544 if ( $generateHtml ) $html = $this->getHtml( $options );
545 else $html = '';
546
547 $po = new ParserOutput( $html );
548
549 return $po;
550 }
551
552 protected abstract function getHtml( );
553
554 }
555
556 /**
557 * @since WD.1
558 */
559 class WikitextContent extends TextContent {
560
561 public function __construct( $text ) {
562 parent::__construct($text, CONTENT_MODEL_WIKITEXT);
563 }
564
565 protected function getHtml( ) {
566 throw new MWException( "getHtml() not implemented for wikitext. Use getParserOutput()->getText()." );
567 }
568
569 /**
570 * Returns a ParserOutput object resulting from parsing the content's text using $wgParser.
571 *
572 * @since WikiData1
573 *
574 * @param IContextSource|null $context
575 * @param null $revId
576 * @param null|ParserOptions $options
577 * @param bool $generateHtml
578 *
579 * @return ParserOutput representing the HTML form of the text
580 */
581 public function getParserOutput( IContextSource $context, $revId = null, ParserOptions $options = null, $generateHtml = true ) {
582 global $wgParser;
583
584 if ( !$options ) {
585 $options = ParserOptions::newFromUserAndLang( $context->getUser(), $context->getLanguage() );
586 }
587
588 $po = $wgParser->parse( $this->mText, $context->getTitle(), $options, true, true, $revId );
589
590 return $po;
591 }
592
593 /**
594 * Returns the section with the given id.
595 *
596 * @param String $sectionId the section's id
597 * @return Content|false|null the section, or false if no such section exist, or null if sections are not supported
598 */
599 public function getSection( $section ) {
600 global $wgParser;
601
602 $text = $this->getNativeData();
603 $sect = $wgParser->getSection( $text, $section, false );
604
605 return new WikitextContent( $sect );
606 }
607
608 /**
609 * Replaces a section in the wikitext
610 *
611 * @param $section empty/null/false or a section number (0, 1, 2, T1, T2...), or "new"
612 * @param $with Content: new content of the section
613 * @param $sectionTitle String: new section's subject, only if $section is 'new'
614 * @return Content Complete article content, or null if error
615 */
616 public function replaceSection( $section, Content $with, $sectionTitle = '' ) {
617 wfProfileIn( __METHOD__ );
618
619 $myModelId = $this->getModel();
620 $sectionModelId = $with->getModel();
621
622 if ( $sectionModelId != $myModelId ) {
623 $myModelName = ContentHandler::getContentModelName( $myModelId );
624 $sectionModelName = ContentHandler::getContentModelName( $sectionModelId );
625
626 throw new MWException( "Incompatible content model for section: document uses $myModelId ($myModelName), "
627 . "section uses $sectionModelId ($sectionModelName)." );
628 }
629
630 $oldtext = $this->getNativeData();
631 $text = $with->getNativeData();
632
633 if ( $section === '' ) {
634 return $with; #XXX: copy first?
635 } if ( $section == 'new' ) {
636 # Inserting a new section
637 $subject = $sectionTitle ? wfMsgForContent( 'newsectionheaderdefaultlevel', $sectionTitle ) . "\n\n" : '';
638 if ( wfRunHooks( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) {
639 $text = strlen( trim( $oldtext ) ) > 0
640 ? "{$oldtext}\n\n{$subject}{$text}"
641 : "{$subject}{$text}";
642 }
643 } else {
644 # Replacing an existing section; roll out the big guns
645 global $wgParser;
646
647 $text = $wgParser->replaceSection( $oldtext, $section, $text );
648 }
649
650 $newContent = new WikitextContent( $text );
651
652 wfProfileOut( __METHOD__ );
653 return $newContent;
654 }
655
656 /**
657 * Returns a new WikitextContent object with the given section heading prepended.
658 *
659 * @param $header String
660 * @return Content
661 */
662 public function addSectionHeader( $header ) {
663 $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $header ) . "\n\n" . $this->getNativeData();
664
665 return new WikitextContent( $text );
666 }
667
668 /**
669 * Returns a Content object with pre-save transformations applied (or this object if no transformations apply).
670 *
671 * @param Title $title
672 * @param User $user
673 * @param ParserOptions $popts
674 * @return Content
675 */
676 public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
677 global $wgParser, $wgConteLang;
678
679 $text = $this->getNativeData();
680 $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
681
682 return new WikitextContent( $pst );
683 }
684
685 /**
686 * Returns a Content object with preload transformations applied (or this object if no transformations apply).
687 *
688 * @param Title $title
689 * @param ParserOptions $popts
690 * @return Content
691 */
692 public function preloadTransform( Title $title, ParserOptions $popts ) {
693 global $wgParser, $wgConteLang;
694
695 $text = $this->getNativeData();
696 $plt = $wgParser->getPreloadText( $text, $title, $popts );
697
698 return new WikitextContent( $plt );
699 }
700
701 public function getRedirectChain() {
702 $text = $this->getNativeData();
703 return Title::newFromRedirectArray( $text );
704 }
705
706 public function getRedirectTarget() {
707 $text = $this->getNativeData();
708 return Title::newFromRedirect( $text );
709 }
710
711 public function getUltimateRedirectTarget() {
712 $text = $this->getNativeData();
713 return Title::newFromRedirectRecurse( $text );
714 }
715
716 /**
717 * Returns true if this content is not a redirect, and this content's text is countable according to
718 * the criteria defiend by $wgArticleCountMethod.
719 *
720 * @param Bool $hasLinks if it is known whether this content contains links, provide this information here,
721 * to avoid redundant parsing to find out.
722 * @param IContextSource $context context for parsing if necessary
723 *
724 * @return bool true if the content is countable
725 */
726 public function isCountable( $hasLinks = null, IContextSource $context = null ) {
727 global $wgArticleCountMethod, $wgRequest;
728
729 if ( $this->isRedirect( ) ) {
730 return false;
731 }
732
733 $text = $this->getNativeData();
734
735 switch ( $wgArticleCountMethod ) {
736 case 'any':
737 return true;
738 case 'comma':
739 return strpos( $text, ',' ) !== false;
740 case 'link':
741 if ( $hasLinks === null ) { # not known, find out
742 if ( !$context ) { # make dummy context
743 //XXX: caller of this method often knows the title, but not a context...
744 $context = new RequestContext( $wgRequest );
745 }
746
747 $po = $this->getParserOutput( $context, null, null, false );
748 $links = $po->getLinks();
749 $hasLinks = !empty( $links );
750 }
751
752 return $hasLinks;
753 }
754 }
755
756 public function getTextForSummary( $maxlength = 250 ) {
757 $truncatedtext = parent::getTextForSummary( $maxlength );
758
759 #clean up unfinished links
760 #XXX: make this optional? wasn't there in autosummary, but required for deletion summary.
761 $truncatedtext = preg_replace( '/\[\[([^\]]*)\]?$/', '$1', $truncatedtext );
762
763 return $truncatedtext;
764 }
765
766 }
767
768 /**
769 * @since WD.1
770 */
771 class MessageContent extends TextContent {
772 public function __construct( $msg_key, $params = null, $options = null ) {
773 parent::__construct(null, CONTENT_MODEL_WIKITEXT); #XXX: messages may be wikitext, html or plain text! and maybe even something else entirely.
774
775 $this->mMessageKey = $msg_key;
776
777 $this->mParameters = $params;
778
779 if ( is_null( $options ) ) {
780 $options = array();
781 }
782 elseif ( is_string( $options ) ) {
783 $options = array( $options );
784 }
785
786 $this->mOptions = $options;
787
788 $this->mHtmlOptions = null;
789 }
790
791 /**
792 * Returns the message as rendered HTML, using the options supplied to the constructor plus "parse".
793 */
794 protected function getHtml( ) {
795 $opt = array_merge( $this->mOptions, array('parse') );
796
797 return wfMsgExt( $this->mMessageKey, $this->mParameters, $opt );
798 }
799
800
801 /**
802 * Returns the message as raw text, using the options supplied to the constructor minus "parse" and "parseinline".
803 */
804 public function getNativeData( ) {
805 $opt = array_diff( $this->mOptions, array('parse', 'parseinline') );
806
807 return wfMsgExt( $this->mMessageKey, $this->mParameters, $opt );
808 }
809
810 }
811
812 /**
813 * @since WD.1
814 */
815 class JavaScriptContent extends TextContent {
816 public function __construct( $text ) {
817 parent::__construct($text, CONTENT_MODEL_JAVASCRIPT);
818 }
819
820 protected function getHtml( ) {
821 $html = "";
822 $html .= "<pre class=\"mw-code mw-js\" dir=\"ltr\">\n";
823 $html .= htmlspecialchars( $this->getNativeData() );
824 $html .= "\n</pre>\n";
825
826 return $html;
827 }
828
829 }
830
831 /**
832 * @since WD.1
833 */
834 class CssContent extends TextContent {
835 public function __construct( $text ) {
836 parent::__construct($text, CONTENT_MODEL_CSS);
837 }
838
839 protected function getHtml( ) {
840 $html = "";
841 $html .= "<pre class=\"mw-code mw-css\" dir=\"ltr\">\n";
842 $html .= htmlspecialchars( $this->getNativeData() );
843 $html .= "\n</pre>\n";
844
845 return $html;
846 }
847 }