text:
<?php

class Ess_M2ePro_Block_Adminhtml_Amazon_Template_Description_Category_Specific_Add_Grid
    extends Mage_Adminhtml_Block_Widget_Grid
{
    public $marketplaceId;
    public $productDataNick;

    public $currentXpath;

    public $searchQuery;
    public $onlyDesired = false;

    public $selectedSpecifics = array();

    public $allRenderedSpecifics = array();
    public $blockRenderedSpecifics = array();

    //########################################

    public function __construct()
    {
        parent::__construct();

        // Initialization block
        // ---------------------------------------
        $this->setId('amazonTemplateDescriptionCategorySpecificAddGrid');
        // ---------------------------------------

        // Set default values
        // ---------------------------------------
        $this->setFilterVisibility(false);
        $this->setPagerVisibility(false);
        $this->setDefaultSort('id');
        $this->setDefaultDir('ASC');
        $this->setSaveParametersInSession(true);
        $this->setUseAjax(true);
        // ---------------------------------------
    }

    //########################################

    protected function _prepareCollection()
    {
        /** @var $connRead Varien_Db_Adapter_Pdo_Mysql */
        $connRead = Mage::getSingleton('core/resource')->getConnection('core_read');

        $select = $connRead->select()
            ->from(
                Mage::helper('M2ePro/Module_Database_Structure')
                      ->getTableNameWithPrefix('m2epro_amazon_dictionary_specific')
            )
              ->where('marketplace_id = ?', (int)$this->marketplaceId)
              ->where('product_data_nick = ?', $this->productDataNick)
              ->where('type != ?', Ess_M2ePro_Model_Amazon_Template_Description_Specific::DICTIONARY_TYPE_CONTAINER)
              ->where('xpath LIKE ?', "{$this->currentXpath}/%")
              ->order('title ASC');

        if ($this->searchQuery) {
            $select->where('title LIKE ? OR xml_tag LIKE ?', "%{$this->searchQuery}%");
        }

        $filteredResult = array();

        $queryStmt = $select->query();
        while ($row = $queryStmt->fetch()) {
            if (in_array($row['xpath'], $this->selectedSpecifics, true)) {
                continue;
            }

            if (in_array($row['xpath'], $this->allRenderedSpecifics, true)) {
                // an already rendered specific can be added again only to parent container directly
                if (str_replace($this->currentXpath . '/', '', $row['xpath']) !== $row['xml_tag']) {
                    continue;
                }

                if (in_array($row['xpath'], $this->blockRenderedSpecifics, true)) {
                    continue;
                }
            }

            $row['data_definition'] = (array)Mage::helper('M2ePro')->jsonDecode($row['data_definition']);
            $row['is_desired'] = !empty($row['data_definition']['is_desired']) && $row['data_definition']['is_desired'];

            if ($this->onlyDesired && !$row['is_desired']) {
                continue;
            }

            $filteredResult[] = $row;
        }

        usort(
            $filteredResult, function($a, $b) {

            if ($a['is_desired'] && !$b['is_desired']) {
                return -1;
            }

            if ($b['is_desired'] && !$a['is_desired']) {
                return 1;
            }

            return $a['title'] == $b['title'] ? 0 : ($a['title'] > $b['title'] ? 1 : -1);
            }
        );

        $collection = new Varien_Data_Collection();
        foreach ($filteredResult as $item) {
            $collection->addItem(new Varien_Object($item));
        }

        $this->setCollection($collection);

        return parent::_prepareCollection();
    }

    protected function _prepareColumns()
    {
        $this->addColumn(
            'title', array(
            'header'         => Mage::helper('M2ePro')->__('Specific'),
            'align'          => 'left',
            'type'           => 'text',
            'index'          => 'title',
            'width'          => '700px',
            'filter'         => false,
            'sortable'       => false,
            'frame_callback' => array($this, 'callbackColumnTitle')
            )
        );

        $this->addColumn(
            'is_desired', array(
            'header'         => Mage::helper('M2ePro')->__('Desired'),
            'align'          => 'center',
            'type'           => 'text',
            'index'          => 'is_desired',
            'width'          => '80px',
            'filter'         => false,
            'sortable'       => false,
            'frame_callback' => array($this, 'callbackColumnIsDesired')
            )
        );

        $this->addColumn(
            'actions', array(
            'header'         => Mage::helper('M2ePro')->__('Action'),
            'align'          => 'center',
            'type'           => 'text',
            'width'          => '80px',
            'filter'         => false,
            'sortable'       => false,
            'frame_callback' => array($this, 'callbackColumnActions'),
            )
        );
    }

    //########################################

    public function callbackColumnTitle($title, $row, $column, $isExport)
    {
        strlen($title) > 60 && $title = substr($title, 0, 60) . '...';
        $title = Mage::helper('M2ePro')->escapeHtml($title);

        $path = explode('/', ltrim($row->getData('xpath'), '/'));
        array_pop($path);
        $path = implode(' > ', $path);
        $path = Mage::helper('M2ePro')->escapeHtml($path);

        $fullPath = $path;
        strlen($path) > 135 && $path = substr($path, 0, 135) . '...';

        $foundInWord = Mage::helper('M2ePro')->__('Found In');

        return <<<HTML

getData('xpath')}"
   xml_tag = {$row->getData('xml_tag')}>{$title}

{$foundInWord}:
{$path}

HTML;
    }

    public function callbackColumnIsDesired($value, $row, $column, $isExport)
    {
        return $value ? Mage::helper('M2ePro')->__('Yes') : Mage::helper('M2ePro')->__('No');
    }

    public function callbackColumnActions($value, $row, $column, $isExport)
    {
        $select = Mage::helper('M2ePro')->__('Select');
        return <<<HTML
getData('xpath')}
                                                                 xml_tag = {$row->getData('xml_tag')}>
{$select}

HTML;
    }

    //########################################

    public function setMarketplaceId($marketplaceId)
    {
        $this->marketplaceId = $marketplaceId;
        return $this;
    }

    public function setProductDataNick($productDataNick)
    {
        $this->productDataNick = $productDataNick;
        return $this;
    }

    public function setCurrentXpath($indexedXpath)
    {
        $this->currentXpath = preg_replace('/-\d+/', '', $indexedXpath);
        return $this;
    }

    public function setAllRenderedSpecifics(array $specifics)
    {
        $this->allRenderedSpecifics = $this->replaceWithDictionaryXpathes($specifics);
        return $this;
    }

    public function setBlockRenderedSpecifics(array $specifics)
    {
        $this->blockRenderedSpecifics = $this->replaceWithDictionaryXpathes($specifics);
        return $this;
    }

    public function setSelectedSpecifics(array $specifics)
    {
        $this->selectedSpecifics = $this->replaceWithDictionaryXpathes($specifics);
        return $this;
    }

    public function setOnlyDesired($value)
    {
        $this->onlyDesired = $value;
        return $this;
    }

    public function setSearchQuery($searchQuery)
    {
        $this-> searchQuery = $searchQuery;
        return $this;
    }

    // ---------------------------------------

    protected function replaceWithDictionaryXpathes(array $xPathes)
    {
        return array_map(
            function($el) {
            return preg_replace('/-\d+/', '', $el);
            }, $xPathes
        );
    }

    //########################################

    public function getGridUrl()
    {
        return false;
    }

    public function getRowUrl($row)
    {
        return false;
    }

    //########################################
}


text:
<?php echo $html_heading; echo $header;?>

<?php echo $common_how_it_works;?>
<?php echo $feedback;?>

                        <?php /*
Hello. What can we help you with?

                                            Your Orders

Track your packages

Edit or cancel orders

                                            Returns and refunds

Track your packages

Edit or cancel orders

                                            Your Orders

Track your packages

Edit or cancel orders

                                            Your Orders

Track your packages

Edit or cancel orders

                                            Your Orders

Track your packages

Edit or cancel orders

                                            Your Orders

Track your packages

Edit or cancel orders

                        */ /* ?>

Can't find what you need?

                                  <input type="text" class="form-control" placeholder="Search for solutions...">
                                  Go

                        */?>

Browse Help topics

                                        <?php $i=0;
                                        foreach ($helpTopicsArr As $k):
                                            $tabTitle=  str_replace(" ","", $k->helpTopics);?>
                                          <li role="presentation" <?php if($i==0){?>class="active"<?php }?>>
                                              <a href="#<?php echo $tabTitle;?>" aria-controls="<?php echo $tabTitle;?>" role="tab" data-toggle="tab" data-topicsid="<?php echo $k->helpTopicsId;?>" class="showHelpTopicContent"><?php echo $k->helpTopics;?>

                                        <?php $i++; endforeach;?>

                                            <?php $k=$helpTopicsArr[0];
                                                $tabTitle=  str_replace(" ","", $k->helpTopics);?>
                                            <div role="tabpanel" class="tab-pane active" id="<?php echo $tabTitle;?>">

 <?php echo $k->helpTopics;?>

                                                            <?php foreach($helpDataArr AS $key => $k){?>

                                                                    <a role="button" data-toggle="collapse" style="text-decoration: none;cursor: pointer;" data-parent="#accordion" href="#collapse<?=$key;?>" aria-expanded="true" aria-controls="collapseOne">
                                                                           <?php echo $k->question;?>

                                                              <div id="collapse<?=$key;?>" class="panel-collapse collapse <?php if($key==0){ echo 'in';}?>" role="tabpanel" aria-labelledby="headingOne">

                                                                  <?php echo $k->answer;?>

                                                            <?php }?>

 Are you want more help ?

                                    <button class="btn btn-info" data-toggle="modal" data-target="#exampleModal">Submit your query </button>

            <form action="<?php echo BASE_URL.'index/submit_help_query/';?>" name="help-form" class="help-form" id="wtil-cms-form" method="post">

                <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Want to get more info ?

                        Choose your topic:

                        <?php if($questions):?>
                            <select name="help_subject" class="form-control" id="help-subject">
                                <?php foreach($questions as $q):?>
                                <option value="<?=$q?>"><?=$q?></option>
                                <?php endforeach;?>
                            </select>
                        <?php else:?>
                            <input class="form-control" name="help_subject" id="help_subject">
                        <?php endif;?>

                        Name:
                        <input class="form-control" name="name" id="help_name">

                        Email:
                        <input class="form-control" name="email" id="help_email">

                        Phone Number:
                        <input class="form-control" name="phone" id="help_phone">

                        Type your query here:
                        <textarea class="form-control" name="help_message" id="message-text"></textarea>

                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <input type="submit" class="btn btn-primary" name="wtil-post-submit" value="Send us now!">

