'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _reactReconciler = require('react-reconciler');

var _reactReconciler2 = _interopRequireDefault(_reactReconciler);

var _emptyObject = require('fbjs/lib/emptyObject');

var _emptyObject2 = _interopRequireDefault(_emptyObject);

var _elements = require('./elements');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var PDFRenderer = (0, _reactReconciler2.default)({
  appendInitialChild: function appendInitialChild(parentInstance, child) {
    if (parentInstance.appendChild) {
      parentInstance.appendChild(child);
    } else {
      parentInstance.document = child;
    }
  },
  createInstance: function createInstance(type, props, internalInstanceHandle) {
    return (0, _elements.createElement)(type, props, internalInstanceHandle);
  },
  createTextInstance: function createTextInstance(text, rootContainerInstance, internalInstanceHandle) {
    return text;
  },
  finalizeInitialChildren: function finalizeInitialChildren(domElement, type, props) {
    return false;
  },
  getPublicInstance: function getPublicInstance(instance) {
    return instance;
  },
  prepareForCommit: function prepareForCommit() {
    // Noop
  },
  prepareUpdate: function prepareUpdate(domElement, type, oldProps, newProps) {
    return true;
  },
  resetAfterCommit: function resetAfterCommit() {
    // Noop
  },
  resetTextContent: function resetTextContent(domElement) {
    // Noop
  },
  getRootHostContext: function getRootHostContext() {
    return _emptyObject2.default;
  },
  getChildHostContext: function getChildHostContext() {
    return _emptyObject2.default;
  },
  shouldSetTextContent: function shouldSetTextContent(type, props) {
    return false;
  },


  now: function now() {},

  useSyncScheduling: true,

  mutation: {
    appendChild: function appendChild(parentInstance, child) {
      if (parentInstance.appendChild) {
        parentInstance.appendChild(child);
      } else {
        parentInstance.document = child;
      }
    },
    appendChildToContainer: function appendChildToContainer(parentInstance, child) {
      if (parentInstance.appendChild) {
        parentInstance.appendChild(child);
      } else {
        parentInstance.document = child;
      }
    },
    insertBefore: function insertBefore(parentInstance, child, beforeChild) {
      // noob
    },
    insertInContainerBefore: function insertInContainerBefore(parentInstance, child, beforeChild) {
      // noob
    },
    removeChild: function removeChild(parentInstance, child) {
      parentInstance.removeChild(child);
    },
    removeChildFromContainer: function removeChildFromContainer(parentInstance, child) {
      if (parentInstance.removeChild) {
        parentInstance.removeChild(child);
      }
    },
    commitTextUpdate: function commitTextUpdate(textInstance, oldText, newText) {
      textInstance = newText;
    },
    commitMount: function commitMount(instance, type, newProps) {
      // Noop
    },
    commitUpdate: function commitUpdate(instance, updatePayload, type, oldProps, newProps) {
      // noop
    }
  }
});

exports.default = PDFRenderer;