|
|
@ -113,10 +113,12 @@ module.exports = pdfjsLib; |
|
|
|
Object.defineProperty(exports, "__esModule", { |
|
|
|
Object.defineProperty(exports, "__esModule", { |
|
|
|
value: true |
|
|
|
value: true |
|
|
|
}); |
|
|
|
}); |
|
|
|
exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.mozL10n = exports.RendererType = exports.cloneObj = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined; |
|
|
|
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.mozL10n = exports.RendererType = exports.cloneObj = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined; |
|
|
|
|
|
|
|
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
|
|
|
|
|
|
|
|
|
|
|
var _pdfjsLib = __w_pdfjs_require__(0); |
|
|
|
var _pdfjsLib = __w_pdfjs_require__(0); |
|
|
|
|
|
|
|
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
@ -420,6 +422,41 @@ function cloneObj(obj) { |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var WaitOnType = { |
|
|
|
|
|
|
|
EVENT: 'event', |
|
|
|
|
|
|
|
TIMEOUT: 'timeout' |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
function waitOnEventOrTimeout(_ref) { |
|
|
|
|
|
|
|
var target = _ref.target, |
|
|
|
|
|
|
|
name = _ref.name, |
|
|
|
|
|
|
|
_ref$delay = _ref.delay, |
|
|
|
|
|
|
|
delay = _ref$delay === undefined ? 0 : _ref$delay; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) { |
|
|
|
|
|
|
|
return Promise.reject(new Error('waitOnEventOrTimeout - invalid paramaters.')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var capability = (0, _pdfjsLib.createPromiseCapability)(); |
|
|
|
|
|
|
|
function handler(type) { |
|
|
|
|
|
|
|
if (target instanceof EventBus) { |
|
|
|
|
|
|
|
target.off(name, eventHandler); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
target.removeEventListener(name, eventHandler); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (timeout) { |
|
|
|
|
|
|
|
clearTimeout(timeout); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
capability.resolve(type); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var eventHandler = handler.bind(null, WaitOnType.EVENT); |
|
|
|
|
|
|
|
if (target instanceof EventBus) { |
|
|
|
|
|
|
|
target.on(name, eventHandler); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
target.addEventListener(name, eventHandler); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT); |
|
|
|
|
|
|
|
var timeout = setTimeout(timeoutHandler, delay); |
|
|
|
|
|
|
|
return capability.promise; |
|
|
|
|
|
|
|
} |
|
|
|
var animationStarted = new Promise(function (resolve) { |
|
|
|
var animationStarted = new Promise(function (resolve) { |
|
|
|
window.requestAnimationFrame(resolve); |
|
|
|
window.requestAnimationFrame(resolve); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -476,10 +513,10 @@ function clamp(v, min, max) { |
|
|
|
|
|
|
|
|
|
|
|
var ProgressBar = function () { |
|
|
|
var ProgressBar = function () { |
|
|
|
function ProgressBar(id) { |
|
|
|
function ProgressBar(id) { |
|
|
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, |
|
|
|
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, |
|
|
|
height = _ref.height, |
|
|
|
height = _ref2.height, |
|
|
|
width = _ref.width, |
|
|
|
width = _ref2.width, |
|
|
|
units = _ref.units; |
|
|
|
units = _ref2.units; |
|
|
|
|
|
|
|
|
|
|
|
_classCallCheck(this, ProgressBar); |
|
|
|
_classCallCheck(this, ProgressBar); |
|
|
|
|
|
|
|
|
|
|
@ -580,6 +617,8 @@ exports.binarySearchFirstItem = binarySearchFirstItem; |
|
|
|
exports.normalizeWheelEventDelta = normalizeWheelEventDelta; |
|
|
|
exports.normalizeWheelEventDelta = normalizeWheelEventDelta; |
|
|
|
exports.animationStarted = animationStarted; |
|
|
|
exports.animationStarted = animationStarted; |
|
|
|
exports.localized = localized; |
|
|
|
exports.localized = localized; |
|
|
|
|
|
|
|
exports.WaitOnType = WaitOnType; |
|
|
|
|
|
|
|
exports.waitOnEventOrTimeout = waitOnEventOrTimeout; |
|
|
|
|
|
|
|
|
|
|
|
/***/ }), |
|
|
|
/***/ }), |
|
|
|
/* 2 */ |
|
|
|
/* 2 */ |
|
|
@ -792,17 +831,18 @@ var PDFLinkService = function () { |
|
|
|
console.error('PDFLinkService.navigateTo: "' + pageNumber + '" is not ' + ('a valid page number, for dest="' + dest + '".')); |
|
|
|
console.error('PDFLinkService.navigateTo: "' + pageNumber + '" is not ' + ('a valid page number, for dest="' + dest + '".')); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
_this.pdfViewer.scrollPageIntoView({ |
|
|
|
|
|
|
|
pageNumber: pageNumber, |
|
|
|
|
|
|
|
destArray: explicitDest |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (_this.pdfHistory) { |
|
|
|
if (_this.pdfHistory) { |
|
|
|
|
|
|
|
_this.pdfHistory.pushCurrentPosition(); |
|
|
|
_this.pdfHistory.push({ |
|
|
|
_this.pdfHistory.push({ |
|
|
|
dest: explicitDest, |
|
|
|
namedDest: namedDest, |
|
|
|
hash: namedDest, |
|
|
|
explicitDest: explicitDest, |
|
|
|
page: pageNumber |
|
|
|
pageNumber: pageNumber |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
_this.pdfViewer.scrollPageIntoView({ |
|
|
|
|
|
|
|
pageNumber: pageNumber, |
|
|
|
|
|
|
|
destArray: explicitDest |
|
|
|
|
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
new Promise(function (resolve, reject) { |
|
|
|
new Promise(function (resolve, reject) { |
|
|
|
if (typeof dest === 'string') { |
|
|
|
if (typeof dest === 'string') { |
|
|
@ -858,9 +898,6 @@ var PDFLinkService = function () { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if ('nameddest' in params) { |
|
|
|
if ('nameddest' in params) { |
|
|
|
if (this.pdfHistory) { |
|
|
|
|
|
|
|
this.pdfHistory.updateNextHashParam(params.nameddest); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.navigateTo(params.nameddest); |
|
|
|
this.navigateTo(params.nameddest); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -917,9 +954,6 @@ var PDFLinkService = function () { |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (ex) {} |
|
|
|
} catch (ex) {} |
|
|
|
if (typeof dest === 'string' || isValidExplicitDestination(dest)) { |
|
|
|
if (typeof dest === 'string' || isValidExplicitDestination(dest)) { |
|
|
|
if (this.pdfHistory) { |
|
|
|
|
|
|
|
this.pdfHistory.updateNextHashParam(dest); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.navigateTo(dest); |
|
|
|
this.navigateTo(dest); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -3083,302 +3117,421 @@ exports.PDFViewer = PDFViewer; |
|
|
|
Object.defineProperty(exports, "__esModule", { |
|
|
|
Object.defineProperty(exports, "__esModule", { |
|
|
|
value: true |
|
|
|
value: true |
|
|
|
}); |
|
|
|
}); |
|
|
|
exports.PDFHistory = undefined; |
|
|
|
exports.isDestsEqual = exports.PDFHistory = undefined; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _ui_utils = __w_pdfjs_require__(1); |
|
|
|
|
|
|
|
|
|
|
|
var _dom_events = __w_pdfjs_require__(2); |
|
|
|
var _dom_events = __w_pdfjs_require__(2); |
|
|
|
|
|
|
|
|
|
|
|
function PDFHistory(options) { |
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
|
this.linkService = options.linkService; |
|
|
|
|
|
|
|
this.eventBus = options.eventBus || (0, _dom_events.getGlobalEventBus)(); |
|
|
|
var HASH_CHANGE_TIMEOUT = 1000; |
|
|
|
|
|
|
|
var POSITION_UPDATED_THRESHOLD = 50; |
|
|
|
|
|
|
|
var UPDATE_VIEWAREA_TIMEOUT = 2000; |
|
|
|
|
|
|
|
function getCurrentHash() { |
|
|
|
|
|
|
|
return document.location.hash; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function parseCurrentHash(linkService) { |
|
|
|
|
|
|
|
var hash = unescape(getCurrentHash()).substring(1); |
|
|
|
|
|
|
|
var params = (0, _ui_utils.parseQueryString)(hash); |
|
|
|
|
|
|
|
var page = params.page | 0; |
|
|
|
|
|
|
|
if (!(Number.isInteger(page) && page > 0 && page <= linkService.pagesCount)) { |
|
|
|
|
|
|
|
page = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
hash: hash, |
|
|
|
|
|
|
|
page: page |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var PDFHistory = function () { |
|
|
|
|
|
|
|
function PDFHistory(_ref) { |
|
|
|
|
|
|
|
var _this = this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var linkService = _ref.linkService, |
|
|
|
|
|
|
|
eventBus = _ref.eventBus; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_classCallCheck(this, PDFHistory); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.linkService = linkService; |
|
|
|
|
|
|
|
this.eventBus = eventBus || (0, _dom_events.getGlobalEventBus)(); |
|
|
|
this.initialized = false; |
|
|
|
this.initialized = false; |
|
|
|
this.initialDestination = null; |
|
|
|
|
|
|
|
this.initialBookmark = null; |
|
|
|
this.initialBookmark = null; |
|
|
|
} |
|
|
|
this._boundEvents = Object.create(null); |
|
|
|
PDFHistory.prototype = { |
|
|
|
this._isViewerInPresentationMode = false; |
|
|
|
initialize: function pdfHistoryInitialize(fingerprint) { |
|
|
|
this._isPagesLoaded = false; |
|
|
|
this.initialized = true; |
|
|
|
this.eventBus.on('presentationmodechanged', function (evt) { |
|
|
|
this.reInitialized = false; |
|
|
|
_this._isViewerInPresentationMode = evt.active || evt.switchInProgress; |
|
|
|
this.allowHashChange = true; |
|
|
|
}); |
|
|
|
this.historyUnlocked = true; |
|
|
|
this.eventBus.on('pagesloaded', function (evt) { |
|
|
|
this.isViewerInPresentationMode = false; |
|
|
|
_this._isPagesLoaded = !!evt.pagesCount; |
|
|
|
this.previousHash = window.location.hash.substring(1); |
|
|
|
}); |
|
|
|
this.currentBookmark = ''; |
|
|
|
} |
|
|
|
this.currentPage = 0; |
|
|
|
|
|
|
|
this.updatePreviousBookmark = false; |
|
|
|
_createClass(PDFHistory, [{ |
|
|
|
this.previousBookmark = ''; |
|
|
|
key: 'initialize', |
|
|
|
this.previousPage = 0; |
|
|
|
value: function initialize(fingerprint) { |
|
|
|
this.nextHashParam = ''; |
|
|
|
var resetHistory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!fingerprint || typeof fingerprint !== 'string') { |
|
|
|
|
|
|
|
console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.'); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var reInitialized = this.initialized && this.fingerprint !== fingerprint; |
|
|
|
this.fingerprint = fingerprint; |
|
|
|
this.fingerprint = fingerprint; |
|
|
|
this.currentUid = this.uid = 0; |
|
|
|
if (!this.initialized) { |
|
|
|
this.current = {}; |
|
|
|
this._bindEvents(); |
|
|
|
|
|
|
|
} |
|
|
|
var state = window.history.state; |
|
|
|
var state = window.history.state; |
|
|
|
if (this._isStateObjectDefined(state)) { |
|
|
|
this.initialized = true; |
|
|
|
if (state.target.dest) { |
|
|
|
this.initialBookmark = null; |
|
|
|
this.initialDestination = state.target.dest; |
|
|
|
this._popStateInProgress = false; |
|
|
|
} else { |
|
|
|
this._blockHashChange = 0; |
|
|
|
this.initialBookmark = state.target.hash; |
|
|
|
this._currentHash = getCurrentHash(); |
|
|
|
|
|
|
|
this._numPositionUpdates = 0; |
|
|
|
|
|
|
|
this._currentUid = this._uid = 0; |
|
|
|
|
|
|
|
this._destination = null; |
|
|
|
|
|
|
|
this._position = null; |
|
|
|
|
|
|
|
if (!this._isValidState(state) || resetHistory) { |
|
|
|
|
|
|
|
var _parseCurrentHash = parseCurrentHash(this.linkService), |
|
|
|
|
|
|
|
hash = _parseCurrentHash.hash, |
|
|
|
|
|
|
|
page = _parseCurrentHash.page; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!hash || reInitialized || resetHistory) { |
|
|
|
|
|
|
|
this._pushOrReplaceState(null, true); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.currentUid = state.uid; |
|
|
|
this._pushOrReplaceState({ |
|
|
|
this.uid = state.uid + 1; |
|
|
|
hash: hash, |
|
|
|
this.current = state.target; |
|
|
|
page: page |
|
|
|
} else { |
|
|
|
}, true); |
|
|
|
if (state && state.fingerprint && this.fingerprint !== state.fingerprint) { |
|
|
|
return; |
|
|
|
this.reInitialized = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
this._pushOrReplaceState({ fingerprint: this.fingerprint }, true); |
|
|
|
var destination = state.destination; |
|
|
|
|
|
|
|
this._updateInternalState(destination, state.uid, true); |
|
|
|
|
|
|
|
if (destination.dest) { |
|
|
|
|
|
|
|
this.initialBookmark = JSON.stringify(destination.dest); |
|
|
|
|
|
|
|
this._destination.page = null; |
|
|
|
|
|
|
|
} else if (destination.hash) { |
|
|
|
|
|
|
|
this.initialBookmark = destination.hash; |
|
|
|
|
|
|
|
} else if (destination.page) { |
|
|
|
|
|
|
|
this.initialBookmark = 'page=' + destination.page; |
|
|
|
} |
|
|
|
} |
|
|
|
var self = this; |
|
|
|
} |
|
|
|
window.addEventListener('popstate', function pdfHistoryPopstate(evt) { |
|
|
|
}, { |
|
|
|
if (!self.historyUnlocked) { |
|
|
|
key: 'push', |
|
|
|
|
|
|
|
value: function push(_ref2) { |
|
|
|
|
|
|
|
var namedDest = _ref2.namedDest, |
|
|
|
|
|
|
|
explicitDest = _ref2.explicitDest, |
|
|
|
|
|
|
|
pageNumber = _ref2.pageNumber; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.initialized) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (evt.state) { |
|
|
|
if (namedDest && typeof namedDest !== 'string' || !(explicitDest instanceof Array) || !(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.linkService.pagesCount)) { |
|
|
|
self._goTo(evt.state); |
|
|
|
console.error('PDFHistory.push: Invalid parameters.'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (self.uid === 0) { |
|
|
|
var hash = namedDest || JSON.stringify(explicitDest); |
|
|
|
var previousParams = self.previousHash && self.currentBookmark && self.previousHash !== self.currentBookmark ? { |
|
|
|
if (!hash) { |
|
|
|
hash: self.currentBookmark, |
|
|
|
return; |
|
|
|
page: self.currentPage |
|
|
|
|
|
|
|
} : { page: 1 }; |
|
|
|
|
|
|
|
replacePreviousHistoryState(previousParams, function () { |
|
|
|
|
|
|
|
updateHistoryWithCurrentHash(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
updateHistoryWithCurrentHash(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
var forceReplace = false; |
|
|
|
function updateHistoryWithCurrentHash() { |
|
|
|
if (this._destination && (this._destination.hash === hash || isDestsEqual(this._destination.dest, explicitDest))) { |
|
|
|
self.previousHash = window.location.hash.slice(1); |
|
|
|
if (this._destination.page) { |
|
|
|
self._pushToHistory({ hash: self.previousHash }, false, true); |
|
|
|
return; |
|
|
|
self._updatePreviousBookmark(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function replacePreviousHistoryState(params, callback) { |
|
|
|
|
|
|
|
self.historyUnlocked = false; |
|
|
|
|
|
|
|
self.allowHashChange = false; |
|
|
|
|
|
|
|
window.addEventListener('popstate', rewriteHistoryAfterBack); |
|
|
|
|
|
|
|
history.back(); |
|
|
|
|
|
|
|
function rewriteHistoryAfterBack() { |
|
|
|
|
|
|
|
window.removeEventListener('popstate', rewriteHistoryAfterBack); |
|
|
|
|
|
|
|
window.addEventListener('popstate', rewriteHistoryAfterForward); |
|
|
|
|
|
|
|
self._pushToHistory(params, false, true); |
|
|
|
|
|
|
|
history.forward(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function rewriteHistoryAfterForward() { |
|
|
|
|
|
|
|
window.removeEventListener('popstate', rewriteHistoryAfterForward); |
|
|
|
|
|
|
|
self.allowHashChange = true; |
|
|
|
|
|
|
|
self.historyUnlocked = true; |
|
|
|
|
|
|
|
callback(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
forceReplace = true; |
|
|
|
} |
|
|
|
} |
|
|
|
function pdfHistoryBeforeUnload() { |
|
|
|
if (this._popStateInProgress && !forceReplace) { |
|
|
|
var previousParams = self._getPreviousParams(null, true); |
|
|
|
return; |
|
|
|
if (previousParams) { |
|
|
|
|
|
|
|
var replacePrevious = !self.current.dest && self.current.hash !== self.previousHash; |
|
|
|
|
|
|
|
self._pushToHistory(previousParams, false, replacePrevious); |
|
|
|
|
|
|
|
self._updatePreviousBookmark(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
window.removeEventListener('beforeunload', pdfHistoryBeforeUnload); |
|
|
|
this._pushOrReplaceState({ |
|
|
|
|
|
|
|
dest: explicitDest, |
|
|
|
|
|
|
|
hash: hash, |
|
|
|
|
|
|
|
page: pageNumber |
|
|
|
|
|
|
|
}, forceReplace); |
|
|
|
} |
|
|
|
} |
|
|
|
window.addEventListener('beforeunload', pdfHistoryBeforeUnload); |
|
|
|
}, { |
|
|
|
window.addEventListener('pageshow', function pdfHistoryPageShow(evt) { |
|
|
|
key: 'pushCurrentPosition', |
|
|
|
window.addEventListener('beforeunload', pdfHistoryBeforeUnload); |
|
|
|
value: function pushCurrentPosition() { |
|
|
|
}); |
|
|
|
if (!this.initialized || this._popStateInProgress) { |
|
|
|
self.eventBus.on('presentationmodechanged', function (e) { |
|
|
|
return; |
|
|
|
self.isViewerInPresentationMode = e.active; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
clearHistoryState: function pdfHistory_clearHistoryState() { |
|
|
|
|
|
|
|
this._pushOrReplaceState(null, true); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
_isStateObjectDefined: function pdfHistory_isStateObjectDefined(state) { |
|
|
|
|
|
|
|
return state && state.uid >= 0 && state.fingerprint && this.fingerprint === state.fingerprint && state.target && state.target.hash ? true : false; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
_pushOrReplaceState: function pdfHistory_pushOrReplaceState(stateObj, replace) { |
|
|
|
|
|
|
|
if (replace) { |
|
|
|
|
|
|
|
window.history.replaceState(stateObj, '', document.URL); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
window.history.pushState(stateObj, '', document.URL); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
this._tryPushCurrentPosition(); |
|
|
|
get isHashChangeUnlocked() { |
|
|
|
|
|
|
|
if (!this.initialized) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return this.allowHashChange; |
|
|
|
}, { |
|
|
|
}, |
|
|
|
key: 'back', |
|
|
|
_updatePreviousBookmark: function pdfHistory_updatePreviousBookmark() { |
|
|
|
value: function back() { |
|
|
|
if (this.updatePreviousBookmark && this.currentBookmark && this.currentPage) { |
|
|
|
if (!this.initialized || this._popStateInProgress) { |
|
|
|
this.previousBookmark = this.currentBookmark; |
|
|
|
return; |
|
|
|
this.previousPage = this.currentPage; |
|
|
|
|
|
|
|
this.updatePreviousBookmark = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
var state = window.history.state; |
|
|
|
updateCurrentBookmark: function pdfHistoryUpdateCurrentBookmark(bookmark, pageNum) { |
|
|
|
if (this._isValidState(state) && state.uid > 0) { |
|
|
|
if (this.initialized) { |
|
|
|
window.history.back(); |
|
|
|
this.currentBookmark = bookmark.substring(1); |
|
|
|
|
|
|
|
this.currentPage = pageNum | 0; |
|
|
|
|
|
|
|
this._updatePreviousBookmark(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
updateNextHashParam: function pdfHistoryUpdateNextHashParam(param) { |
|
|
|
|
|
|
|
if (this.initialized) { |
|
|
|
|
|
|
|
this.nextHashParam = param; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, { |
|
|
|
push: function pdfHistoryPush(params, isInitialBookmark) { |
|
|
|
key: 'forward', |
|
|
|
if (!(this.initialized && this.historyUnlocked)) { |
|
|
|
value: function forward() { |
|
|
|
|
|
|
|
if (!this.initialized || this._popStateInProgress) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (params.dest && !params.hash) { |
|
|
|
var state = window.history.state; |
|
|
|
params.hash = this.current.hash && this.current.dest && this.current.dest === params.dest ? this.current.hash : this.linkService.getDestinationHash(params.dest).split('#')[1]; |
|
|
|
if (this._isValidState(state) && state.uid < this._uid - 1) { |
|
|
|
|
|
|
|
window.history.forward(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (params.page) { |
|
|
|
|
|
|
|
params.page |= 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (isInitialBookmark) { |
|
|
|
}, { |
|
|
|
var target = window.history.state.target; |
|
|
|
key: '_pushOrReplaceState', |
|
|
|
if (!target) { |
|
|
|
value: function _pushOrReplaceState(destination) { |
|
|
|
this._pushToHistory(params, false); |
|
|
|
var forceReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
|
|
|
this.previousHash = window.location.hash.substring(1); |
|
|
|
|
|
|
|
|
|
|
|
var shouldReplace = forceReplace || !this._destination; |
|
|
|
|
|
|
|
var newState = { |
|
|
|
|
|
|
|
fingerprint: this.fingerprint, |
|
|
|
|
|
|
|
uid: shouldReplace ? this._currentUid : this._uid, |
|
|
|
|
|
|
|
destination: destination |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this._updateInternalState(destination, newState.uid); |
|
|
|
|
|
|
|
if (shouldReplace) { |
|
|
|
|
|
|
|
window.history.replaceState(newState, '', document.URL); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
window.history.pushState(newState, '', document.URL); |
|
|
|
} |
|
|
|
} |
|
|
|
this.updatePreviousBookmark = this.nextHashParam ? false : true; |
|
|
|
|
|
|
|
if (target) { |
|
|
|
|
|
|
|
this._updatePreviousBookmark(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
key: '_tryPushCurrentPosition', |
|
|
|
|
|
|
|
value: function _tryPushCurrentPosition() { |
|
|
|
|
|
|
|
var temporary = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this._position) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.nextHashParam) { |
|
|
|
var position = this._position; |
|
|
|
if (this.nextHashParam === params.hash) { |
|
|
|
if (temporary) { |
|
|
|
this.nextHashParam = null; |
|
|
|
position = (0, _ui_utils.cloneObj)(this._position); |
|
|
|
this.updatePreviousBookmark = true; |
|
|
|
position.temporary = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!this._destination) { |
|
|
|
|
|
|
|
this._pushOrReplaceState(position); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.nextHashParam = null; |
|
|
|
if (this._destination.temporary) { |
|
|
|
|
|
|
|
this._pushOrReplaceState(position, true); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (params.hash) { |
|
|
|
if (this._destination.hash === position.hash) { |
|
|
|
if (this.current.hash) { |
|
|
|
return; |
|
|
|
if (this.current.hash !== params.hash) { |
|
|
|
|
|
|
|
this._pushToHistory(params, true); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (!this.current.page && params.page) { |
|
|
|
|
|
|
|
this._pushToHistory(params, false, true); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
this.updatePreviousBookmark = true; |
|
|
|
if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) { |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
var forceReplace = false; |
|
|
|
this._pushToHistory(params, true); |
|
|
|
if (this._destination.page === position.first || this._destination.page === position.page) { |
|
|
|
|
|
|
|
if (this._destination.dest || !this._destination.first) { |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (this.current.page && params.page && this.current.page !== params.page) { |
|
|
|
forceReplace = true; |
|
|
|
this._pushToHistory(params, true); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
this._pushOrReplaceState(position, forceReplace); |
|
|
|
_getPreviousParams: function pdfHistory_getPreviousParams(onlyCheckPage, beforeUnload) { |
|
|
|
|
|
|
|
if (!(this.currentBookmark && this.currentPage)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} else if (this.updatePreviousBookmark) { |
|
|
|
|
|
|
|
this.updatePreviousBookmark = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (this.uid > 0 && !(this.previousBookmark && this.previousPage)) { |
|
|
|
}, { |
|
|
|
return null; |
|
|
|
key: '_isValidState', |
|
|
|
|
|
|
|
value: function _isValidState(state) { |
|
|
|
|
|
|
|
if (!state) { |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!this.current.dest && !onlyCheckPage || beforeUnload) { |
|
|
|
if (state.fingerprint !== this.fingerprint) { |
|
|
|
if (this.previousBookmark === this.currentBookmark) { |
|
|
|
return false; |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else if (this.current.page || onlyCheckPage) { |
|
|
|
if (!Number.isInteger(state.uid) || state.uid < 0) { |
|
|
|
if (this.previousPage === this.currentPage) { |
|
|
|
return false; |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (state.destination === null || _typeof(state.destination) !== 'object') { |
|
|
|
return null; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
var params = { |
|
|
|
return true; |
|
|
|
hash: this.currentBookmark, |
|
|
|
|
|
|
|
page: this.currentPage |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
if (this.isViewerInPresentationMode) { |
|
|
|
|
|
|
|
params.hash = null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return params; |
|
|
|
}, { |
|
|
|
}, |
|
|
|
key: '_updateInternalState', |
|
|
|
_stateObj: function pdfHistory_stateObj(params) { |
|
|
|
value: function _updateInternalState(destination, uid) { |
|
|
|
return { |
|
|
|
var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
|
|
|
fingerprint: this.fingerprint, |
|
|
|
|
|
|
|
uid: this.uid, |
|
|
|
if (removeTemporary && destination && destination.temporary) { |
|
|
|
target: params |
|
|
|
delete destination.temporary; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this._destination = destination; |
|
|
|
|
|
|
|
this._currentUid = uid; |
|
|
|
|
|
|
|
this._uid = this._currentUid + 1; |
|
|
|
|
|
|
|
this._numPositionUpdates = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
key: '_updateViewarea', |
|
|
|
|
|
|
|
value: function _updateViewarea(_ref3) { |
|
|
|
|
|
|
|
var _this2 = this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var location = _ref3.location; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this._updateViewareaTimeout) { |
|
|
|
|
|
|
|
clearTimeout(this._updateViewareaTimeout); |
|
|
|
|
|
|
|
this._updateViewareaTimeout = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this._position = { |
|
|
|
|
|
|
|
hash: this._isViewerInPresentationMode ? 'page=' + location.pageNumber : location.pdfOpenParams.substring(1), |
|
|
|
|
|
|
|
page: this.linkService.page, |
|
|
|
|
|
|
|
first: location.pageNumber |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
if (this._popStateInProgress) { |
|
|
|
_pushToHistory: function pdfHistory_pushToHistory(params, addPrevious, overwrite) { |
|
|
|
|
|
|
|
if (!this.initialized) { |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!params.hash && params.page) { |
|
|
|
if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) { |
|
|
|
params.hash = 'page=' + params.page; |
|
|
|
this._numPositionUpdates++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (addPrevious && !overwrite) { |
|
|
|
if (UPDATE_VIEWAREA_TIMEOUT > 0) { |
|
|
|
var previousParams = this._getPreviousParams(); |
|
|
|
this._updateViewareaTimeout = setTimeout(function () { |
|
|
|
if (previousParams) { |
|
|
|
if (!_this2._popStateInProgress) { |
|
|
|
var replacePrevious = !this.current.dest && this.current.hash !== this.previousHash; |
|
|
|
_this2._tryPushCurrentPosition(true); |
|
|
|
this._pushToHistory(previousParams, false, replacePrevious); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
_this2._updateViewareaTimeout = null; |
|
|
|
|
|
|
|
}, UPDATE_VIEWAREA_TIMEOUT); |
|
|
|
} |
|
|
|
} |
|
|
|
this._pushOrReplaceState(this._stateObj(params), overwrite || this.uid === 0); |
|
|
|
} |
|
|
|
this.currentUid = this.uid++; |
|
|
|
}, { |
|
|
|
this.current = params; |
|
|
|
key: '_popState', |
|
|
|
this.updatePreviousBookmark = true; |
|
|
|
value: function _popState(_ref4) { |
|
|
|
}, |
|
|
|
var _this3 = this; |
|
|
|
_goTo: function pdfHistory_goTo(state) { |
|
|
|
|
|
|
|
if (!(this.initialized && this.historyUnlocked && this._isStateObjectDefined(state))) { |
|
|
|
var state = _ref4.state; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var newHash = getCurrentHash(), |
|
|
|
|
|
|
|
hashChanged = this._currentHash !== newHash; |
|
|
|
|
|
|
|
this._currentHash = newHash; |
|
|
|
|
|
|
|
if (!state || false) { |
|
|
|
|
|
|
|
this._currentUid = this._uid; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _parseCurrentHash2 = parseCurrentHash(this.linkService), |
|
|
|
|
|
|
|
hash = _parseCurrentHash2.hash, |
|
|
|
|
|
|
|
page = _parseCurrentHash2.page; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._pushOrReplaceState({ |
|
|
|
|
|
|
|
hash: hash, |
|
|
|
|
|
|
|
page: page |
|
|
|
|
|
|
|
}, true); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!this._isValidState(state)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!this.reInitialized && state.uid < this.currentUid) { |
|
|
|
this._popStateInProgress = true; |
|
|
|
var previousParams = this._getPreviousParams(true); |
|
|
|
if (hashChanged) { |
|
|
|
if (previousParams) { |
|
|
|
this._blockHashChange++; |
|
|
|
this._pushToHistory(this.current, false); |
|
|
|
(0, _ui_utils.waitOnEventOrTimeout)({ |
|
|
|
this._pushToHistory(previousParams, false); |
|
|
|
target: window, |
|
|
|
this.currentUid = state.uid; |
|
|
|
name: 'hashchange', |
|
|
|
|
|
|
|
delay: HASH_CHANGE_TIMEOUT |
|
|
|
|
|
|
|
}).then(function () { |
|
|
|
|
|
|
|
_this3._blockHashChange--; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (state.uid < this._currentUid && this._position && this._destination) { |
|
|
|
|
|
|
|
var shouldGoBack = false; |
|
|
|
|
|
|
|
if (this._destination.temporary) { |
|
|
|
|
|
|
|
this._pushOrReplaceState(this._position); |
|
|
|
|
|
|
|
shouldGoBack = true; |
|
|
|
|
|
|
|
} else if (this._destination.page && this._destination.page !== this._position.first && this._destination.page !== this._position.page) { |
|
|
|
|
|
|
|
this._pushOrReplaceState(this._destination); |
|
|
|
|
|
|
|
this._pushOrReplaceState(this._position); |
|
|
|
|
|
|
|
shouldGoBack = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (shouldGoBack) { |
|
|
|
|
|
|
|
this._currentUid = state.uid; |
|
|
|
window.history.back(); |
|
|
|
window.history.back(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.historyUnlocked = false; |
|
|
|
var destination = state.destination; |
|
|
|
if (state.target.dest) { |
|
|
|
this._updateInternalState(destination, state.uid, true); |
|
|
|
this.linkService.navigateTo(state.target.dest); |
|
|
|
if (destination.dest) { |
|
|
|
} else { |
|
|
|
this.linkService.navigateTo(destination.dest); |
|
|
|
this.linkService.setHash(state.target.hash); |
|
|
|
} else if (destination.hash) { |
|
|
|
|
|
|
|
this.linkService.setHash(destination.hash); |
|
|
|
|
|
|
|
} else if (destination.page) { |
|
|
|
|
|
|
|
this.linkService.page = destination.page; |
|
|
|
} |
|
|
|
} |
|
|
|
this.currentUid = state.uid; |
|
|
|
Promise.resolve().then(function () { |
|
|
|
if (state.uid > this.uid) { |
|
|
|
_this3._popStateInProgress = false; |
|
|
|
this.uid = state.uid; |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
this.current = state.target; |
|
|
|
}, { |
|
|
|
this.updatePreviousBookmark = true; |
|
|
|
key: '_bindEvents', |
|
|
|
var currentHash = window.location.hash.substring(1); |
|
|
|
value: function _bindEvents() { |
|
|
|
if (this.previousHash !== currentHash) { |
|
|
|
var _this4 = this; |
|
|
|
this.allowHashChange = false; |
|
|
|
|
|
|
|
|
|
|
|
var _boundEvents = this._boundEvents, |
|
|
|
|
|
|
|
eventBus = this.eventBus; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_boundEvents.updateViewarea = this._updateViewarea.bind(this); |
|
|
|
|
|
|
|
_boundEvents.popState = this._popState.bind(this); |
|
|
|
|
|
|
|
_boundEvents.pageHide = function (evt) { |
|
|
|
|
|
|
|
if (!_this4._destination) { |
|
|
|
|
|
|
|
_this4._tryPushCurrentPosition(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.previousHash = currentHash; |
|
|
|
}; |
|
|
|
this.historyUnlocked = true; |
|
|
|
eventBus.on('updateviewarea', _boundEvents.updateViewarea); |
|
|
|
}, |
|
|
|
window.addEventListener('popstate', _boundEvents.popState); |
|
|
|
back: function pdfHistoryBack() { |
|
|
|
window.addEventListener('pagehide', _boundEvents.pageHide); |
|
|
|
this.go(-1); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
forward: function pdfHistoryForward() { |
|
|
|
|
|
|
|
this.go(1); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
go: function pdfHistoryGo(direction) { |
|
|
|
|
|
|
|
if (this.initialized && this.historyUnlocked) { |
|
|
|
|
|
|
|
var state = window.history.state; |
|
|
|
|
|
|
|
if (direction === -1 && state && state.uid > 0) { |
|
|
|
|
|
|
|
window.history.back(); |
|
|
|
|
|
|
|
} else if (direction === 1 && state && state.uid < this.uid - 1) { |
|
|
|
|
|
|
|
window.history.forward(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
key: 'popStateInProgress', |
|
|
|
|
|
|
|
get: function get() { |
|
|
|
|
|
|
|
return this.initialized && (this._popStateInProgress || this._blockHashChange > 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return PDFHistory; |
|
|
|
|
|
|
|
}(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isDestsEqual(firstDest, secondDest) { |
|
|
|
|
|
|
|
function isEntryEqual(first, second) { |
|
|
|
|
|
|
|
if ((typeof first === 'undefined' ? 'undefined' : _typeof(first)) !== (typeof second === 'undefined' ? 'undefined' : _typeof(second))) { |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
if (first instanceof Array || second instanceof Array) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (first !== null && (typeof first === 'undefined' ? 'undefined' : _typeof(first)) === 'object' && second !== null) { |
|
|
|
|
|
|
|
if (Object.keys(first).length !== Object.keys(second).length) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (var key in first) { |
|
|
|
|
|
|
|
if (!isEntryEqual(first[key], second[key])) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return first === second || Number.isNaN(first) && Number.isNaN(second); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!(firstDest instanceof Array && secondDest instanceof Array)) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (firstDest.length !== secondDest.length) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (var i = 0, ii = firstDest.length; i < ii; i++) { |
|
|
|
|
|
|
|
if (!isEntryEqual(firstDest[i], secondDest[i])) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
exports.PDFHistory = PDFHistory; |
|
|
|
exports.PDFHistory = PDFHistory; |
|
|
|
|
|
|
|
exports.isDestsEqual = isDestsEqual; |
|
|
|
|
|
|
|
|
|
|
|
/***/ }), |
|
|
|
/***/ }), |
|
|
|
/* 11 */ |
|
|
|
/* 11 */ |
|
|
|