Processing...

Our customer care executive with you for 24X7 . Happy visiting!

            </form>

<?php echo $footer;?>

redpajama_set_name: RedPajamaGithub


text:
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _jsxRuntime = require("../../lib/jsxRuntime");

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));

var _objectSpread7 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var React = _interopRequireWildcard(require("react"));

var _classNames = require("../../lib/classNames");

var _supportEvents = require("../../lib/supportEvents");

var _getClassName = require("../../helpers/getClassName");

var _platform = require("../../lib/platform");

var _Touch = require("../Touch/Touch");

var _withPlatform = require("../../hoc/withPlatform");

var _withContext = require("../../hoc/withContext");

var _ConfigProviderContext = require("../ConfigProvider/ConfigProviderContext");

var _SplitCol = require("../SplitCol/SplitCol");

var _AppRootPortal = require("../AppRoot/AppRootPortal");

var _dom = require("../../lib/dom");

var _ScrollContext = require("../AppRoot/ScrollContext");

var _NavTransitionContext = require("../NavTransitionContext/NavTransitionContext");

var _getNavId = require("../../lib/getNavId");

var _warnOnce = require("../../lib/warnOnce");

var _utils = require("./utils");

var _excluded = ["popout", "modal", "platform", "activePanel", "splitCol", "configProvider", "history", "id", "nav", "onTransition", "onSwipeBack", "onSwipeBackStart", "onSwipeBackCancel", "window", "document", "scroll", "isBackCheck"];
var warn = (0, _warnOnce.warnOnce)("ViewInfinite");
var SwipeBackResults;

(function (SwipeBackResults) {
  SwipeBackResults[SwipeBackResults["fail"] = 1] = "fail";
  SwipeBackResults[SwipeBackResults["success"] = 2] = "success";
})(SwipeBackResults || (SwipeBackResults = {}));

var scrollsCache = {};

var ViewInfinite = /*#__PURE__*/function (_React$Component) {
  (0, _inherits2.default)(ViewInfinite, _React$Component);

  var _super = (0, _createSuper2.default)(ViewInfinite);

  function ViewInfinite(props) {
    var _this;

    (0, _classCallCheck2.default)(this, ViewInfinite);
    _this = _super.call(this, props);
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scrolls", scrollsCache[(0, _getNavId.getNavId)(_this.props, warn)] || {});
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "transitionFinishTimeout", void 0);
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "animationFinishTimeout", void 0);
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "panelNodes", {});
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "transitionEndHandler", function (e) {
      if (!e || ["vkui-animation-ios-next-forward", "vkui-animation-ios-prev-back", "vkui-animation-view-next-forward", "vkui-animation-view-prev-back"].includes(e.animationName)) {
        _this.flushTransition(_this.state.prevPanel, _this.state.isBack);
      }
    });
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "swipingBackTransitionEndHandler", function (e) {
      // indexOf because of vendor prefixes in old browsers
      if (!e || e.propertyName.includes("transform") && e.target === _this.pickPanel(_this.state.swipeBackNextPanel)) {
        switch (_this.state.swipeBackResult) {
          case SwipeBackResults.fail:
            _this.onSwipeBackCancel();

            break;

          case SwipeBackResults.success:
            _this.onSwipeBackSuccess();

        }
      }
    });
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMoveX", function (e) {
      if ((0, _utils.swipeBackExcluded)(e)) {
        return;
      }

      var _this$props = _this.props,
          platform = _this$props.platform,
          configProvider = _this$props.configProvider;

      if (platform === _platform.IOS && !configProvider.isWebView && (e.startX <= 70 || e.startX >= _this.window.innerWidth - 70) && !_this.state.browserSwipe) {
        _this.setState({
          browserSwipe: true
        });
      }

      if (platform === _platform.IOS && configProvider.isWebView && _this.props.onSwipeBack) {
        if (_this.state.animated && e.startX <= 70) {
          return;
        }

        if (e.startX <= 70 && !_this.state.swipingBack && _this.props.history.length > 1) {
          var prevScrolls = _this.scrolls[_this.state.activePanel] || [];
          _this.scrolls = (0, _objectSpread7.default)((0, _objectSpread7.default)({}, _this.scrolls), {}, (0, _defineProperty2.default)({}, _this.state.activePanel, [].concat((0, _toConsumableArray2.default)(prevScrolls), [_this.props.scroll.getScroll().y])));

          _this.setState({
            swipingBack: true,
            swipebackStartX: e.startX,
            swipeBackPrevPanel: _this.state.activePanel,
            swipeBackNextPanel: _this.props.history.slice(-2)[0]
          });
        }

        if (_this.state.swipingBack) {
          var swipeBackShift;

          if (e.shiftX < 0) {
            swipeBackShift = 0;
          } else if (e.shiftX > _this.window.innerWidth - _this.state.swipebackStartX) {
            swipeBackShift = _this.window.innerWidth;
          } else {
            swipeBackShift = e.shiftX;
          }

          _this.setState({
            swipeBackShift: swipeBackShift
          });
        }
      }
    });
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onEnd", function (e) {
      if (_this.state.swipingBack) {
        var speed = _this.state.swipeBackShift / e.duration * 1000;

        if (_this.state.swipeBackShift === 0) {
          _this.onSwipeBackCancel();
        } else if (_this.state.swipeBackShift >= _this.window.innerWidth) {
          _this.onSwipeBackSuccess();
        } else if (speed > 250 || _this.state.swipebackStartX + _this.state.swipeBackShift > _this.window.innerWidth / 2) {
          _this.setState({
            swipeBackResult: SwipeBackResults.success
          });
        } else {
          _this.setState({
            swipeBackResult: SwipeBackResults.fail
          });
        }
      }
    });
    _this.state = {
      animated: false,
      visiblePanels: [props.activePanel],
      activePanel: props.activePanel,
      isBack: undefined,
      prevPanel: null,
      nextPanel: null,
      swipingBack: false,
      swipebackStartX: 0,
      swipeBackShift: 0,
      swipeBackNextPanel: null,
      swipeBackPrevPanel: null,
      swipeBackResult: null,
      browserSwipe: false
    };
    return _this;
  }

  (0, _createClass2.default)(ViewInfinite, [{
    key: "document",
    get: function get() {
      return this.props.document;
    }
  }, {
    key: "window",
    get: function get() {
      return this.props.window;
    }
  }, {
    key: "panels",
    get: function get() {
      return React.Children.toArray(this.props.children);
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      var id = (0, _getNavId.getNavId)(this.props);

      if (id) {
        scrollsCache[id] = this.scrolls;
      }
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      var _this2 = this;

      this.props.popout && !prevProps.popout && this.blurActiveElement();
      this.props.modal && !prevProps.modal && this.blurActiveElement(); // Нужен переход

      if (prevProps.activePanel !== this.props.activePanel && !prevState.swipingBack && !prevState.browserSwipe) {
        var isBack = false;

        if (this.props.isBackCheck) {
          isBack = this.props.isBackCheck({
            from: prevProps.activePanel,
            to: this.props.activePanel
          });
        } else {
          var firstLayerId = this.panels.map(function (panel) {
            return (0, _getNavId.getNavId)(panel.props, warn);
          }).find(function (id) {
            return id === prevProps.activePanel || id === _this2.props.activePanel;
          });
          isBack = firstLayerId === this.props.activePanel;
        }

        this.blurActiveElement();
        var prevScrolls = this.scrolls[prevProps.activePanel] || [];
        var scrolls = (0, _objectSpread7.default)((0, _objectSpread7.default)({}, this.scrolls), {}, (0, _defineProperty2.default)({}, prevProps.activePanel, [].concat((0, _toConsumableArray2.default)(prevScrolls), [this.props.scroll.getScroll().y])));
        this.scrolls = scrolls;

        if (this.shouldDisableTransitionMotion()) {
          this.flushTransition(prevProps.activePanel, isBack);
        } else {
          this.setState({
            visiblePanels: [prevProps.activePanel, this.props.activePanel],
            prevPanel: prevProps.activePanel,
            nextPanel: this.props.activePanel,
            activePanel: null,
            animated: true,
            isBack: isBack
          }); // Фолбек анимации перехода

          if (!_supportEvents.animationEvent.supported) {
            clearTimeout(this.animationFinishTimeout);
            this.animationFinishTimeout = setTimeout(this.transitionEndHandler, this.props.platform === _platform.ANDROID || this.props.platform === _platform.VKCOM ? 300 : 600);
          }
        }
      } // Закончилась анимация свайпа назад

      if (prevProps.activePanel !== this.props.activePanel && prevState.swipingBack) {
        var _objectSpread4;

        var nextPanel = this.state.swipeBackNextPanel;
        var prevPanel = this.state.swipeBackPrevPanel;
        var prevPanelScrolls = (0, _toConsumableArray2.default)(this.scrolls[prevPanel] || []).slice(0, -1);
        var newPanelScrolls = (0, _toConsumableArray2.default)(this.scrolls[nextPanel] || []);
        var scrollPosition = newPanelScrolls.pop();
        this.scrolls = (0, _objectSpread7.default)((0, _objectSpread7.default)({}, this.scrolls), {}, (_objectSpread4 = {}, (0, _defineProperty2.default)(_objectSpread4, nextPanel, newPanelScrolls), (0, _defineProperty2.default)(_objectSpread4, prevPanel, prevPanelScrolls), _objectSpread4));
        this.setState({
          swipeBackPrevPanel: null,
          swipeBackNextPanel: null,
          swipingBack: false,
          swipeBackResult: null,
          swipebackStartX: 0,
          swipeBackShift: 0,
          activePanel: nextPanel,
          visiblePanels: [nextPanel]
        }, function () {
          _this2.props.scroll.scrollTo(0, scrollPosition);

          prevProps.onTransition && prevProps.onTransition({
            isBack: true,
            from: prevPanel,
            to: nextPanel
          });
        });
      } // Начался свайп назад

      if (!prevState.swipingBack && this.state.swipingBack) {
        this.props.onSwipeBackStart && this.props.onSwipeBackStart();
      } // Началась анимация завершения свайпа назад.

      if (!prevState.swipeBackResult && this.state.swipeBackResult) {
        this.waitTransitionFinish(this.pickPanel(this.state.swipeBackNextPanel), this.swipingBackTransitionEndHandler);
      } // Если свайп назад отменился (когда пользователь недостаточно сильно свайпнул)

      if (prevState.swipeBackResult === SwipeBackResults.fail && !this.state.swipeBackResult) {
        var _newPanelScrolls = (0, _toConsumableArray2.default)(this.scrolls[this.state.activePanel] || []);

        var _scrollPosition = _newPanelScrolls.pop();

        this.scrolls = (0, _objectSpread7.default)((0, _objectSpread7.default)({}, this.scrolls), {}, (0, _defineProperty2.default)({}, this.state.activePanel, _newPanelScrolls));
        this.props.scroll.scrollTo(0, _scrollPosition);
      } // Закончился Safari свайп

      if (prevProps.activePanel !== this.props.activePanel && this.state.browserSwipe) {
        this.setState({
          browserSwipe: false,
          nextPanel: null,
          prevPanel: null,
          animated: false,
          visiblePanels: [this.props.activePanel],
          activePanel: this.props.activePanel
        });
      }
    }
  }, {
    key: "shouldDisableTransitionMotion",
    value: function shouldDisableTransitionMotion() {
      return this.props.configProvider.transitionMotionEnabled === false || !this.props.splitCol.animate;
    }
  }, {
    key: "waitTransitionFinish",
    value: function waitTransitionFinish(elem, eventHandler) {
      if (_supportEvents.transitionEvent.supported) {
        elem.removeEventListener(_supportEvents.transitionEvent.name, eventHandler);
        elem.addEventListener(_supportEvents.transitionEvent.name, eventHandler);
      } else {
        clearTimeout(this.transitionFinishTimeout);
        this.transitionFinishTimeout = setTimeout(eventHandler, this.props.platform === _platform.ANDROID || this.props.platform === _platform.VKCOM ? 300 : 600);
      }
    }
  }, {
    key: "blurActiveElement",
    value: function blurActiveElement() {
      if (typeof this.window !== "undefined" && this.document.activeElement) {
        this.document.activeElement.blur();
      }
    }
  }, {
    key: "pickPanel",
    value: function pickPanel(id) {
      return this.panelNodes[id];
    }
  }, {
    key: "flushTransition",
    value: function flushTransition(prevPanel, isBack) {
      var _this3 = this;

      var activePanel = this.props.activePanel;
      var prevPanelScrolls = (0, _toConsumableArray2.default)(this.scrolls[prevPanel] || []).slice(0, -1);
      var newPanelScrolls = (0, _toConsumableArray2.default)(this.scrolls[activePanel] || []);
      var scrollPosition = isBack ? newPanelScrolls.pop() : 0;

      if (isBack) {
        var _objectSpread6;

        this.scrolls = (0, _objectSpread7.default)((0, _objectSpread7.default)({}, this.scrolls), {}, (_objectSpread6 = {}, (0, _defineProperty2.default)(_objectSpread6, prevPanel, prevPanelScrolls), (0, _defineProperty2.default)(_objectSpread6, activePanel, newPanelScrolls), _objectSpread6));
      }

      this.setState({
        prevPanel: null,
        nextPanel: null,
        visiblePanels: [activePanel],
        activePanel: activePanel,
        animated: false,
        isBack: undefined
      }, function () {
        _this3.props.scroll.scrollTo(0, isBack ? scrollPosition : 0);

        _this3.props.onTransition && _this3.props.onTransition({
          isBack: isBack,
          from: prevPanel,
          to: activePanel
        });
      });
    }
  }, {
    key: "onSwipeBackSuccess",
    value: function onSwipeBackSuccess() {
      this.props.onSwipeBack && this.props.onSwipeBack();
    }
  }, {
    key: "onSwipeBackCancel",
    value: function onSwipeBackCancel() {
      this.props.onSwipeBackCancel && this.props.onSwipeBackCancel();
      this.setState({
        swipeBackPrevPanel: null,
        swipeBackNextPanel: null,
        swipingBack: false,
        swipeBackResult: null,
        swipebackStartX: 0,
        swipeBackShift: 0
      });
    }
  }, {
    key: "calcPanelSwipeStyles",
    value: function calcPanelSwipeStyles(panelId) {
      if (!_dom.canUseDOM) {
        return {};
      }

      var isPrev = panelId === this.state.swipeBackPrevPanel;
      var isNext = panelId === this.state.swipeBackNextPanel;

      if (!isPrev && !isNext || this.state.swipeBackResult) {
        return {};
      }

      var prevPanelTranslate = "".concat(this.state.swipeBackShift, "px");
      var nextPanelTranslate = "".concat(-50 + this.state.swipeBackShift * 100 / this.window.innerWidth / 2, "%");
      var prevPanelShadow = 0.3 * (this.window.innerWidth - this.state.swipeBackShift) / this.window.innerWidth;

      if (this.state.swipeBackResult) {
        return isPrev ? {
          boxShadow: "-2px 0 12px rgba(0, 0, 0, ".concat(prevPanelShadow, ")")
        } : {};
      }

      if (isNext) {
        return {
          transform: "translate3d(".concat(nextPanelTranslate, ", 0, 0)"),
          WebkitTransform: "translate3d(".concat(nextPanelTranslate, ", 0, 0)")
        };
      }

      if (isPrev) {
        return {
          transform: "translate3d(".concat(prevPanelTranslate, ", 0, 0)"),
          WebkitTransform: "translate3d(".concat(prevPanelTranslate, ", 0, 0)"),
          boxShadow: "-2px 0 12px rgba(0, 0, 0, ".concat(prevPanelShadow, ")")
        };
      }

      return {};
    }
  }, {
    key: "render",
    value: function render() {
      var _this4 = this;

      var _this$props2 = this.props,
          popout = _this$props2.popout,
          modal = _this$props2.modal,
          platform = _this$props2.platform,
          _1 = _this$props2.activePanel,
          splitCol = _this$props2.splitCol,
          configProvider = _this$props2.configProvider,
          history = _this$props2.history,
          id = _this$props2.id,
          nav = _this$props2.nav,
          onTransition = _this$props2.onTransition,
          onSwipeBack = _this$props2.onSwipeBack,
          onSwipeBackStart = _this$props2.onSwipeBackStart,
          onSwipeBackCancel = _this$props2.onSwipeBackCancel,
          window = _this$props2.window,
          document = _this$props2.document,
          scroll = _this$props2.scroll,
          isBackCheck = _this$props2.isBackCheck,
          restProps = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
      var _this$state = this.state,
          prevPanel = _this$state.prevPanel,
          nextPanel = _this$state.nextPanel,
          activePanel = _this$state.activePanel,
          isBack = _this$state.isBack,
          animated = _this$state.animated,
          swipeBackPrevPanel = _this$state.swipeBackPrevPanel,
          swipeBackNextPanel = _this$state.swipeBackNextPanel,
          swipeBackResult = _this$state.swipeBackResult,
          swipingBack = _this$state.swipingBack;
      var hasPopout = !!popout;
      var hasModal = !!modal;
      var panels = this.panels.filter(function (panel) {
        var panelId = (0, _getNavId.getNavId)(panel.props, warn);
        return _this4.state.visiblePanels.includes(panelId) || panelId === swipeBackPrevPanel || panelId === swipeBackNextPanel;
      }).sort(function (panel) {
        var panelId = (0, _getNavId.getNavId)(panel.props, warn);
        var isPrevPanel = panelId === prevPanel || panelId === swipeBackPrevPanel;
        var isNextPanel = panelId === nextPanel || panelId === swipeBackNextPanel;

        if (isNextPanel) {
          return swipingBack || _this4.state.isBack ? -1 : 1;
        }

        if (isPrevPanel) {
          return swipingBack || _this4.state.isBack ? 1 : -1;
        }

        return 0;
      });
      var disableAnimation = this.shouldDisableTransitionMotion();
      var modifiers = {
        "View--animated": !disableAnimation && this.state.animated,
        "View--swiping-back": !disableAnimation && this.state.swipingBack,
        "View--no-motion": disableAnimation
      };
      return (0, _jsxRuntime.createScopedElement)(_Touch.Touch, (0, _extends2.default)({
        Component: "section"
      }, restProps, {
        vkuiClass: (0, _classNames.classNames)((0, _getClassName.getClassName)("View", platform), modifiers),
        onMoveX: this.onMoveX,
        onEnd: this.onEnd
      }), (0, _jsxRuntime.createScopedElement)("div", {
        vkuiClass: "View__panels"
      }, panels.map(function (panel) {
        var panelId = (0, _getNavId.getNavId)(panel.props, warn);
        var isPrev = panelId === prevPanel || panelId === swipeBackPrevPanel;
        var compensateScroll = isPrev || panelId === swipeBackNextPanel || panelId === nextPanel && isBack;
        var isTransitionTarget = animated && panelId === (isBack ? prevPanel : nextPanel);
        var scrollList = _this4.scrolls[panelId] || [];
        var scroll = scrollList[scrollList.length - 1] || 0;
        return (0, _jsxRuntime.createScopedElement)("div", {
          vkuiClass: (0, _classNames.classNames)("View__panel", {
            "View__panel--active": panelId === activePanel,
            "View__panel--prev": panelId === prevPanel,
            "View__panel--next": panelId === nextPanel,
            "View__panel--swipe-back-prev": panelId === swipeBackPrevPanel,
            "View__panel--swipe-back-next": panelId === swipeBackNextPanel,
            "View__panel--swipe-back-success": swipeBackResult === SwipeBackResults.success,
            "View__panel--swipe-back-failed": swipeBackResult === SwipeBackResults.fail
          }),
          onAnimationEnd: isTransitionTarget ? _this4.transitionEndHandler : null,
          ref: function ref(el) {
            return _this4.panelNodes[panelId] = el;
          },
          style: _this4.calcPanelSwipeStyles(panelId),
          key: panelId
        }, (0, _jsxRuntime.createScopedElement)("div", {
          vkuiClass: "View__panel-in",
          style: {
            marginTop: compensateScroll ? -scroll : null
          }
        }, (0, _jsxRuntime.createScopedElement)(_NavTransitionContext.NavTransitionProvider, {
          entering: panelId === nextPanel || panelId === swipeBackNextPanel
        }, panel)));
      })), (0, _jsxRuntime.createScopedElement)(_AppRootPortal.AppRootPortal, null, hasPopout && (0, _jsxRuntime.createScopedElement)("div", {
        vkuiClass: "View__popout"
      }, popout), hasModal && (0, _jsxRuntime.createScopedElement)("div", {
        vkuiClass: "View__modal"
      }, modal)));
    }
  }]);
  return ViewInfinite;
}(React.Component);

(0, _defineProperty2.default)(ViewInfinite, "defaultProps", {
  history: []
});

var _default = (0, _withContext.withContext)((0, _withContext.withContext)((0, _withContext.withContext)((0, _withPlatform.withPlatform)((0, _dom.withDOM)(ViewInfinite)), _SplitCol.SplitColContext, "splitCol"), _ConfigProviderContext.ConfigProviderContext, "configProvider"), _ScrollContext.ScrollContext, "scroll");

exports.default = _default;
//# sourceMappingURL=ViewInfinite.js.map


text:
package com.example.controller;

import com.basistech.rosette.api.RosetteAPI;
import com.basistech.rosette.api.RosetteAPIException;
import com.basistech.rosette.apimodel.SentimentResponse;
import com.example.response.AnalyzeResponse;
import com.example.response.AnalyzeSentenceResponse;
import com.example.service.SentimentAnalysisService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.sentiment.SentimentCoreAnnotations;
import edu.stanford.nlp.util.CoreMap;
import org.apache.commons.io.IOUtils;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;

@RestController
public class AnalyzeController {

    @Autowired
    SentimentAnalysisService sentimentAnalysisService;

//    @RequestMapping("/greeting")
//    public String greeting(@RequestParam(value = "name", required = false, defaultValue = "John") String name, Model model) {
//        model.addAttribute("name", name);
//
//        AnalyzeResponse analyzeResponse = new AnalyzeResponse();
////        analyzeResponse.setText(name + "-" + System.currentTimeMillis());
////        analyzeResponse.setSentences(new String[]{"s1", "s2", System.nanoTime() + "b"});
//
//        model.addAttribute("analyzeResponse", analyzeResponse);
//
//        return "greeting";
//    }

    @RequestMapping(value = "/analyze2", method = RequestMethod.POST, produces = "application/json")
    public AnalyzeResponse analizeText(@RequestBody @NotEmpty String text) {
        AnalyzeResponse analyzeResponse = new AnalyzeResponse();
        List<AnalyzeSentenceResponse> analyzeSentenceResponses = new ArrayList<>();

        Annotation annotation = sentimentAnalysisService.getPipeline().process(text);
        List<CoreMap> sentences = annotation.get(CoreAnnotations.SentencesAnnotation.class);
        for (CoreMap sentence : sentences) {
            String sentiment = sentence.get(SentimentCoreAnnotations.SentimentClass.class);
            AnalyzeSentenceResponse analyzeSentenceResponse = new AnalyzeSentenceResponse();
            analyzeSentenceResponse.setSentence(sentence.toString());
            analyzeSentenceResponse.setSentiment(sentiment);
            analyzeSentenceResponse.setScore(sentimentAnalysisService.analyzeSentence(sentence.toString()));
            analyzeSentenceResponses.add(analyzeSentenceResponse);
        }

        analyzeResponse.setAnalyzeSentenceResponses(analyzeSentenceResponses);
        return analyzeResponse;
    }

    @RequestMapping(value = "/analyzeR", method = RequestMethod.POST, produces = "application/json")
    public AnalyzeResponse analizeTextRosette(@RequestBody @NotEmpty String text) throws IOException, RosetteAPIException {
        AnalyzeResponse analyzeResponse = new AnalyzeResponse();
        List<AnalyzeSentenceResponse> analyzeSentenceResponses = new ArrayList<>();

        RosetteAPI rosetteApi = new RosetteAPI("35056fa31ad5ecfb39e419b8eb10c20e",  "https://api.rosette.com/rest/v1");
        SentimentResponse response = rosetteApi.getSentiment(IOUtils.toInputStream(text, "UTF-8"), "text/html", null, null);

        return analyzeResponse;
    }

}


text:
/* global expect, request, describe, it, before, after */
import '../setup'
import { fileExists, parseRouteParams, parseRequestParams } from '../../src/util'

describe('util', () => {

  describe('fileExists', () => {
    it('rejects when the file does not exist', (done) => {
      fileExists('./test/dne.txt').catch(() => done())
    })

    it('resolves when the file exists', (done) => {
      fileExists('./test/gateway.yml').then(() => done())
    })
  })

  describe('parseRouteParams', () => {
    it('returns a properly formatted route', () => {
      const testCase = parseRouteParams(`$input.params('fooId')`, 'id', '/foo/{fooId}')
      expect(testCase).to.equal('/foo/:id')
    })

    it('returns false if param is not in route', () => {
      const testCase = parseRouteParams(`$input.params('notInRoute')`, 'id', '/foo/{fooId}')
      expect(testCase).to.be.false
    })
  })

  describe('parseRequestParams', () => {

    const testBody = {
      body: {
        foo: 'bar'
      }
    }

    const testQuery = {
      query: {
        baz: 'quz'
      }
    }

    const testHeader = {
      get: (name) => {
        return 'buzz'
      }
    }

    it('returns the full body when input.json($) is requested', () => {
      const testCase = parseRequestParams(`$input.json('$')`, testBody)
      expect(testCase).to.deep.equal(testBody.body)
    })

    it('returns the specific body property when input.json($.PROP) is requested', () => {
      const testCase = parseRequestParams(`$input.json('$.foo')`, testBody)
      expect(testCase).to.equal(testBody.body.foo)
    })

    it('returns the querystring value when input.params(PROP) is in the query', () => {
      const testCase = parseRequestParams(`$input.params('baz')`, testQuery)
      expect(testCase).to.equal('quz')
    })

    it('returns the header value when input.params(PROP) is in the header', () => {
      const testCase = parseRequestParams(`$input.params('some-header')`, testHeader)
      expect(testCase).to.equal('buzz')
    })

    it('returns the value if no parameters matched', () => {
      const testCase = parseRequestParams('fizz', testBody)
      expect(testCase).to.equal('fizz')
    })
  })

})


text:
#ifndef __CONVERSIONCLOTHINGPHYSICALMESHPARAMETERS_0P2_0P3H__
#define __CONVERSIONCLOTHINGPHYSICALMESHPARAMETERS_0P2_0P3H__

#include "ParamConversionTemplate.h"
#include "ClothingPhysicalMeshParameters_0p2.h"
#include "ClothingPhysicalMeshParameters_0p3.h"

namespace physx
{
namespace apex
{
namespace legacy
{

typedef ParamConversionTemplate<ClothingPhysicalMeshParameters_0p2, ClothingPhysicalMeshParameters_0p3, 2, 3> ConversionClothingPhysicalMeshParameters_0p2_0p3Parent;

class ConversionClothingPhysicalMeshParameters_0p2_0p3: ConversionClothingPhysicalMeshParameters_0p2_0p3Parent
{
public:
	static NxParameterized::Conversion* Create(NxParameterized::Traits* t)
	{
		void* buf = t->alloc(sizeof(ConversionClothingPhysicalMeshParameters_0p2_0p3));
		return buf ? PX_PLACEMENT_NEW(buf, ConversionClothingPhysicalMeshParameters_0p2_0p3)(t) : 0;
	}

protected:
	ConversionClothingPhysicalMeshParameters_0p2_0p3(NxParameterized::Traits* t) : ConversionClothingPhysicalMeshParameters_0p2_0p3Parent(t) {}

	bool convert()
	{
		//TODO:
		//	Write custom conversion code here using mNewData and mLegacyData members.
		//
		//	Note that
		//		- mNewData was initialized with default values
		//		- same-named/same-typed members were copied from mLegacyData to mNewData
		//		- included references were moved to mNewData
		//			(and updated to preferred versions according to getPreferredVersions)
		//
		//	For more info see the versioning wiki.

		return true;
	}
};

}
}
} //end of physx::apex:: namespace

#endif


text:
Modules
=======

Modules of this project.

.. toctree::

    bwg.modules.rst


text:
package com.intellij.openapi.vcs.readOnlyHandler;

import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.vfs.VirtualFile;
import javax.annotation.Nullable;

/**
 * @author yole
 */
public interface HandleTypeFactory {
  ExtensionPointName<HandleTypeFactory> EP_NAME = ExtensionPointName.create("com.intellij.handleTypeFactory");

  @Nullable
  HandleType createHandleType(VirtualFile file);
}


text:
<!DOCTYPE html>

<meta charset="utf-8"/>
<title>@xslet/datatype API document</title>
<link rel="stylesheet" href="./api.css"/>

@xslet/datatype v0.2 - API document

APIs

Rect

Represents a rectangle.

Each of .right and .width properties are calculated automatically with another properties and .left.
As well as each of .bottom and .height properties are calculated automatically with another properties and .top.

When .left and .top properties are changed, the rectangle is moved and .width and .height are not changed.

The unit of this value is not specified.
In xslet package, it would be determined by xslet.window.unitOfSize.

Properties:

.top {number} - The top position of this rectangle.

.left {number} - The left position of this rectangle.

.right {number} - The right position of this rectangle.

.bottom {number} - The bottom position of this rectangle.

.width {number} - The width position of this rectangle.

.height {number} - The height position of this rectangle.

Constructor:

Rect()

  Creates a Rect object of which all properties is zero.

Rect(obj)

  Creates a Rect object of which properties are corner positions or size of a rectangle.

  Parameters:

obj {object}

  An object which supposed to have either or all following properties: .left, .top, .right, .bottom, .width and .height.
  If all .left, .right and .width properties are specified but .width is different from .right - .left, .right is changed to .left + .width. It is also same about .top, .bottom and .height.


text:
define("ace/snippets/html_ruby", ["require", "exports", "module"], function (e, t, n) {
  "use strict";
  t.snippetText = "", t.scope = "html_ruby"
});
(function () {
  window.require(["ace/snippets/html_ruby"], function (m) {
    if (typeof module == "object" && typeof exports == "object" && module) {
      module.exports = m;
    }
  });
})();


text:
// @flow
// A knockoff of Dashbot's API for generic conversation logging
const dashbot = require('dashbot');
const winston = require('winston');
const Slack = require('winston-slack-transport');

class ConversationLogger {
  /*:: dashbotClient: ?Object */
  /*:: logger: winston.Logger */
  /*:: options: Object */
  // $FlowFixMe https://github.com/facebook/flow/issues/183
  constructor({
    dashBotKey, logFile, slackChannel, slackWebhookUrl
  } = {}) {
    this.logger = new winston.Logger({ transports: [] });
    this.options = {
      dashBotKey,
      logFile,
      slackChannel,
      slackWebhookUrl
    };

    if (this.options.logFile) {
      this.logger.add(winston.transports.File, {
        filename: this.options.logFile,
        json: true
      });
    }
    this.dashbotClient = this.options.dashBotKey ? dashbot(this.options.dashBotKey).facebook : null;

    if (this.options.slackWebhookUrl && this.options.slackChannel) {
      this.logger.add(Slack, {
        webhook_url: this.options.slackWebhookUrl,
        username: 'Chat Spy',
        custom_formatter: this.slackFormatter.bind(this)
      });
    }
  }

  slackFormatter(level/*: string */, msg/*: Object */, meta/*: Object */) {
    // console.log(JSON.stringify(meta));  // enable for DEBUG
    const addressee = meta.userId === meta.recipientId ? '' : '> ';
    let text = '```' + JSON.stringify(meta, undefined, 2) + '\n```';
    if (meta.text) {
      text = meta.text;
    } else if (meta.payload) {
      text = '`' + meta.payload + '`';
    } else if (meta.attachment) {
      if (meta.attachment.type === 'template') {
        text = meta.attachment.payload.elements.map((element) => element.title).join('\n');
      } else if (meta.attachment.payload.url) {
        text = meta.attachment.payload.url;
      } else {
        text = `Unknown meta.attachment: \`${JSON.stringify(meta.attachment)}\``;
      }
    } else if (meta.attachments) {
      text = meta.attachments.map((attachment) => {
        if (attachment.payload && attachment.payload.url) {
          return attachment.payload.url;
        }

        return 'Unknown meta.attachments[]: `' + JSON.stringify(attachment) + '`';
      }).join('\n');
    }

    return {
      channel: this.options.slackChannel,
      icon_url: `https://robohash.org/${meta.userId}.png`,
      username: meta.userId,
      text: addressee + text
    };
  }

  logIncoming(requestBody/*: Object */) {
    if (this.dashbotClient) {
      this.dashbotClient.logIncoming(requestBody);
    }
    const data = requestBody.entry[0].messaging[0];
    if (!(data.postback || data.message)) {
      // console.log(JSON.stringify(data));  // enable for DEBUG
      return;
    }

    // TODO: rewrite? postbacks came along and were shoved in
    this.logger.info(Object.assign({
      userId: data.sender.id,
      senderId: data.sender.id
    }, data.message || {}, data.postback || {}));
  }

  logOutgoing(requestData/*: Object */, responseBody/*: Object */) {
    if (this.dashbotClient) {
      // TODO should we strip pageAccessToken before giving it to dashbotClient?
      // Dashbot probably uses it to get profile information
      this.dashbotClient.logOutgoing(requestData, responseBody);
    }
    this.logger.info(Object.assign({
      recipientId: requestData.json.recipient.id,
      userId: requestData.json.recipient.id,
      mid: responseBody.message_id
    }, requestData.json.message));
  }
}

exports.ConversationLogger = ConversationLogger;


text:
describe('Adopter', function() {
  var path

  beforeEach(function() {
    path      = SVG.get('lineAB')
    polyline  = SVG.get('inlineSVG').select('polyline').first()
    polygon   = SVG.get('inlineSVG').select('polygon').first()
  })

  describe('with SVG.Doc instance', function() {
    it('adopts the main svg document when parent() method is called on first level children', function() {
      expect(path.parent() instanceof SVG.Doc).toBeTruthy()
    })
    it('defines a xmlns attribute', function() {
      expect(path.parent().node.getAttribute('xmlns')).toBe(SVG.ns)
    })
    it('defines a version attribute', function() {
      expect(path.parent().node.getAttribute('version')).toBe('1.1')
    })
    it('defines a xmlns:xlink attribute', function() {
      expect(path.parent().node.getAttribute('xmlns:xlink')).toBe(SVG.xlink)
    })
    it('initializes a defs node', function() {
      expect(path.parent()._defs).toBe(path.parent().defs())
    })
  })

  describe('with SVG.Path instance', function() {
    it('adopts an exiting path element', function() {
      expect(path instanceof SVG.Path).toBeTruthy()
    })
    it('modifies an adopted element', function() {
      path.fill('#f06')
      expect(path.node.getAttribute('fill')).toBe('#ff0066')
    })
    it('parses d attribute to SVG.PathArray', function() {
      expect(path.array() instanceof SVG.PathArray).toBeTruthy()
    })
  })

  describe('with SVG.Polyline instance', function() {
    it('parses points attribute to SVG.PointArray', function() {
      expect(polyline.array() instanceof SVG.PointArray).toBeTruthy()
    })
  })

  describe('with SVG.Polygon instance', function() {
    it('parses points attribute to SVG.PointArray', function() {
      expect(polygon.array() instanceof SVG.PointArray).toBeTruthy()
    })
  })

  describe('with node that has no matching svg.js class', function() {
    it('wraps the node in the base SVG.Element class', function() {
      var desc = SVG.get('inlineSVG').select('desc').first()
      expect(desc instanceof SVG.Element).toBeTruthy()
    })
  })

})


text:
/**
 * @constructor
 * @extends {WebInspector.SidebarPane}
 * @param {!WebInspector.BreakpointManager} breakpointManager
 * @param {function(!WebInspector.UISourceCode, number=, number=, boolean=)} showSourceLineDelegate
 */
WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, showSourceLineDelegate)
{
    WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
    this.registerRequiredCSS("breakpointsList.css");

    this._breakpointManager = breakpointManager;
    this._showSourceLineDelegate = showSourceLineDelegate;

    this.listElement = document.createElementWithClass("ol", "breakpoint-list");

    this.emptyElement = this.bodyElement.createChild("div", "info");
    this.emptyElement.textContent = WebInspector.UIString("No Breakpoints");

    this._items = new Map();

    var breakpointLocations = this._breakpointManager.allBreakpointLocations();
    for (var i = 0; i < breakpointLocations.length; ++i)
        this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocations[i].uiLocation);

    this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this);
    this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this);

    this.emptyElement.addEventListener("contextmenu", this._emptyElementContextMenu.bind(this), true);
}

WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
    _emptyElementContextMenu: function(event)
    {
        var contextMenu = new WebInspector.ContextMenu(event);
        this._appendBreakpointActiveItem(contextMenu);
        contextMenu.show();
    },

    /**
     * @param {!WebInspector.ContextMenu} contextMenu
     */
    _appendBreakpointActiveItem: function(contextMenu)
    {
        var breakpointActive = this._breakpointManager.breakpointsActive();
        var breakpointActiveTitle = breakpointActive ?
            WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Deactivate breakpoints" : "Deactivate Breakpoints") :
            WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Activate breakpoints" : "Activate Breakpoints");
        contextMenu.appendItem(breakpointActiveTitle, this._breakpointManager.setBreakpointsActive.bind(this._breakpointManager, !breakpointActive));
    },

    /**
     * @param {!WebInspector.Event} event
     */
    _breakpointAdded: function(event)
    {
        this._breakpointRemoved(event);

        var breakpoint = /** @type {!WebInspector.BreakpointManager.Breakpoint} */ (event.data.breakpoint);
        var uiLocation = /** @type {!WebInspector.UILocation} */ (event.data.uiLocation);
        this._addBreakpoint(breakpoint, uiLocation);
    },

    /**
     * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint
     * @param {!WebInspector.UILocation} uiLocation
     */
    _addBreakpoint: function(breakpoint, uiLocation)
    {
        var element = document.createElementWithClass("li", "cursor-pointer");
        element.addEventListener("contextmenu", this._breakpointContextMenu.bind(this, breakpoint), true);
        element.addEventListener("click", this._breakpointClicked.bind(this, uiLocation), false);

        var checkbox = element.createChild("input", "checkbox-elem");
        checkbox.type = "checkbox";
        checkbox.checked = breakpoint.enabled();
        checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(this, breakpoint), false);

        element.createTextChild(uiLocation.linkText());

        var snippetElement = element.createChild("div", "source-text monospace");

        /**
         * @param {?string} content
         */
        function didRequestContent(content)
        {
            var lineNumber = uiLocation.lineNumber
            var columnNumber = uiLocation.columnNumber;
            var contentString = new String(content);
            if (lineNumber < contentString.lineCount()) {
                var lineText = contentString.lineAt(lineNumber);
                var maxSnippetLength = 200;
                var snippetStartIndex = columnNumber > 100 ? columnNumber : 0;
                snippetElement.textContent = lineText.substr(snippetStartIndex).trimEnd(maxSnippetLength);
            }
        }

        uiLocation.uiSourceCode.requestContent(didRequestContent);

        element._data = uiLocation;
        var currentElement = this.listElement.firstChild;
        while (currentElement) {
            if (currentElement._data && this._compareBreakpoints(currentElement._data, element._data) > 0)
                break;
            currentElement = currentElement.nextSibling;
        }
        this._addListElement(element, currentElement);

        var breakpointItem = { element: element, checkbox: checkbox };
        this._items.set(breakpoint, breakpointItem);

        this.expand();
    },

    /**
     * @param {!WebInspector.Event} event
     */
    _breakpointRemoved: function(event)
    {
        var breakpoint = /** @type {!WebInspector.BreakpointManager.Breakpoint} */ (event.data.breakpoint);
        var uiLocation = /** @type {!WebInspector.UILocation} */ (event.data.uiLocation);
        var breakpointItem = this._items.get(breakpoint);
        if (!breakpointItem)
            return;
        this._items.remove(breakpoint);
        this._removeListElement(breakpointItem.element);
    },

    /**
     * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint
     */
    highlightBreakpoint: function(breakpoint)
    {
        var breakpointItem = this._items.get(breakpoint);
        if (!breakpointItem)
            return;
        breakpointItem.element.classList.add("breakpoint-hit");
        this._highlightedBreakpointItem = breakpointItem;
    },

    clearBreakpointHighlight: function()
    {
        if (this._highlightedBreakpointItem) {
            this._highlightedBreakpointItem.element.classList.remove("breakpoint-hit");
            delete this._highlightedBreakpointItem;
        }
    },

    _breakpointClicked: function(uiLocation, event)
    {
        this._showSourceLineDelegate(uiLocation.uiSourceCode, uiLocation.lineNumber);
    },

    /**
     * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint
     * @param {!Event} event
     */
    _breakpointCheckboxClicked: function(breakpoint, event)
    {
        // Breakpoint element has it's own click handler.
        event.consume();
        breakpoint.setEnabled(event.target.checked);
    },

    /**
     * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint
     * @param {!Event} event
     */
    _breakpointContextMenu: function(breakpoint, event)
    {
        var breakpoints = this._items.values();
        var contextMenu = new WebInspector.ContextMenu(event);
        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove breakpoint" : "Remove Breakpoint"), breakpoint.remove.bind(breakpoint));
        if (breakpoints.length > 1) {
            var removeAllTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove all breakpoints" : "Remove All Breakpoints");
            contextMenu.appendItem(removeAllTitle, this._breakpointManager.removeAllBreakpoints.bind(this._breakpointManager));
        }

        contextMenu.appendSeparator();
        this._appendBreakpointActiveItem(contextMenu);

        function enabledBreakpointCount(breakpoints)
        {
            var count = 0;
            for (var i = 0; i < breakpoints.length; ++i) {
                if (breakpoints[i].checkbox.checked)
                    count++;
            }
            return count;
        }
        if (breakpoints.length > 1) {
            var enableBreakpointCount = enabledBreakpointCount(breakpoints);
            var enableTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Enable all breakpoints" : "Enable All Breakpoints");
            var disableTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Disable all breakpoints" : "Disable All Breakpoints");

            contextMenu.appendSeparator();

            contextMenu.appendItem(enableTitle, this._breakpointManager.toggleAllBreakpoints.bind(this._breakpointManager, true), !(enableBreakpointCount != breakpoints.length));
            contextMenu.appendItem(disableTitle, this._breakpointManager.toggleAllBreakpoints.bind(this._breakpointManager, false), !(enableBreakpointCount > 1));
        }

        contextMenu.show();
    },

    _addListElement: function(element, beforeElement)
    {
        if (beforeElement)
            this.listElement.insertBefore(element, beforeElement);
        else {
            if (!this.listElement.firstChild) {
                this.bodyElement.removeChild(this.emptyElement);
                this.bodyElement.appendChild(this.listElement);
            }
            this.listElement.appendChild(element);
        }
    },

    _removeListElement: function(element)
    {
        this.listElement.removeChild(element);
        if (!this.listElement.firstChild) {
            this.bodyElement.removeChild(this.listElement);
            this.bodyElement.appendChild(this.emptyElement);
        }
    },

    _compare: function(x, y)
    {
        if (x !== y)
            return x < y ? -1 : 1;
        return 0;
    },

    _compareBreakpoints: function(b1, b2)
    {
        return this._compare(b1.uiSourceCode.originURL(), b2.uiSourceCode.originURL()) || this._compare(b1.lineNumber, b2.lineNumber);
    },

    reset: function()
    {
        this.listElement.removeChildren();
        if (this.listElement.parentElement) {
            this.bodyElement.removeChild(this.listElement);
            this.bodyElement.appendChild(this.emptyElement);
        }
        this._items.clear();
    },

    __proto__: WebInspector.SidebarPane.prototype
}

/**
 * @constructor
 * @extends {WebInspector.NativeBreakpointsSidebarPane}
 * @implements {WebInspector.TargetManager.Observer}
 */
WebInspector.XHRBreakpointsSidebarPane = function()
{
    WebInspector.NativeBreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints"));

    // FIXME: Use StringMap.
    this._breakpointElements = { __proto__: null };

    var addButton = this.titleElement.createChild("button", "pane-title-button add");
    addButton.title = WebInspector.UIString("Add XHR breakpoint");
    addButton.addEventListener("click", this._addButtonClicked.bind(this), false);

    this.emptyElement.addEventListener("contextmenu", this._emptyElementContextMenu.bind(this), true);

    WebInspector.targetManager.observeTargets(this);
}

WebInspector.XHRBreakpointsSidebarPane.prototype = {
    /**
     * @param {!WebInspector.Target} target
     */
    targetAdded: function(target)
    {
        this._restoreBreakpoints(target);
    },

    /**
     * @param {!WebInspector.Target} target
     */
    targetRemoved: function(target) { },

    _emptyElementContextMenu: function(event)
    {
        var contextMenu = new WebInspector.ContextMenu(event);
        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add breakpoint" : "Add Breakpoint"), this._addButtonClicked.bind(this));
        contextMenu.show();
    },

    _addButtonClicked: function(event)
    {
        if (event)
            event.consume();

        this.expand();

        var inputElementContainer = document.createElementWithClass("p", "breakpoint-condition");
        inputElementContainer.textContent = WebInspector.UIString("Break when URL contains:");

        var inputElement = inputElementContainer.createChild("span", "editing");
        inputElement.id = "breakpoint-condition-input";
        this.addListElement(inputElementContainer, /** @type {?Element} */ (this.listElement.firstChild));

        /**
         * @param {boolean} accept
         * @param {!Element} e
         * @param {string} text
         * @this {WebInspector.XHRBreakpointsSidebarPane}
         */
        function finishEditing(accept, e, text)
        {
            this.removeListElement(inputElementContainer);
            if (accept) {
                this._setBreakpoint(text, true);
                this._saveBreakpoints();
            }
        }

        var config = new WebInspector.InplaceEditor.Config(finishEditing.bind(this, true), finishEditing.bind(this, false));
        WebInspector.InplaceEditor.startEditing(inputElement, config);
    },

    /**
     * @param {string} url
     * @param {boolean} enabled
     * @param {!WebInspector.Target=} target
     */
    _setBreakpoint: function(url, enabled, target)
    {
        if (enabled)
            this._updateBreakpointOnTarget(url, true, target);

        if (url in this._breakpointElements)
            return;

        var element = document.createElement("li");
        element._url = url;
        element.addEventListener("contextmenu", this._contextMenu.bind(this, url), true);

        var checkboxElement = element.createChild("input", "checkbox-elem");
        checkboxElement.type = "checkbox";
        checkboxElement.checked = enabled;
        checkboxElement.addEventListener("click", this._checkboxClicked.bind(this, url), false);
        element._checkboxElement = checkboxElement;

        var labelElement = element.createChild("span", "cursor-auto");
        if (!url)
            labelElement.textContent = WebInspector.UIString("Any XHR");
        else
            labelElement.textContent = WebInspector.UIString("URL contains \"%s\"", url);
        labelElement.addEventListener("dblclick", this._labelClicked.bind(this, url), false);

        var currentElement = /** @type {?Element} */ (this.listElement.firstChild);
        while (currentElement) {
            if (currentElement._url && currentElement._url < element._url)
                break;
            currentElement = /** @type {?Element} */ (currentElement.nextSibling);
        }
        this.addListElement(element, currentElement);
        this._breakpointElements[url] = element;
    },

    /**
     * @param {string} url
     * @param {!WebInspector.Target=} target
     */
    _removeBreakpoint: function(url, target)
    {
        var element = this._breakpointElements[url];
        if (!element)
            return;

        this.removeListElement(element);
        delete this._breakpointElements[url];
        if (element._checkboxElement.checked)
            this._updateBreakpointOnTarget(url, false, target);
    },

    /**
     * @param {string} url
     * @param {boolean} enable
     * @param {!WebInspector.Target=} target
     */
    _updateBreakpointOnTarget: function(url, enable, target)
    {
        var targets = target ? [target] : WebInspector.targetManager.targets();
        for (var i = 0; i < targets.length; ++i) {
            if (enable)
                targets[i].domdebuggerAgent().setXHRBreakpoint(url);
            else
                targets[i].domdebuggerAgent().removeXHRBreakpoint(url);
        }
    },

    _contextMenu: function(url, event)
    {
        var contextMenu = new WebInspector.ContextMenu(event);

        /**
         * @this {WebInspector.XHRBreakpointsSidebarPane}
         */
        function removeBreakpoint()
        {
            this._removeBreakpoint(url);
            this._saveBreakpoints();
        }

        /**
         * @this {WebInspector.XHRBreakpointsSidebarPane}
         */
        function removeAllBreakpoints()
        {
            for (var url in this._breakpointElements)
                this._removeBreakpoint(url);
            this._saveBreakpoints();
        }
        var removeAllTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove all breakpoints" : "Remove All Breakpoints");

        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Add breakpoint" : "Add Breakpoint"), this._addButtonClicked.bind(this));
        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove breakpoint" : "Remove Breakpoint"), removeBreakpoint.bind(this));
        contextMenu.appendItem(removeAllTitle, removeAllBreakpoints.bind(this));
        contextMenu.show();
    },

    _checkboxClicked: function(url, event)
    {
        this._updateBreakpointOnTarget(url, event.target.checked);
        this._saveBreakpoints();
    },

    _labelClicked: function(url)
    {
        var element = this._breakpointElements[url];
        var inputElement = document.createElementWithClass("span", "breakpoint-condition editing");
        inputElement.textContent = url;
        this.listElement.insertBefore(inputElement, element);
        element.classList.add("hidden");

        /**
         * @param {boolean} accept
         * @param {!Element} e
         * @param {string} text
         * @this {WebInspector.XHRBreakpointsSidebarPane}
         */
        function finishEditing(accept, e, text)
        {
            this.removeListElement(inputElement);
            if (accept) {
                this._removeBreakpoint(url);
                this._setBreakpoint(text, element._checkboxElement.checked);
                this._saveBreakpoints();
            } else
                element.classList.remove("hidden");
        }

        WebInspector.InplaceEditor.startEditing(inputElement, new WebInspector.InplaceEditor.Config(finishEditing.bind(this, true), finishEditing.bind(this, false)));
    },

    highlightBreakpoint: function(url)
    {
        var element = this._breakpointElements[url];
        if (!element)
            return;
        this.expand();
        element.classList.add("breakpoint-hit");
        this._highlightedElement = element;
    },

    clearBreakpointHighlight: function()
    {
        if (this._highlightedElement) {
            this._highlightedElement.classList.remove("breakpoint-hit");
            delete this._highlightedElement;
        }
    },

    _saveBreakpoints: function()
    {
        var breakpoints = [];
        for (var url in this._breakpointElements)
            breakpoints.push({ url: url, enabled: this._breakpointElements[url]._checkboxElement.checked });
        WebInspector.settings.xhrBreakpoints.set(breakpoints);
    },

    /**
     * @param {!WebInspector.Target} target
     */
    _restoreBreakpoints: function(target)
    {
        var breakpoints = WebInspector.settings.xhrBreakpoints.get();
        for (var i = 0; i < breakpoints.length; ++i) {
            var breakpoint = breakpoints[i];
            if (breakpoint && typeof breakpoint.url === "string")
                this._setBreakpoint(breakpoint.url, breakpoint.enabled, target);
        }
    },

    __proto__: WebInspector.NativeBreakpointsSidebarPane.prototype
}

/**
 * @constructor
 * @extends {WebInspector.SidebarPane}
 * @implements {WebInspector.TargetManager.Observer}
 */
WebInspector.EventListenerBreakpointsSidebarPane = function()
{
    WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Breakpoints"));
    this.registerRequiredCSS("breakpointsList.css");

    this.categoriesElement = this.bodyElement.createChild("ol", "properties-tree event-listener-breakpoints");
    this.categoriesElement.tabIndex = 0;
    this.categoriesTreeOutline = new TreeOutline(this.categoriesElement);

    this._categoryItems = [];
    // FIXME: uncomment following once inspector stops being drop targer in major ports.
    // Otherwise, inspector page reacts on drop event and tries to load the event data.
    // this._createCategory(WebInspector.UIString("Drag"), ["drag", "drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]);
    this._createCategory(WebInspector.UIString("Animation"), ["requestAnimationFrame", "cancelAnimationFrame", "animationFrameFired"], true);
    this._createCategory(WebInspector.UIString("Control"), ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
    this._createCategory(WebInspector.UIString("Clipboard"), ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
    this._createCategory(WebInspector.UIString("DOM Mutation"), ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
    this._createCategory(WebInspector.UIString("Device"), ["deviceorientation", "devicemotion"]);
    this._createCategory(WebInspector.UIString("Drag / drop"), ["dragenter", "dragover", "dragleave", "drop"]);
    this._createCategory(WebInspector.UIString("Keyboard"), ["keydown", "keyup", "keypress", "input"]);
    this._createCategory(WebInspector.UIString("Load"), ["load", "beforeunload", "unload", "abort", "error", "hashchange", "popstate"]);
    this._createCategory(WebInspector.UIString("Media"), ["play", "pause", "playing", "canplay", "canplaythrough", "seeking", "seeked", "timeupdate", "ended", "ratechange", "durationchange", "volumechange", "loadstart", "progress", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "waiting"], false, ["audio", "video"]);
    this._createCategory(WebInspector.UIString("Mouse"), ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel", "wheel"]);
    this._createCategory(WebInspector.UIString("Promise"), ["newPromise", "promiseResolved", "promiseRejected"], true);
    this._createCategory(WebInspector.UIString("Timer"), ["setTimer", "clearTimer", "timerFired"], true);
    this._createCategory(WebInspector.UIString("Touch"), ["touchstart", "touchmove", "touchend", "touchcancel"]);
    this._createCategory(WebInspector.UIString("XHR"), ["readystatechange", "load", "loadstart", "loadend", "abort", "error", "progress", "timeout"], false, ["XMLHttpRequest", "XMLHttpRequestUpload"]);
    this._createCategory(WebInspector.UIString("WebGL"), ["webglErrorFired", "webglWarningFired"], true);
    this._createCategory(WebInspector.UIString("Window"), ["close"], true);

    WebInspector.targetManager.observeTargets(this);
}

WebInspector.EventListenerBreakpointsSidebarPane.categoryListener = "listener:";
WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation = "instrumentation:";
WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny = "*";

/**
 * @param {string} eventName
 * @param {!Object=} auxData
 * @return {string}
 */
WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI = function(eventName, auxData)
{
    if (!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI) {
        WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI = {
            "instrumentation:setTimer": WebInspector.UIString("Set Timer"),
            "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"),
            "instrumentation:timerFired": WebInspector.UIString("Timer Fired"),
            "instrumentation:newPromise": WebInspector.UIString("Promise Created"),
            "instrumentation:promiseResolved": WebInspector.UIString("Promise Resolved"),
            "instrumentation:promiseRejected": WebInspector.UIString("Promise Rejected"),
            "instrumentation:requestAnimationFrame": WebInspector.UIString("Request Animation Frame"),
            "instrumentation:cancelAnimationFrame": WebInspector.UIString("Cancel Animation Frame"),
            "instrumentation:animationFrameFired": WebInspector.UIString("Animation Frame Fired"),
            "instrumentation:webglErrorFired": WebInspector.UIString("WebGL Error Fired"),
            "instrumentation:webglWarningFired": WebInspector.UIString("WebGL Warning Fired")
        };
    }
    if (auxData) {
        if (eventName === "instrumentation:webglErrorFired" && auxData["webglErrorName"]) {
            var errorName = auxData["webglErrorName"];
            // If there is a hex code of the error, display only this.
            errorName = errorName.replace(/^.*(0x[0-9a-f]+).*$/i, "$1");
            return WebInspector.UIString("WebGL Error Fired (%s)", errorName);
        }
    }
    return WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI[eventName] || eventName.substring(eventName.indexOf(":") + 1);
}

WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
    /**
     * @param {!WebInspector.Target} target
     */
    targetAdded: function(target)
    {
        this._restoreBreakpoints(target);
    },

    /**
     * @param {!WebInspector.Target} target
     */
    targetRemoved: function(target) { },

    /**
     * @param {string} name
     * @param {!Array.<string>} eventNames
     * @param {boolean=} isInstrumentationEvent
     * @param {!Array.<string>=} targetNames
     */
    _createCategory: function(name, eventNames, isInstrumentationEvent, targetNames)
    {
        var labelNode = document.createElement("label");
        labelNode.textContent = name;

        var categoryItem = {};
        categoryItem.element = new TreeElement(labelNode);
        this.categoriesTreeOutline.appendChild(categoryItem.element);
        categoryItem.element.listItemElement.classList.add("event-category");
        categoryItem.element.selectable = true;

        categoryItem.checkbox = this._createCheckbox(labelNode);
        categoryItem.checkbox.addEventListener("click", this._categoryCheckboxClicked.bind(this, categoryItem), true);

        categoryItem.targetNames = this._stringArrayToLowerCase(targetNames || [WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny]);
        categoryItem.children = {};
        var category = (isInstrumentationEvent ? WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation :  WebInspector.EventListenerBreakpointsSidebarPane.categoryListener);
        for (var i = 0; i < eventNames.length; ++i) {
            var eventName = category + eventNames[i];

            var breakpointItem = {};
            var title = WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName);

            labelNode = document.createElement("label");
            labelNode.textContent = title;

            breakpointItem.element = new TreeElement(labelNode);
            categoryItem.element.appendChild(breakpointItem.element);

            breakpointItem.element.listItemElement.createChild("div", "breakpoint-hit-marker");
            breakpointItem.element.listItemElement.classList.add("source-code");
            breakpointItem.element.selectable = false;

            breakpointItem.checkbox = this._createCheckbox(labelNode);
            breakpointItem.checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(this, eventName, categoryItem.targetNames), true);
            breakpointItem.parent = categoryItem;

            categoryItem.children[eventName] = breakpointItem;
        }
        this._categoryItems.push(categoryItem);
    },

    /**
     * @param {!Array.<string>} array
     * @return {!Array.<string>}
     */
    _stringArrayToLowerCase: function(array)
    {
        return array.map(function(value) {
            return value.toLowerCase();
        });
    },

    /**
     * @param {!Element} labelNode
     * @return {!Element}
     */
    _createCheckbox: function(labelNode)
    {
        var checkbox = document.createElementWithClass("input", "checkbox-elem");
        checkbox.type = "checkbox";
        labelNode.insertBefore(checkbox, labelNode.firstChild);
        return checkbox;
    },

    _categoryCheckboxClicked: function(categoryItem)
    {
        var checked = categoryItem.checkbox.checked;
        for (var eventName in categoryItem.children) {
            var breakpointItem = categoryItem.children[eventName];
            if (breakpointItem.checkbox.checked === checked)
                continue;
            if (checked)
                this._setBreakpoint(eventName, categoryItem.targetNames);
            else
                this._removeBreakpoint(eventName, categoryItem.targetNames);
        }
        this._saveBreakpoints();
    },

    /**
     * @param {string} eventName
     * @param {!Array.<string>} targetNames
     * @param {!Event} event
     */
    _breakpointCheckboxClicked: function(eventName, targetNames, event)
    {
        if (event.target.checked)
            this._setBreakpoint(eventName, targetNames);
        else
            this._removeBreakpoint(eventName, targetNames);
        this._saveBreakpoints();
    },

    /**
     * @param {string} eventName
     * @param {?Array.<string>=} eventTargetNames
     * @param {!WebInspector.Target=} target
     */
    _setBreakpoint: function(eventName, eventTargetNames, target)
    {
        eventTargetNames = eventTargetNames || [WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny];
        for (var i = 0; i < eventTargetNames.length; ++i) {
            var eventTargetName = eventTargetNames[i];
            var breakpointItem = this._findBreakpointItem(eventName, eventTargetName);
            if (!breakpointItem)
                continue;
            breakpointItem.checkbox.checked = true;
            breakpointItem.parent.dirtyCheckbox = true;
            this._updateBreakpointOnTarget(eventName, eventTargetName, true, target);
        }
        this._updateCategoryCheckboxes();
    },

    /**
     * @param {string} eventName
     * @param {?Array.<string>=} eventTargetNames
     * @param {!WebInspector.Target=} target
     */
    _removeBreakpoint: function(eventName, eventTargetNames, target)
    {
        eventTargetNames = eventTargetNames || [WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny];
        for (var i = 0; i < eventTargetNames.length; ++i) {
            var eventTargetName = eventTargetNames[i];
            var breakpointItem = this._findBreakpointItem(eventName, eventTargetName);
            if (!breakpointItem)
                continue;
            breakpointItem.checkbox.checked = false;
            breakpointItem.parent.dirtyCheckbox = true;
            this._updateBreakpointOnTarget(eventName, eventTargetName, false, target);
        }
        this._updateCategoryCheckboxes();
    },

    /**
     * @param {string} eventName
     * @param {string} eventTargetName
     * @param {boolean} enable
     * @param {!WebInspector.Target=} target
     */
    _updateBreakpointOnTarget: function(eventName, eventTargetName, enable, target)
    {
        var targets = target ? [target] : WebInspector.targetManager.targets();
        for (var i = 0; i < targets.length; ++i) {
            if (eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPane.categoryListener)) {
                var protocolEventName = eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categoryListener.length);
                if (enable)
                    targets[i].domdebuggerAgent().setEventListenerBreakpoint(protocolEventName, eventTargetName);
                else
                    targets[i].domdebuggerAgent().removeEventListenerBreakpoint(protocolEventName, eventTargetName);
            } else if (eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation)) {
                var protocolEventName = eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation.length);
                if (enable)
                    targets[i].domdebuggerAgent().setInstrumentationBreakpoint(protocolEventName);
                else
                    targets[i].domdebuggerAgent().removeInstrumentationBreakpoint(protocolEventName);
            }
        }
    },

    _updateCategoryCheckboxes: function()
    {
        for (var i = 0; i < this._categoryItems.length; ++i) {
            var categoryItem = this._categoryItems[i];
            if (!categoryItem.dirtyCheckbox)
                continue;
            categoryItem.dirtyCheckbox = false;
            var hasEnabled = false;
            var hasDisabled = false;
            for (var eventName in categoryItem.children) {
                var breakpointItem = categoryItem.children[eventName];
                if (breakpointItem.checkbox.checked)
                    hasEnabled = true;
                else
                    hasDisabled = true;
            }
            categoryItem.checkbox.checked = hasEnabled;
            categoryItem.checkbox.indeterminate = hasEnabled && hasDisabled;
        }
    },

    /**
     * @param {string} eventName
     * @param {string=} targetName
     * @return {?Object}
     */
    _findBreakpointItem: function(eventName, targetName)
    {
        targetName = (targetName || WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny).toLowerCase();
        for (var i = 0; i < this._categoryItems.length; ++i) {
            var categoryItem = this._categoryItems[i];
            if (categoryItem.targetNames.indexOf(targetName) === -1)
                continue;
            var breakpointItem = categoryItem.children[eventName];
            if (breakpointItem)
                return breakpointItem;
        }
        return null;
    },

    /**
     * @param {string} eventName
     * @param {string=} targetName
     */
    highlightBreakpoint: function(eventName, targetName)
    {
        var breakpointItem = this._findBreakpointItem(eventName, targetName);
        if (!breakpointItem || !breakpointItem.checkbox.checked)
            breakpointItem = this._findBreakpointItem(eventName, WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny);
        if (!breakpointItem)
            return;
        this.expand();
        breakpointItem.parent.element.expand();
        breakpointItem.element.listItemElement.classList.add("breakpoint-hit");
        this._highlightedElement = breakpointItem.element.listItemElement;
    },

    clearBreakpointHighlight: function()
    {
        if (this._highlightedElement) {
            this._highlightedElement.classList.remove("breakpoint-hit");
            delete this._highlightedElement;
        }
    },

    _saveBreakpoints: function()
    {
        var breakpoints = [];
        for (var i = 0; i < this._categoryItems.length; ++i) {
            var categoryItem = this._categoryItems[i];
            for (var eventName in categoryItem.children) {
                var breakpointItem = categoryItem.children[eventName];
                if (breakpointItem.checkbox.checked)
                    breakpoints.push({ eventName: eventName, targetNames: categoryItem.targetNames });
            }
        }
        WebInspector.settings.eventListenerBreakpoints.set(breakpoints);
    },

    /**
     * @param {!WebInspector.Target} target
     */
    _restoreBreakpoints: function(target)
    {
        var breakpoints = WebInspector.settings.eventListenerBreakpoints.get();
        for (var i = 0; i < breakpoints.length; ++i) {
            var breakpoint = breakpoints[i];
            if (breakpoint && typeof breakpoint.eventName === "string")
                this._setBreakpoint(breakpoint.eventName, breakpoint.targetNames, target);
        }
    },

    __proto__: WebInspector.SidebarPane.prototype
}


text:
package com.alexstyl.specialdates.events.namedays.activity;

import com.alexstyl.specialdates.contact.ContactsProvider;
import com.alexstyl.specialdates.events.namedays.NamedayUserSettings;
import com.alexstyl.specialdates.events.namedays.calendar.NamedayCalendar;
import com.alexstyl.specialdates.ui.widget.AndroidLetterPainter;

import dagger.Module;
import dagger.Provides;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

@Module
public class NamedaysInADayModule {

    @Provides
    NamedaysViewModelFactory viewModelFactory(AndroidLetterPainter letterPainter) {
        return new NamedaysViewModelFactory(letterPainter);
    }

    @Provides
    NamedaysInADayPresenter presenter(NamedayCalendar calendar,
                               NamedaysViewModelFactory namedaysViewModelFactory,
                               ContactsProvider contactsProvider,
                               NamedayUserSettings namedayUserSettings) {
        return new NamedaysInADayPresenter(calendar, namedaysViewModelFactory, contactsProvider, namedayUserSettings, Schedulers.io(), AndroidSchedulers.mainThread());
    }
}


text:
package edu.ptu.javatest._90_jcu._10_jsr133._12_jmm;

import org.junit.Test;

public class FinalFieldInitTest {

    final int finalProperty;

    public FinalFieldInitTest() throws Exception{
        finalProperty = 1;
        int a=1/0;
    }

    @Test
    public void testInitWithCrash() {
        FinalFieldInitTest finalFieldInitTest=null;
        try {
              finalFieldInitTest = new FinalFieldInitTest();
        }catch (Exception e){
//            e.printStackTrace();
        }
        if (finalFieldInitTest!=null){
            System.out.println(finalFieldInitTest.finalProperty);
        }
        System.out.println();
    }

}


text:
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
$this->inc('elements/header.php');
$layoutClass = 'two-columns-left';
include('elements/header_common.php'); ?>

		<?php
        $hi = new Area('Header Image');
        $hi->display($c);
        ?>

    <?php
	//get the top most parent
    $autoNav = BlockType::getByHandle('autonav');
    $anController = $autoNav->getController();
    $topParentID = ($anController->getParentAtLevel(2));
    $topParentPage = Page::getByID($topParentID);
    ?>

    <?php include('elements/breadcrumbs.php'); ?>

       		<?php if (!$c->getAttribute('hide_sidenav_heading')) { ?>

<a href="<?php echo DIR_REL . $topParentPage->getCollectionPath(); ?>"><?php echo $topParentPage->getCollectionName(); ?>

        	<?php
        	}
        	if (!$c->getAttribute('hide_sidenav')) {
				$bt = BlockType::getByHandle('autonav');
				$bt->controller->displayPages = 'second_level';
				$bt->controller->orderBy = 'display_asc';
				$bt->controller->displaySubPages = 'relevant';
				$bt->controller->displaySubPageLevels = 'custom';
				$bt->controller->displaySubPageLevelsNum = '2';
				$bt->render('view');
			}
			?>

			<?php
			$as = new Area('Sidebar');
			$as->display($c);
			?>

			<?php  if (isset($error)) { ?>
			   <?php
			   if ($error instanceof Exception) {
			      $_error[] = $error->getMessage();
			   } else if ($error instanceof ValidationErrorHelper) {
			      $_error = $error->getList();
			   } else if (is_array($error)) {
			      $_error = $error;
			   } else if (is_string($error)) {
			      $_error[] = $error;
			   }

			      ?>

			      <?php  foreach($_error as $e) { ?>
<?php echo $e?>
<?php  } ?>

			   <?php
			} ?>

			<?php print $innerContent; ?>

    	<?php
		$af = new Area('Lower');
		$af->display($c);
		?>

<?php  $this->inc('elements/footer.php'); ?>


text:
#pragma once

#include <iostream>
#include <vector>
#include <thread>
#include <atomic>
#include <future>
#include <queue>
#include <memory>
#include "thread_state.h"

using std::istream;
using std::ostream;
using std::shared_ptr;
using std::unique_ptr;

class LocalTask
{
public:
  virtual void run(uint worker_id) = 0;

  virtual ~LocalTask() {}
};

/**
 * A scheduler is responsible for registering each thread it uses.
 */

/* abstract */
class Scheduler
{
public:
  /* add a task to be scheduled */
  virtual void add_task(shared_ptr<LocalTask> t) = 0;

  /* blocks until all current tasks are complete. */
  virtual void complete_pending() = 0;

  /* Return the concurrency available to the scheduler. */
  virtual uint concurrency() const = 0;

  virtual ~Scheduler() { }
};

unique_ptr<Scheduler> make_scheduler(uint num_threads);


text:
package net.evolutionaryarchitecture.jpa.samples;

import java.sql.Timestamp;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import net.evolutionaryarchitecture.jpa.samples.Conference;
import net.evolutionaryarchitecture.jpa.samples.EventRepository;
import net.evolutionaryarchitecture.jpa.samples.Name;
import net.evolutionaryarchitecture.jpa.samples.OnsiteCourse;
import net.evolutionaryarchitecture.jpa.samples.Person;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

@ContextConfiguration(locations = "classpath:itest-system-definition.xml")
@RunWith(SpringJUnit4ClassRunner.class)
@Transactional
public class JoinDemo {

  @Autowired
  EventRepository eventRepo;

  @PersistenceContext
  EntityManager em;

  @Test
  public void fkAssociation() {
    OnsiteCourse onsiteCourse = new OnsiteCourse("Effective JPA",
        Timestamp.valueOf("2011-12-01 08:00:00"), "MŒrten Haglind",
        "Volvo");
    em.persist(onsiteCourse);

    Person theCustomer = new Person(new Name("Nils", "Nilsson"));
    em.persist(theCustomer);

    onsiteCourse.setTechnicalContact(theCustomer);
    em.flush();
  }

  @Test
  public void joinTableAssociation() {
    OnsiteCourse onsiteCourse = new OnsiteCourse("Effective JPA",
        Timestamp.valueOf("2011-12-01 08:00:00"), "MŒrten Haglind",
        "Volvo");
    em.persist(onsiteCourse);

    Person theCustomer = new Person(new Name("Eva", "Andersson"));
    em.persist(theCustomer);

    onsiteCourse.setBillingContact(theCustomer);
    em.flush();
  }

  @Test
  public void oneToManyWithoutJoinTable() {
    DemoDataHelper.createDefaultDataSet(eventRepo);

    Conference conference = em.createQuery(
        "from Conference where title='JavaOne'", Conference.class)
        .getSingleResult();
    Person person = em.createQuery(
        "from Person where name.firstName='Johan'", Person.class)
        .getSingleResult();

    conference.addOrganizer(person);

    em.flush();
  }

}


text:
package triaina.webview.entity.device;

import triaina.commons.json.annotation.Exclude;
import triaina.webview.entity.Params;
import android.os.Parcel;
import android.os.Parcelable;

public class WebStatusParams implements Params {

	public WebStatusParams() {}

	public WebStatusParams(Parcel source) {
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub

	}

	@Exclude
	public static final Parcelable.Creator<WebStatusParams> CREATOR = new Parcelable.Creator<WebStatusParams>() {
        @Override
        public WebStatusParams createFromParcel(Parcel source) {
            return new WebStatusParams(source);
        }
        @Override
        public WebStatusParams[] newArray(int size) {
            return new WebStatusParams[size];
        }
    };
}