diff --git a/dist/pdf-annotate.js b/dist/pdf-annotate.js index 9209a18f..b4524cd4 100644 --- a/dist/pdf-annotate.js +++ b/dist/pdf-annotate.js @@ -177,7 +177,7 @@ return /******/ (function(modules) { // webpackBootstrap * @param {String} pageNumber The page number * @return {Promise} */ - getAnnotations: function getAnnotations(documentId, pageNumber) { + getAnnotations: function getAnnotations(documentId, userId, pageNumber) { var _getStoreAdapter; return (_getStoreAdapter = this.getStoreAdapter()).getAnnotations.apply(_getStoreAdapter, arguments); @@ -238,6 +238,7 @@ return /******/ (function(modules) { // webpackBootstrap * Get all the annotations for a given document and page number. * * @param {String} documentId The ID for the document the annotations belong to + * @param {String} userId The user makeing changes to this document * @param {Number} pageNumber The number of the page the annotations belong to * @return {Promise} */ @@ -245,7 +246,7 @@ return /******/ (function(modules) { // webpackBootstrap _createClass(StoreAdapter, [{ key: '__getAnnotations', - value: function __getAnnotations(documentId, pageNumber) { + value: function __getAnnotations(documentId, userId, pageNumber) { (0, _abstractFunction2.default)('getAnnotations'); } }, { @@ -274,7 +275,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '__addAnnotation', - value: function __addAnnotation(documentId, pageNumber, annotation) { + value: function __addAnnotation(documentId, userId, pageNumber, annotation) { (0, _abstractFunction2.default)('addAnnotation'); } }, { @@ -355,7 +356,7 @@ return /******/ (function(modules) { // webpackBootstrap return this.__getAnnotations; }, set: function set(fn) { - this.__getAnnotations = function getAnnotations(documentId, pageNumber) { + this.__getAnnotations = function getAnnotations(documentId, userId, pageNumber) { return fn.apply(undefined, arguments).then(function (annotations) { // TODO may be best to have this happen on the server if (annotations.annotations) { @@ -373,9 +374,9 @@ return /******/ (function(modules) { // webpackBootstrap return this.__addAnnotation; }, set: function set(fn) { - this.__addAnnotation = function addAnnotation(documentId, pageNumber, annotation) { + this.__addAnnotation = function addAnnotation(documentId, userId, pageNumber, annotation) { return fn.apply(undefined, arguments).then(function (annotation) { - (0, _event.fireEvent)('annotation:add', documentId, pageNumber, annotation); + (0, _event.fireEvent)('annotation:add', documentId, userId, pageNumber, annotation); return annotation; }); }; @@ -1143,6 +1144,7 @@ return /******/ (function(modules) { // webpackBootstrap function getMetadata(svg) { return { documentId: svg.getAttribute('data-pdf-annotate-document'), + userId: svg.getAttribute('data-pdf-annotate-user'), pageNumber: parseInt(svg.getAttribute('data-pdf-annotate-page'), 10), viewport: JSON.parse(svg.getAttribute('data-pdf-annotate-viewport')) }; @@ -2190,6 +2192,8 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } @@ -2205,64 +2209,65 @@ return /******/ (function(modules) { // webpackBootstrap _classCallCheck(this, LocalStoreAdapter); return _possibleConstructorReturn(this, (LocalStoreAdapter.__proto__ || Object.getPrototypeOf(LocalStoreAdapter)).call(this, { - getAnnotations: function getAnnotations(documentId, pageNumber) { + getAnnotations: function getAnnotations(documentId, userId, pageNumber) { return new Promise(function (resolve, reject) { - var annotations = _getAnnotations(documentId).filter(function (i) { + var annotations = _getAnnotations(documentId, userId).filter(function (i) { return i.page === pageNumber && i.class === 'Annotation'; }); resolve({ documentId: documentId, + userId: userId, pageNumber: pageNumber, annotations: annotations }); }); }, - getAnnotation: function getAnnotation(documentId, annotationId) { - return Promise.resolve(_getAnnotations(documentId)[findAnnotation(documentId, annotationId)]); + getAnnotation: function getAnnotation(documentId, userId, annotationId) { + return Promise.resolve(_getAnnotations(documentId, userId)[findAnnotation(documentId, userId, annotationId)]); }, - addAnnotation: function addAnnotation(documentId, pageNumber, annotation) { + addAnnotation: function addAnnotation(documentId, userId, pageNumber, annotation) { return new Promise(function (resolve, reject) { annotation.class = 'Annotation'; annotation.uuid = (0, _uuid2.default)(); annotation.page = pageNumber; - var annotations = _getAnnotations(documentId); + var annotations = _getAnnotations(documentId, userId); annotations.push(annotation); - updateAnnotations(documentId, annotations); + updateAnnotations(documentId, userId, annotations); resolve(annotation); }); }, - editAnnotation: function editAnnotation(documentId, annotationId, annotation) { + editAnnotation: function editAnnotation(documentId, userId, annotationId, annotation) { return new Promise(function (resolve, reject) { - var annotations = _getAnnotations(documentId); - annotations[findAnnotation(documentId, annotationId)] = annotation; - updateAnnotations(documentId, annotations); + var annotations = _getAnnotations(documentId, userId); + annotations[findAnnotation(documentId, userId, annotationId)] = annotation; + updateAnnotations(documentId, userId, annotations); resolve(annotation); }); }, - deleteAnnotation: function deleteAnnotation(documentId, annotationId) { + deleteAnnotation: function deleteAnnotation(documentId, userId, annotationId) { return new Promise(function (resolve, reject) { - var index = findAnnotation(documentId, annotationId); + var index = findAnnotation(documentId, userId, annotationId); if (index > -1) { - var annotations = _getAnnotations(documentId); + var annotations = _getAnnotations(documentId, userId); annotations.splice(index, 1); - updateAnnotations(documentId, annotations); + updateAnnotations(documentId, userId, annotations); } resolve(true); }); }, - getComments: function getComments(documentId, annotationId) { + getComments: function getComments(documentId, userId, annotationId) { return new Promise(function (resolve, reject) { - resolve(_getAnnotations(documentId).filter(function (i) { + resolve(_getAnnotations(documentId, userId).filter(function (i) { return i.class === 'Comment' && i.annotation === annotationId; })); }); }, - addComment: function addComment(documentId, annotationId, content) { + addComment: function addComment(documentId, userId, annotationId, content) { return new Promise(function (resolve, reject) { var comment = { class: 'Comment', @@ -2271,18 +2276,18 @@ return /******/ (function(modules) { // webpackBootstrap content: content }; - var annotations = _getAnnotations(documentId); + var annotations = _getAnnotations(documentId, userId); annotations.push(comment); - updateAnnotations(documentId, annotations); + updateAnnotations(documentId, userId, annotations); resolve(comment); }); }, - deleteComment: function deleteComment(documentId, commentId) { + deleteComment: function deleteComment(documentId, userId, commentId) { return new Promise(function (resolve, reject) { - _getAnnotations(documentId); + _getAnnotations(documentId, userId); var index = -1; - var annotations = _getAnnotations(documentId); + var annotations = _getAnnotations(documentId, userId); for (var i = 0, l = annotations.length; i < l; i++) { if (annotations[i].uuid === commentId) { index = i; @@ -2292,7 +2297,7 @@ return /******/ (function(modules) { // webpackBootstrap if (index > -1) { annotations.splice(index, 1); - updateAnnotations(documentId, annotations); + updateAnnotations(documentId, userId, annotations); } resolve(true); @@ -2307,17 +2312,23 @@ return /******/ (function(modules) { // webpackBootstrap exports.default = LocalStoreAdapter; - function _getAnnotations(documentId) { - return JSON.parse(localStorage.getItem(documentId + '/annotations')) || []; + function _getAnnotations(documentId, userId) { + var all_annotations = []; + for (var i = 0; i < localStorage.length; i++) { + if (localStorage.key(i).includes('annotations')) { + all_annotations.push.apply(all_annotations, _toConsumableArray(JSON.parse(localStorage.getItem(localStorage.key(i))))); + } + } + return all_annotations; } - function updateAnnotations(documentId, annotations) { - localStorage.setItem(documentId + '/annotations', JSON.stringify(annotations)); + function updateAnnotations(documentId, userId, annotations) { + localStorage.setItem(documentId + '/' + userId + '/annotations', JSON.stringify(annotations)); } - function findAnnotation(documentId, annotationId) { + function findAnnotation(documentId, userId, annotationId) { var index = -1; - var annotations = _getAnnotations(documentId); + var annotations = _getAnnotations(documentId, userId); for (var i = 0, l = annotations.length; i < l; i++) { if (annotations[i].uuid === annotationId) { index = i; @@ -2406,6 +2417,7 @@ return /******/ (function(modules) { // webpackBootstrap } svg.setAttribute('data-pdf-annotate-document', data.documentId); + svg.setAttribute('data-pdf-annotate-user', data.userId); svg.setAttribute('data-pdf-annotate-page', data.pageNumber); // Make sure annotations is an array @@ -2966,11 +2978,11 @@ return /******/ (function(modules) { // webpackBootstrap * Initialize the event handlers for keeping screen reader hints synced with data */ function initEventHandlers() { - (0, _event.addEventListener)('annotation:add', function (documentId, pageNumber, annotation) { - reorderAnnotationsByType(documentId, pageNumber, annotation.type); + (0, _event.addEventListener)('annotation:add', function (documentId, userId, pageNumber, annotation) { + reorderAnnotationsByType(documentId, userId, pageNumber, annotation.type); }); - (0, _event.addEventListener)('annotation:edit', function (documentId, annotationId, annotation) { - reorderAnnotationsByType(documentId, annotation.page, annotation.type); + (0, _event.addEventListener)('annotation:edit', function (documentId, userId, annotationId, annotation) { + reorderAnnotationsByType(documentId, userId, annotation.page, annotation.type); }); (0, _event.addEventListener)('annotation:delete', removeAnnotation); (0, _event.addEventListener)('comment:add', insertComment); @@ -2981,11 +2993,12 @@ return /******/ (function(modules) { // webpackBootstrap * Reorder the annotation numbers by annotation type * * @param {String} documentId The ID of the document + * @param {String} userId The ID of the user * @param {Number} pageNumber The page number of the annotations * @param {Strig} type The annotation type */ - function reorderAnnotationsByType(documentId, pageNumber, type) { - _PDFJSAnnotate2.default.getStoreAdapter().getAnnotations(documentId, pageNumber).then(function (annotations) { + function reorderAnnotationsByType(documentId, userId, pageNumber, type) { + _PDFJSAnnotate2.default.getStoreAdapter().getAnnotations(documentId, userId, pageNumber).then(function (annotations) { return annotations.annotations.filter(function (a) { return a.type === type; }); @@ -3358,11 +3371,12 @@ return /******/ (function(modules) { // webpackBootstrap var svg = overlay.parentNode.querySelector(_config2.default.annotationSvgQuery()); var _getMetadata2 = (0, _utils.getMetadata)(svg), - documentId = _getMetadata2.documentId; + documentId = _getMetadata2.documentId, + userId = _getMetadata2.userId; overlay.querySelector('a').style.display = ''; - _PDFJSAnnotate2.default.getStoreAdapter().getAnnotation(documentId, annotationId).then(function (annotation) { + _PDFJSAnnotate2.default.getStoreAdapter().getAnnotation(documentId, userId, annotationId).then(function (annotation) { var attribX = 'x'; var attribY = 'y'; if (['circle', 'fillcircle', 'emptycircle'].indexOf(type) > -1) { @@ -3558,9 +3572,10 @@ return /******/ (function(modules) { // webpackBootstrap if (lines.length > 1 && (svg = (0, _utils.findSVGAtPoint)(x, y))) { var _getMetadata = (0, _utils.getMetadata)(svg), documentId = _getMetadata.documentId, + userId = _getMetadata.userId, pageNumber = _getMetadata.pageNumber; - _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, pageNumber, { + _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, { type: 'drawing', width: _penSize, color: _penColor, @@ -3587,7 +3602,9 @@ return /******/ (function(modules) { // webpackBootstrap } function handleDocumentPointermoveChrome(e) { - savePoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY); + if (_candraw) { + savePoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY); + } } /** @@ -3736,7 +3753,19 @@ return /******/ (function(modules) { // webpackBootstrap function handleDocumentMouseMove(e) { if (_canerase) { var target = (0, _utils.findAnnotationAtPoint)(e.clientX, e.clientY); - console.log(target); + if (target) { + console.log(target); + // let annotationId = target.getAttribute('data-pdf-annotate-id'); + // let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`); + // let svg = overlay.parentNode.querySelector(config.annotationSvgQuery()); + // let { documentId } = getMetadata(svg); + + // [...nodes].forEach((n) => { + // n.parentNode.removeChild(n); + // }); + + // PDFJSAnnotate.getStoreAdapter().deleteAnnotation(documentId, annotationId); + } } } @@ -3796,12 +3825,13 @@ return /******/ (function(modules) { // webpackBootstrap var svg = (0, _utils.findSVGContainer)(target); var _getMetadata = (0, _utils.getMetadata)(svg), - documentId = _getMetadata.documentId; + documentId = _getMetadata.documentId, + userId = _getMetadata.userId; var annotationId = target.getAttribute('data-pdf-annotate-id'); var event = e; - _PDFJSAnnotate2.default.getStoreAdapter().getAnnotation(documentId, annotationId).then(function (annotation) { + _PDFJSAnnotate2.default.getStoreAdapter().getAnnotation(documentId, userId, annotationId).then(function (annotation) { if (annotation) { path = null; lines = []; @@ -4040,6 +4070,7 @@ return /******/ (function(modules) { // webpackBootstrap var _getMetadata = (0, _utils.getMetadata)(svg), documentId = _getMetadata.documentId, + userId = _getMetadata.userId, pageNumber = _getMetadata.pageNumber; var annotation = Object.assign({ @@ -4049,7 +4080,7 @@ return /******/ (function(modules) { // webpackBootstrap y: clientY - rect.top })); - _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation).then(function (annotation) { + _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation).then(function (annotation) { _PDFJSAnnotate2.default.getStoreAdapter().addComment(documentId, annotation.uuid, content); (0, _appendChild.appendChild)(svg, annotation); @@ -4308,12 +4339,13 @@ return /******/ (function(modules) { // webpackBootstrap var _getMetadata = (0, _utils.getMetadata)(svg), documentId = _getMetadata.documentId, + userId = _getMetadata.userId, pageNumber = _getMetadata.pageNumber; // Add the annotation - _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation).then(function (annotation) { + _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation).then(function (annotation) { (0, _appendChild.appendChild)(svg, annotation); }); } @@ -4432,12 +4464,13 @@ return /******/ (function(modules) { // webpackBootstrap var _getMetadata = (0, _utils.getMetadata)(svg), documentId = _getMetadata.documentId, + userId = _getMetadata.userId, pageNumber = _getMetadata.pageNumber; // Add the annotation - _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation).then(function (annotation) { + _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation).then(function (annotation) { (0, _appendChild.appendChild)(svg, annotation); }); } @@ -4565,6 +4598,7 @@ return /******/ (function(modules) { // webpackBootstrap var _getMetadata = (0, _utils.getMetadata)(svg), documentId = _getMetadata.documentId, + userId = _getMetadata.userId, pageNumber = _getMetadata.pageNumber, viewport = _getMetadata.viewport; @@ -4581,7 +4615,7 @@ return /******/ (function(modules) { // webpackBootstrap rotation: -viewport.rotation }; - _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation).then(function (annotation) { + _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation).then(function (annotation) { (0, _appendChild.appendChild)(svg, annotation); }); } @@ -4705,13 +4739,14 @@ return /******/ (function(modules) { // webpackBootstrap */ function renderPage(pageNumber, renderOptions) { var documentId = renderOptions.documentId, + userId = renderOptions.userId, pdfDocument = renderOptions.pdfDocument, scale = renderOptions.scale, rotate = renderOptions.rotate; // Load the page and annotations - return Promise.all([pdfDocument.getPage(pageNumber), _PDFJSAnnotate2.default.getAnnotations(documentId, pageNumber)]).then(function (_ref) { + return Promise.all([pdfDocument.getPage(pageNumber), _PDFJSAnnotate2.default.getAnnotations(documentId, userId, pageNumber)]).then(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), pdfPage = _ref2[0], annotations = _ref2[1]; diff --git a/dist/pdf-annotate.js.map b/dist/pdf-annotate.js.map index 57eec751..f55ed838 100644 --- a/dist/pdf-annotate.js.map +++ b/dist/pdf-annotate.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 9cdc3f05148d1dd28505","webpack:///./index.js","webpack:///./src/PDFJSAnnotate.js","webpack:///./src/adapter/StoreAdapter.js","webpack:///./src/utils/abstractFunction.js","webpack:///./src/UI/event.js","webpack:///./~/events/events.js","webpack:///./src/UI/utils.js","webpack:///./~/create-stylesheet/index.js","webpack:///./src/render/appendChild.js","webpack:///./~/object-assign/index.js","webpack:///./src/render/renderLine.js","webpack:///./src/utils/setAttributes.js","webpack:///./src/utils/normalizeColor.js","webpack:///./src/render/renderPath.js","webpack:///./src/render/renderPoint.js","webpack:///./src/render/renderRect.js","webpack:///./src/render/renderText.js","webpack:///./src/render/renderCircle.js","webpack:///./src/render/renderArrow.js","webpack:///./src/utils/mathUtils.js","webpack:///./src/adapter/LocalStoreAdapter.js","webpack:///./src/utils/uuid.js","webpack:///./src/render/index.js","webpack:///./src/a11y/renderScreenReaderHints.js","webpack:///./src/a11y/insertScreenReaderHint.js","webpack:///./src/a11y/createScreenReaderOnly.js","webpack:///./src/a11y/insertElementWithinChildren.js","webpack:///./src/config.js","webpack:///./src/a11y/insertElementWithinElement.js","webpack:///./src/a11y/renderScreenReaderComments.js","webpack:///./src/a11y/insertScreenReaderComment.js","webpack:///./src/a11y/initEventHandlers.js","webpack:///./src/UI/index.js","webpack:///./src/UI/edit.js","webpack:///./src/UI/pen.js","webpack:///./src/UI/eraser.js","webpack:///./src/UI/arrow.js","webpack:///./src/UI/point.js","webpack:///./src/UI/rect.js","webpack:///./src/UI/circle.js","webpack:///./src/UI/text.js","webpack:///./src/UI/page.js"],"names":["PDFJSAnnotate","findAnnotationAtPoint","findSVGContainer","convertToScreenPoint","StoreAdapter","LocalStoreAdapter","__storeAdapter","getStoreAdapter","setStoreAdapter","adapter","UI","render","getAnnotations","documentId","pageNumber","arguments","config","uuid","definition","Object","keys","forEach","key","annotationId","annotation","content","commentId","__getAnnotations","fn","then","annotations","a","__addAnnotation","addAnnotation","__editAnnotation","editAnnotation","__deleteAnnotation","deleteAnnotation","success","__addComment","addComment","comment","__deleteComment","deleteComment","abstractFunction","name","Error","fireEvent","addEventListener","removeEventListener","emitter","EventEmitter","clickNode","document","handleDocumentClick","e","clientX","clientY","target","emit","on","removeListener","findSVGAtPoint","pointIntersectsRect","getOffsetAnnotationRect","scaleUp","convertToSvgRect","convertToSvgPoint","scaleDown","getScroll","getOffset","disableUserSelect","enableUserSelect","getMetadata","BORDER_COLOR","userSelectStyleSheet","body","setAttribute","node","parentNode","nodeName","toUpperCase","getAttribute","x","y","elements","querySelectorAll","i","l","length","el","rect","getBoundingClientRect","candidate","elementFromPoint","type","top","bottom","left","right","offsetLeft","offsetTop","width","height","svg","result","viewport","scale","pt1","pt2","Math","min","abs","pt","xform","rotation","offset","scrollTop","scrollLeft","head","appendChild","removeChild","parseInt","JSON","parse","getTranslation","transformChild","isFirefox","test","navigator","userAgent","transform","trans","toLowerCase","path","querySelector","n","child","renderLine","group","createElementNS","stroke","color","strokeWidth","rectangles","r","line","x1","y1","x2","y2","setAttributes","UPPER_REGEX","BLACKLIST","keyCase","indexOf","replace","match","attributes","normalizeColor","REGEX_HASHLESS_HEX","renderPath","d","lines","p1","p2","push","join","fill","renderPoint","SIZE","D","outerSVG","innerSVG","viewBox","renderRect","fillOpacity","createRect","renderText","text","fontSize","size","innerHTML","g","renderCircle","circle","createCircle","cx","cy","renderArrow","arrow","arrowLength","pt0","unitX","unitZ","unitY","thickness","A","B","C","G","F","E","points","applyTransform","applyInverseTransform","translate","rotate","makePoint","makeVector","makeVectorFromPoints","addVector","multiplyVector","magnitude","negateVector","unitVector","crossProduct","p","m","xt","yt","m1","m2","angle","PI","cosValue","cos","sinValue","sin","getInverseTransform","z","xcoord","ycoord","zcoord","v","scalar","sqrt","pow","mag","u","Promise","resolve","reject","filter","page","class","getAnnotation","findAnnotation","updateAnnotations","index","splice","getComments","localStorage","getItem","setItem","stringify","REGEXP","PATTERN","replacement","c","random","toString","data","removeAttribute","Array","isArray","renderScreenReaderHints","SORT_TYPES","sortBy","sort","sortByPoint","b","sortByRectPoint","sortByLinePoint","lineA","lineB","insertScreenReaderHint","COMMENT_TYPES","num","rects","first","last","includes","createScreenReaderOnly","createElement","createTextNode","style","position","overflow","insertElementWithinChildren","nodes","textClassQuery","insertBefore","textLayer","textRect","annotationLayerName","textLayerName","annotationSvgQuery","annotationClassQuery","insertElementWithinElement","OFFSET_ADJUST","max","textLayerElementFromPoint","temp","cloneNode","split","tail","unshift","pop","outerHTML","renderScreenReaderComments","comments","promise","getElementById","list","insertScreenReaderComment","item","initEventHandlers","reorderAnnotationsByType","removeAnnotation","insertComment","removeComment","removeElementById","elementId","disableEdit","enableEdit","disablePen","enablePen","setPen","enableEraser","disableEraser","disablePoint","enablePoint","disableRect","enableRect","disableCircle","enableCircle","setCircle","addCircle","disableArrow","enableArrow","setArrow","disableText","enableText","setText","createPage","renderPage","_enabled","isDragging","overlay","dragOffsetX","dragOffsetY","dragStartX","dragStartY","OVERLAY_BORDER_SIZE","createEditOverlay","destroyEditOverlay","anchor","id","styleLeft","styleTop","boxSizing","border","borderRadius","zIndex","background","padding","textAlign","textDecoration","handleDocumentKeyup","handleDocumentMousedown","borderColor","boxShadow","display","handleDocumentMousemove","handleDocumentMouseup","keyCode","cursor","minY","maxY","minX","maxX","offsetHeight","offsetWidth","attribX","attribY","modelStart","modelEnd","modelDelta","firstChild","t","modelX","modelY","viewY","viewX","setTimeout","handleAnnotationClick","_candraw","_penSize","_penColor","handleDocumentPointerdown","handleDocumentKeyupChrome","saveToStorage","changedTouches","handleDocumentPointerup","handleDocumentPointermove","savePoint","handleDocumentPointermoveChrome","point","penSize","penColor","_canerase","handleDocumentMouseDown","handleDocumentMouseUp","handleDocumentMouseMove","console","log","originY","originX","event","input","handleInputBlur","handleInputKeyup","focus","closeInput","value","trim","assign","_type","getSelectionRects","selection","window","getSelection","range","getRangeAt","getClientRects","saveRect","map","removeAllRanges","boundingRect","_circleRadius","_circleColor","circleRadius","circleColor","saveCircle","radius","svg_pt","oldType","_textSize","_textColor","saveText","textSize","textColor","PAGE_TEMPLATE","children","canvas","mozOpaque","renderOptions","pdfDocument","all","getPage","pdfPage","canvasContext","getContext","alpha","totalRotation","getViewport","scalePage","getTextContent","normalizeWhitespace","textContent","textLayerFactory","PDFJS","DefaultTextLayerFactory","textLayerBuilder","createTextLayerBuilder","setTextContent","context","wrapper","outputScale","getOutputScale","scaled","sx","sy","sfx","approximateFraction","sfy","visibility","roundToDivide","floor","xinv","limit","x_","q","ctx","devicePixelRatio","backingStoreRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","pixelRatio","div","round"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAE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EAAR,gBAAc7C,SAAd;AAA2B;AACzD,UAASkC,mBAAT,GAA+B;AAAEC,WAAQW,cAAR,gBAA0B9C,SAA1B;AAAuC,G;;;;;;ACpD/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAiB;AACjB,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA,gBAAe,SAAS;AACxB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,IAAG;AACH,qBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;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GAAQ0U,EAAzB,EAA6B;AAC3B,YAAOA,OAAOzZ,CAAP,GAAW,CAACpD,CAAD,EAAIgP,CAAJ,CAAX,GAAoB,CAACA,CAAD,EAAIhP,CAAJ,CAA3B;AACD,IAFD,MAEO;AACL,YAAO6c,OAAOzZ,CAAP,GAAW,CAACgL,CAAD,EAAIjG,CAAJ,CAAX,GAAoB,CAACA,CAAD,EAAIiG,CAAJ,CAA3B;AACD;AACF;;AAED,UAAS6N,cAAT,CAAwBc,GAAxB,EAA6B;AAC3B,OAAIC,mBAAmBhE,OAAOgE,gBAAP,IAA2B,CAAlD;AACA,OAAIC,oBAAoBF,IAAIG,4BAAJ,IACAH,IAAII,yBADJ,IAEAJ,IAAIK,wBAFJ,IAGAL,IAAIM,uBAHJ,IAIAN,IAAIO,sBAJJ,IAI8B,CAJtD;AAKA,OAAIC,aAAaP,mBAAmBC,iBAApC;AACA,UAAO;AACLd,SAAIoB,UADC;AAELnB,SAAImB,UAFC;AAGLrB,aAAQqB,eAAe;AAHlB,IAAP;AAKD;;AAED,UAASd,aAAT,CAAuBrZ,CAAvB,EAA0Boa,GAA1B,EAA+B;AAC7B,OAAItW,IAAI9D,IAAIoa,GAAZ;AACA,UAAOtW,MAAM,CAAN,GAAU9D,CAAV,GAAc2B,KAAK0Y,KAAL,CAAWra,IAAI8D,CAAJ,GAAQsW,GAAnB,CAArB;AACD,E","file":"dist/pdf-annotate.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PDFAnnotate\"] = factory();\n\telse\n\t\troot[\"PDFAnnotate\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 9cdc3f05148d1dd28505\n **/","import PDFJSAnnotate from './src/PDFJSAnnotate';\n\nexport default PDFJSAnnotate;\n\n\n\n/** WEBPACK FOOTER **\n ** ./index.js\n **/","import StoreAdapter from './adapter/StoreAdapter';\nimport LocalStoreAdapter from './adapter/LocalStoreAdapter';\nimport render from './render';\nimport UI from './UI';\nimport config from './config';\nimport uuid from './utils/uuid';\nimport { \n findAnnotationAtPoint, \n findSVGContainer,\n convertToScreenPoint\n} from './UI/utils';\n\nexport default {\n findAnnotationAtPoint,\n findSVGContainer,\n convertToScreenPoint,\n\n /**\n * Abstract class that needs to be defined so PDFJSAnnotate\n * knows how to communicate with your server.\n */\n StoreAdapter,\n\n /**\n * Implementation of StoreAdapter that stores annotation data to localStorage.\n */\n LocalStoreAdapter,\n\n /**\n * Abstract instance of StoreAdapter\n */\n __storeAdapter: new StoreAdapter(),\n\n /**\n * Getter for the underlying StoreAdapter property\n *\n * @return {StoreAdapter}\n */\n getStoreAdapter() {\n return this.__storeAdapter;\n },\n\n /**\n * Setter for the underlying StoreAdapter property\n *\n * @param {StoreAdapter} adapter The StoreAdapter implementation to be used.\n */\n setStoreAdapter(adapter) {\n // TODO this throws an error when bundled\n // if (!(adapter instanceof StoreAdapter)) {\n // throw new Error('adapter must be an instance of StoreAdapter');\n // }\n\n this.__storeAdapter = adapter;\n },\n\n /**\n * UI is a helper for instrumenting UI interactions for creating,\n * editing, and deleting annotations in the browser.\n */\n UI,\n\n /**\n * Render the annotations for a page in the PDF Document\n *\n * @param {SVGElement} svg The SVG element that annotations should be rendered to\n * @param {PageViewport} viewport The PDFPage.getViewport data\n * @param {Object} data The StoreAdapter.getAnnotations data\n * @return {Promise}\n */\n render,\n\n /**\n * Convenience method for getting annotation data\n *\n * @alias StoreAdapter.getAnnotations\n * @param {String} documentId The ID of the document\n * @param {String} pageNumber The page number\n * @return {Promise}\n */\n getAnnotations(documentId, pageNumber) {\n return this.getStoreAdapter().getAnnotations(...arguments);\n },\n\n config,\n\n uuid\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/PDFJSAnnotate.js\n **/","import abstractFunction from '../utils/abstractFunction';\nimport { fireEvent } from '../UI/event';\n\n// Adapter should never be invoked publicly\nexport default class StoreAdapter {\n /**\n * Create a new StoreAdapter instance\n *\n * @param {Object} [definition] The definition to use for overriding abstract methods\n */\n constructor(definition = {}) {\n // Copy each function from definition if it is a function we know about\n Object.keys(definition).forEach((key) => {\n if (typeof definition[key] === 'function' &&\n typeof this[key] === 'function') {\n this[key] = definition[key];\n }\n });\n }\n\n /**\n * Get all the annotations for a given document and page number.\n *\n * @param {String} documentId The ID for the document the annotations belong to\n * @param {Number} pageNumber The number of the page the annotations belong to\n * @return {Promise}\n */\n __getAnnotations(documentId, pageNumber) { abstractFunction('getAnnotations'); }\n get getAnnotations() { return this.__getAnnotations; }\n set getAnnotations(fn) {\n this.__getAnnotations = function getAnnotations(documentId, pageNumber) {\n return fn(...arguments).then((annotations) => {\n // TODO may be best to have this happen on the server\n if (annotations.annotations) {\n annotations.annotations.forEach((a) => {\n a.documentId = documentId;\n });\n }\n return annotations;\n });\n };\n }\n\n /**\n * Get the definition for a specific annotation.\n *\n * @param {String} documentId The ID for the document the annotation belongs to\n * @param {String} annotationId The ID for the annotation\n * @return {Promise}\n */\n getAnnotation(documentId, annotationId) { abstractFunction('getAnnotation'); }\n\n /**\n * Add an annotation\n *\n * @param {String} documentId The ID for the document to add the annotation to\n * @param {String} pageNumber The page number to add the annotation to\n * @param {Object} annotation The definition for the new annotation\n * @return {Promise}\n */\n __addAnnotation(documentId, pageNumber, annotation) { abstractFunction('addAnnotation'); }\n get addAnnotation() { return this.__addAnnotation; }\n set addAnnotation(fn) {\n this.__addAnnotation = function addAnnotation(documentId, pageNumber, annotation) {\n return fn(...arguments).then((annotation) => {\n fireEvent('annotation:add', documentId, pageNumber, annotation);\n return annotation;\n });\n };\n }\n\n /**\n * Edit an annotation\n *\n * @param {String} documentId The ID for the document\n * @param {String} pageNumber the page number of the annotation\n * @param {Object} annotation The definition of the modified annotation\n * @return {Promise}\n */\n __editAnnotation(documentId, pageNumber, annotation) { abstractFunction('editAnnotation'); }\n get editAnnotation() { return this.__editAnnotation; }\n set editAnnotation(fn) {\n this.__editAnnotation = function editAnnotation(documentId, annotationId, annotation) {\n return fn(...arguments).then((annotation) => {\n fireEvent('annotation:edit', documentId, annotationId, annotation);\n return annotation;\n });\n };\n }\n\n /**\n * Delete an annotation\n *\n * @param {String} documentId The ID for the document\n * @param {String} annotationId The ID for the annotation\n * @return {Promise}\n */\n __deleteAnnotation(documentId, annotationId) { abstractFunction('deleteAnnotation'); }\n get deleteAnnotation() { return this.__deleteAnnotation; }\n set deleteAnnotation(fn) {\n this.__deleteAnnotation = function deleteAnnotation(documentId, annotationId) {\n return fn(...arguments).then((success) => {\n if (success) {\n fireEvent('annotation:delete', documentId, annotationId);\n }\n return success;\n });\n };\n }\n\n /**\n * Get all the comments for an annotation\n *\n * @param {String} documentId The ID for the document\n * @param {String} annotationId The ID for the annotation\n * @return {Promise}\n */\n getComments(documentId, annotationId) { abstractFunction('getComments'); }\n\n /**\n * Add a new comment\n *\n * @param {String} documentId The ID for the document\n * @param {String} annotationId The ID for the annotation\n * @param {Object} content The definition of the comment\n * @return {Promise}\n */\n __addComment(documentId, annotationId, content) { abstractFunction('addComment'); }\n get addComment() { return this.__addComment; }\n set addComment(fn) {\n this.__addComment = function addComment(documentId, annotationId, content) {\n return fn(...arguments).then((comment) => {\n fireEvent('comment:add', documentId, annotationId, comment);\n return comment;\n });\n };\n }\n\n /**\n * Delete a comment\n *\n * @param {String} documentId The ID for the document\n * @param {String} commentId The ID for the comment\n * @return {Promise}\n */\n __deleteComment(documentId, commentId) { abstractFunction('deleteComment'); }\n get deleteComment() { return this.__deleteComment; }\n set deleteComment(fn) {\n this.__deleteComment = function deleteComment(documentId, commentId) {\n return fn(...arguments).then((success) => {\n if (success) {\n fireEvent('comment:delete', documentId, commentId);\n }\n return success;\n });\n };\n }\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/adapter/StoreAdapter.js\n **/","/**\n * Throw an Error for an abstract function that hasn't been implemented.\n *\n * @param {String} name The name of the abstract function\n */\nexport default function abstractFunction(name) {\n throw new Error(name + ' is not implemented');\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/abstractFunction.js\n **/","import EventEmitter from 'events';\nimport {\n findAnnotationAtPoint,\n findSVGAtPoint\n} from './utils';\n\nconst emitter = new EventEmitter;\n\nlet clickNode;\n\n/**\n * Handle document.click event\n *\n * @param {Event} e The DOM event to be handled\n */\ndocument.addEventListener('click', function handleDocumentClick(e) {\n if (!findSVGAtPoint(e.clientX, e.clientY)) { return; }\n\n let target = findAnnotationAtPoint(e.clientX, e.clientY);\n\n // Emit annotation:blur if clickNode is no longer clicked\n if (clickNode && clickNode !== target) {\n emitter.emit('annotation:blur', clickNode);\n }\n\n // Emit annotation:click if target was clicked\n if (target) {\n emitter.emit('annotation:click', target);\n }\n\n clickNode = target;\n});\n\n// let mouseOverNode;\n// document.addEventListener('mousemove', function handleDocumentMousemove(e) {\n// let target = findAnnotationAtPoint(e.clientX, e.clientY);\n//\n// // Emit annotation:mouseout if target was mouseout'd\n// if (mouseOverNode && !target) {\n// emitter.emit('annotation:mouseout', mouseOverNode);\n// }\n//\n// // Emit annotation:mouseover if target was mouseover'd\n// if (target && mouseOverNode !== target) {\n// emitter.emit('annotation:mouseover', target);\n// }\n//\n// mouseOverNode = target;\n// });\n\nexport function fireEvent() { emitter.emit(...arguments); };\nexport function addEventListener() { emitter.on(...arguments); };\nexport function removeEventListener() { emitter.removeListener(...arguments); };\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/event.js\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/events/events.js\n ** module id = 5\n ** module chunks = 0\n **/","import createStyleSheet from 'create-stylesheet';\nimport { getTranslation } from '../render/appendChild';\nimport { \n applyTransform, \n applyInverseTransform, \n translate,\n rotate,\n scale \n} from '../utils/mathUtils';\n\n\nexport const BORDER_COLOR = '#00BFFF';\n\nconst userSelectStyleSheet = createStyleSheet({\n body: {\n '-webkit-user-select': 'none',\n '-moz-user-select': 'none',\n '-ms-user-select': 'none',\n 'user-select': 'none'\n }\n});\nuserSelectStyleSheet.setAttribute('data-pdf-annotate-user-select', 'true');\n\n/**\n * Find the SVGElement that contains all the annotations for a page\n *\n * @param {Element} node An annotation within that container\n * @return {SVGElement} The container SVG or null if it can't be found\n */\nexport function findSVGContainer(node) {\n let parentNode = node;\n\n while ((parentNode = parentNode.parentNode) &&\n parentNode !== document) {\n if (parentNode.nodeName.toUpperCase() === 'SVG' &&\n parentNode.getAttribute('data-pdf-annotate-container') === 'true') {\n return parentNode;\n }\n }\n\n return null;\n}\n\n/**\n * Find an SVGElement container at a given point\n *\n * @param {Number} x The x coordinate of the point\n * @param {Number} y The y coordinate of the point\n * @return {SVGElement} The container SVG or null if one can't be found\n */\nexport function findSVGAtPoint(x, y) {\n let elements = document.querySelectorAll('svg[data-pdf-annotate-container=\"true\"]');\n\n for (let i=0, l=elements.length; i= rect.top && y <= rect.bottom && x >= rect.left && x <= rect.right;\n}\n\n/**\n * Get the rect of an annotation element accounting for offset.\n *\n * @param {Element} el The element to get the rect of\n * @return {Object} The dimensions of the element\n */\nexport function getOffsetAnnotationRect(el) {\n let rect = el.getBoundingClientRect();\n let { offsetLeft, offsetTop } = getOffset(el);\n return {\n top: rect.top - offsetTop,\n left: rect.left - offsetLeft,\n right: rect.right - offsetLeft,\n bottom: rect.bottom - offsetTop,\n width: rect.width,\n height: rect.height\n };\n}\n\n/**\n * Adjust scale from normalized scale (100%) to rendered scale.\n *\n * @param {SVGElement} svg The SVG to gather metadata from\n * @param {Object} rect A map of numeric values to scale\n * @return {Object} A copy of `rect` with values scaled up\n */\nexport function scaleUp(svg, rect) {\n let result = {};\n let { viewport } = getMetadata(svg);\n\n Object.keys(rect).forEach((key) => {\n result[key] = rect[key] * viewport.scale;\n });\n\n return result;\n}\n\nexport function convertToSvgRect(rect, svg, viewport) {\n var pt1 = [rect.x, rect.y];\n var pt2 = [rect.x + rect.width, rect.y + rect.height];\n\n pt1 = convertToSvgPoint(pt1, svg, viewport);\n pt2 = convertToSvgPoint(pt2, svg, viewport);\n\n return {\n x: Math.min(pt1[0], pt2[0]),\n y: Math.min(pt1[1], pt2[1]),\n width: Math.abs(pt2[0] - pt1[0]),\n height: Math.abs(pt2[1] - pt1[1])\n };\n}\n\nexport function convertToSvgPoint(pt, svg, viewport) {\n let result = {};\n viewport = viewport || getMetadata(svg).viewport;\n\n let xform = [ 1, 0, 0, 1, 0, 0 ];\n xform = scale(xform, viewport.scale, viewport.scale);\n xform = rotate(xform, viewport.rotation);\n\n let offset = getTranslation(viewport);\n xform = translate(xform, offset.x, offset.y);\n\n return applyInverseTransform(pt, xform);\n}\n\nexport function convertToScreenPoint(pt, svg, viewport) {\n let result = {};\n viewport = viewport || getMetadata(svg).viewport;\n\n let xform = [ 1, 0, 0, 1, 0, 0 ];\n xform = scale(xform, viewport.scale, viewport.scale);\n xform = rotate(xform, viewport.rotation);\n\n let offset = getTranslation(viewport);\n xform = translate(xform, offset.x, offset.y);\n\n return applyTransform(pt, xform);\n}\n\n/**\n * Adjust scale from rendered scale to a normalized scale (100%).\n *\n * @param {SVGElement} svg The SVG to gather metadata from\n * @param {Object} rect A map of numeric values to scale\n * @return {Object} A copy of `rect` with values scaled down\n */\nexport function scaleDown(svg, rect) {\n let result = {};\n let { viewport } = getMetadata(svg);\n\n Object.keys(rect).forEach((key) => {\n result[key] = rect[key] / viewport.scale;\n });\n\n return result;\n}\n\n/**\n * Get the scroll position of an element, accounting for parent elements\n *\n * @param {Element} el The element to get the scroll position for\n * @return {Object} The scrollTop and scrollLeft position\n */\nexport function getScroll(el) {\n let scrollTop = 0;\n let scrollLeft = 0;\n let parentNode = el;\n\n while ((parentNode = parentNode.parentNode) &&\n parentNode !== document) {\n scrollTop += parentNode.scrollTop;\n scrollLeft += parentNode.scrollLeft;\n }\n\n return { scrollTop, scrollLeft };\n}\n\n/**\n * Get the offset position of an element, accounting for parent elements\n *\n * @param {Element} el The element to get the offset position for\n * @return {Object} The offsetTop and offsetLeft position\n */\nexport function getOffset(el) {\n let parentNode = el;\n\n while ((parentNode = parentNode.parentNode) &&\n parentNode !== document) {\n if (parentNode.nodeName.toUpperCase() === 'SVG') {\n break;\n }\n }\n\n let rect = parentNode.getBoundingClientRect();\n\n return { offsetLeft: rect.left, offsetTop: rect.top };\n}\n\n/**\n * Disable user ability to select text on page\n */\nexport function disableUserSelect() {\n if (!userSelectStyleSheet.parentNode) {\n document.head.appendChild(userSelectStyleSheet);\n }\n}\n\n\n/**\n * Enable user ability to select text on page\n */\nexport function enableUserSelect() {\n if (userSelectStyleSheet.parentNode) {\n userSelectStyleSheet.parentNode.removeChild(userSelectStyleSheet);\n }\n}\n\n/**\n * Get the metadata for a SVG container\n *\n * @param {SVGElement} svg The SVG container to get metadata for\n */\nexport function getMetadata(svg) {\n return {\n documentId: svg.getAttribute('data-pdf-annotate-document'),\n pageNumber: parseInt(svg.getAttribute('data-pdf-annotate-page'), 10),\n viewport: JSON.parse(svg.getAttribute('data-pdf-annotate-viewport'))\n };\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/utils.js\n **/","module.exports = function createStyleSheet(blocks) {\n var style = document.createElement('style');\n var text = Object.keys(blocks).map(function (selector) {\n return processRuleSet(selector, blocks[selector]);\n }).join('\\n');\n \n style.setAttribute('type', 'text/css');\n style.appendChild(document.createTextNode(text));\n\n return style;\n}\n\nfunction processRuleSet(selector, block) {\n return selector + ' {\\n' + processDeclarationBlock(block) + '\\n}';\n}\n\nfunction processDeclarationBlock(block) {\n return Object.keys(block).map(function (prop) {\n return processDeclaration(prop, block[prop]);\n }).join('\\n');\n}\n\nfunction processDeclaration(prop, value) {\n if (!isNaN(value) && value != 0) {\n value = value + 'px';\n }\n\n return hyphenate(prop) + ': ' + value + ';';\n}\n\nfunction hyphenate(prop) {\n return prop.replace(/[A-Z]/g, function (match) {\n return '-' + match.toLowerCase();\n });\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/create-stylesheet/index.js\n ** module id = 7\n ** module chunks = 0\n **/","import objectAssign from 'object-assign';\nimport renderLine from './renderLine';\nimport renderPath from './renderPath';\nimport renderPoint from './renderPoint';\nimport renderRect from './renderRect';\nimport renderText from './renderText';\nimport renderCircle from './renderCircle';\nimport renderArrow from './renderArrow';\n\nconst isFirefox = /firefox/i.test(navigator.userAgent);\n\n/**\n * Get the x/y translation to be used for transforming the annotations\n * based on the rotation of the viewport.\n *\n * @param {Object} viewport The viewport data from the page\n * @return {Object}\n */\nexport function getTranslation(viewport) {\n let x;\n let y;\n\n // Modulus 360 on the rotation so that we only\n // have to worry about four possible values.\n switch(viewport.rotation % 360) {\n case 0:\n x = y = 0;\n break;\n case 90:\n x = 0;\n y = (viewport.width / viewport.scale) * -1;\n break;\n case 180:\n x = (viewport.width / viewport.scale) * -1;\n y = (viewport.height / viewport.scale) * -1;\n break;\n case 270:\n x = (viewport.height / viewport.scale) * -1;\n y = 0;\n break;\n }\n\n return { x, y };\n}\n\n/**\n * Transform the rotation and scale of a node using SVG's native transform attribute.\n *\n * @param {Node} node The node to be transformed\n * @param {Object} viewport The page's viewport data\n * @return {Node}\n */\nfunction transform(node, viewport) {\n let trans = getTranslation(viewport);\n\n // Let SVG natively transform the element\n node.setAttribute('transform', `scale(${viewport.scale}) rotate(${viewport.rotation}) translate(${trans.x}, ${trans.y})`);\n \n // Manually adjust x/y for nested SVG nodes\n if (!isFirefox && node.nodeName.toLowerCase() === 'svg') {\n node.setAttribute('x', parseInt(node.getAttribute('x'), 10) * viewport.scale);\n node.setAttribute('y', parseInt(node.getAttribute('y'), 10) * viewport.scale);\n\n let x = parseInt(node.getAttribute('x', 10));\n let y = parseInt(node.getAttribute('y', 10));\n let width = parseInt(node.getAttribute('width'), 10);\n let height = parseInt(node.getAttribute('height'), 10);\n let path = node.querySelector('path');\n let svg = path.parentNode;\n \n // Scale width/height\n [node, svg, path, node.querySelector('rect')].forEach((n) => {\n n.setAttribute('width', parseInt(n.getAttribute('width'), 10) * viewport.scale);\n n.setAttribute('height', parseInt(n.getAttribute('height'), 10) * viewport.scale);\n });\n\n // Transform path but keep scale at 100% since it will be handled natively\n transform(path, objectAssign({}, viewport, { scale: 1 }));\n \n switch(viewport.rotation % 360) {\n case 90:\n node.setAttribute('x', viewport.width - y - width);\n node.setAttribute('y', x);\n svg.setAttribute('x', 1);\n svg.setAttribute('y', 0);\n break;\n case 180:\n node.setAttribute('x', viewport.width - x - width);\n node.setAttribute('y', viewport.height - y - height);\n svg.setAttribute('y', 2);\n break;\n case 270:\n node.setAttribute('x', y);\n node.setAttribute('y', viewport.height - x - height);\n svg.setAttribute('x', -1);\n svg.setAttribute('y', 0);\n break;\n }\n }\n\n return node;\n}\n\n/**\n * Append an annotation as a child of an SVG.\n *\n * @param {SVGElement} svg The SVG element to append the annotation to\n * @param {Object} annotation The annotation definition to render and append\n * @param {Object} viewport The page's viewport data\n * @return {SVGElement} A node that was created and appended by this function\n */\nexport function appendChild(svg, annotation, viewport) {\n if (!viewport) {\n viewport = JSON.parse(svg.getAttribute('data-pdf-annotate-viewport'));\n }\n \n let child;\n switch (annotation.type) {\n case 'area':\n case 'highlight':\n child = renderRect(annotation);\n break;\n case 'circle':\n case 'fillcircle':\n case 'emptycircle':\n child = renderCircle(annotation);\n break;\n case 'strikeout':\n child = renderLine(annotation);\n break;\n case 'point':\n child = renderPoint(annotation);\n break;\n case 'textbox':\n child = renderText(annotation);\n break;\n case 'drawing':\n child = renderPath(annotation);\n break;\n case 'arrow':\n child = renderArrow(annotation);\n break;\n }\n\n // If no type was provided for an annotation it will result in node being null.\n // Skip appending/transforming if node doesn't exist.\n if (child) {\n // Set attributes\n child.setAttribute('data-pdf-annotate-id', annotation.uuid);\n child.setAttribute('data-pdf-annotate-type', annotation.type);\n child.setAttribute('aria-hidden', true);\n\n svg.appendChild(transform(child, viewport));\n }\n\n return child;\n}\n\n/**\n * Transform a child annotation of an SVG.\n *\n * @param {SVGElement} svg The SVG element with the child annotation\n * @param {Object} child The SVG child to transform\n * @param {Object} viewport The page's viewport data\n * @return {SVGElement} A node that was transformed by this function\n */\nexport function transformChild(svg, child, viewport) {\n if (!viewport) {\n viewport = JSON.parse(svg.getAttribute('data-pdf-annotate-viewport'));\n }\n\n // If no type was provided for an annotation it will result in node being null.\n // Skip transforming if node doesn't exist.\n if (child) {\n child = transform(child, viewport);\n }\n\n return child;\n}\n\nexport default {\n /**\n * Get the x/y translation to be used for transforming the annotations\n * based on the rotation of the viewport.\n */\n getTranslation,\n \n /**\n * Append an SVG child for an annotation\n */\n appendChild,\n\n /**\n * Transform an existing SVG child\n */ \n transformChild\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/appendChild.js\n **/","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/object-assign/index.js\n ** module id = 9\n ** module chunks = 0\n **/","import setAttributes from '../utils/setAttributes';\nimport normalizeColor from '../utils/normalizeColor';\n\n/**\n * Create SVGLineElements from an annotation definition.\n * This is used for anntations of type `strikeout`.\n *\n * @param {Object} a The annotation definition\n * @return {SVGGElement} A group of all lines to be rendered\n */\nexport default function renderLine(a) {\n let group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n setAttributes(group, {\n stroke: normalizeColor(a.color || '#f00'),\n strokeWidth: 1\n });\n\n a.rectangles.forEach((r) => {\n let line = document.createElementNS('http://www.w3.org/2000/svg', 'line');\n\n setAttributes(line, {\n x1: r.x,\n y1: r.y,\n x2: r.x + r.width,\n y2: r.y,\n });\n\n group.appendChild(line);\n });\n\n return group;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderLine.js\n **/","const UPPER_REGEX = /[A-Z]/g;\n\n// Don't convert these attributes from camelCase to hyphenated-attributes\nconst BLACKLIST = [\n 'viewBox'\n];\n\nlet keyCase = (key) => {\n if (BLACKLIST.indexOf(key) === -1) {\n key = key.replace(UPPER_REGEX, match => '-' + match.toLowerCase());\n }\n return key;\n}\n\n/**\n * Set attributes for a node from a map\n *\n * @param {Node} node The node to set attributes on\n * @param {Object} attributes The map of key/value pairs to use for attributes\n */\nexport default function setAttributes(node, attributes) {\n Object.keys(attributes).forEach((key) => {\n node.setAttribute(keyCase(key), attributes[key]);\n });\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/setAttributes.js\n **/","const REGEX_HASHLESS_HEX = /^([a-f0-9]{6}|[a-f0-9]{3})$/i;\n\n/**\n * Normalize a color value\n *\n * @param {String} color The color to normalize\n * @return {String}\n */\nexport default function normalizeColor(color) {\n if (REGEX_HASHLESS_HEX.test(color)) {\n color = `#${color}`;\n }\n return color;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/normalizeColor.js\n **/","import setAttributes from '../utils/setAttributes';\nimport normalizeColor from '../utils/normalizeColor';\n\n/**\n * Create SVGPathElement from an annotation definition.\n * This is used for anntations of type `drawing`.\n *\n * @param {Object} a The annotation definition\n * @return {SVGPathElement} The path to be rendered\n */\nexport default function renderPath(a) {\n let d = [];\n let path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n \n \n for (let i=0, l=a.lines.length; i2) {\n var p1 = a.lines[0];\n var p2 = a.lines[a.lines.length-1];\n\n var p3 = []; //arrow \n var p4 = [];\n var p0 = []; //arrow intersection\n\n\n \n if (p2) {\n var k = -(p2[0]-p1[0])/(p2[1]-p1[1]);\n\n var deltaX = 3;\n p0[0] = p1[0]+0.8*(p2[0]-p1[0]);\n p0[1] = p1[1]+0.8*(p2[1]-p1[1]);\n\n p3[0] = p0[0] + deltaX;\n p3[1] = p0[1] + k*deltaX;\n\n p4[0] = p0[0] - deltaX;\n p4[1] = p0[1] - k*deltaX;\n\n if(Math.abs(p2[1]-p1[1]) < 20) {\n\n p3[0] = p0[0] ;\n p3[1] = p0[1] + deltaX*1;\n\n p4[0] = p0[0] ;\n p4[1] = p0[1] - deltaX*1;\n\n }\n\n d.push(`M${p1[0]} ${p1[1]} ${p2[0]} ${p2[1]}`);\n //d.push(`M${p1[0]} ${p1[1]} ${p2[0]} ${p2[1]}`);\n d.push(`M${p2[0]} ${p2[1]} ${p3[0]} ${p3[1]}`);\n d.push(`M${p3[0]} ${p3[1]} ${p4[0]} ${p4[1]}`);\n d.push(`M${p4[0]} ${p4[1]} ${p2[0]} ${p2[1]}`);\n }\n }*/\n \n setAttributes(path, {\n d: `${d.join(' ')}Z`,\n stroke: normalizeColor(a.color || '#000'),\n strokeWidth: a.width || 1,\n fill: 'none'\n });\n\n return path;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderPath.js\n **/","import setAttributes from '../utils/setAttributes';\n\nconst SIZE = 25;\nconst D = 'M499.968 214.336q-113.832 0 -212.877 38.781t-157.356 104.625 -58.311 142.29q0 62.496 39.897 119.133t112.437 97.929l48.546 27.9 -15.066 53.568q-13.392 50.778 -39.06 95.976 84.816 -35.154 153.45 -95.418l23.994 -21.204 31.806 3.348q38.502 4.464 72.54 4.464 113.832 0 212.877 -38.781t157.356 -104.625 58.311 -142.29 -58.311 -142.29 -157.356 -104.625 -212.877 -38.781z';\n\n/**\n * Create SVGElement from an annotation definition.\n * This is used for anntations of type `comment`.\n *\n * @param {Object} a The annotation definition\n * @return {SVGElement} A svg to be rendered\n */\nexport default function renderPoint(a) {\n let outerSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n let innerSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n let rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n let path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n\n setAttributes(outerSVG, {\n width: SIZE,\n height: SIZE,\n x: a.x,\n y: a.y\n });\n\n setAttributes(innerSVG, {\n width: SIZE,\n height: SIZE,\n x: 0,\n y: (SIZE * 0.05) * -1,\n viewBox: '0 0 1000 1000'\n });\n\n setAttributes(rect, {\n width: SIZE,\n height: SIZE,\n stroke: '#000',\n fill: '#ff0'\n });\n\n setAttributes(path, {\n d: D,\n strokeWidth: 50,\n stroke: '#000',\n fill: '#fff'\n });\n\n innerSVG.appendChild(path);\n outerSVG.appendChild(rect);\n outerSVG.appendChild(innerSVG);\n\n return outerSVG;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderPoint.js\n **/","import setAttributes from '../utils/setAttributes';\nimport normalizeColor from '../utils/normalizeColor';\n\n/**\n * Create SVGRectElements from an annotation definition.\n * This is used for anntations of type `area` and `highlight`.\n *\n * @param {Object} a The annotation definition\n * @return {SVGGElement|SVGRectElement} A group of all rects to be rendered\n */\nexport default function renderRect(a) {\n if (a.type === 'highlight') {\n let group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n setAttributes(group, {\n fill: normalizeColor(a.color || '#ff0'),\n fillOpacity: 0.2\n });\n \n a.rectangles.forEach((r) => {\n group.appendChild(createRect(r));\n });\n\n return group;\n } else {\n let rect = createRect(a);\n setAttributes(rect, {\n stroke: normalizeColor(a.color || '#f00'),\n fill: 'none'\n });\n\n return rect;\n }\n}\n\nfunction createRect(r) {\n let rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n\n setAttributes(rect, {\n x: r.x,\n y: r.y,\n width: r.width,\n height: r.height\n });\n\n return rect;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderRect.js\n **/","import setAttributes from '../utils/setAttributes';\nimport normalizeColor from '../utils/normalizeColor';\n\n/**\n * Create SVGTextElement from an annotation definition.\n * This is used for anntations of type `textbox`.\n *\n * @param {Object} a The annotation definition\n * @return {SVGTextElement} A text to be rendered\n */\nexport default function renderText(a) {\n\n // Text should be rendered at 0 degrees relative to\n // document rotation\n let text = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n let x = a.x;\n let y = a.y;\n\n setAttributes(text, {\n x: x,\n y: y,\n fill: normalizeColor(a.color || '#000'),\n fontSize: a.size,\n transform: `rotate(${a.rotation}, ${x}, ${y})`\n });\n text.innerHTML = a.content;\n\n var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n g.appendChild(text);\n\n return g;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderText.js\n **/","import setAttributes from '../utils/setAttributes';\nimport normalizeColor from '../utils/normalizeColor';\n\n/**\n * Create an SVGCircleElement from an annotation definition.\n * This is used for annotations of type `circle`.\n *\n * @param {Object} a The annotation definition\n * @return {SVGGElement|SVGCircleElement} A circle to be rendered\n */\nexport default function renderCircle(a) {\n let circle = createCircle(a);\n let color = normalizeColor(a.color || '#f00')\n\n if (a.type === 'circle')\n setAttributes(circle, {\n stroke: color,\n fill: 'none',\n 'stroke-width': 5\n });\n if (a.type === 'emptycircle')\n setAttributes(circle, {\n stroke: color,\n fill: 'none',\n 'stroke-width': 2\n });\n\n if (a.type === 'fillcircle')\n setAttributes(circle, {\n stroke: color,\n fill: color,\n 'stroke-width': 5\n });\n\n return circle;\n}\n\nfunction createCircle(a) {\n let circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n setAttributes(circle, {\n cx: a.cx,\n cy: a.cy,\n r: a.r\n });\n\n return circle;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderCircle.js\n **/","import setAttributes from '../utils/setAttributes';\nimport normalizeColor from '../utils/normalizeColor';\nimport { \n makePoint, makeVector, makeVectorFromPoints,\n magnitude, unitVector, crossProduct,\n addVector, multiplyVector, negateVector\n} from '../utils/mathUtils';\n\n/**\n * Create SVGPathElement from an annotation definition.\n * This is used for anntations of type `drawing`.\n *\n * @param {Object} a The annotation definition\n * @return {SVGPathElement} The path to be rendered\n */\nexport default function renderArrow(a) {\n let d = [];\n let arrow = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');\n\n if (a.lines.length == 2) {\n let p1 = a.lines[0];\n let p2 = a.lines[a.lines.length - 1];\n\n let arrowLength = 40;\n let pt0 = makePoint(p1[0], p1[1], 0);\n let pt1 = makePoint(p2[0], p2[1], 0);\n let x = makeVectorFromPoints(pt0, pt1);\n let unitX = unitVector(x);\n pt1 = addVector(pt0, multiplyVector(unitX, arrowLength));\n x = makeVectorFromPoints(pt0, pt1);\n let unitZ = makeVector(0, 0, 1);\n let unitY = unitVector(crossProduct(unitX, unitZ));\n let thickness = a.width || 10;\n\n let A = addVector(pt0, multiplyVector(unitY, thickness * 0.5)); \n let B = addVector(A, multiplyVector(unitX, magnitude(x) - thickness * 2.0)); \n let C = addVector(B, multiplyVector(unitY, thickness)); \n let D = pt1;\n let G = addVector(pt0, multiplyVector(negateVector(unitY), thickness * 0.5)); \n let F = addVector(G, multiplyVector(unitX, magnitude(x) - thickness * 2.0)); \n let E = addVector(F, multiplyVector(negateVector(unitY), thickness)); \n\n let points = '' + \n A.x + ',' + A.y + ' ' +\n B.x + ',' + B.y + ' ' +\n C.x + ',' + C.y + ' ' +\n D.x + ',' + D.y + ' ' +\n E.x + ',' + E.y + ' ' +\n F.x + ',' + F.y + ' ' +\n G.x + ',' + G.y\n\n setAttributes(arrow, {\n points: points,\n stroke: normalizeColor(a.color || '#000'),\n fill: normalizeColor(a.color || '#000')\n });\n }\n\n return arrow;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderArrow.js\n **/","// Transform point by matrix\n//\nexport function applyTransform(p, m) {\n var xt = p[0] * m[0] + p[1] * m[2] + m[4];\n var yt = p[0] * m[1] + p[1] * m[3] + m[5];\n return [xt, yt];\n};\n\n// Transform point by matrix inverse\n//\nexport function applyInverseTransform(p, m) {\n var d = m[0] * m[3] - m[1] * m[2];\n var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\n var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\n return [xt, yt];\n};\n\n\n// Concatenates two transformation matrices together and returns the result.\nexport function transform(m1, m2) {\n return [\n m1[0] * m2[0] + m1[2] * m2[1],\n m1[1] * m2[0] + m1[3] * m2[1],\n m1[0] * m2[2] + m1[2] * m2[3],\n m1[1] * m2[2] + m1[3] * m2[3],\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5]\n ];\n};\n\nexport function translate(m, x, y) {\n return [\n m[0],\n m[1],\n m[2],\n m[3],\n m[0] * x + m[2] * y + m[4],\n m[1] * x + m[3] * y + m[5]\n ];\n};\n\n\nexport function rotate(m, angle) {\n angle = angle * Math.PI / 180;\n\n var cosValue = Math.cos(angle);\n var sinValue = Math.sin(angle);\n\n return [\n m[0] * cosValue + m[2] * sinValue,\n m[1] * cosValue + m[3] * sinValue,\n m[0] * (-sinValue) + m[2] * cosValue,\n m[1] * (-sinValue) + m[3] * cosValue,\n m[4],\n m[5]\n ];\n};\n\nexport function scale(m, x, y) {\n return [\n m[0] * x,\n m[1] * x,\n m[2] * y,\n m[3] * y,\n m[4],\n m[5]\n ];\n};\n \nfunction getInverseTransform(m) {\n var d = m[0] * m[3] - m[1] * m[2];\n return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d,\n (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];\n};\n\n\nexport function makePoint(x, y, z) {\n return { x: x, y: y, z: z }\n}\n\nexport function makeVector(xcoord, ycoord, zcoord) {\n return { xcoord: xcoord, ycoord: ycoord, zcoord: zcoord }\n}\n\nexport function makeVectorFromPoints(pt1, pt2)\n{\n let xcoord = pt2.x - pt1.x;\n let ycoord = pt2.y - pt1.y;\n let zcoord = pt2.z - pt1.z;\n return makeVector(xcoord, ycoord, zcoord);\n}\n\nexport function addVector(pt, v) {\n return makePoint(pt.x + v.xcoord, pt.y + v.ycoord, pt.z + v.zcoord);\n}\n\nexport function multiplyVector(v, scalar) {\n return makeVector(v.xcoord * scalar, v.ycoord * scalar, v.zcoord * scalar);\n}\n\nexport function magnitude(v)\n{\n return Math.sqrt(\n Math.pow(v.xcoord, 2) + Math.pow(v.ycoord, 2) + Math.pow(v.zcoord, 2)\n );\n}\n\nexport function negateVector(v) {\n return multiplyVector(v, -1);\n}\n\nexport function unitVector(v) {\n let mag = magnitude(v);\n let xcoord = v.xcoord / mag;\n let ycoord = v.ycoord / mag;\n let zcoord = v.zcoord / mag;\n return makeVector(xcoord, ycoord, zcoord);\n} \n\nexport function crossProduct(u, v) {\n //\n // u X v = < u2*v3 - u3*v2,\n // u3*v1 - u1*v3,\n // u1*v2 - u2*v1 >\n let xcoord = u.ycoord * v.zcoord - u.zcoord * v.ycoord;\n let ycoord = u.zcoord * v.xcoord - u.xcoord * v.zcoord;\n let zcoord = u.xcoord * v.ycoord - u.ycoord * v.xcoord;\n return makeVector(xcoord, ycoord, zcoord);\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/mathUtils.js\n **/","import uuid from '../utils/uuid';\nimport StoreAdapter from './StoreAdapter';\n\n// StoreAdapter for working with localStorage\n// This is ideal for testing, examples, and prototyping\nexport default class LocalStoreAdapter extends StoreAdapter {\n constructor() {\n super({\n getAnnotations(documentId, pageNumber) {\n return new Promise((resolve, reject) => {\n let annotations = getAnnotations(documentId).filter((i) => {\n return i.page === pageNumber && i.class === 'Annotation';\n });\n\n resolve({\n documentId,\n pageNumber,\n annotations\n });\n });\n },\n\n getAnnotation(documentId, annotationId) {\n return Promise.resolve(getAnnotations(documentId)[findAnnotation(documentId, annotationId)]);\n },\n\n addAnnotation(documentId, pageNumber, annotation) {\n return new Promise((resolve, reject) => {\n annotation.class = 'Annotation';\n annotation.uuid = uuid();\n annotation.page = pageNumber;\n\n let annotations = getAnnotations(documentId);\n annotations.push(annotation);\n updateAnnotations(documentId, annotations);\n\n resolve(annotation);\n });\n },\n\n editAnnotation(documentId, annotationId, annotation) {\n return new Promise((resolve, reject) => {\n let annotations = getAnnotations(documentId);\n annotations[findAnnotation(documentId, annotationId)] = annotation;\n updateAnnotations(documentId, annotations);\n\n resolve(annotation);\n });\n },\n\n deleteAnnotation(documentId, annotationId) {\n return new Promise((resolve, reject) => {\n let index = findAnnotation(documentId, annotationId);\n if (index > -1) {\n let annotations = getAnnotations(documentId);\n annotations.splice(index, 1);\n updateAnnotations(documentId, annotations);\n }\n\n resolve(true);\n });\n },\n\n getComments(documentId, annotationId) {\n return new Promise((resolve, reject) => {\n resolve(getAnnotations(documentId).filter((i) => {\n return i.class === 'Comment' && i.annotation === annotationId;\n }));\n });\n },\n\n addComment(documentId, annotationId, content) {\n return new Promise((resolve, reject) => {\n let comment = {\n class: 'Comment',\n uuid: uuid(),\n annotation: annotationId,\n content: content\n };\n\n let annotations = getAnnotations(documentId);\n annotations.push(comment);\n updateAnnotations(documentId, annotations);\n\n resolve(comment);\n });\n },\n\n deleteComment(documentId, commentId) {\n return new Promise((resolve, reject) => {\n getAnnotations(documentId);\n let index = -1;\n let annotations = getAnnotations(documentId);\n for (let i=0, l=annotations.length; i -1) {\n annotations.splice(index, 1);\n updateAnnotations(documentId, annotations);\n }\n\n resolve(true);\n });\n }\n });\n }\n}\n\nfunction getAnnotations(documentId) {\n return JSON.parse(localStorage.getItem(`${documentId}/annotations`)) || [];\n}\n\nfunction updateAnnotations(documentId, annotations) {\n localStorage.setItem(`${documentId}/annotations`, JSON.stringify(annotations));\n}\n\nfunction findAnnotation(documentId, annotationId) {\n let index = -1;\n let annotations = getAnnotations(documentId);\n for (let i=0, l=annotations.length; i {\n // Reset the content of the SVG\n svg.setAttribute('data-pdf-annotate-container', true);\n svg.setAttribute('data-pdf-annotate-viewport', JSON.stringify(viewport));\n svg.removeAttribute('data-pdf-annotate-document');\n svg.removeAttribute('data-pdf-annotate-page');\n\n // If there's no data nothing can be done\n if (!data) {\n svg.innerHTML = ''; \n return resolve(svg);\n }\n\n svg.setAttribute('data-pdf-annotate-document', data.documentId);\n svg.setAttribute('data-pdf-annotate-page', data.pageNumber);\n \n // Make sure annotations is an array\n if (!Array.isArray(data.annotations) || data.annotations.length === 0) {\n return resolve(svg);\n }\n\n // Append or transform annotation to svg\n data.annotations.forEach((a) => {\n var node = svg.querySelector('[data-pdf-annotate-id=\"' + a.uuid + '\"]');\n if (node) {\n transformChild(svg, node, viewport);\n } else {\n appendChild(svg, a, viewport);\n }\n });\n\n resolve(svg);\n });\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/index.js\n **/","import insertScreenReaderHint from './insertScreenReaderHint';\nimport initEventHandlers from './initEventHandlers';\n\n// TODO This is not the right place for this to live\ninitEventHandlers();\n\n/**\n * Insert hints into the DOM for screen readers.\n *\n * @param {Array} annotations The annotations that hints are inserted for\n */\nexport default function renderScreenReaderHints(annotations) {\n annotations = Array.isArray(annotations) ? annotations : [];\n\n // Insert hints for each type\n Object.keys(SORT_TYPES).forEach((type) => {\n let sortBy = SORT_TYPES[type];\n annotations\n .filter((a) => a.type === type)\n .sort(sortBy)\n .forEach((a, i) => insertScreenReaderHint(a, i + 1));\n });\n}\n\n// Sort annotations first by y, then by x.\n// This allows hints to be injected in the order they appear,\n// which makes numbering them easier.\nfunction sortByPoint(a, b) {\n if (a.y < b.y) {\n return a.x - b.x;\n } else {\n return 1;\n }\n}\n\n// Sort annotation by it's first rectangle\nfunction sortByRectPoint(a, b) {\n return sortByPoint(a.rectangles[0], b.rectangles[0]);\n}\n\n// Sort annotation by it's first line\nfunction sortByLinePoint(a, b) {\n let lineA = a.lines[0];\n let lineB = b.lines[0];\n return sortByPoint(\n {x: lineA[0], y: lineA[1]},\n {x: lineB[0], y: lineB[1]}\n );\n}\n\n// Arrange supported types and associated sort methods\nconst SORT_TYPES = {\n 'highlight': sortByRectPoint,\n 'strikeout': sortByRectPoint,\n 'drawing': sortByLinePoint,\n 'textbox': sortByPoint,\n 'point': sortByPoint,\n 'area': sortByPoint\n};\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/renderScreenReaderHints.js\n **/","import createScreenReaderOnly from './createScreenReaderOnly';\nimport insertElementWithinChildren from './insertElementWithinChildren';\nimport insertElementWithinElement from './insertElementWithinElement';\nimport renderScreenReaderComments from './renderScreenReaderComments';\n\n// Annotation types that support comments\nconst COMMENT_TYPES = ['highlight', 'point', 'area','circle','emptycircle','fillcircle'];\n\n/**\n * Insert a hint into the DOM for screen readers for a specific annotation.\n *\n * @param {Object} annotation The annotation to insert a hint for\n * @param {Number} num The number of the annotation out of all annotations of the same type\n */\nexport default function insertScreenReaderHint(annotation, num = 0) {\n switch (annotation.type) {\n case 'highlight':\n case 'strikeout':\n let rects = annotation.rectangles;\n let first = rects[0];\n let last = rects[rects.length - 1];\n\n insertElementWithinElement(\n createScreenReaderOnly(`Begin ${annotation.type} annotation ${num}`, annotation.uuid),\n first.x, first.y, annotation.page, true\n );\n\n insertElementWithinElement(\n createScreenReaderOnly(`End ${annotation.type} annotation ${num}`, `${annotation.uuid}-end`),\n last.x + last.width, last.y, annotation.page, false\n );\n break;\n\n case 'textbox':\n case 'point':\n let text = annotation.type === 'textbox' ? ` (content: ${annotation.content})` : '';\n\n insertElementWithinChildren(\n createScreenReaderOnly(`${annotation.type} annotation ${num}${text}`, annotation.uuid),\n annotation.x, annotation.y, annotation.page\n );\n break;\n\n case 'drawing':\n case 'area':\n let x = typeof annotation.x !== 'undefined' ? annotation.x : annotation.lines[0][0];\n let y = typeof annotation.y !== 'undefined' ? annotation.y : annotation.lines[0][1];\n\n insertElementWithinChildren(\n createScreenReaderOnly(`Unlabeled drawing`, annotation.uuid),\n x, y, annotation.page\n );\n break;\n\n case 'circle':\n case 'fillcircle':\n case 'emptycircle':\n let x2 = typeof annotation.cx !== 'undefined' ? annotation.cx : annotation.lines[0][0];\n let y2 = typeof annotation.cy !== 'undefined' ? annotation.cy : annotation.lines[0][1];\n\n insertElementWithinChildren(\n createScreenReaderOnly(`Unlabeled drawing`, annotation.uuid),\n x2, y2, annotation.page\n );\n break;\n }\n\n // Include comments in screen reader hint\n if (COMMENT_TYPES.includes(annotation.type)) {\n renderScreenReaderComments(annotation.documentId, annotation.uuid);\n }\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/insertScreenReaderHint.js\n **/","/**\n * Create a node that is only visible to screen readers\n *\n * @param {String} content The text content that should be read by screen reader\n * @param {String} [annotationId] The ID of the annotation assocaited\n * @return {Element} An Element that is only visible to screen readers\n */\nexport default function createScreenReaderOnly(content, annotationId) {\n let node = document.createElement('div');\n let text = document.createTextNode(content);\n node.appendChild(text);\n node.setAttribute('id', `pdf-annotate-screenreader-${annotationId}`);\n node.style.position = 'absolute';\n node.style.left = '-10000px';\n node.style.top = 'auto';\n node.style.width = '1px';\n node.style.height = '1px';\n node.style.overflow = 'hidden';\n return node;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/createScreenReaderOnly.js\n **/","import config from '../config';\nimport insertElementWithinElement from './insertElementWithinElement';\nimport { pointIntersectsRect } from '../UI/utils';\nimport { scaleUp } from '../UI/utils'; \n\n/**\n * Insert an element at a point within the document.\n * This algorithm will try to insert between elements if possible.\n * It will however use `insertElementWithinElement` if it is more accurate.\n *\n * @param {Element} el The element to be inserted\n * @param {Number} x The x coordinate of the point\n * @param {Number} y The y coordinate of the point\n * @param {Number} pageNumber The page number to limit elements to\n * @return {Boolean} True if element was able to be inserted, otherwise false\n */\nexport default function insertElementWithinChildren(el, x, y, pageNumber) {\n // Try and use most accurate method of inserting within an element\n if (insertElementWithinElement(el, x, y, pageNumber, true)) {\n return true;\n }\n\n // Fall back to inserting between elements\n let svg = document.querySelector(`svg[data-pdf-annotate-page=\"${pageNumber}\"]`);\n let rect = svg.getBoundingClientRect();\n let nodes = [...svg.parentNode.querySelectorAll(config.textClassQuery() + ' > div')];\n\n y = scaleUp(svg, {y}).y + rect.top;\n x = scaleUp(svg, {x}).x + rect.left;\n\n // Find the best node to insert before\n for (let i=0, l=nodes.length; i') {\n while(head.length) {\n tail.unshift(head.pop());\n if (tail[0] === '<') {\n break;\n }\n }\n }\n \n // Check if width of temp based on current head value satisfies x\n temp.innerHTML = head.join('');\n let width = scaleDown(svg, {width: temp.getBoundingClientRect().width}).width;\n if (left + width <= x) {\n break;\n }\n tail.unshift(head.pop());\n }\n \n // Update original node with new markup, including element to be inserted\n node.innerHTML = head.join('') + el.outerHTML + tail.join('');\n temp.parentNode.removeChild(temp);\n\n return true;\n}\n\n/**\n * Get a text layer element at a given point on a page\n *\n * @param {Number} x The x coordinate of the point\n * @param {Number} y The y coordinate of the point\n * @param {Number} pageNumber The page to limit elements to\n * @return {Element} First text layer element found at the point\n */\nfunction textLayerElementFromPoint(x, y, pageNumber) {\n let svg = document.querySelector(`svg[data-pdf-annotate-page=\"${pageNumber}\"]`);\n let rect = svg.getBoundingClientRect();\n y = scaleUp(svg, {y}).y + rect.top;\n x = scaleUp(svg, {x}).x + rect.left;\n return [...svg.parentNode.querySelectorAll(config.textClassQuery() + ' [data-canvas-width]')].filter((el) => {\n return pointIntersectsRect(x, y, el.getBoundingClientRect());\n })[0];\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/insertElementWithinElement.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\nimport insertScreenReaderComment from './insertScreenReaderComment';\n\n/**\n * Insert the comments into the DOM to be available by screen reader\n *\n * Example output:\n *
\n *
Begin highlight 1
\n *
    \n *
  1. Foo
  2. \n *
  3. Bar
  4. \n *
  5. Baz
  6. \n *
  7. Qux
  8. \n *
\n *
\n *
Some highlighted text goes here...
\n *
End highlight 1
\n *\n * NOTE: `screenReaderOnly` is not a real class, just used for brevity\n *\n * @param {String} documentId The ID of the document\n * @param {String} annotationId The ID of the annotation\n * @param {Array} [comments] Optionally preloaded comments to be rendered\n * @return {Promise}\n */\nexport default function renderScreenReaderComments(documentId, annotationId, comments) {\n let promise;\n\n if (Array.isArray(comments)) {\n promise = Promise.resolve(comments);\n } else {\n promise = PDFJSAnnotate.getStoreAdapter().getComments(documentId, annotationId);\n }\n\n return promise.then((comments) => {\n // Node needs to be found by querying DOM as it may have been inserted as innerHTML\n // leaving `screenReaderNode` as an invalid reference (see `insertElementWithinElement`).\n let node = document.getElementById(`pdf-annotate-screenreader-${annotationId}`);\n if (node) { \n let list = document.createElement('ol');\n list.setAttribute('id', `pdf-annotate-screenreader-comment-list-${annotationId}`);\n list.setAttribute('aria-label', 'Comments');\n node.appendChild(list);\n comments.forEach(insertScreenReaderComment);\n }\n });\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/renderScreenReaderComments.js\n **/","/**\n * Insert a comment into the DOM to be available by screen reader\n *\n * @param {Object} comment The comment to be inserted\n */\nexport default function insertScreenReaderComment(comment) {\n if (!comment) {\n return;\n }\n\n let list = document.querySelector(`#pdf-annotate-screenreader-${comment.annotation} ol`);\n if (list) {\n let item = document.createElement('li');\n item.setAttribute('id', `pdf-annotate-screenreader-comment-${comment.uuid}`);\n item.appendChild(document.createTextNode(`${comment.content}`));\n list.appendChild(item);\n }\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/insertScreenReaderComment.js\n **/","import insertScreenReaderHint from './insertScreenReaderHint';\nimport renderScreenReaderHints from './renderScreenReaderHints';\nimport insertScreenReaderComment from './insertScreenReaderComment';\nimport renderScreenReaderComments from './renderScreenReaderComments';\nimport { addEventListener } from '../UI/event';\nimport PDFJSAnnotate from '../PDFJSAnnotate';\n\n/**\n * Initialize the event handlers for keeping screen reader hints synced with data\n */\nexport default function initEventHandlers() {\n addEventListener('annotation:add', (documentId, pageNumber, annotation) => {\n reorderAnnotationsByType(documentId, pageNumber, annotation.type);\n });\n addEventListener('annotation:edit', (documentId, annotationId, annotation) => {\n reorderAnnotationsByType(documentId, annotation.page, annotation.type);\n });\n addEventListener('annotation:delete', removeAnnotation);\n addEventListener('comment:add', insertComment);\n addEventListener('comment:delete', removeComment);\n}\n\n/**\n * Reorder the annotation numbers by annotation type\n *\n * @param {String} documentId The ID of the document\n * @param {Number} pageNumber The page number of the annotations\n * @param {Strig} type The annotation type\n */\nfunction reorderAnnotationsByType(documentId, pageNumber, type) {\n PDFJSAnnotate.getStoreAdapter().getAnnotations(documentId, pageNumber)\n .then((annotations) => {\n return annotations.annotations.filter((a) => {\n return a.type === type;\n });\n })\n .then((annotations) => {\n annotations.forEach((a) => {\n removeAnnotation(documentId, a.uuid);\n });\n\n return annotations;\n })\n .then(renderScreenReaderHints);\n}\n\n/**\n * Remove the screen reader hint for an annotation\n *\n * @param {String} documentId The ID of the document\n * @param {String} annotationId The Id of the annotation\n */\nfunction removeAnnotation(documentId, annotationId) {\n removeElementById(`pdf-annotate-screenreader-${annotationId}`);\n removeElementById(`pdf-annotate-screenreader-${annotationId}-end`);\n}\n\n/**\n * Insert a screen reader hint for a comment\n *\n * @param {String} documentId The ID of the document\n * @param {String} annotationId The ID of tha assocated annotation\n * @param {Object} comment The comment to insert a hint for\n */\nfunction insertComment(documentId, annotationId, comment) {\n let list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`);\n let promise;\n\n if (!list) {\n promise = renderScreenReaderComments(documentId, annotationId, []).then(() => {\n list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`);\n return true;\n });\n } else {\n promise = Promise.resolve(true);\n }\n\n promise.then(() => {\n insertScreenReaderComment(comment);\n });\n}\n\n/**\n * Remove a screen reader hint for a comment\n *\n * @param {String} documentId The ID of the document\n * @param {String} commentId The ID of the comment\n */\nfunction removeComment(documentId, commentId) {\n removeElementById(`pdf-annotate-screenreader-comment-${commentId}`);\n}\n\n/**\n * Remove an element from the DOM by it's ID if it exists\n *\n * @param {String} elementID The ID of the element to be removed\n */\nfunction removeElementById(elementId) {\n let el = document.getElementById(elementId);\n if (el) {\n el.parentNode.removeChild(el);\n }\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/initEventHandlers.js\n **/","import { addEventListener, removeEventListener, fireEvent } from './event';\r\nimport { disableEdit, enableEdit } from './edit';\r\nimport { disablePen, enablePen, setPen } from './pen';\r\nimport { enableEraser, disableEraser } from './eraser';\r\nimport { disableArrow, enableArrow, setArrow } from './arrow';\r\nimport { disablePoint, enablePoint } from './point';\r\nimport { disableRect, enableRect } from './rect';\r\nimport { disableCircle, enableCircle, setCircle, addCircle } from './circle';\r\nimport { disableText, enableText, setText } from './text';\r\nimport { createPage, renderPage } from './page';\r\n\r\nexport default {\r\n addEventListener, removeEventListener, fireEvent,\r\n disableEdit, enableEdit,\r\n disablePen, enablePen, setPen,\r\n enableEraser, disableEraser,\r\n disablePoint, enablePoint,\r\n disableRect, enableRect,\r\n disableCircle, enableCircle, setCircle, addCircle,\r\n disableArrow, enableArrow, setArrow,\r\n disableText, enableText, setText,\r\n createPage, renderPage\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/index.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\nimport config from '../config';\nimport { appendChild } from '../render/appendChild';\nimport {\n addEventListener,\n removeEventListener\n} from './event';\nimport {\n BORDER_COLOR,\n disableUserSelect,\n enableUserSelect,\n findSVGContainer,\n findSVGAtPoint,\n getOffsetAnnotationRect,\n getMetadata,\n scaleUp,\n convertToSvgPoint\n} from './utils';\n\nlet _enabled = false;\nlet isDragging = false, overlay;\nlet dragOffsetX, dragOffsetY, dragStartX, dragStartY;\nconst OVERLAY_BORDER_SIZE = 3;\n\n/**\n * Create an overlay for editing an annotation.\n *\n * @param {Element} target The annotation element to apply overlay for\n */\nfunction createEditOverlay(target) {\n destroyEditOverlay();\n\n overlay = document.createElement('div');\n let anchor = document.createElement('a');\n let parentNode = findSVGContainer(target).parentNode;\n let id = target.getAttribute('data-pdf-annotate-id');\n let rect = getOffsetAnnotationRect(target);\n let styleLeft = rect.left - OVERLAY_BORDER_SIZE;\n let styleTop = rect.top - OVERLAY_BORDER_SIZE;\n \n overlay.setAttribute('id', 'pdf-annotate-edit-overlay');\n overlay.setAttribute('data-target-id', id);\n overlay.style.boxSizing = 'content-box';\n overlay.style.position = 'absolute';\n overlay.style.top = `${styleTop}px`;\n overlay.style.left = `${styleLeft}px`;\n overlay.style.width = `${rect.width}px`;\n overlay.style.height = `${rect.height}px`;\n overlay.style.border = `${OVERLAY_BORDER_SIZE}px solid ${BORDER_COLOR}`;\n overlay.style.borderRadius = `${OVERLAY_BORDER_SIZE}px`;\n overlay.style.zIndex = 20100;\n\n anchor.innerHTML = '×';\n anchor.setAttribute('href', 'javascript://');\n anchor.style.background = '#fff';\n anchor.style.borderRadius = '20px';\n anchor.style.border = '1px solid #bbb';\n anchor.style.color = '#bbb';\n anchor.style.fontSize = '16px';\n anchor.style.padding = '2px';\n anchor.style.textAlign = 'center';\n anchor.style.textDecoration = 'none';\n anchor.style.position = 'absolute';\n anchor.style.top = '-13px';\n anchor.style.right = '-13px';\n anchor.style.width = '25px';\n anchor.style.height = '25px';\n \n overlay.appendChild(anchor);\n parentNode.appendChild(overlay);\n document.addEventListener('click', handleDocumentClick);\n document.addEventListener('keyup', handleDocumentKeyup);\n document.addEventListener('mousedown', handleDocumentMousedown);\n anchor.addEventListener('click', deleteAnnotation);\n anchor.addEventListener('mouseover', () => {\n anchor.style.color = '#35A4DC';\n anchor.style.borderColor = '#999';\n anchor.style.boxShadow = '0 1px 1px #ccc';\n });\n anchor.addEventListener('mouseout', () => {\n anchor.style.color = '#bbb';\n anchor.style.borderColor = '#bbb';\n anchor.style.boxShadow = '';\n });\n overlay.addEventListener('mouseover', () => {\n if (!isDragging) { anchor.style.display = ''; }\n });\n overlay.addEventListener('mouseout', () => {\n anchor.style.display = 'none';\n });\n}\n\n/**\n * Destroy the edit overlay if it exists.\n */\nfunction destroyEditOverlay() {\n if (overlay) {\n overlay.parentNode.removeChild(overlay);\n overlay = null;\n }\n\n document.removeEventListener('click', handleDocumentClick);\n document.removeEventListener('keyup', handleDocumentKeyup);\n document.removeEventListener('mousedown', handleDocumentMousedown);\n document.removeEventListener('mousemove', handleDocumentMousemove);\n document.removeEventListener('mouseup', handleDocumentMouseup);\n enableUserSelect();\n}\n\n/**\n * Delete currently selected annotation\n */\nfunction deleteAnnotation() {\n if (!overlay) { return; }\n\n let annotationId = overlay.getAttribute('data-target-id');\n let nodes = document.querySelectorAll(`[data-pdf-annotate-id=\"${annotationId}\"]`);\n let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\n let { documentId } = getMetadata(svg);\n\n [...nodes].forEach((n) => {\n n.parentNode.removeChild(n);\n });\n \n PDFJSAnnotate.getStoreAdapter().deleteAnnotation(documentId, annotationId);\n\n destroyEditOverlay();\n}\n\n/**\n * Handle document.click event\n *\n * @param {Event} e The DOM event that needs to be handled\n */\nfunction handleDocumentClick(e) {\n if (!findSVGAtPoint(e.clientX, e.clientY)) { return; }\n\n // Remove current overlay\n let overlay = document.getElementById('pdf-annotate-edit-overlay');\n if (overlay) {\n if (isDragging || e.target === overlay) {\n return;\n }\n\n destroyEditOverlay();\n }\n}\n\n/**\n * Handle document.keyup event\n *\n * @param {Event} e The DOM event that needs to be handled\n */\nfunction handleDocumentKeyup(e) {\n if (overlay && e.keyCode === 46 &&\n e.target.nodeName.toLowerCase() !== 'textarea' &&\n e.target.nodeName.toLowerCase() !== 'input') {\n deleteAnnotation();\n }\n}\n\n/**\n * Handle document.mousedown event\n *\n * @param {Event} e The DOM event that needs to be handled\n */\nfunction handleDocumentMousedown(e) {\n if (e.target !== overlay) { return; }\n\n // Highlight and strikeout annotations are bound to text within the document.\n // It doesn't make sense to allow repositioning these types of annotations.\n let annotationId = overlay.getAttribute('data-target-id');\n let target = document.querySelector(`[data-pdf-annotate-id=\"${annotationId}\"]`);\n let type = target.getAttribute('data-pdf-annotate-type');\n\n if (type === 'highlight' || type === 'strikeout') { return; }\n\n isDragging = true;\n dragOffsetX = e.clientX;\n dragOffsetY = e.clientY;\n dragStartX = overlay.offsetLeft;\n dragStartY = overlay.offsetTop;\n\n overlay.style.background = 'rgba(255, 255, 255, 0.7)';\n overlay.style.cursor = 'move';\n overlay.querySelector('a').style.display = 'none';\n\n document.addEventListener('mousemove', handleDocumentMousemove);\n document.addEventListener('mouseup', handleDocumentMouseup);\n disableUserSelect();\n}\n\n/**\n * Handle document.mousemove event\n *\n * @param {Event} e The DOM event that needs to be handled\n */\nfunction handleDocumentMousemove(e) {\n let annotationId = overlay.getAttribute('data-target-id');\n let parentNode = overlay.parentNode;\n let rect = parentNode.getBoundingClientRect();\n let y = (dragStartY + (e.clientY - dragOffsetY));\n let x = (dragStartX + (e.clientX - dragOffsetX));\n let minY = 0;\n let maxY = rect.height;\n let minX = 0;\n let maxX = rect.width;\n\n if (y > minY && y + overlay.offsetHeight < maxY) {\n overlay.style.top = `${y}px`;\n }\n\n if (x > minX && x + overlay.offsetWidth < maxX) {\n overlay.style.left = `${x}px`;\n }\n}\n\n/**\n * Handle document.mouseup event\n *\n * @param {Event} e The DOM event that needs to be handled\n */\nfunction handleDocumentMouseup(e) {\n let annotationId = overlay.getAttribute('data-target-id');\n let target = document.querySelectorAll(`[data-pdf-annotate-id=\"${annotationId}\"]`);\n let type = target[0].getAttribute('data-pdf-annotate-type');\n let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\n let { documentId } = getMetadata(svg);\n \n overlay.querySelector('a').style.display = '';\n\n PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, annotationId).then((annotation) => {\n let attribX = 'x';\n let attribY = 'y';\n if (['circle', 'fillcircle', 'emptycircle'].indexOf(type) > -1) {\n attribX = 'cx';\n attribY = 'cy';\n }\n if (['area', 'highlight', 'point', 'textbox', 'circle', 'fillcircle', 'emptycircle'].indexOf(type) > -1) {\n let modelStart = convertToSvgPoint([dragStartX, dragStartY], svg);\n let modelEnd = convertToSvgPoint([overlay.offsetLeft, overlay.offsetTop], svg);\n let modelDelta = {\n x: modelEnd[0] - modelStart[0],\n y: modelEnd[1] - modelStart[1]\n };\n\n if (type === 'textbox') {\n target = [target[0].firstChild];\n }\n\n [...target].forEach((t, i) => {\n let modelX = parseInt(t.getAttribute(attribX), 10);\n let modelY = parseInt(t.getAttribute(attribY), 10);\n if (modelDelta.y !== 0) {\n modelY = modelY + modelDelta.y;\n let viewY = modelY;\n\n if (type === 'point') {\n viewY = scaleUp(svg, { viewY }).viewY;\n }\n\n t.setAttribute(attribY, viewY);\n if (annotation.rectangles && i < annotation.rectangles.length) {\n annotation.rectangles[i].y = modelY;\n } else if (annotation[attribY]) {\n annotation[attribY] = modelY;\n }\n }\n if (modelDelta.x !== 0) {\n modelX = modelX + modelDelta.x;\n let viewX = modelX;\n\n if (type === 'point') {\n viewX = scaleUp(svg, { viewX }).viewX;\n }\n\n t.setAttribute(attribX, viewX);\n if (annotation.rectangles && i < annotation.rectangles.length) {\n annotation.rectangles[i].x = modelX;\n } else if (annotation[attribX]) {\n annotation[attribX] = modelX;\n }\n }\n });\n // } else if (type === 'strikeout') {\n // let { deltaX, deltaY } = getDelta('x1', 'y1');\n // [...target].forEach(target, (t, i) => {\n // if (deltaY !== 0) {\n // t.setAttribute('y1', parseInt(t.getAttribute('y1'), 10) + deltaY);\n // t.setAttribute('y2', parseInt(t.getAttribute('y2'), 10) + deltaY);\n // annotation.rectangles[i].y = parseInt(t.getAttribute('y1'), 10);\n // }\n // if (deltaX !== 0) {\n // t.setAttribute('x1', parseInt(t.getAttribute('x1'), 10) + deltaX);\n // t.setAttribute('x2', parseInt(t.getAttribute('x2'), 10) + deltaX);\n // annotation.rectangles[i].x = parseInt(t.getAttribute('x1'), 10);\n // }\n // });\n } else if (type === 'drawing' || type === 'arrow') {\n let modelStart = convertToSvgPoint([dragStartX, dragStartY], svg);\n let modelEnd = convertToSvgPoint([overlay.offsetLeft, overlay.offsetTop], svg);\n let modelDelta = {\n x: modelEnd[0] - modelStart[0],\n y: modelEnd[1] - modelStart[1]\n };\n\n annotation.lines.forEach((line, i) => {\n let [x, y] = annotation.lines[i];\n annotation.lines[i][0] = x + modelDelta.x;\n annotation.lines[i][1] = y + modelDelta.y;\n });\n\n target[0].parentNode.removeChild(target[0]);\n appendChild(svg, annotation);\n } \n\n PDFJSAnnotate.getStoreAdapter().editAnnotation(documentId, annotationId, annotation);\n });\n\n setTimeout(() => {\n isDragging = false;\n }, 0);\n\n overlay.style.background = '';\n overlay.style.cursor = '';\n\n document.removeEventListener('mousemove', handleDocumentMousemove);\n document.removeEventListener('mouseup', handleDocumentMouseup);\n enableUserSelect();\n}\n\n/**\n * Handle annotation.click event\n *\n * @param {Element} e The annotation element that was clicked\n */\nfunction handleAnnotationClick(target) {\n createEditOverlay(target);\n}\n\n/**\n * Enable edit mode behavior.\n */\nexport function enableEdit () {\n if (_enabled) { return; }\n\n _enabled = true;\n addEventListener('annotation:click', handleAnnotationClick);\n};\n\n/**\n * Disable edit mode behavior.\n */\nexport function disableEdit () {\n destroyEditOverlay();\n\n if (!_enabled) { return; }\n\n _enabled = false;\n removeEventListener('annotation:click', handleAnnotationClick);\n};\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/edit.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport { appendChild } from '../render/appendChild';\r\nimport {\r\n disableUserSelect,\r\n enableUserSelect,\r\n findSVGAtPoint,\r\n getMetadata,\r\n convertToSvgPoint\r\n} from './utils';\r\n\r\nlet _enabled = false;\r\nlet _candraw = false;\r\nlet _penSize;\r\nlet _penColor;\r\nlet path;\r\nlet lines = [];\r\n\r\n/**\r\n * Handle document.touchdown or document.pointerdown event\r\n */\r\nfunction handleDocumentPointerdown(e) {\r\n path = null;\r\n lines = [];\r\n _candraw = true;\r\n}\r\n\r\n/**\r\n * Handle document.touchup or document.pointerup event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentKeyupChrome(e){\r\n saveToStorage(e.changedTouches[0].clientX, e.changedTouches[0].clientY);\r\n}\r\n\r\nfunction handleDocumentPointerup(e) {\r\n saveToStorage(e.clientX, e.clientY);\r\n}\r\n\r\nfunction saveToStorage(x, y){\r\n _candraw = false;\r\n let svg;\r\n if (lines.length > 1 && (svg = findSVGAtPoint(x, y))) {\r\n let { documentId, pageNumber } = getMetadata(svg);\r\n\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, {\r\n type: 'drawing',\r\n width: _penSize,\r\n color: _penColor,\r\n lines\r\n }\r\n ).then((annotation) => {\r\n if (path) {\r\n svg.removeChild(path);\r\n }\r\n\r\n appendChild(svg, annotation);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Handle document.mousemove event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentPointermove(e) {\r\n if(_candraw){\r\n savePoint(e.clientX, e.clientY);\r\n }\r\n}\r\n\r\nfunction handleDocumentPointermoveChrome(e){\r\n savePoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY);\r\n}\r\n\r\n/**\r\n * Handle document.keyup event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentKeyup(e) {\r\n // Cancel rect if Esc is pressed\r\n if (e.keyCode === 27) {\r\n lines = null;\r\n path.parentNode.removeChild(path);\r\n document.removeEventListener('pointermove', handleDocumentPointermove);\r\n document.removeEventListener('pointerup', handleDocumentPointerup);\r\n }\r\n}\r\n\r\n/**\r\n * Save a point to the line being drawn.\r\n *\r\n * @param {Number} x The x coordinate of the point\r\n * @param {Number} y The y coordinate of the point\r\n */\r\nfunction savePoint(x, y) {\r\n let svg = findSVGAtPoint(x, y);\r\n if (!svg) {\r\n return;\r\n }\r\n\r\n let rect = svg.getBoundingClientRect();\r\n let point = convertToSvgPoint([\r\n x - rect.left,\r\n y - rect.top\r\n ], svg);\r\n\r\n lines.push(point);\r\n\r\n if (lines.length <= 1) {\r\n return;\r\n }\r\n\r\n if (path) {\r\n svg.removeChild(path);\r\n }\r\n\r\n path = appendChild(svg, {\r\n type: 'drawing',\r\n color: _penColor,\r\n width: _penSize,\r\n lines\r\n });\r\n}\r\n\r\n/**\r\n * Set the attributes of the pen.\r\n *\r\n * @param {Number} penSize The size of the lines drawn by the pen\r\n * @param {String} penColor The color of the lines drawn by the pen\r\n */\r\nexport function setPen(penSize = 1, penColor = '000000') {\r\n _penSize = parseInt(penSize, 10);\r\n _penColor = penColor;\r\n}\r\n\r\n/**\r\n * Enable the pen behavior\r\n */\r\nexport function enablePen() {\r\n if (_enabled) { return; }\r\n\r\n _enabled = true;\r\n // Chrome and Firefox has different behaviors with how pen works, so we need different events.\r\n if (navigator.userAgent.indexOf(\"Chrome\") !== -1){\r\n document.addEventListener('touchstart', handleDocumentPointerdown);\r\n document.addEventListener('touchmove', handleDocumentPointermoveChrome);\r\n document.addEventListener('touchend', handleDocumentKeyupChrome);\r\n document.addEventListener('mousedown', handleDocumentPointerdown);\r\n document.addEventListener('mousemove', handleDocumentPointermove);\r\n document.addEventListener('mouseup', handleDocumentPointerup);\r\n } else {\r\n document.addEventListener('pointerdown', handleDocumentPointerdown);\r\n document.addEventListener('pointermove', handleDocumentPointermove);\r\n document.addEventListener('pointerup', handleDocumentPointerup);\r\n }\r\n document.addEventListener('keyup', handleDocumentKeyup);\r\n disableUserSelect();\r\n}\r\n\r\n/**\r\n * Disable the pen behavior\r\n */\r\nexport function disablePen() {\r\n if (!_enabled) { return; }\r\n\r\n _enabled = false;\r\n if (navigator.userAgent.indexOf(\"Chrome\") !== -1){\r\n document.removeEventListener('touchstart', handleDocumentPointerdown);\r\n document.removeEventListener('touchmove', handleDocumentPointermoveChrome);\r\n document.removeEventListener('touchend', handleDocumentKeyupChrome);\r\n document.removeEventListener('mousedown', handleDocumentPointerdown);\r\n document.removeEventListener('mousemove', handleDocumentPointermove);\r\n document.removeEventListener('mouseup', handleDocumentPointerup);\r\n } else {\r\n document.removeEventListener('pointerdown', handleDocumentPointerdown);\r\n document.removeEventListener('pointermove', handleDocumentPointermove);\r\n document.removeEventListener('pointerup', handleDocumentPointerup);\r\n }\r\n document.removeEventListener('keyup', handleDocumentKeyup);\r\n enableUserSelect();\r\n}\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/pen.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport {\r\n findAnnotationAtPoint,\r\n findSVGAtPoint\r\n} from './utils';\r\n\r\nlet _canerase = false;\r\n\r\nfunction handleDocumentMouseDown(e){\r\n _canerase = true;\r\n}\r\n\r\nfunction handleDocumentMouseUp(e){\r\n _canerase = false;\r\n}\r\n\r\nfunction handleDocumentMouseMove(e){\r\n if(_canerase){\r\n let target = findAnnotationAtPoint(e.clientX, e.clientY);\r\n console.log(target);\r\n }\r\n}\r\n\r\nexport function enableEraser(){\r\n document.addEventListener('mousemove', handleDocumentMouseMove);\r\n document.addEventListener('mousedown', handleDocumentMouseDown);\r\n document.addEventListener('mouseup', handleDocumentMouseUp);\r\n}\r\n\r\nexport function disableEraser(){\r\n document.removeEventListener('mousemove', handleDocumentMouseMove);\r\n}\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/eraser.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\nimport { appendChild } from '../render/appendChild';\nimport {\n disableUserSelect,\n enableUserSelect,\n findSVGAtPoint,\n findSVGContainer,\n getMetadata,\n convertToSvgPoint,\n convertToScreenPoint,\n findAnnotationAtPoint\n} from './utils';\n\nlet _enabled = false;\nlet _penSize;\nlet _penColor;\nlet path;\nlet lines;\nlet originY;\nlet originX;\n\n/**\n * Handle document.mousedown event\n */\nfunction handleDocumentMousedown(e) {\n let target = findAnnotationAtPoint(e.clientX, e.clientY);\n if (target === null)\n return;\n\n let type = target.getAttribute('data-pdf-annotate-type');\n if (type !== 'circle' && type !== 'fillcircle' && type !== 'emptycircle') {\n return;\n }\n\n let svg = findSVGContainer(target);\n let { documentId } = getMetadata(svg);\n let annotationId = target.getAttribute('data-pdf-annotate-id');\n\n let event = e;\n PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, annotationId).then((annotation) => {\n if (annotation) {\n path = null;\n lines = [];\n\n let point = convertToScreenPoint([\n annotation.cx,\n annotation.cy\n ], svg);\n\n let rect = svg.getBoundingClientRect();\n\n originX = point[0] + rect.left;\n originY = point[1] + rect.top; \n\n document.addEventListener('mousemove', handleDocumentMousemove);\n document.addEventListener('mouseup', handleDocumentMouseup);\n }\n });\n}\n\n/**\n * Handle document.mouseup event\n *\n * @param {Event} e The DOM event to be handled\n */\nfunction handleDocumentMouseup(e) {\n let svg;\n if (lines.length > 1 && (svg = findSVGAtPoint(e.clientX, e.clientY))) {\n let { documentId, pageNumber } = getMetadata(svg);\n\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, {\n type: 'arrow',\n width: _penSize,\n color: _penColor,\n lines\n }\n ).then((annotation) => {\n if (path) {\n svg.removeChild(path);\n }\n\n appendChild(svg, annotation);\n });\n }\n\n document.removeEventListener('mousemove', handleDocumentMousemove);\n document.removeEventListener('mouseup', handleDocumentMouseup);\n}\n\n/**\n * Handle document.mousemove event\n *\n * @param {Event} e The DOM event to be handled\n */\nfunction handleDocumentMousemove(e) {\n let x = lines.length === 0 ? originX : e.clientX;\n let y = lines.length === 0 ? originY : e.clientY;\n\n savePoint(x, y);\n}\n\n/**\n * Handle document.keyup event\n *\n * @param {Event} e The DOM event to be handled\n */\nfunction handleDocumentKeyup(e) {\n // Cancel rect if Esc is pressed\n if (e.keyCode === 27) {\n lines = null;\n path.parentNode.removeChild(path);\n document.removeEventListener('mousemove', handleDocumentMousemove);\n document.removeEventListener('mouseup', handleDocumentMouseup);\n }\n}\n\n/**\n * Save a point to the line being drawn.\n *\n * @param {Number} x The x coordinate of the point\n * @param {Number} y The y coordinate of the point\n */\nfunction savePoint(x, y) {\n let svg = findSVGAtPoint(x, y);\n if (!svg) {\n return;\n }\n\n let rect = svg.getBoundingClientRect();\n let point = convertToSvgPoint([\n x - rect.left,\n y - rect.top\n ], svg);\n\n if (lines.length < 2) {\n lines.push(point);\n return;\n } else {\n lines[1] = point; // update end point\n }\n\n if (path) {\n svg.removeChild(path);\n }\n\n path = appendChild(svg, {\n type: 'arrow',\n color: _penColor,\n width: _penSize,\n lines\n });\n}\n\n/**\n * Set the attributes of the pen.\n *\n * @param {Number} penSize The size of the lines drawn by the pen\n * @param {String} penColor The color of the lines drawn by the pen\n */\nexport function setArrow(penSize = 10, penColor = '0000FF') {\n _penSize = parseInt(penSize, 10);\n _penColor = penColor;\n}\n\n/**\n * Enable the pen behavior\n */\nexport function enableArrow() {\n if (_enabled) { return; }\n\n _enabled = true;\n document.addEventListener('mousedown', handleDocumentMousedown);\n document.addEventListener('keyup', handleDocumentKeyup);\n disableUserSelect();\n}\n\n/**\n * Disable the pen behavior\n */\nexport function disableArrow() {\n if (!_enabled) { return; }\n\n _enabled = false;\n document.removeEventListener('mousedown', handleDocumentMousedown);\n document.removeEventListener('keyup', handleDocumentKeyup);\n enableUserSelect();\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/arrow.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\nimport { appendChild } from '../render/appendChild';\nimport {\n BORDER_COLOR,\n findSVGAtPoint,\n getMetadata,\n scaleDown\n} from './utils';\n\nlet _enabled = false;\nlet input;\n\n/**\n * Handle document.mouseup event\n *\n * @param {Event} The DOM event to be handled\n */\nfunction handleDocumentMouseup(e) {\n if (input || !findSVGAtPoint(e.clientX, e.clientY)) {\n return\n }\n \n input = document.createElement('input');\n input.setAttribute('id', 'pdf-annotate-point-input');\n input.setAttribute('placeholder', 'Enter comment');\n input.style.border = `3px solid ${BORDER_COLOR}`;\n input.style.borderRadius = '3px';\n input.style.position = 'absolute';\n input.style.top = `${e.clientY}px`;\n input.style.left = `${e.clientX}px`;\n\n input.addEventListener('blur', handleInputBlur);\n input.addEventListener('keyup', handleInputKeyup);\n\n document.body.appendChild(input);\n input.focus();\n}\n\n/**\n * Handle input.blur event\n */\nfunction handleInputBlur() {\n savePoint();\n}\n\n/**\n * Handle input.keyup event\n *\n * @param {Event} e The DOM event to handle\n */\nfunction handleInputKeyup(e) {\n if (e.keyCode === 27) {\n closeInput();\n } else if (e.keyCode === 13) {\n savePoint();\n }\n}\n\n/**\n * Save a new point annotation from input\n */\nfunction savePoint() {\n if (input.value.trim().length > 0) {\n let clientX = parseInt(input.style.left, 10);\n let clientY = parseInt(input.style.top, 10);\n let content = input.value.trim();\n let svg = findSVGAtPoint(clientX, clientY);\n if (!svg) {\n return;\n }\n\n let rect = svg.getBoundingClientRect();\n let { documentId, pageNumber } = getMetadata(svg);\n let annotation = Object.assign({\n type: 'point'\n }, scaleDown(svg, {\n x: clientX - rect.left,\n y: clientY - rect.top\n })\n );\n\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation)\n .then((annotation) => {\n PDFJSAnnotate.getStoreAdapter().addComment(\n documentId,\n annotation.uuid,\n content\n );\n\n appendChild(svg, annotation);\n });\n }\n\n closeInput();\n}\n\n/**\n * Close the input element\n */\nfunction closeInput() {\n input.removeEventListener('blur', handleInputBlur);\n input.removeEventListener('keyup', handleInputKeyup);\n document.body.removeChild(input);\n input = null;\n}\n\n/**\n * Enable point annotation behavior\n */\nexport function enablePoint() {\n if (_enabled) { return; }\n\n _enabled = true;\n document.addEventListener('mouseup', handleDocumentMouseup);\n}\n\n/**\n * Disable point annotation behavior\n */\nexport function disablePoint() {\n if (!_enabled) { return; }\n\n _enabled = false;\n document.removeEventListener('mouseup', handleDocumentMouseup);\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/point.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\nimport config from '../config';\nimport { appendChild } from '../render/appendChild';\nimport {\n BORDER_COLOR,\n disableUserSelect,\n enableUserSelect,\n findSVGAtPoint,\n getMetadata,\n convertToSvgRect\n} from './utils';\n\nlet _enabled = false;\nlet _type;\nlet overlay;\nlet originY;\nlet originX;\n\n/**\n * Get the current window selection as rects\n *\n * @return {Array} An Array of rects\n */\nfunction getSelectionRects() {\n try {\n let selection = window.getSelection();\n let range = selection.getRangeAt(0);\n let rects = range.getClientRects();\n\n if (rects.length > 0 &&\n rects[0].width > 0 &&\n rects[0].height > 0) {\n return rects;\n }\n } catch (e) {}\n \n return null;\n}\n\n/**\n * Handle document.mousedown event\n *\n * @param {Event} e The DOM event to handle\n */\nfunction handleDocumentMousedown(e) {\n let svg;\n if (_type !== 'area' || !(svg = findSVGAtPoint(e.clientX, e.clientY))) {\n return;\n }\n\n let rect = svg.getBoundingClientRect();\n originY = e.clientY;\n originX = e.clientX;\n\n overlay = document.createElement('div');\n overlay.style.position = 'absolute';\n overlay.style.top = `${originY - rect.top}px`;\n overlay.style.left = `${originX - rect.left}px`;\n overlay.style.border = `3px solid ${BORDER_COLOR}`;\n overlay.style.borderRadius = '3px';\n svg.parentNode.appendChild(overlay);\n \n document.addEventListener('mousemove', handleDocumentMousemove);\n disableUserSelect();\n}\n\n/**\n * Handle document.mousemove event\n *\n * @param {Event} e The DOM event to handle\n */\nfunction handleDocumentMousemove(e) {\n let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\n let rect = svg.getBoundingClientRect();\n\n if (originX + (e.clientX - originX) < rect.right) {\n overlay.style.width = `${e.clientX - originX}px`;\n }\n\n if (originY + (e.clientY - originY) < rect.bottom) {\n overlay.style.height = `${e.clientY - originY}px`;\n }\n}\n\n/**\n * Handle document.mouseup event\n *\n * @param {Event} e The DOM event to handle\n */\nfunction handleDocumentMouseup(e) {\n let rects;\n if (_type !== 'area' && (rects = getSelectionRects())) {\n let svg = findSVGAtPoint(rects[0].left, rects[0].top);\n saveRect(_type, [...rects].map((r) => {\n return {\n top: r.top,\n left: r.left,\n width: r.width,\n height: r.height\n };\n }));\n } else if (_type === 'area' && overlay) {\n let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\n let rect = svg.getBoundingClientRect();\n saveRect(_type, [{\n top: parseInt(overlay.style.top, 10) + rect.top,\n left: parseInt(overlay.style.left, 10) + rect.left,\n width: parseInt(overlay.style.width, 10),\n height: parseInt(overlay.style.height, 10)\n }]);\n\n overlay.parentNode.removeChild(overlay);\n overlay = null;\n\n document.removeEventListener('mousemove', handleDocumentMousemove);\n enableUserSelect();\n }\n}\n\n/**\n * Handle document.keyup event\n *\n * @param {Event} e The DOM event to handle\n */\nfunction handleDocumentKeyup(e) {\n // Cancel rect if Esc is pressed\n if (e.keyCode === 27) {\n let selection = window.getSelection();\n selection.removeAllRanges();\n if (overlay && overlay.parentNode) {\n overlay.parentNode.removeChild(overlay);\n overlay = null;\n document.removeEventListener('mousemove', handleDocumentMousemove);\n }\n }\n}\n\n/**\n * Save a rect annotation\n *\n * @param {String} type The type of rect (area, highlight, strikeout)\n * @param {Array} rects The rects to use for annotation\n * @param {String} color The color of the rects\n */\nfunction saveRect(type, rects, color) {\n let svg = findSVGAtPoint(rects[0].left, rects[0].top);\n let annotation;\n\n if (!svg) {\n return;\n }\n\n let boundingRect = svg.getBoundingClientRect();\n\n if (!color) {\n if (type === 'highlight') {\n color = 'FFFF00';\n } else if (type === 'strikeout') {\n color = 'FF0000';\n }\n }\n\n // Initialize the annotation\n annotation = {\n type,\n color,\n rectangles: [...rects].map((r) => {\n let offset = 0;\n\n if (type === 'strikeout') {\n offset = r.height / 2;\n }\n\n return convertToSvgRect({\n y: (r.top + offset) - boundingRect.top,\n x: r.left - boundingRect.left,\n width: r.width,\n height: r.height\n }, svg);\n }).filter((r) => r.width > 0 && r.height > 0 && r.x > -1 && r.y > -1)\n };\n \n // Short circuit if no rectangles exist\n if (annotation.rectangles.length === 0) {\n return;\n }\n\n // Special treatment for area as it only supports a single rect\n if (type === 'area') {\n let rect = annotation.rectangles[0];\n delete annotation.rectangles;\n annotation.x = rect.x;\n annotation.y = rect.y;\n annotation.width = rect.width;\n annotation.height = rect.height;\n }\n\n let { documentId, pageNumber } = getMetadata(svg);\n\n // Add the annotation\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation)\n .then((annotation) => {\n appendChild(svg, annotation);\n });\n}\n\n/**\n * Enable rect behavior\n */\nexport function enableRect(type) {\n _type = type;\n \n if (_enabled) { return; }\n\n _enabled = true;\n document.addEventListener('mouseup', handleDocumentMouseup);\n document.addEventListener('mousedown', handleDocumentMousedown);\n document.addEventListener('keyup', handleDocumentKeyup);\n}\n\n/**\n * Disable rect behavior\n */\nexport function disableRect() {\n if (!_enabled) { return; }\n\n _enabled = false;\n document.removeEventListener('mouseup', handleDocumentMouseup);\n document.removeEventListener('mousedown', handleDocumentMousedown);\n document.removeEventListener('keyup', handleDocumentKeyup);\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/rect.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\nimport config from '../config';\nimport { appendChild } from '../render/appendChild';\nimport {\n findSVGAtPoint,\n getMetadata,\n convertToSvgPoint\n} from './utils';\n\nlet _enabled = false;\nlet _type;\nlet _circleRadius = 10;\nlet _circleColor = '0000FF';\n\n/**\n * Set the attributes of the pen.\n *\n * @param {Number} circleRadius The radius of the circle\n * @param {String} circleColor The color of the circle\n */\nexport function setCircle(circleRadius = 10, circleColor = '0000FF') {\n _circleRadius = parseInt(circleRadius, 10);\n _circleColor = circleColor;\n}\n\n/**\n * Handle document.mouseup event\n *\n * @param {Event} e The DOM event to handle\n */\nfunction handleDocumentMouseup(e) {\n let svg = findSVGAtPoint(e.clientX, e.clientY);\n if (!svg) {\n return;\n }\n let rect = svg.getBoundingClientRect();\n saveCircle(svg, _type, {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top\n }, _circleRadius, _circleColor\n );\n}\n\n/**\n * Save a circle annotation\n *\n * @param {String} type The type of circle (circle, emptycircle, fillcircle)\n * @param {Object} pt The point to use for annotation\n * @param {String} color The color of the rects\n */\nfunction saveCircle(svg, type, pt, radius, color) {\n // Initialize the annotation\n let svg_pt = convertToSvgPoint([ pt.x, pt.y ], svg)\n let annotation = {\n type,\n color,\n cx: svg_pt[0],\n cy: svg_pt[1],\n r: radius\n };\n\n let { documentId, pageNumber } = getMetadata(svg);\n\n // Add the annotation\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation)\n .then((annotation) => {\n appendChild(svg, annotation);\n });\n}\n\n/**\n * Enable circle behavior\n */\nexport function enableCircle(type) {\n _type = type;\n \n if (_enabled) { return; }\n\n _enabled = true;\n document.addEventListener('mouseup', handleDocumentMouseup);\n}\n\n/**\n * Disable circle behavior\n */\nexport function disableCircle() {\n if (!_enabled) { return; }\n\n _enabled = false;\n document.removeEventListener('mouseup', handleDocumentMouseup);\n}\n\nexport function addCircle(type, e) {\n let oldType = _type;\n _type = type;\n handleDocumentMouseup(e);\n _type = oldType; \n}\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/circle.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\nimport { appendChild } from '../render/appendChild';\nimport {\n BORDER_COLOR,\n findSVGAtPoint,\n getMetadata,\n convertToSvgPoint\n} from './utils';\n\nlet _enabled = false;\nlet input;\nlet _textSize;\nlet _textColor;\n\n/**\n * Handle document.mouseup event\n *\n * @param {Event} e The DOM event to handle\n */\nfunction handleDocumentMouseup(e) {\n if (input || !findSVGAtPoint(e.clientX, e.clientY)) {\n return;\n }\n\n input = document.createElement('input');\n input.setAttribute('id', 'pdf-annotate-text-input');\n input.setAttribute('placeholder', 'Enter text');\n input.style.border = `3px solid ${BORDER_COLOR}`;\n input.style.borderRadius = '3px';\n input.style.position = 'absolute';\n input.style.top = `${e.clientY}px`;\n input.style.left = `${e.clientX}px`;\n input.style.fontSize = `${_textSize}px`;\n input.style.zIndex = \"41\";\n input.addEventListener('blur', handleInputBlur);\n input.addEventListener('keyup', handleInputKeyup);\n\n document.body.appendChild(input);\n input.focus();\n}\n\n/**\n * Handle input.blur event\n */\nfunction handleInputBlur() {\n saveText();\n}\n\n/**\n * Handle input.keyup event\n *\n * @param {Event} e The DOM event to handle\n */\nfunction handleInputKeyup(e) {\n if (e.keyCode === 27) {\n closeInput();\n } else if (e.keyCode === 13) {\n saveText();\n }\n}\n\n/**\n * Save a text annotation from input\n */\nfunction saveText() {\n if (input.value.trim().length > 0) {\n let clientX = parseInt(input.style.left, 10);\n let clientY = parseInt(input.style.top, 10);\n let svg = findSVGAtPoint(clientX, clientY);\n if (!svg) {\n return;\n }\n let height = _textSize;\n let { documentId, pageNumber, viewport } = getMetadata(svg);\n let scale = 1 / viewport.scale;\n let rect = svg.getBoundingClientRect();\n let pt = convertToSvgPoint([\n clientX - rect.left, \n clientY - rect.top + height], svg, viewport);\n let annotation = {\n type: 'textbox',\n size: _textSize * scale,\n color: _textColor,\n content: input.value.trim(),\n x: pt[0],\n y: pt[1],\n rotation: -viewport.rotation\n }\n\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation)\n .then((annotation) => {\n appendChild(svg, annotation);\n });\n }\n \n closeInput();\n}\n\n/**\n * Close the input\n */\nfunction closeInput() {\n if (input) {\n input.removeEventListener('blur', handleInputBlur);\n input.removeEventListener('keyup', handleInputKeyup);\n document.body.removeChild(input);\n input = null;\n }\n}\n\n/**\n * Set the text attributes\n *\n * @param {Number} textSize The size of the text\n * @param {String} textColor The color of the text\n */\nexport function setText(textSize = 12, textColor = '000000') {\n _textSize = parseInt(textSize, 10);\n _textColor = textColor;\n}\n\n\n/**\n * Enable text behavior\n */\nexport function enableText() {\n if (_enabled) { return; }\n\n _enabled = true;\n document.addEventListener('mouseup', handleDocumentMouseup);\n}\n\n\n/**\n * Disable text behavior\n */\nexport function disableText() {\n if (!_enabled) { return; }\n\n _enabled = false;\n document.removeEventListener('mouseup', handleDocumentMouseup);\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/text.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\nimport config from '../config';\nimport renderScreenReaderHints from '../a11y/renderScreenReaderHints';\n\n// Template for creating a new page\nconst PAGE_TEMPLATE = `\n
\n
\n \n
\n
\n \n
\n`;\n\n/**\n * Create a new page to be appended to the DOM.\n *\n * @param {Number} pageNumber The page number that is being created\n * @return {HTMLElement}\n */\nexport function createPage(pageNumber) {\n let temp = document.createElement('div');\n temp.innerHTML = PAGE_TEMPLATE;\n\n let page = temp.children[0];\n let canvas = page.querySelector('canvas');\n\n page.setAttribute('id', `pageContainer${pageNumber}`);\n page.setAttribute('data-page-number', pageNumber);\n\n canvas.mozOpaque = true;\n canvas.setAttribute('id', `page${pageNumber}`);\n\n return page;\n}\n\n/**\n * Render a page that has already been created.\n *\n * @param {Number} pageNumber The page number to be rendered\n * @param {Object} renderOptions The options for rendering\n * @return {Promise} Settled once rendering has completed\n * A settled Promise will be either:\n * - fulfilled: [pdfPage, annotations]\n * - rejected: Error\n */\nexport function renderPage(pageNumber, renderOptions) {\n let {\n documentId,\n pdfDocument,\n scale,\n rotate\n } = renderOptions;\n\n // Load the page and annotations\n return Promise.all([\n pdfDocument.getPage(pageNumber),\n PDFJSAnnotate.getAnnotations(documentId, pageNumber)\n ]).then(([pdfPage, annotations]) => {\n let page = document.getElementById(`pageContainer${pageNumber}`);\n let svg = page.querySelector(config.annotationClassQuery());\n let canvas = page.querySelector('.canvasWrapper canvas');\n let canvasContext = canvas.getContext('2d', {alpha: false});\n let totalRotation = (rotate + pdfPage.rotate) % 360;\n let viewport = pdfPage.getViewport(scale, totalRotation);\n let transform = scalePage(pageNumber, viewport, canvasContext);\n\n // Render the page\n return Promise.all([\n pdfPage.render({ canvasContext, viewport, transform }),\n PDFJSAnnotate.render(svg, viewport, annotations)\n ]).then(() => {\n // Text content is needed for a11y, but is also necessary for creating\n // highlight and strikeout annotations which require selecting text.\n return pdfPage.getTextContent({normalizeWhitespace: true}).then((textContent) => {\n return new Promise((resolve, reject) => {\n // Render text layer for a11y of text content\n let textLayer = page.querySelector(config.textClassQuery());\n let textLayerFactory = new PDFJS.DefaultTextLayerFactory();\n let textLayerBuilder = textLayerFactory.createTextLayerBuilder(textLayer, pageNumber -1, viewport);\n textLayerBuilder.setTextContent(textContent);\n textLayerBuilder.render();\n\n // Enable a11y for annotations\n // Timeout is needed to wait for `textLayerBuilder.render`\n setTimeout(() => {\n try {\n renderScreenReaderHints(annotations.annotations);\n resolve();\n } catch (e) {\n reject(e);\n }\n });\n });\n });\n }).then(() => {\n // Indicate that the page was loaded\n page.setAttribute('data-loaded', 'true');\n\n return [pdfPage, annotations];\n });\n });\n}\n\n/**\n * Scale the elements of a page.\n *\n * @param {Number} pageNumber The page number to be scaled\n * @param {Object} viewport The viewport of the PDF page (see pdfPage.getViewport(scale, rotate))\n * @param {Object} context The canvas context that the PDF page is rendered to\n * @return {Array} The transform data for rendering the PDF page\n */\nfunction scalePage(pageNumber, viewport, context) {\n let page = document.getElementById(`pageContainer${pageNumber}`);\n let canvas = page.querySelector('.canvasWrapper canvas');\n let svg = page.querySelector(config.annotationClassQuery());\n let wrapper = page.querySelector('.canvasWrapper');\n let textLayer = page.querySelector(config.textClassQuery());\n let outputScale = getOutputScale(context);\n let transform = !outputScale.scaled ? null : [outputScale.sx, 0, 0, outputScale.sy, 0, 0];\n let sfx = approximateFraction(outputScale.sx);\n let sfy = approximateFraction(outputScale.sy);\n\n // Adjust width/height for scale\n page.style.visibility = '';\n canvas.width = roundToDivide(viewport.width * outputScale.sx, sfx[0]);\n canvas.height = roundToDivide(viewport.height * outputScale.sy, sfy[0]);\n canvas.style.width = roundToDivide(viewport.width, sfx[1]) + 'px';\n canvas.style.height = roundToDivide(viewport.height, sfx[1]) + 'px';\n svg.setAttribute('width', viewport.width);\n svg.setAttribute('height', viewport.height);\n svg.style.width = `${viewport.width}px`;\n svg.style.height = `${viewport.height}px`;\n page.style.width = `${viewport.width}px`;\n page.style.height = `${viewport.height}px`;\n wrapper.style.width = `${viewport.width}px`;\n wrapper.style.height = `${viewport.height}px`;\n textLayer.style.width = `${viewport.width}px`;\n textLayer.style.height = `${viewport.height}px`;\n\n return transform;\n}\n\n\n/**\n * Approximates a float number as a fraction using Farey sequence (max order of 8).\n *\n * @param {Number} x Positive float number\n * @return {Array} Estimated fraction: the first array item is a numerator,\n * the second one is a denominator.\n */\nfunction approximateFraction(x) {\n // Fast path for int numbers or their inversions.\n if (Math.floor(x) === x) {\n return [x, 1];\n }\n\n const xinv = 1 / x;\n const limit = 8;\n if (xinv > limit) {\n return [1, limit];\n } else if (Math.floor(xinv) === xinv) {\n return [1, xinv];\n }\n\n const x_ = x > 1 ? xinv : x;\n \n // a/b and c/d are neighbours in Farey sequence.\n let a = 0, b = 1, c = 1, d = 1;\n \n // Limit search to order 8.\n while (true) {\n // Generating next term in sequence (order of q).\n let p = a + c, q = b + d;\n if (q > limit) {\n break;\n }\n if (x_ <= p / q) {\n c = p; d = q;\n } else {\n a = p; b = q;\n }\n }\n\n // Select closest of neighbours to x.\n if (x_ - a / b < c / d - x_) {\n return x_ === x ? [a, b] : [b, a];\n } else {\n return x_ === x ? [c, d] : [d, c];\n }\n}\n\nfunction getOutputScale(ctx) {\n let devicePixelRatio = window.devicePixelRatio || 1;\n let backingStoreRatio = ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio || 1;\n let pixelRatio = devicePixelRatio / backingStoreRatio;\n return {\n sx: pixelRatio,\n sy: pixelRatio,\n scaled: pixelRatio !== 1\n };\n}\n\nfunction roundToDivide(x, div) {\n let r = x % div;\n return r === 0 ? x : Math.round(x - r + div);\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/page.js\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap e8845abf2304a711cbe4","webpack:///./index.js","webpack:///./src/PDFJSAnnotate.js","webpack:///./src/adapter/StoreAdapter.js","webpack:///./src/utils/abstractFunction.js","webpack:///./src/UI/event.js","webpack:///./~/events/events.js","webpack:///./src/UI/utils.js","webpack:///./~/create-stylesheet/index.js","webpack:///./src/render/appendChild.js","webpack:///./~/object-assign/index.js","webpack:///./src/render/renderLine.js","webpack:///./src/utils/setAttributes.js","webpack:///./src/utils/normalizeColor.js","webpack:///./src/render/renderPath.js","webpack:///./src/render/renderPoint.js","webpack:///./src/render/renderRect.js","webpack:///./src/render/renderText.js","webpack:///./src/render/renderCircle.js","webpack:///./src/render/renderArrow.js","webpack:///./src/utils/mathUtils.js","webpack:///./src/adapter/LocalStoreAdapter.js","webpack:///./src/utils/uuid.js","webpack:///./src/render/index.js","webpack:///./src/a11y/renderScreenReaderHints.js","webpack:///./src/a11y/insertScreenReaderHint.js","webpack:///./src/a11y/createScreenReaderOnly.js","webpack:///./src/a11y/insertElementWithinChildren.js","webpack:///./src/config.js","webpack:///./src/a11y/insertElementWithinElement.js","webpack:///./src/a11y/renderScreenReaderComments.js","webpack:///./src/a11y/insertScreenReaderComment.js","webpack:///./src/a11y/initEventHandlers.js","webpack:///./src/UI/index.js","webpack:///./src/UI/edit.js","webpack:///./src/UI/pen.js","webpack:///./src/UI/eraser.js","webpack:///./src/UI/arrow.js","webpack:///./src/UI/point.js","webpack:///./src/UI/rect.js","webpack:///./src/UI/circle.js","webpack:///./src/UI/text.js","webpack:///./src/UI/page.js"],"names":["PDFJSAnnotate","findAnnotationAtPoint","findSVGContainer","convertToScreenPoint","StoreAdapter","LocalStoreAdapter","__storeAdapter","getStoreAdapter","setStoreAdapter","adapter","UI","render","getAnnotations","documentId","userId","pageNumber","arguments","config","uuid","definition","Object","keys","forEach","key","annotationId","annotation","content","commentId","__getAnnotations","fn","then","annotations","a","__addAnnotation","addAnnotation","__editAnnotation","editAnnotation","__deleteAnnotation","deleteAnnotation","success","__addComment","addComment","comment","__deleteComment","deleteComment","abstractFunction","name","Error","fireEvent","addEventListener","removeEventListener","emitter","EventEmitter","clickNode","document","handleDocumentClick","e","clientX","clientY","target","emit","on","removeListener","findSVGAtPoint","pointIntersectsRect","getOffsetAnnotationRect","scaleUp","convertToSvgRect","convertToSvgPoint","scaleDown","getScroll","getOffset","disableUserSelect","enableUserSelect","getMetadata","BORDER_COLOR","userSelectStyleSheet","body","setAttribute","node","parentNode","nodeName","toUpperCase","getAttribute","x","y","elements","querySelectorAll","i","l","length","el","rect","getBoundingClientRect","candidate","elementFromPoint","type","top","bottom","left","right","offsetLeft","offsetTop","width","height","svg","result","viewport","scale","pt1","pt2","Math","min","abs","pt","xform","rotation","offset","scrollTop","scrollLeft","head","appendChild","removeChild","parseInt","JSON","parse","getTranslation","transformChild","isFirefox","test","navigator","userAgent","transform","trans","toLowerCase","path","querySelector","n","child","renderLine","group","createElementNS","stroke","color","strokeWidth","rectangles","r","line","x1","y1","x2","y2","setAttributes","UPPER_REGEX","BLACKLIST","keyCase","indexOf","replace","match","attributes","normalizeColor","REGEX_HASHLESS_HEX","renderPath","d","lines","p1","p2","push","join","fill","renderPoint","SIZE","D","outerSVG","innerSVG","viewBox","renderRect","fillOpacity","createRect","renderText","text","fontSize","size","innerHTML","g","renderCircle","circle","createCircle","cx","cy","renderArrow","arrow","arrowLength","pt0","unitX","unitZ","unitY","thickness","A","B","C","G","F","E","points","applyTransform","applyInverseTransform","translate","rotate","makePoint","makeVector","makeVectorFromPoints","addVector","multiplyVector","magnitude","negateVector","unitVector","crossProduct","p","m","xt","yt","m1","m2","angle","PI","cosValue","cos","sinValue","sin","getInverseTransform","z","xcoord","ycoord","zcoord","v","scalar","sqrt","pow","mag","u","Promise","resolve","reject","filter","page","class","getAnnotation","findAnnotation","updateAnnotations","index","splice","getComments","all_annotations","localStorage","includes","getItem","setItem","stringify","REGEXP","PATTERN","replacement","c","random","toString","data","removeAttribute","Array","isArray","renderScreenReaderHints","SORT_TYPES","sortBy","sort","sortByPoint","b","sortByRectPoint","sortByLinePoint","lineA","lineB","insertScreenReaderHint","COMMENT_TYPES","num","rects","first","last","createScreenReaderOnly","createElement","createTextNode","style","position","overflow","insertElementWithinChildren","nodes","textClassQuery","insertBefore","textLayer","textRect","annotationLayerName","textLayerName","annotationSvgQuery","annotationClassQuery","insertElementWithinElement","OFFSET_ADJUST","max","textLayerElementFromPoint","temp","cloneNode","split","tail","unshift","pop","outerHTML","renderScreenReaderComments","comments","promise","getElementById","list","insertScreenReaderComment","item","initEventHandlers","reorderAnnotationsByType","removeAnnotation","insertComment","removeComment","removeElementById","elementId","disableEdit","enableEdit","disablePen","enablePen","setPen","enableEraser","disableEraser","disablePoint","enablePoint","disableRect","enableRect","disableCircle","enableCircle","setCircle","addCircle","disableArrow","enableArrow","setArrow","disableText","enableText","setText","createPage","renderPage","_enabled","isDragging","overlay","dragOffsetX","dragOffsetY","dragStartX","dragStartY","OVERLAY_BORDER_SIZE","createEditOverlay","destroyEditOverlay","anchor","id","styleLeft","styleTop","boxSizing","border","borderRadius","zIndex","background","padding","textAlign","textDecoration","handleDocumentKeyup","handleDocumentMousedown","borderColor","boxShadow","display","handleDocumentMousemove","handleDocumentMouseup","keyCode","cursor","minY","maxY","minX","maxX","offsetHeight","offsetWidth","attribX","attribY","modelStart","modelEnd","modelDelta","firstChild","t","modelX","modelY","viewY","viewX","setTimeout","handleAnnotationClick","_candraw","_penSize","_penColor","handleDocumentPointerdown","handleDocumentKeyupChrome","saveToStorage","changedTouches","handleDocumentPointerup","handleDocumentPointermove","savePoint","handleDocumentPointermoveChrome","point","penSize","penColor","_canerase","handleDocumentMouseDown","handleDocumentMouseUp","handleDocumentMouseMove","console","log","originY","originX","event","input","handleInputBlur","handleInputKeyup","focus","closeInput","value","trim","assign","_type","getSelectionRects","selection","window","getSelection","range","getRangeAt","getClientRects","saveRect","map","removeAllRanges","boundingRect","_circleRadius","_circleColor","circleRadius","circleColor","saveCircle","radius","svg_pt","oldType","_textSize","_textColor","saveText","textSize","textColor","PAGE_TEMPLATE","children","canvas","mozOpaque","renderOptions","pdfDocument","all","getPage","pdfPage","canvasContext","getContext","alpha","totalRotation","getViewport","scalePage","getTextContent","normalizeWhitespace","textContent","textLayerFactory","PDFJS","DefaultTextLayerFactory","textLayerBuilder","createTextLayerBuilder","setTextContent","context","wrapper","outputScale","getOutputScale","scaled","sx","sy","sfx","approximateFraction","sfy","visibility","roundToDivide","floor","xinv","limit","x_","q","ctx","devicePixelRatio","backingStoreRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","pixelRatio","div","round"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA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S,IAAR,CAAa,kBAAb,EAAiCD,MAAjC;AACD;;AAEDN,eAAYM,MAAZ;AACD,EAhBD;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,UAASX,SAAT,GAAqB;AAAEG,WAAQS,IAAR,gBAAgB5C,SAAhB;AAA6B;AACpD,UAASiC,gBAAT,GAA4B;AAAEE,WAAQU,EAAR,gBAAc7C,SAAd;AAA2B;AACzD,UAASkC,mBAAT,GAA+B;AAAEC,WAAQW,cAAR,gBAA0B9C,SAA1B;AAAuC,G;;;;;;ACpD/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAiB;AACjB,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA,gBAAe,SAAS;AACxB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;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BtZ,CAAvB,EAA0Bqa,GAA1B,EAA+B;AAC7B,OAAIvW,IAAI9D,IAAIqa,GAAZ;AACA,UAAOvW,MAAM,CAAN,GAAU9D,CAAV,GAAc2B,KAAK2Y,KAAL,CAAWta,IAAI8D,CAAJ,GAAQuW,GAAnB,CAArB;AACD,E","file":"dist/pdf-annotate.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PDFAnnotate\"] = factory();\n\telse\n\t\troot[\"PDFAnnotate\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap e8845abf2304a711cbe4\n **/","import PDFJSAnnotate from './src/PDFJSAnnotate';\r\n\r\nexport default PDFJSAnnotate;\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./index.js\n **/","import StoreAdapter from './adapter/StoreAdapter';\r\nimport LocalStoreAdapter from './adapter/LocalStoreAdapter';\r\nimport render from './render';\r\nimport UI from './UI';\r\nimport config from './config';\r\nimport uuid from './utils/uuid';\r\nimport { \r\n findAnnotationAtPoint, \r\n findSVGContainer,\r\n convertToScreenPoint\r\n} from './UI/utils';\r\n\r\nexport default {\r\n findAnnotationAtPoint,\r\n findSVGContainer,\r\n convertToScreenPoint,\r\n\r\n /**\r\n * Abstract class that needs to be defined so PDFJSAnnotate\r\n * knows how to communicate with your server.\r\n */\r\n StoreAdapter,\r\n\r\n /**\r\n * Implementation of StoreAdapter that stores annotation data to localStorage.\r\n */\r\n LocalStoreAdapter,\r\n\r\n /**\r\n * Abstract instance of StoreAdapter\r\n */\r\n __storeAdapter: new StoreAdapter(),\r\n\r\n /**\r\n * Getter for the underlying StoreAdapter property\r\n *\r\n * @return {StoreAdapter}\r\n */\r\n getStoreAdapter() {\r\n return this.__storeAdapter;\r\n },\r\n\r\n /**\r\n * Setter for the underlying StoreAdapter property\r\n *\r\n * @param {StoreAdapter} adapter The StoreAdapter implementation to be used.\r\n */\r\n setStoreAdapter(adapter) {\r\n // TODO this throws an error when bundled\r\n // if (!(adapter instanceof StoreAdapter)) {\r\n // throw new Error('adapter must be an instance of StoreAdapter');\r\n // }\r\n\r\n this.__storeAdapter = adapter;\r\n },\r\n\r\n /**\r\n * UI is a helper for instrumenting UI interactions for creating,\r\n * editing, and deleting annotations in the browser.\r\n */\r\n UI,\r\n\r\n /**\r\n * Render the annotations for a page in the PDF Document\r\n *\r\n * @param {SVGElement} svg The SVG element that annotations should be rendered to\r\n * @param {PageViewport} viewport The PDFPage.getViewport data\r\n * @param {Object} data The StoreAdapter.getAnnotations data\r\n * @return {Promise}\r\n */\r\n render,\r\n\r\n /**\r\n * Convenience method for getting annotation data\r\n *\r\n * @alias StoreAdapter.getAnnotations\r\n * @param {String} documentId The ID of the document\r\n * @param {String} pageNumber The page number\r\n * @return {Promise}\r\n */\r\n getAnnotations(documentId, userId, pageNumber) {\r\n return this.getStoreAdapter().getAnnotations(...arguments);\r\n },\r\n\r\n config,\r\n\r\n uuid\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/PDFJSAnnotate.js\n **/","import abstractFunction from '../utils/abstractFunction';\r\nimport { fireEvent } from '../UI/event';\r\n\r\n// Adapter should never be invoked publicly\r\nexport default class StoreAdapter {\r\n /**\r\n * Create a new StoreAdapter instance\r\n *\r\n * @param {Object} [definition] The definition to use for overriding abstract methods\r\n */\r\n constructor(definition = {}) {\r\n // Copy each function from definition if it is a function we know about\r\n Object.keys(definition).forEach((key) => {\r\n if (typeof definition[key] === 'function' &&\r\n typeof this[key] === 'function') {\r\n this[key] = definition[key];\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Get all the annotations for a given document and page number.\r\n *\r\n * @param {String} documentId The ID for the document the annotations belong to\r\n * @param {String} userId The user makeing changes to this document\r\n * @param {Number} pageNumber The number of the page the annotations belong to\r\n * @return {Promise}\r\n */\r\n __getAnnotations(documentId, userId, pageNumber) { abstractFunction('getAnnotations'); }\r\n get getAnnotations() { return this.__getAnnotations; }\r\n set getAnnotations(fn) {\r\n this.__getAnnotations = function getAnnotations(documentId, userId, pageNumber) {\r\n return fn(...arguments).then((annotations) => {\r\n // TODO may be best to have this happen on the server\r\n if (annotations.annotations) {\r\n annotations.annotations.forEach((a) => {\r\n a.documentId = documentId;\r\n });\r\n }\r\n return annotations;\r\n });\r\n };\r\n }\r\n\r\n /**\r\n * Get the definition for a specific annotation.\r\n *\r\n * @param {String} documentId The ID for the document the annotation belongs to\r\n * @param {String} annotationId The ID for the annotation\r\n * @return {Promise}\r\n */\r\n getAnnotation(documentId, annotationId) { abstractFunction('getAnnotation'); }\r\n\r\n /**\r\n * Add an annotation\r\n *\r\n * @param {String} documentId The ID for the document to add the annotation to\r\n * @param {String} pageNumber The page number to add the annotation to\r\n * @param {Object} annotation The definition for the new annotation\r\n * @return {Promise}\r\n */\r\n __addAnnotation(documentId, userId, pageNumber, annotation) { abstractFunction('addAnnotation'); }\r\n get addAnnotation() { return this.__addAnnotation; }\r\n set addAnnotation(fn) {\r\n this.__addAnnotation = function addAnnotation(documentId, userId, pageNumber, annotation) {\r\n return fn(...arguments).then((annotation) => {\r\n fireEvent('annotation:add', documentId, userId, pageNumber, annotation);\r\n return annotation;\r\n });\r\n };\r\n }\r\n\r\n /**\r\n * Edit an annotation\r\n *\r\n * @param {String} documentId The ID for the document\r\n * @param {String} pageNumber the page number of the annotation\r\n * @param {Object} annotation The definition of the modified annotation\r\n * @return {Promise}\r\n */\r\n __editAnnotation(documentId, pageNumber, annotation) { abstractFunction('editAnnotation'); }\r\n get editAnnotation() { return this.__editAnnotation; }\r\n set editAnnotation(fn) {\r\n this.__editAnnotation = function editAnnotation(documentId, annotationId, annotation) {\r\n return fn(...arguments).then((annotation) => {\r\n fireEvent('annotation:edit', documentId, annotationId, annotation);\r\n return annotation;\r\n });\r\n };\r\n }\r\n\r\n /**\r\n * Delete an annotation\r\n *\r\n * @param {String} documentId The ID for the document\r\n * @param {String} annotationId The ID for the annotation\r\n * @return {Promise}\r\n */\r\n __deleteAnnotation(documentId, annotationId) { abstractFunction('deleteAnnotation'); }\r\n get deleteAnnotation() { return this.__deleteAnnotation; }\r\n set deleteAnnotation(fn) {\r\n this.__deleteAnnotation = function deleteAnnotation(documentId, annotationId) {\r\n return fn(...arguments).then((success) => {\r\n if (success) {\r\n fireEvent('annotation:delete', documentId, annotationId);\r\n }\r\n return success;\r\n });\r\n };\r\n }\r\n\r\n /**\r\n * Get all the comments for an annotation\r\n *\r\n * @param {String} documentId The ID for the document\r\n * @param {String} annotationId The ID for the annotation\r\n * @return {Promise}\r\n */\r\n getComments(documentId, annotationId) { abstractFunction('getComments'); }\r\n\r\n /**\r\n * Add a new comment\r\n *\r\n * @param {String} documentId The ID for the document\r\n * @param {String} annotationId The ID for the annotation\r\n * @param {Object} content The definition of the comment\r\n * @return {Promise}\r\n */\r\n __addComment(documentId, annotationId, content) { abstractFunction('addComment'); }\r\n get addComment() { return this.__addComment; }\r\n set addComment(fn) {\r\n this.__addComment = function addComment(documentId, annotationId, content) {\r\n return fn(...arguments).then((comment) => {\r\n fireEvent('comment:add', documentId, annotationId, comment);\r\n return comment;\r\n });\r\n };\r\n }\r\n\r\n /**\r\n * Delete a comment\r\n *\r\n * @param {String} documentId The ID for the document\r\n * @param {String} commentId The ID for the comment\r\n * @return {Promise}\r\n */\r\n __deleteComment(documentId, commentId) { abstractFunction('deleteComment'); }\r\n get deleteComment() { return this.__deleteComment; }\r\n set deleteComment(fn) {\r\n this.__deleteComment = function deleteComment(documentId, commentId) {\r\n return fn(...arguments).then((success) => {\r\n if (success) {\r\n fireEvent('comment:delete', documentId, commentId);\r\n }\r\n return success;\r\n });\r\n };\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/adapter/StoreAdapter.js\n **/","/**\r\n * Throw an Error for an abstract function that hasn't been implemented.\r\n *\r\n * @param {String} name The name of the abstract function\r\n */\r\nexport default function abstractFunction(name) {\r\n throw new Error(name + ' is not implemented');\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/abstractFunction.js\n **/","import EventEmitter from 'events';\r\nimport {\r\n findAnnotationAtPoint,\r\n findSVGAtPoint\r\n} from './utils';\r\n\r\nconst emitter = new EventEmitter;\r\n\r\nlet clickNode;\r\n\r\n/**\r\n * Handle document.click event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\ndocument.addEventListener('click', function handleDocumentClick(e) {\r\n if (!findSVGAtPoint(e.clientX, e.clientY)) { return; }\r\n\r\n let target = findAnnotationAtPoint(e.clientX, e.clientY);\r\n\r\n // Emit annotation:blur if clickNode is no longer clicked\r\n if (clickNode && clickNode !== target) {\r\n emitter.emit('annotation:blur', clickNode);\r\n }\r\n\r\n // Emit annotation:click if target was clicked\r\n if (target) {\r\n emitter.emit('annotation:click', target);\r\n }\r\n\r\n clickNode = target;\r\n});\r\n\r\n// let mouseOverNode;\r\n// document.addEventListener('mousemove', function handleDocumentMousemove(e) {\r\n// let target = findAnnotationAtPoint(e.clientX, e.clientY);\r\n//\r\n// // Emit annotation:mouseout if target was mouseout'd\r\n// if (mouseOverNode && !target) {\r\n// emitter.emit('annotation:mouseout', mouseOverNode);\r\n// }\r\n//\r\n// // Emit annotation:mouseover if target was mouseover'd\r\n// if (target && mouseOverNode !== target) {\r\n// emitter.emit('annotation:mouseover', target);\r\n// }\r\n//\r\n// mouseOverNode = target;\r\n// });\r\n\r\nexport function fireEvent() { emitter.emit(...arguments); };\r\nexport function addEventListener() { emitter.on(...arguments); };\r\nexport function removeEventListener() { emitter.removeListener(...arguments); };\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/event.js\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/events/events.js\n ** module id = 5\n ** module chunks = 0\n **/","import createStyleSheet from 'create-stylesheet';\r\nimport { getTranslation } from '../render/appendChild';\r\nimport { \r\n applyTransform, \r\n applyInverseTransform, \r\n translate,\r\n rotate,\r\n scale \r\n} from '../utils/mathUtils';\r\n\r\n\r\nexport const BORDER_COLOR = '#00BFFF';\r\n\r\nconst userSelectStyleSheet = createStyleSheet({\r\n body: {\r\n '-webkit-user-select': 'none',\r\n '-moz-user-select': 'none',\r\n '-ms-user-select': 'none',\r\n 'user-select': 'none'\r\n }\r\n});\r\nuserSelectStyleSheet.setAttribute('data-pdf-annotate-user-select', 'true');\r\n\r\n/**\r\n * Find the SVGElement that contains all the annotations for a page\r\n *\r\n * @param {Element} node An annotation within that container\r\n * @return {SVGElement} The container SVG or null if it can't be found\r\n */\r\nexport function findSVGContainer(node) {\r\n let parentNode = node;\r\n\r\n while ((parentNode = parentNode.parentNode) &&\r\n parentNode !== document) {\r\n if (parentNode.nodeName.toUpperCase() === 'SVG' &&\r\n parentNode.getAttribute('data-pdf-annotate-container') === 'true') {\r\n return parentNode;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Find an SVGElement container at a given point\r\n *\r\n * @param {Number} x The x coordinate of the point\r\n * @param {Number} y The y coordinate of the point\r\n * @return {SVGElement} The container SVG or null if one can't be found\r\n */\r\nexport function findSVGAtPoint(x, y) {\r\n let elements = document.querySelectorAll('svg[data-pdf-annotate-container=\"true\"]');\r\n\r\n for (let i=0, l=elements.length; i= rect.top && y <= rect.bottom && x >= rect.left && x <= rect.right;\r\n}\r\n\r\n/**\r\n * Get the rect of an annotation element accounting for offset.\r\n *\r\n * @param {Element} el The element to get the rect of\r\n * @return {Object} The dimensions of the element\r\n */\r\nexport function getOffsetAnnotationRect(el) {\r\n let rect = el.getBoundingClientRect();\r\n let { offsetLeft, offsetTop } = getOffset(el);\r\n return {\r\n top: rect.top - offsetTop,\r\n left: rect.left - offsetLeft,\r\n right: rect.right - offsetLeft,\r\n bottom: rect.bottom - offsetTop,\r\n width: rect.width,\r\n height: rect.height\r\n };\r\n}\r\n\r\n/**\r\n * Adjust scale from normalized scale (100%) to rendered scale.\r\n *\r\n * @param {SVGElement} svg The SVG to gather metadata from\r\n * @param {Object} rect A map of numeric values to scale\r\n * @return {Object} A copy of `rect` with values scaled up\r\n */\r\nexport function scaleUp(svg, rect) {\r\n let result = {};\r\n let { viewport } = getMetadata(svg);\r\n\r\n Object.keys(rect).forEach((key) => {\r\n result[key] = rect[key] * viewport.scale;\r\n });\r\n\r\n return result;\r\n}\r\n\r\nexport function convertToSvgRect(rect, svg, viewport) {\r\n var pt1 = [rect.x, rect.y];\r\n var pt2 = [rect.x + rect.width, rect.y + rect.height];\r\n\r\n pt1 = convertToSvgPoint(pt1, svg, viewport);\r\n pt2 = convertToSvgPoint(pt2, svg, viewport);\r\n\r\n return {\r\n x: Math.min(pt1[0], pt2[0]),\r\n y: Math.min(pt1[1], pt2[1]),\r\n width: Math.abs(pt2[0] - pt1[0]),\r\n height: Math.abs(pt2[1] - pt1[1])\r\n };\r\n}\r\n\r\nexport function convertToSvgPoint(pt, svg, viewport) {\r\n let result = {};\r\n viewport = viewport || getMetadata(svg).viewport;\r\n\r\n let xform = [ 1, 0, 0, 1, 0, 0 ];\r\n xform = scale(xform, viewport.scale, viewport.scale);\r\n xform = rotate(xform, viewport.rotation);\r\n\r\n let offset = getTranslation(viewport);\r\n xform = translate(xform, offset.x, offset.y);\r\n\r\n return applyInverseTransform(pt, xform);\r\n}\r\n\r\nexport function convertToScreenPoint(pt, svg, viewport) {\r\n let result = {};\r\n viewport = viewport || getMetadata(svg).viewport;\r\n\r\n let xform = [ 1, 0, 0, 1, 0, 0 ];\r\n xform = scale(xform, viewport.scale, viewport.scale);\r\n xform = rotate(xform, viewport.rotation);\r\n\r\n let offset = getTranslation(viewport);\r\n xform = translate(xform, offset.x, offset.y);\r\n\r\n return applyTransform(pt, xform);\r\n}\r\n\r\n/**\r\n * Adjust scale from rendered scale to a normalized scale (100%).\r\n *\r\n * @param {SVGElement} svg The SVG to gather metadata from\r\n * @param {Object} rect A map of numeric values to scale\r\n * @return {Object} A copy of `rect` with values scaled down\r\n */\r\nexport function scaleDown(svg, rect) {\r\n let result = {};\r\n let { viewport } = getMetadata(svg);\r\n\r\n Object.keys(rect).forEach((key) => {\r\n result[key] = rect[key] / viewport.scale;\r\n });\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Get the scroll position of an element, accounting for parent elements\r\n *\r\n * @param {Element} el The element to get the scroll position for\r\n * @return {Object} The scrollTop and scrollLeft position\r\n */\r\nexport function getScroll(el) {\r\n let scrollTop = 0;\r\n let scrollLeft = 0;\r\n let parentNode = el;\r\n\r\n while ((parentNode = parentNode.parentNode) &&\r\n parentNode !== document) {\r\n scrollTop += parentNode.scrollTop;\r\n scrollLeft += parentNode.scrollLeft;\r\n }\r\n\r\n return { scrollTop, scrollLeft };\r\n}\r\n\r\n/**\r\n * Get the offset position of an element, accounting for parent elements\r\n *\r\n * @param {Element} el The element to get the offset position for\r\n * @return {Object} The offsetTop and offsetLeft position\r\n */\r\nexport function getOffset(el) {\r\n let parentNode = el;\r\n\r\n while ((parentNode = parentNode.parentNode) &&\r\n parentNode !== document) {\r\n if (parentNode.nodeName.toUpperCase() === 'SVG') {\r\n break;\r\n }\r\n }\r\n\r\n let rect = parentNode.getBoundingClientRect();\r\n\r\n return { offsetLeft: rect.left, offsetTop: rect.top };\r\n}\r\n\r\n/**\r\n * Disable user ability to select text on page\r\n */\r\nexport function disableUserSelect() {\r\n if (!userSelectStyleSheet.parentNode) {\r\n document.head.appendChild(userSelectStyleSheet);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Enable user ability to select text on page\r\n */\r\nexport function enableUserSelect() {\r\n if (userSelectStyleSheet.parentNode) {\r\n userSelectStyleSheet.parentNode.removeChild(userSelectStyleSheet);\r\n }\r\n}\r\n\r\n/**\r\n * Get the metadata for a SVG container\r\n *\r\n * @param {SVGElement} svg The SVG container to get metadata for\r\n */\r\nexport function getMetadata(svg) {\r\n return {\r\n documentId: svg.getAttribute('data-pdf-annotate-document'),\r\n userId: svg.getAttribute('data-pdf-annotate-user'),\r\n pageNumber: parseInt(svg.getAttribute('data-pdf-annotate-page'), 10),\r\n viewport: JSON.parse(svg.getAttribute('data-pdf-annotate-viewport'))\r\n };\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/utils.js\n **/","module.exports = function createStyleSheet(blocks) {\n var style = document.createElement('style');\n var text = Object.keys(blocks).map(function (selector) {\n return processRuleSet(selector, blocks[selector]);\n }).join('\\n');\n \n style.setAttribute('type', 'text/css');\n style.appendChild(document.createTextNode(text));\n\n return style;\n}\n\nfunction processRuleSet(selector, block) {\n return selector + ' {\\n' + processDeclarationBlock(block) + '\\n}';\n}\n\nfunction processDeclarationBlock(block) {\n return Object.keys(block).map(function (prop) {\n return processDeclaration(prop, block[prop]);\n }).join('\\n');\n}\n\nfunction processDeclaration(prop, value) {\n if (!isNaN(value) && value != 0) {\n value = value + 'px';\n }\n\n return hyphenate(prop) + ': ' + value + ';';\n}\n\nfunction hyphenate(prop) {\n return prop.replace(/[A-Z]/g, function (match) {\n return '-' + match.toLowerCase();\n });\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/create-stylesheet/index.js\n ** module id = 7\n ** module chunks = 0\n **/","import objectAssign from 'object-assign';\r\nimport renderLine from './renderLine';\r\nimport renderPath from './renderPath';\r\nimport renderPoint from './renderPoint';\r\nimport renderRect from './renderRect';\r\nimport renderText from './renderText';\r\nimport renderCircle from './renderCircle';\r\nimport renderArrow from './renderArrow';\r\n\r\nconst isFirefox = /firefox/i.test(navigator.userAgent);\r\n\r\n/**\r\n * Get the x/y translation to be used for transforming the annotations\r\n * based on the rotation of the viewport.\r\n *\r\n * @param {Object} viewport The viewport data from the page\r\n * @return {Object}\r\n */\r\nexport function getTranslation(viewport) {\r\n let x;\r\n let y;\r\n\r\n // Modulus 360 on the rotation so that we only\r\n // have to worry about four possible values.\r\n switch(viewport.rotation % 360) {\r\n case 0:\r\n x = y = 0;\r\n break;\r\n case 90:\r\n x = 0;\r\n y = (viewport.width / viewport.scale) * -1;\r\n break;\r\n case 180:\r\n x = (viewport.width / viewport.scale) * -1;\r\n y = (viewport.height / viewport.scale) * -1;\r\n break;\r\n case 270:\r\n x = (viewport.height / viewport.scale) * -1;\r\n y = 0;\r\n break;\r\n }\r\n\r\n return { x, y };\r\n}\r\n\r\n/**\r\n * Transform the rotation and scale of a node using SVG's native transform attribute.\r\n *\r\n * @param {Node} node The node to be transformed\r\n * @param {Object} viewport The page's viewport data\r\n * @return {Node}\r\n */\r\nfunction transform(node, viewport) {\r\n let trans = getTranslation(viewport);\r\n\r\n // Let SVG natively transform the element\r\n node.setAttribute('transform', `scale(${viewport.scale}) rotate(${viewport.rotation}) translate(${trans.x}, ${trans.y})`);\r\n \r\n // Manually adjust x/y for nested SVG nodes\r\n if (!isFirefox && node.nodeName.toLowerCase() === 'svg') {\r\n node.setAttribute('x', parseInt(node.getAttribute('x'), 10) * viewport.scale);\r\n node.setAttribute('y', parseInt(node.getAttribute('y'), 10) * viewport.scale);\r\n\r\n let x = parseInt(node.getAttribute('x', 10));\r\n let y = parseInt(node.getAttribute('y', 10));\r\n let width = parseInt(node.getAttribute('width'), 10);\r\n let height = parseInt(node.getAttribute('height'), 10);\r\n let path = node.querySelector('path');\r\n let svg = path.parentNode;\r\n \r\n // Scale width/height\r\n [node, svg, path, node.querySelector('rect')].forEach((n) => {\r\n n.setAttribute('width', parseInt(n.getAttribute('width'), 10) * viewport.scale);\r\n n.setAttribute('height', parseInt(n.getAttribute('height'), 10) * viewport.scale);\r\n });\r\n\r\n // Transform path but keep scale at 100% since it will be handled natively\r\n transform(path, objectAssign({}, viewport, { scale: 1 }));\r\n \r\n switch(viewport.rotation % 360) {\r\n case 90:\r\n node.setAttribute('x', viewport.width - y - width);\r\n node.setAttribute('y', x);\r\n svg.setAttribute('x', 1);\r\n svg.setAttribute('y', 0);\r\n break;\r\n case 180:\r\n node.setAttribute('x', viewport.width - x - width);\r\n node.setAttribute('y', viewport.height - y - height);\r\n svg.setAttribute('y', 2);\r\n break;\r\n case 270:\r\n node.setAttribute('x', y);\r\n node.setAttribute('y', viewport.height - x - height);\r\n svg.setAttribute('x', -1);\r\n svg.setAttribute('y', 0);\r\n break;\r\n }\r\n }\r\n\r\n return node;\r\n}\r\n\r\n/**\r\n * Append an annotation as a child of an SVG.\r\n *\r\n * @param {SVGElement} svg The SVG element to append the annotation to\r\n * @param {Object} annotation The annotation definition to render and append\r\n * @param {Object} viewport The page's viewport data\r\n * @return {SVGElement} A node that was created and appended by this function\r\n */\r\nexport function appendChild(svg, annotation, viewport) {\r\n if (!viewport) {\r\n viewport = JSON.parse(svg.getAttribute('data-pdf-annotate-viewport'));\r\n }\r\n \r\n let child;\r\n switch (annotation.type) {\r\n case 'area':\r\n case 'highlight':\r\n child = renderRect(annotation);\r\n break;\r\n case 'circle':\r\n case 'fillcircle':\r\n case 'emptycircle':\r\n child = renderCircle(annotation);\r\n break;\r\n case 'strikeout':\r\n child = renderLine(annotation);\r\n break;\r\n case 'point':\r\n child = renderPoint(annotation);\r\n break;\r\n case 'textbox':\r\n child = renderText(annotation);\r\n break;\r\n case 'drawing':\r\n child = renderPath(annotation);\r\n break;\r\n case 'arrow':\r\n child = renderArrow(annotation);\r\n break;\r\n }\r\n\r\n // If no type was provided for an annotation it will result in node being null.\r\n // Skip appending/transforming if node doesn't exist.\r\n if (child) {\r\n // Set attributes\r\n child.setAttribute('data-pdf-annotate-id', annotation.uuid);\r\n child.setAttribute('data-pdf-annotate-type', annotation.type);\r\n child.setAttribute('aria-hidden', true);\r\n\r\n svg.appendChild(transform(child, viewport));\r\n }\r\n\r\n return child;\r\n}\r\n\r\n/**\r\n * Transform a child annotation of an SVG.\r\n *\r\n * @param {SVGElement} svg The SVG element with the child annotation\r\n * @param {Object} child The SVG child to transform\r\n * @param {Object} viewport The page's viewport data\r\n * @return {SVGElement} A node that was transformed by this function\r\n */\r\nexport function transformChild(svg, child, viewport) {\r\n if (!viewport) {\r\n viewport = JSON.parse(svg.getAttribute('data-pdf-annotate-viewport'));\r\n }\r\n\r\n // If no type was provided for an annotation it will result in node being null.\r\n // Skip transforming if node doesn't exist.\r\n if (child) {\r\n child = transform(child, viewport);\r\n }\r\n\r\n return child;\r\n}\r\n\r\nexport default {\r\n /**\r\n * Get the x/y translation to be used for transforming the annotations\r\n * based on the rotation of the viewport.\r\n */\r\n getTranslation,\r\n \r\n /**\r\n * Append an SVG child for an annotation\r\n */\r\n appendChild,\r\n\r\n /**\r\n * Transform an existing SVG child\r\n */ \r\n transformChild\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/appendChild.js\n **/","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/object-assign/index.js\n ** module id = 9\n ** module chunks = 0\n **/","import setAttributes from '../utils/setAttributes';\r\nimport normalizeColor from '../utils/normalizeColor';\r\n\r\n/**\r\n * Create SVGLineElements from an annotation definition.\r\n * This is used for anntations of type `strikeout`.\r\n *\r\n * @param {Object} a The annotation definition\r\n * @return {SVGGElement} A group of all lines to be rendered\r\n */\r\nexport default function renderLine(a) {\r\n let group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\r\n setAttributes(group, {\r\n stroke: normalizeColor(a.color || '#f00'),\r\n strokeWidth: 1\r\n });\r\n\r\n a.rectangles.forEach((r) => {\r\n let line = document.createElementNS('http://www.w3.org/2000/svg', 'line');\r\n\r\n setAttributes(line, {\r\n x1: r.x,\r\n y1: r.y,\r\n x2: r.x + r.width,\r\n y2: r.y,\r\n });\r\n\r\n group.appendChild(line);\r\n });\r\n\r\n return group;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderLine.js\n **/","const UPPER_REGEX = /[A-Z]/g;\r\n\r\n// Don't convert these attributes from camelCase to hyphenated-attributes\r\nconst BLACKLIST = [\r\n 'viewBox'\r\n];\r\n\r\nlet keyCase = (key) => {\r\n if (BLACKLIST.indexOf(key) === -1) {\r\n key = key.replace(UPPER_REGEX, match => '-' + match.toLowerCase());\r\n }\r\n return key;\r\n}\r\n\r\n/**\r\n * Set attributes for a node from a map\r\n *\r\n * @param {Node} node The node to set attributes on\r\n * @param {Object} attributes The map of key/value pairs to use for attributes\r\n */\r\nexport default function setAttributes(node, attributes) {\r\n Object.keys(attributes).forEach((key) => {\r\n node.setAttribute(keyCase(key), attributes[key]);\r\n });\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/setAttributes.js\n **/","const REGEX_HASHLESS_HEX = /^([a-f0-9]{6}|[a-f0-9]{3})$/i;\r\n\r\n/**\r\n * Normalize a color value\r\n *\r\n * @param {String} color The color to normalize\r\n * @return {String}\r\n */\r\nexport default function normalizeColor(color) {\r\n if (REGEX_HASHLESS_HEX.test(color)) {\r\n color = `#${color}`;\r\n }\r\n return color;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/normalizeColor.js\n **/","import setAttributes from '../utils/setAttributes';\r\nimport normalizeColor from '../utils/normalizeColor';\r\n\r\n/**\r\n * Create SVGPathElement from an annotation definition.\r\n * This is used for anntations of type `drawing`.\r\n *\r\n * @param {Object} a The annotation definition\r\n * @return {SVGPathElement} The path to be rendered\r\n */\r\nexport default function renderPath(a) {\r\n let d = [];\r\n let path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\r\n \r\n \r\n for (let i=0, l=a.lines.length; i2) {\r\n var p1 = a.lines[0];\r\n var p2 = a.lines[a.lines.length-1];\r\n\r\n var p3 = []; //arrow \r\n var p4 = [];\r\n var p0 = []; //arrow intersection\r\n\r\n\r\n \r\n if (p2) {\r\n var k = -(p2[0]-p1[0])/(p2[1]-p1[1]);\r\n\r\n var deltaX = 3;\r\n p0[0] = p1[0]+0.8*(p2[0]-p1[0]);\r\n p0[1] = p1[1]+0.8*(p2[1]-p1[1]);\r\n\r\n p3[0] = p0[0] + deltaX;\r\n p3[1] = p0[1] + k*deltaX;\r\n\r\n p4[0] = p0[0] - deltaX;\r\n p4[1] = p0[1] - k*deltaX;\r\n\r\n if(Math.abs(p2[1]-p1[1]) < 20) {\r\n\r\n p3[0] = p0[0] ;\r\n p3[1] = p0[1] + deltaX*1;\r\n\r\n p4[0] = p0[0] ;\r\n p4[1] = p0[1] - deltaX*1;\r\n\r\n }\r\n\r\n d.push(`M${p1[0]} ${p1[1]} ${p2[0]} ${p2[1]}`);\r\n //d.push(`M${p1[0]} ${p1[1]} ${p2[0]} ${p2[1]}`);\r\n d.push(`M${p2[0]} ${p2[1]} ${p3[0]} ${p3[1]}`);\r\n d.push(`M${p3[0]} ${p3[1]} ${p4[0]} ${p4[1]}`);\r\n d.push(`M${p4[0]} ${p4[1]} ${p2[0]} ${p2[1]}`);\r\n }\r\n }*/\r\n \r\n setAttributes(path, {\r\n d: `${d.join(' ')}Z`,\r\n stroke: normalizeColor(a.color || '#000'),\r\n strokeWidth: a.width || 1,\r\n fill: 'none'\r\n });\r\n\r\n return path;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderPath.js\n **/","import setAttributes from '../utils/setAttributes';\r\n\r\nconst SIZE = 25;\r\nconst D = 'M499.968 214.336q-113.832 0 -212.877 38.781t-157.356 104.625 -58.311 142.29q0 62.496 39.897 119.133t112.437 97.929l48.546 27.9 -15.066 53.568q-13.392 50.778 -39.06 95.976 84.816 -35.154 153.45 -95.418l23.994 -21.204 31.806 3.348q38.502 4.464 72.54 4.464 113.832 0 212.877 -38.781t157.356 -104.625 58.311 -142.29 -58.311 -142.29 -157.356 -104.625 -212.877 -38.781z';\r\n\r\n/**\r\n * Create SVGElement from an annotation definition.\r\n * This is used for anntations of type `comment`.\r\n *\r\n * @param {Object} a The annotation definition\r\n * @return {SVGElement} A svg to be rendered\r\n */\r\nexport default function renderPoint(a) {\r\n let outerSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\r\n let innerSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\r\n let rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\r\n let path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\r\n\r\n setAttributes(outerSVG, {\r\n width: SIZE,\r\n height: SIZE,\r\n x: a.x,\r\n y: a.y\r\n });\r\n\r\n setAttributes(innerSVG, {\r\n width: SIZE,\r\n height: SIZE,\r\n x: 0,\r\n y: (SIZE * 0.05) * -1,\r\n viewBox: '0 0 1000 1000'\r\n });\r\n\r\n setAttributes(rect, {\r\n width: SIZE,\r\n height: SIZE,\r\n stroke: '#000',\r\n fill: '#ff0'\r\n });\r\n\r\n setAttributes(path, {\r\n d: D,\r\n strokeWidth: 50,\r\n stroke: '#000',\r\n fill: '#fff'\r\n });\r\n\r\n innerSVG.appendChild(path);\r\n outerSVG.appendChild(rect);\r\n outerSVG.appendChild(innerSVG);\r\n\r\n return outerSVG;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderPoint.js\n **/","import setAttributes from '../utils/setAttributes';\r\nimport normalizeColor from '../utils/normalizeColor';\r\n\r\n/**\r\n * Create SVGRectElements from an annotation definition.\r\n * This is used for anntations of type `area` and `highlight`.\r\n *\r\n * @param {Object} a The annotation definition\r\n * @return {SVGGElement|SVGRectElement} A group of all rects to be rendered\r\n */\r\nexport default function renderRect(a) {\r\n if (a.type === 'highlight') {\r\n let group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\r\n setAttributes(group, {\r\n fill: normalizeColor(a.color || '#ff0'),\r\n fillOpacity: 0.2\r\n });\r\n \r\n a.rectangles.forEach((r) => {\r\n group.appendChild(createRect(r));\r\n });\r\n\r\n return group;\r\n } else {\r\n let rect = createRect(a);\r\n setAttributes(rect, {\r\n stroke: normalizeColor(a.color || '#f00'),\r\n fill: 'none'\r\n });\r\n\r\n return rect;\r\n }\r\n}\r\n\r\nfunction createRect(r) {\r\n let rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\r\n\r\n setAttributes(rect, {\r\n x: r.x,\r\n y: r.y,\r\n width: r.width,\r\n height: r.height\r\n });\r\n\r\n return rect;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderRect.js\n **/","import setAttributes from '../utils/setAttributes';\r\nimport normalizeColor from '../utils/normalizeColor';\r\n\r\n/**\r\n * Create SVGTextElement from an annotation definition.\r\n * This is used for anntations of type `textbox`.\r\n *\r\n * @param {Object} a The annotation definition\r\n * @return {SVGTextElement} A text to be rendered\r\n */\r\nexport default function renderText(a) {\r\n\r\n // Text should be rendered at 0 degrees relative to\r\n // document rotation\r\n let text = document.createElementNS('http://www.w3.org/2000/svg', 'text');\r\n let x = a.x;\r\n let y = a.y;\r\n\r\n setAttributes(text, {\r\n x: x,\r\n y: y,\r\n fill: normalizeColor(a.color || '#000'),\r\n fontSize: a.size,\r\n transform: `rotate(${a.rotation}, ${x}, ${y})`\r\n });\r\n text.innerHTML = a.content;\r\n\r\n var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\r\n g.appendChild(text);\r\n\r\n return g;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderText.js\n **/","import setAttributes from '../utils/setAttributes';\r\nimport normalizeColor from '../utils/normalizeColor';\r\n\r\n/**\r\n * Create an SVGCircleElement from an annotation definition.\r\n * This is used for annotations of type `circle`.\r\n *\r\n * @param {Object} a The annotation definition\r\n * @return {SVGGElement|SVGCircleElement} A circle to be rendered\r\n */\r\nexport default function renderCircle(a) {\r\n let circle = createCircle(a);\r\n let color = normalizeColor(a.color || '#f00')\r\n\r\n if (a.type === 'circle')\r\n setAttributes(circle, {\r\n stroke: color,\r\n fill: 'none',\r\n 'stroke-width': 5\r\n });\r\n if (a.type === 'emptycircle')\r\n setAttributes(circle, {\r\n stroke: color,\r\n fill: 'none',\r\n 'stroke-width': 2\r\n });\r\n\r\n if (a.type === 'fillcircle')\r\n setAttributes(circle, {\r\n stroke: color,\r\n fill: color,\r\n 'stroke-width': 5\r\n });\r\n\r\n return circle;\r\n}\r\n\r\nfunction createCircle(a) {\r\n let circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\r\n setAttributes(circle, {\r\n cx: a.cx,\r\n cy: a.cy,\r\n r: a.r\r\n });\r\n\r\n return circle;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderCircle.js\n **/","import setAttributes from '../utils/setAttributes';\r\nimport normalizeColor from '../utils/normalizeColor';\r\nimport { \r\n makePoint, makeVector, makeVectorFromPoints,\r\n magnitude, unitVector, crossProduct,\r\n addVector, multiplyVector, negateVector\r\n} from '../utils/mathUtils';\r\n\r\n/**\r\n * Create SVGPathElement from an annotation definition.\r\n * This is used for anntations of type `drawing`.\r\n *\r\n * @param {Object} a The annotation definition\r\n * @return {SVGPathElement} The path to be rendered\r\n */\r\nexport default function renderArrow(a) {\r\n let d = [];\r\n let arrow = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');\r\n\r\n if (a.lines.length == 2) {\r\n let p1 = a.lines[0];\r\n let p2 = a.lines[a.lines.length - 1];\r\n\r\n let arrowLength = 40;\r\n let pt0 = makePoint(p1[0], p1[1], 0);\r\n let pt1 = makePoint(p2[0], p2[1], 0);\r\n let x = makeVectorFromPoints(pt0, pt1);\r\n let unitX = unitVector(x);\r\n pt1 = addVector(pt0, multiplyVector(unitX, arrowLength));\r\n x = makeVectorFromPoints(pt0, pt1);\r\n let unitZ = makeVector(0, 0, 1);\r\n let unitY = unitVector(crossProduct(unitX, unitZ));\r\n let thickness = a.width || 10;\r\n\r\n let A = addVector(pt0, multiplyVector(unitY, thickness * 0.5)); \r\n let B = addVector(A, multiplyVector(unitX, magnitude(x) - thickness * 2.0)); \r\n let C = addVector(B, multiplyVector(unitY, thickness)); \r\n let D = pt1;\r\n let G = addVector(pt0, multiplyVector(negateVector(unitY), thickness * 0.5)); \r\n let F = addVector(G, multiplyVector(unitX, magnitude(x) - thickness * 2.0)); \r\n let E = addVector(F, multiplyVector(negateVector(unitY), thickness)); \r\n\r\n let points = '' + \r\n A.x + ',' + A.y + ' ' +\r\n B.x + ',' + B.y + ' ' +\r\n C.x + ',' + C.y + ' ' +\r\n D.x + ',' + D.y + ' ' +\r\n E.x + ',' + E.y + ' ' +\r\n F.x + ',' + F.y + ' ' +\r\n G.x + ',' + G.y\r\n\r\n setAttributes(arrow, {\r\n points: points,\r\n stroke: normalizeColor(a.color || '#000'),\r\n fill: normalizeColor(a.color || '#000')\r\n });\r\n }\r\n\r\n return arrow;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/renderArrow.js\n **/","// Transform point by matrix\r\n//\r\nexport function applyTransform(p, m) {\r\n var xt = p[0] * m[0] + p[1] * m[2] + m[4];\r\n var yt = p[0] * m[1] + p[1] * m[3] + m[5];\r\n return [xt, yt];\r\n};\r\n\r\n// Transform point by matrix inverse\r\n//\r\nexport function applyInverseTransform(p, m) {\r\n var d = m[0] * m[3] - m[1] * m[2];\r\n var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\r\n var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\r\n return [xt, yt];\r\n};\r\n\r\n\r\n// Concatenates two transformation matrices together and returns the result.\r\nexport function transform(m1, m2) {\r\n return [\r\n m1[0] * m2[0] + m1[2] * m2[1],\r\n m1[1] * m2[0] + m1[3] * m2[1],\r\n m1[0] * m2[2] + m1[2] * m2[3],\r\n m1[1] * m2[2] + m1[3] * m2[3],\r\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\r\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5]\r\n ];\r\n};\r\n\r\nexport function translate(m, x, y) {\r\n return [\r\n m[0],\r\n m[1],\r\n m[2],\r\n m[3],\r\n m[0] * x + m[2] * y + m[4],\r\n m[1] * x + m[3] * y + m[5]\r\n ];\r\n};\r\n\r\n\r\nexport function rotate(m, angle) {\r\n angle = angle * Math.PI / 180;\r\n\r\n var cosValue = Math.cos(angle);\r\n var sinValue = Math.sin(angle);\r\n\r\n return [\r\n m[0] * cosValue + m[2] * sinValue,\r\n m[1] * cosValue + m[3] * sinValue,\r\n m[0] * (-sinValue) + m[2] * cosValue,\r\n m[1] * (-sinValue) + m[3] * cosValue,\r\n m[4],\r\n m[5]\r\n ];\r\n};\r\n\r\nexport function scale(m, x, y) {\r\n return [\r\n m[0] * x,\r\n m[1] * x,\r\n m[2] * y,\r\n m[3] * y,\r\n m[4],\r\n m[5]\r\n ];\r\n};\r\n \r\nfunction getInverseTransform(m) {\r\n var d = m[0] * m[3] - m[1] * m[2];\r\n return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d,\r\n (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];\r\n};\r\n\r\n\r\nexport function makePoint(x, y, z) {\r\n return { x: x, y: y, z: z }\r\n}\r\n\r\nexport function makeVector(xcoord, ycoord, zcoord) {\r\n return { xcoord: xcoord, ycoord: ycoord, zcoord: zcoord }\r\n}\r\n\r\nexport function makeVectorFromPoints(pt1, pt2)\r\n{\r\n let xcoord = pt2.x - pt1.x;\r\n let ycoord = pt2.y - pt1.y;\r\n let zcoord = pt2.z - pt1.z;\r\n return makeVector(xcoord, ycoord, zcoord);\r\n}\r\n\r\nexport function addVector(pt, v) {\r\n return makePoint(pt.x + v.xcoord, pt.y + v.ycoord, pt.z + v.zcoord);\r\n}\r\n\r\nexport function multiplyVector(v, scalar) {\r\n return makeVector(v.xcoord * scalar, v.ycoord * scalar, v.zcoord * scalar);\r\n}\r\n\r\nexport function magnitude(v)\r\n{\r\n return Math.sqrt(\r\n Math.pow(v.xcoord, 2) + Math.pow(v.ycoord, 2) + Math.pow(v.zcoord, 2)\r\n );\r\n}\r\n\r\nexport function negateVector(v) {\r\n return multiplyVector(v, -1);\r\n}\r\n\r\nexport function unitVector(v) {\r\n let mag = magnitude(v);\r\n let xcoord = v.xcoord / mag;\r\n let ycoord = v.ycoord / mag;\r\n let zcoord = v.zcoord / mag;\r\n return makeVector(xcoord, ycoord, zcoord);\r\n} \r\n\r\nexport function crossProduct(u, v) {\r\n //\r\n // u X v = < u2*v3 - u3*v2,\r\n // u3*v1 - u1*v3,\r\n // u1*v2 - u2*v1 >\r\n let xcoord = u.ycoord * v.zcoord - u.zcoord * v.ycoord;\r\n let ycoord = u.zcoord * v.xcoord - u.xcoord * v.zcoord;\r\n let zcoord = u.xcoord * v.ycoord - u.ycoord * v.xcoord;\r\n return makeVector(xcoord, ycoord, zcoord);\r\n}\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils/mathUtils.js\n **/","import uuid from '../utils/uuid';\r\nimport StoreAdapter from './StoreAdapter';\r\n\r\n// StoreAdapter for working with localStorage\r\n// This is ideal for testing, examples, and prototyping\r\nexport default class LocalStoreAdapter extends StoreAdapter {\r\n constructor() {\r\n super({\r\n getAnnotations(documentId, userId, pageNumber) {\r\n return new Promise((resolve, reject) => {\r\n let annotations = getAnnotations(documentId, userId).filter((i) => {\r\n return i.page === pageNumber && i.class === 'Annotation';\r\n });\r\n\r\n resolve({\r\n documentId,\r\n userId,\r\n pageNumber,\r\n annotations\r\n });\r\n });\r\n },\r\n\r\n getAnnotation(documentId, userId, annotationId) {\r\n return Promise.resolve(getAnnotations(documentId, userId)[findAnnotation(documentId, userId, annotationId)]);\r\n },\r\n\r\n addAnnotation(documentId, userId, pageNumber, annotation) {\r\n return new Promise((resolve, reject) => {\r\n annotation.class = 'Annotation';\r\n annotation.uuid = uuid();\r\n annotation.page = pageNumber;\r\n\r\n let annotations = getAnnotations(documentId, userId);\r\n annotations.push(annotation);\r\n updateAnnotations(documentId, userId, annotations);\r\n\r\n resolve(annotation);\r\n });\r\n },\r\n\r\n editAnnotation(documentId, userId, annotationId, annotation) {\r\n return new Promise((resolve, reject) => {\r\n let annotations = getAnnotations(documentId, userId);\r\n annotations[findAnnotation(documentId, userId, annotationId)] = annotation;\r\n updateAnnotations(documentId, userId, annotations);\r\n\r\n resolve(annotation);\r\n });\r\n },\r\n\r\n deleteAnnotation(documentId, userId, annotationId) {\r\n return new Promise((resolve, reject) => {\r\n let index = findAnnotation(documentId, userId, annotationId);\r\n if (index > -1) {\r\n let annotations = getAnnotations(documentId, userId);\r\n annotations.splice(index, 1);\r\n updateAnnotations(documentId, userId, annotations);\r\n }\r\n\r\n resolve(true);\r\n });\r\n },\r\n\r\n getComments(documentId, userId, annotationId) {\r\n return new Promise((resolve, reject) => {\r\n resolve(getAnnotations(documentId, userId).filter((i) => {\r\n return i.class === 'Comment' && i.annotation === annotationId;\r\n }));\r\n });\r\n },\r\n\r\n addComment(documentId, userId, annotationId, content) {\r\n return new Promise((resolve, reject) => {\r\n let comment = {\r\n class: 'Comment',\r\n uuid: uuid(),\r\n annotation: annotationId,\r\n content: content\r\n };\r\n\r\n let annotations = getAnnotations(documentId, userId);\r\n annotations.push(comment);\r\n updateAnnotations(documentId, userId, annotations);\r\n\r\n resolve(comment);\r\n });\r\n },\r\n\r\n deleteComment(documentId, userId, commentId) {\r\n return new Promise((resolve, reject) => {\r\n getAnnotations(documentId, userId);\r\n let index = -1;\r\n let annotations = getAnnotations(documentId, userId);\r\n for (let i=0, l=annotations.length; i -1) {\r\n annotations.splice(index, 1);\r\n updateAnnotations(documentId, userId, annotations);\r\n }\r\n\r\n resolve(true);\r\n });\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction getAnnotations(documentId, userId) {\r\n let all_annotations = [];\r\n for(let i = 0 ; i < localStorage.length; i++){\r\n if(localStorage.key(i).includes('annotations')){\r\n all_annotations.push(...JSON.parse(localStorage.getItem(localStorage.key(i))));\r\n }\r\n }\r\n return all_annotations;\r\n}\r\n\r\nfunction updateAnnotations(documentId, userId, annotations) {\r\n localStorage.setItem(`${documentId}/${userId}/annotations`, JSON.stringify(annotations));\r\n}\r\n\r\nfunction findAnnotation(documentId, userId, annotationId) {\r\n let index = -1;\r\n let annotations = getAnnotations(documentId, userId);\r\n for (let i=0, l=annotations.length; i {\r\n // Reset the content of the SVG\r\n svg.setAttribute('data-pdf-annotate-container', true);\r\n svg.setAttribute('data-pdf-annotate-viewport', JSON.stringify(viewport));\r\n svg.removeAttribute('data-pdf-annotate-document');\r\n svg.removeAttribute('data-pdf-annotate-page');\r\n\r\n // If there's no data nothing can be done\r\n if (!data) {\r\n svg.innerHTML = ''; \r\n return resolve(svg);\r\n }\r\n\r\n svg.setAttribute('data-pdf-annotate-document', data.documentId);\r\n svg.setAttribute('data-pdf-annotate-user', data.userId);\r\n svg.setAttribute('data-pdf-annotate-page', data.pageNumber);\r\n \r\n // Make sure annotations is an array\r\n if (!Array.isArray(data.annotations) || data.annotations.length === 0) {\r\n return resolve(svg);\r\n }\r\n\r\n // Append or transform annotation to svg\r\n data.annotations.forEach((a) => {\r\n var node = svg.querySelector('[data-pdf-annotate-id=\"' + a.uuid + '\"]');\r\n if (node) {\r\n transformChild(svg, node, viewport);\r\n } else {\r\n appendChild(svg, a, viewport);\r\n }\r\n });\r\n\r\n resolve(svg);\r\n });\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/render/index.js\n **/","import insertScreenReaderHint from './insertScreenReaderHint';\r\nimport initEventHandlers from './initEventHandlers';\r\n\r\n// TODO This is not the right place for this to live\r\ninitEventHandlers();\r\n\r\n/**\r\n * Insert hints into the DOM for screen readers.\r\n *\r\n * @param {Array} annotations The annotations that hints are inserted for\r\n */\r\nexport default function renderScreenReaderHints(annotations) {\r\n annotations = Array.isArray(annotations) ? annotations : [];\r\n\r\n // Insert hints for each type\r\n Object.keys(SORT_TYPES).forEach((type) => {\r\n let sortBy = SORT_TYPES[type];\r\n annotations\r\n .filter((a) => a.type === type)\r\n .sort(sortBy)\r\n .forEach((a, i) => insertScreenReaderHint(a, i + 1));\r\n });\r\n}\r\n\r\n// Sort annotations first by y, then by x.\r\n// This allows hints to be injected in the order they appear,\r\n// which makes numbering them easier.\r\nfunction sortByPoint(a, b) {\r\n if (a.y < b.y) {\r\n return a.x - b.x;\r\n } else {\r\n return 1;\r\n }\r\n}\r\n\r\n// Sort annotation by it's first rectangle\r\nfunction sortByRectPoint(a, b) {\r\n return sortByPoint(a.rectangles[0], b.rectangles[0]);\r\n}\r\n\r\n// Sort annotation by it's first line\r\nfunction sortByLinePoint(a, b) {\r\n let lineA = a.lines[0];\r\n let lineB = b.lines[0];\r\n return sortByPoint(\r\n {x: lineA[0], y: lineA[1]},\r\n {x: lineB[0], y: lineB[1]}\r\n );\r\n}\r\n\r\n// Arrange supported types and associated sort methods\r\nconst SORT_TYPES = {\r\n 'highlight': sortByRectPoint,\r\n 'strikeout': sortByRectPoint,\r\n 'drawing': sortByLinePoint,\r\n 'textbox': sortByPoint,\r\n 'point': sortByPoint,\r\n 'area': sortByPoint\r\n};\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/renderScreenReaderHints.js\n **/","import createScreenReaderOnly from './createScreenReaderOnly';\r\nimport insertElementWithinChildren from './insertElementWithinChildren';\r\nimport insertElementWithinElement from './insertElementWithinElement';\r\nimport renderScreenReaderComments from './renderScreenReaderComments';\r\n\r\n// Annotation types that support comments\r\nconst COMMENT_TYPES = ['highlight', 'point', 'area','circle','emptycircle','fillcircle'];\r\n\r\n/**\r\n * Insert a hint into the DOM for screen readers for a specific annotation.\r\n *\r\n * @param {Object} annotation The annotation to insert a hint for\r\n * @param {Number} num The number of the annotation out of all annotations of the same type\r\n */\r\nexport default function insertScreenReaderHint(annotation, num = 0) {\r\n switch (annotation.type) {\r\n case 'highlight':\r\n case 'strikeout':\r\n let rects = annotation.rectangles;\r\n let first = rects[0];\r\n let last = rects[rects.length - 1];\r\n\r\n insertElementWithinElement(\r\n createScreenReaderOnly(`Begin ${annotation.type} annotation ${num}`, annotation.uuid),\r\n first.x, first.y, annotation.page, true\r\n );\r\n\r\n insertElementWithinElement(\r\n createScreenReaderOnly(`End ${annotation.type} annotation ${num}`, `${annotation.uuid}-end`),\r\n last.x + last.width, last.y, annotation.page, false\r\n );\r\n break;\r\n\r\n case 'textbox':\r\n case 'point':\r\n let text = annotation.type === 'textbox' ? ` (content: ${annotation.content})` : '';\r\n\r\n insertElementWithinChildren(\r\n createScreenReaderOnly(`${annotation.type} annotation ${num}${text}`, annotation.uuid),\r\n annotation.x, annotation.y, annotation.page\r\n );\r\n break;\r\n\r\n case 'drawing':\r\n case 'area':\r\n let x = typeof annotation.x !== 'undefined' ? annotation.x : annotation.lines[0][0];\r\n let y = typeof annotation.y !== 'undefined' ? annotation.y : annotation.lines[0][1];\r\n\r\n insertElementWithinChildren(\r\n createScreenReaderOnly(`Unlabeled drawing`, annotation.uuid),\r\n x, y, annotation.page\r\n );\r\n break;\r\n\r\n case 'circle':\r\n case 'fillcircle':\r\n case 'emptycircle':\r\n let x2 = typeof annotation.cx !== 'undefined' ? annotation.cx : annotation.lines[0][0];\r\n let y2 = typeof annotation.cy !== 'undefined' ? annotation.cy : annotation.lines[0][1];\r\n\r\n insertElementWithinChildren(\r\n createScreenReaderOnly(`Unlabeled drawing`, annotation.uuid),\r\n x2, y2, annotation.page\r\n );\r\n break;\r\n }\r\n\r\n // Include comments in screen reader hint\r\n if (COMMENT_TYPES.includes(annotation.type)) {\r\n renderScreenReaderComments(annotation.documentId, annotation.uuid);\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/insertScreenReaderHint.js\n **/","/**\r\n * Create a node that is only visible to screen readers\r\n *\r\n * @param {String} content The text content that should be read by screen reader\r\n * @param {String} [annotationId] The ID of the annotation assocaited\r\n * @return {Element} An Element that is only visible to screen readers\r\n */\r\nexport default function createScreenReaderOnly(content, annotationId) {\r\n let node = document.createElement('div');\r\n let text = document.createTextNode(content);\r\n node.appendChild(text);\r\n node.setAttribute('id', `pdf-annotate-screenreader-${annotationId}`);\r\n node.style.position = 'absolute';\r\n node.style.left = '-10000px';\r\n node.style.top = 'auto';\r\n node.style.width = '1px';\r\n node.style.height = '1px';\r\n node.style.overflow = 'hidden';\r\n return node;\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/createScreenReaderOnly.js\n **/","import config from '../config';\r\nimport insertElementWithinElement from './insertElementWithinElement';\r\nimport { pointIntersectsRect } from '../UI/utils';\r\nimport { scaleUp } from '../UI/utils'; \r\n\r\n/**\r\n * Insert an element at a point within the document.\r\n * This algorithm will try to insert between elements if possible.\r\n * It will however use `insertElementWithinElement` if it is more accurate.\r\n *\r\n * @param {Element} el The element to be inserted\r\n * @param {Number} x The x coordinate of the point\r\n * @param {Number} y The y coordinate of the point\r\n * @param {Number} pageNumber The page number to limit elements to\r\n * @return {Boolean} True if element was able to be inserted, otherwise false\r\n */\r\nexport default function insertElementWithinChildren(el, x, y, pageNumber) {\r\n // Try and use most accurate method of inserting within an element\r\n if (insertElementWithinElement(el, x, y, pageNumber, true)) {\r\n return true;\r\n }\r\n\r\n // Fall back to inserting between elements\r\n let svg = document.querySelector(`svg[data-pdf-annotate-page=\"${pageNumber}\"]`);\r\n let rect = svg.getBoundingClientRect();\r\n let nodes = [...svg.parentNode.querySelectorAll(config.textClassQuery() + ' > div')];\r\n\r\n y = scaleUp(svg, {y}).y + rect.top;\r\n x = scaleUp(svg, {x}).x + rect.left;\r\n\r\n // Find the best node to insert before\r\n for (let i=0, l=nodes.length; i') {\r\n while(head.length) {\r\n tail.unshift(head.pop());\r\n if (tail[0] === '<') {\r\n break;\r\n }\r\n }\r\n }\r\n \r\n // Check if width of temp based on current head value satisfies x\r\n temp.innerHTML = head.join('');\r\n let width = scaleDown(svg, {width: temp.getBoundingClientRect().width}).width;\r\n if (left + width <= x) {\r\n break;\r\n }\r\n tail.unshift(head.pop());\r\n }\r\n \r\n // Update original node with new markup, including element to be inserted\r\n node.innerHTML = head.join('') + el.outerHTML + tail.join('');\r\n temp.parentNode.removeChild(temp);\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Get a text layer element at a given point on a page\r\n *\r\n * @param {Number} x The x coordinate of the point\r\n * @param {Number} y The y coordinate of the point\r\n * @param {Number} pageNumber The page to limit elements to\r\n * @return {Element} First text layer element found at the point\r\n */\r\nfunction textLayerElementFromPoint(x, y, pageNumber) {\r\n let svg = document.querySelector(`svg[data-pdf-annotate-page=\"${pageNumber}\"]`);\r\n let rect = svg.getBoundingClientRect();\r\n y = scaleUp(svg, {y}).y + rect.top;\r\n x = scaleUp(svg, {x}).x + rect.left;\r\n return [...svg.parentNode.querySelectorAll(config.textClassQuery() + ' [data-canvas-width]')].filter((el) => {\r\n return pointIntersectsRect(x, y, el.getBoundingClientRect());\r\n })[0];\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/insertElementWithinElement.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport insertScreenReaderComment from './insertScreenReaderComment';\r\n\r\n/**\r\n * Insert the comments into the DOM to be available by screen reader\r\n *\r\n * Example output:\r\n *
\r\n *
Begin highlight 1
\r\n *
    \r\n *
  1. Foo
  2. \r\n *
  3. Bar
  4. \r\n *
  5. Baz
  6. \r\n *
  7. Qux
  8. \r\n *
\r\n *
\r\n *
Some highlighted text goes here...
\r\n *
End highlight 1
\r\n *\r\n * NOTE: `screenReaderOnly` is not a real class, just used for brevity\r\n *\r\n * @param {String} documentId The ID of the document\r\n * @param {String} annotationId The ID of the annotation\r\n * @param {Array} [comments] Optionally preloaded comments to be rendered\r\n * @return {Promise}\r\n */\r\nexport default function renderScreenReaderComments(documentId, annotationId, comments) {\r\n let promise;\r\n\r\n if (Array.isArray(comments)) {\r\n promise = Promise.resolve(comments);\r\n } else {\r\n promise = PDFJSAnnotate.getStoreAdapter().getComments(documentId, annotationId);\r\n }\r\n\r\n return promise.then((comments) => {\r\n // Node needs to be found by querying DOM as it may have been inserted as innerHTML\r\n // leaving `screenReaderNode` as an invalid reference (see `insertElementWithinElement`).\r\n let node = document.getElementById(`pdf-annotate-screenreader-${annotationId}`);\r\n if (node) { \r\n let list = document.createElement('ol');\r\n list.setAttribute('id', `pdf-annotate-screenreader-comment-list-${annotationId}`);\r\n list.setAttribute('aria-label', 'Comments');\r\n node.appendChild(list);\r\n comments.forEach(insertScreenReaderComment);\r\n }\r\n });\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/renderScreenReaderComments.js\n **/","/**\r\n * Insert a comment into the DOM to be available by screen reader\r\n *\r\n * @param {Object} comment The comment to be inserted\r\n */\r\nexport default function insertScreenReaderComment(comment) {\r\n if (!comment) {\r\n return;\r\n }\r\n\r\n let list = document.querySelector(`#pdf-annotate-screenreader-${comment.annotation} ol`);\r\n if (list) {\r\n let item = document.createElement('li');\r\n item.setAttribute('id', `pdf-annotate-screenreader-comment-${comment.uuid}`);\r\n item.appendChild(document.createTextNode(`${comment.content}`));\r\n list.appendChild(item);\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/insertScreenReaderComment.js\n **/","import insertScreenReaderHint from './insertScreenReaderHint';\r\nimport renderScreenReaderHints from './renderScreenReaderHints';\r\nimport insertScreenReaderComment from './insertScreenReaderComment';\r\nimport renderScreenReaderComments from './renderScreenReaderComments';\r\nimport { addEventListener } from '../UI/event';\r\nimport PDFJSAnnotate from '../PDFJSAnnotate';\r\n\r\n/**\r\n * Initialize the event handlers for keeping screen reader hints synced with data\r\n */\r\nexport default function initEventHandlers() {\r\n addEventListener('annotation:add', (documentId, userId, pageNumber, annotation) => {\r\n reorderAnnotationsByType(documentId, userId, pageNumber, annotation.type);\r\n });\r\n addEventListener('annotation:edit', (documentId, userId, annotationId, annotation) => {\r\n reorderAnnotationsByType(documentId, userId, annotation.page, annotation.type);\r\n });\r\n addEventListener('annotation:delete', removeAnnotation);\r\n addEventListener('comment:add', insertComment);\r\n addEventListener('comment:delete', removeComment);\r\n}\r\n\r\n/**\r\n * Reorder the annotation numbers by annotation type\r\n *\r\n * @param {String} documentId The ID of the document\r\n * @param {String} userId The ID of the user\r\n * @param {Number} pageNumber The page number of the annotations\r\n * @param {Strig} type The annotation type\r\n */\r\nfunction reorderAnnotationsByType(documentId, userId, pageNumber, type) {\r\n PDFJSAnnotate.getStoreAdapter().getAnnotations(documentId, userId, pageNumber)\r\n .then((annotations) => {\r\n return annotations.annotations.filter((a) => {\r\n return a.type === type;\r\n });\r\n })\r\n .then((annotations) => {\r\n annotations.forEach((a) => {\r\n removeAnnotation(documentId, a.uuid);\r\n });\r\n\r\n return annotations;\r\n })\r\n .then(renderScreenReaderHints);\r\n}\r\n\r\n/**\r\n * Remove the screen reader hint for an annotation\r\n *\r\n * @param {String} documentId The ID of the document\r\n * @param {String} annotationId The Id of the annotation\r\n */\r\nfunction removeAnnotation(documentId, annotationId) {\r\n removeElementById(`pdf-annotate-screenreader-${annotationId}`);\r\n removeElementById(`pdf-annotate-screenreader-${annotationId}-end`);\r\n}\r\n\r\n/**\r\n * Insert a screen reader hint for a comment\r\n *\r\n * @param {String} documentId The ID of the document\r\n * @param {String} annotationId The ID of tha assocated annotation\r\n * @param {Object} comment The comment to insert a hint for\r\n */\r\nfunction insertComment(documentId, annotationId, comment) {\r\n let list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`);\r\n let promise;\r\n\r\n if (!list) {\r\n promise = renderScreenReaderComments(documentId, annotationId, []).then(() => {\r\n list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`);\r\n return true;\r\n });\r\n } else {\r\n promise = Promise.resolve(true);\r\n }\r\n\r\n promise.then(() => {\r\n insertScreenReaderComment(comment);\r\n });\r\n}\r\n\r\n/**\r\n * Remove a screen reader hint for a comment\r\n *\r\n * @param {String} documentId The ID of the document\r\n * @param {String} commentId The ID of the comment\r\n */\r\nfunction removeComment(documentId, commentId) {\r\n removeElementById(`pdf-annotate-screenreader-comment-${commentId}`);\r\n}\r\n\r\n/**\r\n * Remove an element from the DOM by it's ID if it exists\r\n *\r\n * @param {String} elementID The ID of the element to be removed\r\n */\r\nfunction removeElementById(elementId) {\r\n let el = document.getElementById(elementId);\r\n if (el) {\r\n el.parentNode.removeChild(el);\r\n }\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/a11y/initEventHandlers.js\n **/","import { addEventListener, removeEventListener, fireEvent } from './event';\r\nimport { disableEdit, enableEdit } from './edit';\r\nimport { disablePen, enablePen, setPen } from './pen';\r\nimport { enableEraser, disableEraser } from './eraser';\r\nimport { disableArrow, enableArrow, setArrow } from './arrow';\r\nimport { disablePoint, enablePoint } from './point';\r\nimport { disableRect, enableRect } from './rect';\r\nimport { disableCircle, enableCircle, setCircle, addCircle } from './circle';\r\nimport { disableText, enableText, setText } from './text';\r\nimport { createPage, renderPage } from './page';\r\n\r\nexport default {\r\n addEventListener, removeEventListener, fireEvent,\r\n disableEdit, enableEdit,\r\n disablePen, enablePen, setPen,\r\n enableEraser, disableEraser,\r\n disablePoint, enablePoint,\r\n disableRect, enableRect,\r\n disableCircle, enableCircle, setCircle, addCircle,\r\n disableArrow, enableArrow, setArrow,\r\n disableText, enableText, setText,\r\n createPage, renderPage\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/index.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport config from '../config';\r\nimport { appendChild } from '../render/appendChild';\r\nimport {\r\n addEventListener,\r\n removeEventListener\r\n} from './event';\r\nimport {\r\n BORDER_COLOR,\r\n disableUserSelect,\r\n enableUserSelect,\r\n findSVGContainer,\r\n findSVGAtPoint,\r\n getOffsetAnnotationRect,\r\n getMetadata,\r\n scaleUp,\r\n convertToSvgPoint\r\n} from './utils';\r\n\r\nlet _enabled = false;\r\nlet isDragging = false, overlay;\r\nlet dragOffsetX, dragOffsetY, dragStartX, dragStartY;\r\nconst OVERLAY_BORDER_SIZE = 3;\r\n\r\n/**\r\n * Create an overlay for editing an annotation.\r\n *\r\n * @param {Element} target The annotation element to apply overlay for\r\n */\r\nfunction createEditOverlay(target) {\r\n destroyEditOverlay();\r\n\r\n overlay = document.createElement('div');\r\n let anchor = document.createElement('a');\r\n let parentNode = findSVGContainer(target).parentNode;\r\n let id = target.getAttribute('data-pdf-annotate-id');\r\n let rect = getOffsetAnnotationRect(target);\r\n let styleLeft = rect.left - OVERLAY_BORDER_SIZE;\r\n let styleTop = rect.top - OVERLAY_BORDER_SIZE;\r\n \r\n overlay.setAttribute('id', 'pdf-annotate-edit-overlay');\r\n overlay.setAttribute('data-target-id', id);\r\n overlay.style.boxSizing = 'content-box';\r\n overlay.style.position = 'absolute';\r\n overlay.style.top = `${styleTop}px`;\r\n overlay.style.left = `${styleLeft}px`;\r\n overlay.style.width = `${rect.width}px`;\r\n overlay.style.height = `${rect.height}px`;\r\n overlay.style.border = `${OVERLAY_BORDER_SIZE}px solid ${BORDER_COLOR}`;\r\n overlay.style.borderRadius = `${OVERLAY_BORDER_SIZE}px`;\r\n overlay.style.zIndex = 20100;\r\n\r\n anchor.innerHTML = '×';\r\n anchor.setAttribute('href', 'javascript://');\r\n anchor.style.background = '#fff';\r\n anchor.style.borderRadius = '20px';\r\n anchor.style.border = '1px solid #bbb';\r\n anchor.style.color = '#bbb';\r\n anchor.style.fontSize = '16px';\r\n anchor.style.padding = '2px';\r\n anchor.style.textAlign = 'center';\r\n anchor.style.textDecoration = 'none';\r\n anchor.style.position = 'absolute';\r\n anchor.style.top = '-13px';\r\n anchor.style.right = '-13px';\r\n anchor.style.width = '25px';\r\n anchor.style.height = '25px';\r\n \r\n overlay.appendChild(anchor);\r\n parentNode.appendChild(overlay);\r\n document.addEventListener('click', handleDocumentClick);\r\n document.addEventListener('keyup', handleDocumentKeyup);\r\n document.addEventListener('mousedown', handleDocumentMousedown);\r\n anchor.addEventListener('click', deleteAnnotation);\r\n anchor.addEventListener('mouseover', () => {\r\n anchor.style.color = '#35A4DC';\r\n anchor.style.borderColor = '#999';\r\n anchor.style.boxShadow = '0 1px 1px #ccc';\r\n });\r\n anchor.addEventListener('mouseout', () => {\r\n anchor.style.color = '#bbb';\r\n anchor.style.borderColor = '#bbb';\r\n anchor.style.boxShadow = '';\r\n });\r\n overlay.addEventListener('mouseover', () => {\r\n if (!isDragging) { anchor.style.display = ''; }\r\n });\r\n overlay.addEventListener('mouseout', () => {\r\n anchor.style.display = 'none';\r\n });\r\n}\r\n\r\n/**\r\n * Destroy the edit overlay if it exists.\r\n */\r\nfunction destroyEditOverlay() {\r\n if (overlay) {\r\n overlay.parentNode.removeChild(overlay);\r\n overlay = null;\r\n }\r\n\r\n document.removeEventListener('click', handleDocumentClick);\r\n document.removeEventListener('keyup', handleDocumentKeyup);\r\n document.removeEventListener('mousedown', handleDocumentMousedown);\r\n document.removeEventListener('mousemove', handleDocumentMousemove);\r\n document.removeEventListener('mouseup', handleDocumentMouseup);\r\n enableUserSelect();\r\n}\r\n\r\n/**\r\n * Delete currently selected annotation\r\n */\r\nfunction deleteAnnotation() {\r\n if (!overlay) { return; }\r\n\r\n let annotationId = overlay.getAttribute('data-target-id');\r\n let nodes = document.querySelectorAll(`[data-pdf-annotate-id=\"${annotationId}\"]`);\r\n let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\r\n let { documentId } = getMetadata(svg);\r\n\r\n [...nodes].forEach((n) => {\r\n n.parentNode.removeChild(n);\r\n });\r\n \r\n PDFJSAnnotate.getStoreAdapter().deleteAnnotation(documentId, annotationId);\r\n\r\n destroyEditOverlay();\r\n}\r\n\r\n/**\r\n * Handle document.click event\r\n *\r\n * @param {Event} e The DOM event that needs to be handled\r\n */\r\nfunction handleDocumentClick(e) {\r\n if (!findSVGAtPoint(e.clientX, e.clientY)) { return; }\r\n\r\n // Remove current overlay\r\n let overlay = document.getElementById('pdf-annotate-edit-overlay');\r\n if (overlay) {\r\n if (isDragging || e.target === overlay) {\r\n return;\r\n }\r\n\r\n destroyEditOverlay();\r\n }\r\n}\r\n\r\n/**\r\n * Handle document.keyup event\r\n *\r\n * @param {Event} e The DOM event that needs to be handled\r\n */\r\nfunction handleDocumentKeyup(e) {\r\n if (overlay && e.keyCode === 46 &&\r\n e.target.nodeName.toLowerCase() !== 'textarea' &&\r\n e.target.nodeName.toLowerCase() !== 'input') {\r\n deleteAnnotation();\r\n }\r\n}\r\n\r\n/**\r\n * Handle document.mousedown event\r\n *\r\n * @param {Event} e The DOM event that needs to be handled\r\n */\r\nfunction handleDocumentMousedown(e) {\r\n if (e.target !== overlay) { return; }\r\n\r\n // Highlight and strikeout annotations are bound to text within the document.\r\n // It doesn't make sense to allow repositioning these types of annotations.\r\n let annotationId = overlay.getAttribute('data-target-id');\r\n let target = document.querySelector(`[data-pdf-annotate-id=\"${annotationId}\"]`);\r\n let type = target.getAttribute('data-pdf-annotate-type');\r\n\r\n if (type === 'highlight' || type === 'strikeout') { return; }\r\n\r\n isDragging = true;\r\n dragOffsetX = e.clientX;\r\n dragOffsetY = e.clientY;\r\n dragStartX = overlay.offsetLeft;\r\n dragStartY = overlay.offsetTop;\r\n\r\n overlay.style.background = 'rgba(255, 255, 255, 0.7)';\r\n overlay.style.cursor = 'move';\r\n overlay.querySelector('a').style.display = 'none';\r\n\r\n document.addEventListener('mousemove', handleDocumentMousemove);\r\n document.addEventListener('mouseup', handleDocumentMouseup);\r\n disableUserSelect();\r\n}\r\n\r\n/**\r\n * Handle document.mousemove event\r\n *\r\n * @param {Event} e The DOM event that needs to be handled\r\n */\r\nfunction handleDocumentMousemove(e) {\r\n let annotationId = overlay.getAttribute('data-target-id');\r\n let parentNode = overlay.parentNode;\r\n let rect = parentNode.getBoundingClientRect();\r\n let y = (dragStartY + (e.clientY - dragOffsetY));\r\n let x = (dragStartX + (e.clientX - dragOffsetX));\r\n let minY = 0;\r\n let maxY = rect.height;\r\n let minX = 0;\r\n let maxX = rect.width;\r\n\r\n if (y > minY && y + overlay.offsetHeight < maxY) {\r\n overlay.style.top = `${y}px`;\r\n }\r\n\r\n if (x > minX && x + overlay.offsetWidth < maxX) {\r\n overlay.style.left = `${x}px`;\r\n }\r\n}\r\n\r\n/**\r\n * Handle document.mouseup event\r\n *\r\n * @param {Event} e The DOM event that needs to be handled\r\n */\r\nfunction handleDocumentMouseup(e) {\r\n let annotationId = overlay.getAttribute('data-target-id');\r\n let target = document.querySelectorAll(`[data-pdf-annotate-id=\"${annotationId}\"]`);\r\n let type = target[0].getAttribute('data-pdf-annotate-type');\r\n let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\r\n let { documentId, userId } = getMetadata(svg);\r\n \r\n overlay.querySelector('a').style.display = '';\r\n\r\n PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, userId, annotationId).then((annotation) => {\r\n let attribX = 'x';\r\n let attribY = 'y';\r\n if (['circle', 'fillcircle', 'emptycircle'].indexOf(type) > -1) {\r\n attribX = 'cx';\r\n attribY = 'cy';\r\n }\r\n if (['area', 'highlight', 'point', 'textbox', 'circle', 'fillcircle', 'emptycircle'].indexOf(type) > -1) {\r\n let modelStart = convertToSvgPoint([dragStartX, dragStartY], svg);\r\n let modelEnd = convertToSvgPoint([overlay.offsetLeft, overlay.offsetTop], svg);\r\n let modelDelta = {\r\n x: modelEnd[0] - modelStart[0],\r\n y: modelEnd[1] - modelStart[1]\r\n };\r\n\r\n if (type === 'textbox') {\r\n target = [target[0].firstChild];\r\n }\r\n\r\n [...target].forEach((t, i) => {\r\n let modelX = parseInt(t.getAttribute(attribX), 10);\r\n let modelY = parseInt(t.getAttribute(attribY), 10);\r\n if (modelDelta.y !== 0) {\r\n modelY = modelY + modelDelta.y;\r\n let viewY = modelY;\r\n\r\n if (type === 'point') {\r\n viewY = scaleUp(svg, { viewY }).viewY;\r\n }\r\n\r\n t.setAttribute(attribY, viewY);\r\n if (annotation.rectangles && i < annotation.rectangles.length) {\r\n annotation.rectangles[i].y = modelY;\r\n } else if (annotation[attribY]) {\r\n annotation[attribY] = modelY;\r\n }\r\n }\r\n if (modelDelta.x !== 0) {\r\n modelX = modelX + modelDelta.x;\r\n let viewX = modelX;\r\n\r\n if (type === 'point') {\r\n viewX = scaleUp(svg, { viewX }).viewX;\r\n }\r\n\r\n t.setAttribute(attribX, viewX);\r\n if (annotation.rectangles && i < annotation.rectangles.length) {\r\n annotation.rectangles[i].x = modelX;\r\n } else if (annotation[attribX]) {\r\n annotation[attribX] = modelX;\r\n }\r\n }\r\n });\r\n // } else if (type === 'strikeout') {\r\n // let { deltaX, deltaY } = getDelta('x1', 'y1');\r\n // [...target].forEach(target, (t, i) => {\r\n // if (deltaY !== 0) {\r\n // t.setAttribute('y1', parseInt(t.getAttribute('y1'), 10) + deltaY);\r\n // t.setAttribute('y2', parseInt(t.getAttribute('y2'), 10) + deltaY);\r\n // annotation.rectangles[i].y = parseInt(t.getAttribute('y1'), 10);\r\n // }\r\n // if (deltaX !== 0) {\r\n // t.setAttribute('x1', parseInt(t.getAttribute('x1'), 10) + deltaX);\r\n // t.setAttribute('x2', parseInt(t.getAttribute('x2'), 10) + deltaX);\r\n // annotation.rectangles[i].x = parseInt(t.getAttribute('x1'), 10);\r\n // }\r\n // });\r\n } else if (type === 'drawing' || type === 'arrow') {\r\n let modelStart = convertToSvgPoint([dragStartX, dragStartY], svg);\r\n let modelEnd = convertToSvgPoint([overlay.offsetLeft, overlay.offsetTop], svg);\r\n let modelDelta = {\r\n x: modelEnd[0] - modelStart[0],\r\n y: modelEnd[1] - modelStart[1]\r\n };\r\n\r\n annotation.lines.forEach((line, i) => {\r\n let [x, y] = annotation.lines[i];\r\n annotation.lines[i][0] = x + modelDelta.x;\r\n annotation.lines[i][1] = y + modelDelta.y;\r\n });\r\n\r\n target[0].parentNode.removeChild(target[0]);\r\n appendChild(svg, annotation);\r\n } \r\n\r\n PDFJSAnnotate.getStoreAdapter().editAnnotation(documentId, annotationId, annotation);\r\n });\r\n\r\n setTimeout(() => {\r\n isDragging = false;\r\n }, 0);\r\n\r\n overlay.style.background = '';\r\n overlay.style.cursor = '';\r\n\r\n document.removeEventListener('mousemove', handleDocumentMousemove);\r\n document.removeEventListener('mouseup', handleDocumentMouseup);\r\n enableUserSelect();\r\n}\r\n\r\n/**\r\n * Handle annotation.click event\r\n *\r\n * @param {Element} e The annotation element that was clicked\r\n */\r\nfunction handleAnnotationClick(target) {\r\n createEditOverlay(target);\r\n}\r\n\r\n/**\r\n * Enable edit mode behavior.\r\n */\r\nexport function enableEdit () {\r\n if (_enabled) { return; }\r\n\r\n _enabled = true;\r\n addEventListener('annotation:click', handleAnnotationClick);\r\n};\r\n\r\n/**\r\n * Disable edit mode behavior.\r\n */\r\nexport function disableEdit () {\r\n destroyEditOverlay();\r\n\r\n if (!_enabled) { return; }\r\n\r\n _enabled = false;\r\n removeEventListener('annotation:click', handleAnnotationClick);\r\n};\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/edit.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport { appendChild } from '../render/appendChild';\r\nimport {\r\n disableUserSelect,\r\n enableUserSelect,\r\n findSVGAtPoint,\r\n getMetadata,\r\n convertToSvgPoint\r\n} from './utils';\r\n\r\nlet _enabled = false;\r\nlet _candraw = false;\r\nlet _penSize;\r\nlet _penColor;\r\nlet path;\r\nlet lines = [];\r\n\r\n/**\r\n * Handle document.touchdown or document.pointerdown event\r\n */\r\nfunction handleDocumentPointerdown(e) {\r\n path = null;\r\n lines = [];\r\n _candraw = true;\r\n}\r\n\r\n/**\r\n * Handle document.touchup or document.pointerup event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentKeyupChrome(e){\r\n saveToStorage(e.changedTouches[0].clientX, e.changedTouches[0].clientY);\r\n}\r\n\r\nfunction handleDocumentPointerup(e) {\r\n saveToStorage(e.clientX, e.clientY);\r\n}\r\n\r\nfunction saveToStorage(x, y){\r\n _candraw = false;\r\n let svg;\r\n if (lines.length > 1 && (svg = findSVGAtPoint(x, y))) {\r\n let { documentId, userId, pageNumber } = getMetadata(svg);\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, {\r\n type: 'drawing',\r\n width: _penSize,\r\n color: _penColor,\r\n lines\r\n }\r\n ).then((annotation) => {\r\n if (path) {\r\n svg.removeChild(path);\r\n }\r\n\r\n appendChild(svg, annotation);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Handle document.mousemove event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentPointermove(e) {\r\n if(_candraw){\r\n savePoint(e.clientX, e.clientY);\r\n }\r\n}\r\n\r\nfunction handleDocumentPointermoveChrome(e){\r\n if(_candraw){\r\n savePoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY);\r\n }\r\n}\r\n\r\n/**\r\n * Handle document.keyup event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentKeyup(e) {\r\n // Cancel rect if Esc is pressed\r\n if (e.keyCode === 27) {\r\n lines = null;\r\n path.parentNode.removeChild(path);\r\n document.removeEventListener('pointermove', handleDocumentPointermove);\r\n document.removeEventListener('pointerup', handleDocumentPointerup);\r\n }\r\n}\r\n\r\n/**\r\n * Save a point to the line being drawn.\r\n *\r\n * @param {Number} x The x coordinate of the point\r\n * @param {Number} y The y coordinate of the point\r\n */\r\nfunction savePoint(x, y) {\r\n let svg = findSVGAtPoint(x, y);\r\n if (!svg) {\r\n return;\r\n }\r\n\r\n let rect = svg.getBoundingClientRect();\r\n let point = convertToSvgPoint([\r\n x - rect.left,\r\n y - rect.top\r\n ], svg);\r\n\r\n lines.push(point);\r\n\r\n if (lines.length <= 1) {\r\n return;\r\n }\r\n\r\n if (path) {\r\n svg.removeChild(path);\r\n }\r\n\r\n path = appendChild(svg, {\r\n type: 'drawing',\r\n color: _penColor,\r\n width: _penSize,\r\n lines\r\n });\r\n}\r\n\r\n/**\r\n * Set the attributes of the pen.\r\n *\r\n * @param {Number} penSize The size of the lines drawn by the pen\r\n * @param {String} penColor The color of the lines drawn by the pen\r\n */\r\nexport function setPen(penSize = 1, penColor = '000000') {\r\n _penSize = parseInt(penSize, 10);\r\n _penColor = penColor;\r\n}\r\n\r\n/**\r\n * Enable the pen behavior\r\n */\r\nexport function enablePen() {\r\n if (_enabled) { return; }\r\n\r\n _enabled = true;\r\n // Chrome and Firefox has different behaviors with how pen works, so we need different events.\r\n if (navigator.userAgent.indexOf(\"Chrome\") !== -1){\r\n document.addEventListener('touchstart', handleDocumentPointerdown);\r\n document.addEventListener('touchmove', handleDocumentPointermoveChrome);\r\n document.addEventListener('touchend', handleDocumentKeyupChrome);\r\n document.addEventListener('mousedown', handleDocumentPointerdown);\r\n document.addEventListener('mousemove', handleDocumentPointermove);\r\n document.addEventListener('mouseup', handleDocumentPointerup);\r\n } else {\r\n document.addEventListener('pointerdown', handleDocumentPointerdown);\r\n document.addEventListener('pointermove', handleDocumentPointermove);\r\n document.addEventListener('pointerup', handleDocumentPointerup);\r\n }\r\n document.addEventListener('keyup', handleDocumentKeyup);\r\n disableUserSelect();\r\n}\r\n\r\n/**\r\n * Disable the pen behavior\r\n */\r\nexport function disablePen() {\r\n if (!_enabled) { return; }\r\n\r\n _enabled = false;\r\n if (navigator.userAgent.indexOf(\"Chrome\") !== -1){\r\n document.removeEventListener('touchstart', handleDocumentPointerdown);\r\n document.removeEventListener('touchmove', handleDocumentPointermoveChrome);\r\n document.removeEventListener('touchend', handleDocumentKeyupChrome);\r\n document.removeEventListener('mousedown', handleDocumentPointerdown);\r\n document.removeEventListener('mousemove', handleDocumentPointermove);\r\n document.removeEventListener('mouseup', handleDocumentPointerup);\r\n } else {\r\n document.removeEventListener('pointerdown', handleDocumentPointerdown);\r\n document.removeEventListener('pointermove', handleDocumentPointermove);\r\n document.removeEventListener('pointerup', handleDocumentPointerup);\r\n }\r\n document.removeEventListener('keyup', handleDocumentKeyup);\r\n enableUserSelect();\r\n}\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/pen.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport {\r\n findAnnotationAtPoint,\r\n findSVGAtPoint\r\n} from './utils';\r\n\r\nlet _canerase = false;\r\n\r\nfunction handleDocumentMouseDown(e){\r\n _canerase = true;\r\n}\r\n\r\nfunction handleDocumentMouseUp(e){\r\n _canerase = false;\r\n}\r\n\r\nfunction handleDocumentMouseMove(e){\r\n if(_canerase){\r\n let target = findAnnotationAtPoint(e.clientX, e.clientY);\r\n if(target){\r\n console.log(target);\r\n // let annotationId = target.getAttribute('data-pdf-annotate-id');\r\n // let nodes = document.querySelectorAll(`[data-pdf-annotate-id=\"${annotationId}\"]`);\r\n // let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\r\n // let { documentId } = getMetadata(svg);\r\n \r\n // [...nodes].forEach((n) => {\r\n // n.parentNode.removeChild(n);\r\n // });\r\n \r\n // PDFJSAnnotate.getStoreAdapter().deleteAnnotation(documentId, annotationId);\r\n }\r\n }\r\n}\r\n\r\nexport function enableEraser(){\r\n document.addEventListener('mousemove', handleDocumentMouseMove);\r\n document.addEventListener('mousedown', handleDocumentMouseDown);\r\n document.addEventListener('mouseup', handleDocumentMouseUp);\r\n}\r\n\r\nexport function disableEraser(){\r\n document.removeEventListener('mousemove', handleDocumentMouseMove);\r\n}\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/eraser.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport { appendChild } from '../render/appendChild';\r\nimport {\r\n disableUserSelect,\r\n enableUserSelect,\r\n findSVGAtPoint,\r\n findSVGContainer,\r\n getMetadata,\r\n convertToSvgPoint,\r\n convertToScreenPoint,\r\n findAnnotationAtPoint\r\n} from './utils';\r\n\r\nlet _enabled = false;\r\nlet _penSize;\r\nlet _penColor;\r\nlet path;\r\nlet lines;\r\nlet originY;\r\nlet originX;\r\n\r\n/**\r\n * Handle document.mousedown event\r\n */\r\nfunction handleDocumentMousedown(e) {\r\n let target = findAnnotationAtPoint(e.clientX, e.clientY);\r\n if (target === null)\r\n return;\r\n\r\n let type = target.getAttribute('data-pdf-annotate-type');\r\n if (type !== 'circle' && type !== 'fillcircle' && type !== 'emptycircle') {\r\n return;\r\n }\r\n\r\n let svg = findSVGContainer(target);\r\n let { documentId, userId } = getMetadata(svg);\r\n let annotationId = target.getAttribute('data-pdf-annotate-id');\r\n\r\n let event = e;\r\n PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, userId, annotationId).then((annotation) => {\r\n if (annotation) {\r\n path = null;\r\n lines = [];\r\n\r\n let point = convertToScreenPoint([\r\n annotation.cx,\r\n annotation.cy\r\n ], svg);\r\n\r\n let rect = svg.getBoundingClientRect();\r\n\r\n originX = point[0] + rect.left;\r\n originY = point[1] + rect.top; \r\n\r\n document.addEventListener('mousemove', handleDocumentMousemove);\r\n document.addEventListener('mouseup', handleDocumentMouseup);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Handle document.mouseup event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentMouseup(e) {\r\n let svg;\r\n if (lines.length > 1 && (svg = findSVGAtPoint(e.clientX, e.clientY))) {\r\n let { documentId, pageNumber } = getMetadata(svg);\r\n\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, {\r\n type: 'arrow',\r\n width: _penSize,\r\n color: _penColor,\r\n lines\r\n }\r\n ).then((annotation) => {\r\n if (path) {\r\n svg.removeChild(path);\r\n }\r\n\r\n appendChild(svg, annotation);\r\n });\r\n }\r\n\r\n document.removeEventListener('mousemove', handleDocumentMousemove);\r\n document.removeEventListener('mouseup', handleDocumentMouseup);\r\n}\r\n\r\n/**\r\n * Handle document.mousemove event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentMousemove(e) {\r\n let x = lines.length === 0 ? originX : e.clientX;\r\n let y = lines.length === 0 ? originY : e.clientY;\r\n\r\n savePoint(x, y);\r\n}\r\n\r\n/**\r\n * Handle document.keyup event\r\n *\r\n * @param {Event} e The DOM event to be handled\r\n */\r\nfunction handleDocumentKeyup(e) {\r\n // Cancel rect if Esc is pressed\r\n if (e.keyCode === 27) {\r\n lines = null;\r\n path.parentNode.removeChild(path);\r\n document.removeEventListener('mousemove', handleDocumentMousemove);\r\n document.removeEventListener('mouseup', handleDocumentMouseup);\r\n }\r\n}\r\n\r\n/**\r\n * Save a point to the line being drawn.\r\n *\r\n * @param {Number} x The x coordinate of the point\r\n * @param {Number} y The y coordinate of the point\r\n */\r\nfunction savePoint(x, y) {\r\n let svg = findSVGAtPoint(x, y);\r\n if (!svg) {\r\n return;\r\n }\r\n\r\n let rect = svg.getBoundingClientRect();\r\n let point = convertToSvgPoint([\r\n x - rect.left,\r\n y - rect.top\r\n ], svg);\r\n\r\n if (lines.length < 2) {\r\n lines.push(point);\r\n return;\r\n } else {\r\n lines[1] = point; // update end point\r\n }\r\n\r\n if (path) {\r\n svg.removeChild(path);\r\n }\r\n\r\n path = appendChild(svg, {\r\n type: 'arrow',\r\n color: _penColor,\r\n width: _penSize,\r\n lines\r\n });\r\n}\r\n\r\n/**\r\n * Set the attributes of the pen.\r\n *\r\n * @param {Number} penSize The size of the lines drawn by the pen\r\n * @param {String} penColor The color of the lines drawn by the pen\r\n */\r\nexport function setArrow(penSize = 10, penColor = '0000FF') {\r\n _penSize = parseInt(penSize, 10);\r\n _penColor = penColor;\r\n}\r\n\r\n/**\r\n * Enable the pen behavior\r\n */\r\nexport function enableArrow() {\r\n if (_enabled) { return; }\r\n\r\n _enabled = true;\r\n document.addEventListener('mousedown', handleDocumentMousedown);\r\n document.addEventListener('keyup', handleDocumentKeyup);\r\n disableUserSelect();\r\n}\r\n\r\n/**\r\n * Disable the pen behavior\r\n */\r\nexport function disableArrow() {\r\n if (!_enabled) { return; }\r\n\r\n _enabled = false;\r\n document.removeEventListener('mousedown', handleDocumentMousedown);\r\n document.removeEventListener('keyup', handleDocumentKeyup);\r\n enableUserSelect();\r\n}\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/arrow.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport { appendChild } from '../render/appendChild';\r\nimport {\r\n BORDER_COLOR,\r\n findSVGAtPoint,\r\n getMetadata,\r\n scaleDown\r\n} from './utils';\r\n\r\nlet _enabled = false;\r\nlet input;\r\n\r\n/**\r\n * Handle document.mouseup event\r\n *\r\n * @param {Event} The DOM event to be handled\r\n */\r\nfunction handleDocumentMouseup(e) {\r\n if (input || !findSVGAtPoint(e.clientX, e.clientY)) {\r\n return\r\n }\r\n \r\n input = document.createElement('input');\r\n input.setAttribute('id', 'pdf-annotate-point-input');\r\n input.setAttribute('placeholder', 'Enter comment');\r\n input.style.border = `3px solid ${BORDER_COLOR}`;\r\n input.style.borderRadius = '3px';\r\n input.style.position = 'absolute';\r\n input.style.top = `${e.clientY}px`;\r\n input.style.left = `${e.clientX}px`;\r\n\r\n input.addEventListener('blur', handleInputBlur);\r\n input.addEventListener('keyup', handleInputKeyup);\r\n\r\n document.body.appendChild(input);\r\n input.focus();\r\n}\r\n\r\n/**\r\n * Handle input.blur event\r\n */\r\nfunction handleInputBlur() {\r\n savePoint();\r\n}\r\n\r\n/**\r\n * Handle input.keyup event\r\n *\r\n * @param {Event} e The DOM event to handle\r\n */\r\nfunction handleInputKeyup(e) {\r\n if (e.keyCode === 27) {\r\n closeInput();\r\n } else if (e.keyCode === 13) {\r\n savePoint();\r\n }\r\n}\r\n\r\n/**\r\n * Save a new point annotation from input\r\n */\r\nfunction savePoint() {\r\n if (input.value.trim().length > 0) {\r\n let clientX = parseInt(input.style.left, 10);\r\n let clientY = parseInt(input.style.top, 10);\r\n let content = input.value.trim();\r\n let svg = findSVGAtPoint(clientX, clientY);\r\n if (!svg) {\r\n return;\r\n }\r\n\r\n let rect = svg.getBoundingClientRect();\r\n let { documentId, userId, pageNumber } = getMetadata(svg);\r\n let annotation = Object.assign({\r\n type: 'point'\r\n }, scaleDown(svg, {\r\n x: clientX - rect.left,\r\n y: clientY - rect.top\r\n })\r\n );\r\n\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation)\r\n .then((annotation) => {\r\n PDFJSAnnotate.getStoreAdapter().addComment(\r\n documentId,\r\n annotation.uuid,\r\n content\r\n );\r\n\r\n appendChild(svg, annotation);\r\n });\r\n }\r\n\r\n closeInput();\r\n}\r\n\r\n/**\r\n * Close the input element\r\n */\r\nfunction closeInput() {\r\n input.removeEventListener('blur', handleInputBlur);\r\n input.removeEventListener('keyup', handleInputKeyup);\r\n document.body.removeChild(input);\r\n input = null;\r\n}\r\n\r\n/**\r\n * Enable point annotation behavior\r\n */\r\nexport function enablePoint() {\r\n if (_enabled) { return; }\r\n\r\n _enabled = true;\r\n document.addEventListener('mouseup', handleDocumentMouseup);\r\n}\r\n\r\n/**\r\n * Disable point annotation behavior\r\n */\r\nexport function disablePoint() {\r\n if (!_enabled) { return; }\r\n\r\n _enabled = false;\r\n document.removeEventListener('mouseup', handleDocumentMouseup);\r\n}\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/point.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport config from '../config';\r\nimport { appendChild } from '../render/appendChild';\r\nimport {\r\n BORDER_COLOR,\r\n disableUserSelect,\r\n enableUserSelect,\r\n findSVGAtPoint,\r\n getMetadata,\r\n convertToSvgRect\r\n} from './utils';\r\n\r\nlet _enabled = false;\r\nlet _type;\r\nlet overlay;\r\nlet originY;\r\nlet originX;\r\n\r\n/**\r\n * Get the current window selection as rects\r\n *\r\n * @return {Array} An Array of rects\r\n */\r\nfunction getSelectionRects() {\r\n try {\r\n let selection = window.getSelection();\r\n let range = selection.getRangeAt(0);\r\n let rects = range.getClientRects();\r\n\r\n if (rects.length > 0 &&\r\n rects[0].width > 0 &&\r\n rects[0].height > 0) {\r\n return rects;\r\n }\r\n } catch (e) {}\r\n \r\n return null;\r\n}\r\n\r\n/**\r\n * Handle document.mousedown event\r\n *\r\n * @param {Event} e The DOM event to handle\r\n */\r\nfunction handleDocumentMousedown(e) {\r\n let svg;\r\n if (_type !== 'area' || !(svg = findSVGAtPoint(e.clientX, e.clientY))) {\r\n return;\r\n }\r\n\r\n let rect = svg.getBoundingClientRect();\r\n originY = e.clientY;\r\n originX = e.clientX;\r\n\r\n overlay = document.createElement('div');\r\n overlay.style.position = 'absolute';\r\n overlay.style.top = `${originY - rect.top}px`;\r\n overlay.style.left = `${originX - rect.left}px`;\r\n overlay.style.border = `3px solid ${BORDER_COLOR}`;\r\n overlay.style.borderRadius = '3px';\r\n svg.parentNode.appendChild(overlay);\r\n \r\n document.addEventListener('mousemove', handleDocumentMousemove);\r\n disableUserSelect();\r\n}\r\n\r\n/**\r\n * Handle document.mousemove event\r\n *\r\n * @param {Event} e The DOM event to handle\r\n */\r\nfunction handleDocumentMousemove(e) {\r\n let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\r\n let rect = svg.getBoundingClientRect();\r\n\r\n if (originX + (e.clientX - originX) < rect.right) {\r\n overlay.style.width = `${e.clientX - originX}px`;\r\n }\r\n\r\n if (originY + (e.clientY - originY) < rect.bottom) {\r\n overlay.style.height = `${e.clientY - originY}px`;\r\n }\r\n}\r\n\r\n/**\r\n * Handle document.mouseup event\r\n *\r\n * @param {Event} e The DOM event to handle\r\n */\r\nfunction handleDocumentMouseup(e) {\r\n let rects;\r\n if (_type !== 'area' && (rects = getSelectionRects())) {\r\n let svg = findSVGAtPoint(rects[0].left, rects[0].top);\r\n saveRect(_type, [...rects].map((r) => {\r\n return {\r\n top: r.top,\r\n left: r.left,\r\n width: r.width,\r\n height: r.height\r\n };\r\n }));\r\n } else if (_type === 'area' && overlay) {\r\n let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());\r\n let rect = svg.getBoundingClientRect();\r\n saveRect(_type, [{\r\n top: parseInt(overlay.style.top, 10) + rect.top,\r\n left: parseInt(overlay.style.left, 10) + rect.left,\r\n width: parseInt(overlay.style.width, 10),\r\n height: parseInt(overlay.style.height, 10)\r\n }]);\r\n\r\n overlay.parentNode.removeChild(overlay);\r\n overlay = null;\r\n\r\n document.removeEventListener('mousemove', handleDocumentMousemove);\r\n enableUserSelect();\r\n }\r\n}\r\n\r\n/**\r\n * Handle document.keyup event\r\n *\r\n * @param {Event} e The DOM event to handle\r\n */\r\nfunction handleDocumentKeyup(e) {\r\n // Cancel rect if Esc is pressed\r\n if (e.keyCode === 27) {\r\n let selection = window.getSelection();\r\n selection.removeAllRanges();\r\n if (overlay && overlay.parentNode) {\r\n overlay.parentNode.removeChild(overlay);\r\n overlay = null;\r\n document.removeEventListener('mousemove', handleDocumentMousemove);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Save a rect annotation\r\n *\r\n * @param {String} type The type of rect (area, highlight, strikeout)\r\n * @param {Array} rects The rects to use for annotation\r\n * @param {String} color The color of the rects\r\n */\r\nfunction saveRect(type, rects, color) {\r\n let svg = findSVGAtPoint(rects[0].left, rects[0].top);\r\n let annotation;\r\n\r\n if (!svg) {\r\n return;\r\n }\r\n\r\n let boundingRect = svg.getBoundingClientRect();\r\n\r\n if (!color) {\r\n if (type === 'highlight') {\r\n color = 'FFFF00';\r\n } else if (type === 'strikeout') {\r\n color = 'FF0000';\r\n }\r\n }\r\n\r\n // Initialize the annotation\r\n annotation = {\r\n type,\r\n color,\r\n rectangles: [...rects].map((r) => {\r\n let offset = 0;\r\n\r\n if (type === 'strikeout') {\r\n offset = r.height / 2;\r\n }\r\n\r\n return convertToSvgRect({\r\n y: (r.top + offset) - boundingRect.top,\r\n x: r.left - boundingRect.left,\r\n width: r.width,\r\n height: r.height\r\n }, svg);\r\n }).filter((r) => r.width > 0 && r.height > 0 && r.x > -1 && r.y > -1)\r\n };\r\n \r\n // Short circuit if no rectangles exist\r\n if (annotation.rectangles.length === 0) {\r\n return;\r\n }\r\n\r\n // Special treatment for area as it only supports a single rect\r\n if (type === 'area') {\r\n let rect = annotation.rectangles[0];\r\n delete annotation.rectangles;\r\n annotation.x = rect.x;\r\n annotation.y = rect.y;\r\n annotation.width = rect.width;\r\n annotation.height = rect.height;\r\n }\r\n\r\n let { documentId, userId, pageNumber } = getMetadata(svg);\r\n\r\n // Add the annotation\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation)\r\n .then((annotation) => {\r\n appendChild(svg, annotation);\r\n });\r\n}\r\n\r\n/**\r\n * Enable rect behavior\r\n */\r\nexport function enableRect(type) {\r\n _type = type;\r\n \r\n if (_enabled) { return; }\r\n\r\n _enabled = true;\r\n document.addEventListener('mouseup', handleDocumentMouseup);\r\n document.addEventListener('mousedown', handleDocumentMousedown);\r\n document.addEventListener('keyup', handleDocumentKeyup);\r\n}\r\n\r\n/**\r\n * Disable rect behavior\r\n */\r\nexport function disableRect() {\r\n if (!_enabled) { return; }\r\n\r\n _enabled = false;\r\n document.removeEventListener('mouseup', handleDocumentMouseup);\r\n document.removeEventListener('mousedown', handleDocumentMousedown);\r\n document.removeEventListener('keyup', handleDocumentKeyup);\r\n}\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/rect.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport config from '../config';\r\nimport { appendChild } from '../render/appendChild';\r\nimport {\r\n findSVGAtPoint,\r\n getMetadata,\r\n convertToSvgPoint\r\n} from './utils';\r\n\r\nlet _enabled = false;\r\nlet _type;\r\nlet _circleRadius = 10;\r\nlet _circleColor = '0000FF';\r\n\r\n/**\r\n * Set the attributes of the pen.\r\n *\r\n * @param {Number} circleRadius The radius of the circle\r\n * @param {String} circleColor The color of the circle\r\n */\r\nexport function setCircle(circleRadius = 10, circleColor = '0000FF') {\r\n _circleRadius = parseInt(circleRadius, 10);\r\n _circleColor = circleColor;\r\n}\r\n\r\n/**\r\n * Handle document.mouseup event\r\n *\r\n * @param {Event} e The DOM event to handle\r\n */\r\nfunction handleDocumentMouseup(e) {\r\n let svg = findSVGAtPoint(e.clientX, e.clientY);\r\n if (!svg) {\r\n return;\r\n }\r\n let rect = svg.getBoundingClientRect();\r\n saveCircle(svg, _type, {\r\n x: e.clientX - rect.left,\r\n y: e.clientY - rect.top\r\n }, _circleRadius, _circleColor\r\n );\r\n}\r\n\r\n/**\r\n * Save a circle annotation\r\n *\r\n * @param {String} type The type of circle (circle, emptycircle, fillcircle)\r\n * @param {Object} pt The point to use for annotation\r\n * @param {String} color The color of the rects\r\n */\r\nfunction saveCircle(svg, type, pt, radius, color) {\r\n // Initialize the annotation\r\n let svg_pt = convertToSvgPoint([ pt.x, pt.y ], svg)\r\n let annotation = {\r\n type,\r\n color,\r\n cx: svg_pt[0],\r\n cy: svg_pt[1],\r\n r: radius\r\n };\r\n\r\n let { documentId, userId, pageNumber } = getMetadata(svg);\r\n\r\n // Add the annotation\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation)\r\n .then((annotation) => {\r\n appendChild(svg, annotation);\r\n });\r\n}\r\n\r\n/**\r\n * Enable circle behavior\r\n */\r\nexport function enableCircle(type) {\r\n _type = type;\r\n \r\n if (_enabled) { return; }\r\n\r\n _enabled = true;\r\n document.addEventListener('mouseup', handleDocumentMouseup);\r\n}\r\n\r\n/**\r\n * Disable circle behavior\r\n */\r\nexport function disableCircle() {\r\n if (!_enabled) { return; }\r\n\r\n _enabled = false;\r\n document.removeEventListener('mouseup', handleDocumentMouseup);\r\n}\r\n\r\nexport function addCircle(type, e) {\r\n let oldType = _type;\r\n _type = type;\r\n handleDocumentMouseup(e);\r\n _type = oldType; \r\n}\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/circle.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport { appendChild } from '../render/appendChild';\r\nimport {\r\n BORDER_COLOR,\r\n findSVGAtPoint,\r\n getMetadata,\r\n convertToSvgPoint\r\n} from './utils';\r\n\r\nlet _enabled = false;\r\nlet input;\r\nlet _textSize;\r\nlet _textColor;\r\n\r\n/**\r\n * Handle document.mouseup event\r\n *\r\n * @param {Event} e The DOM event to handle\r\n */\r\nfunction handleDocumentMouseup(e) {\r\n if (input || !findSVGAtPoint(e.clientX, e.clientY)) {\r\n return;\r\n }\r\n\r\n input = document.createElement('input');\r\n input.setAttribute('id', 'pdf-annotate-text-input');\r\n input.setAttribute('placeholder', 'Enter text');\r\n input.style.border = `3px solid ${BORDER_COLOR}`;\r\n input.style.borderRadius = '3px';\r\n input.style.position = 'absolute';\r\n input.style.top = `${e.clientY}px`;\r\n input.style.left = `${e.clientX}px`;\r\n input.style.fontSize = `${_textSize}px`;\r\n input.style.zIndex = \"41\";\r\n input.addEventListener('blur', handleInputBlur);\r\n input.addEventListener('keyup', handleInputKeyup);\r\n\r\n document.body.appendChild(input);\r\n input.focus();\r\n}\r\n\r\n/**\r\n * Handle input.blur event\r\n */\r\nfunction handleInputBlur() {\r\n saveText();\r\n}\r\n\r\n/**\r\n * Handle input.keyup event\r\n *\r\n * @param {Event} e The DOM event to handle\r\n */\r\nfunction handleInputKeyup(e) {\r\n if (e.keyCode === 27) {\r\n closeInput();\r\n } else if (e.keyCode === 13) {\r\n saveText();\r\n }\r\n}\r\n\r\n/**\r\n * Save a text annotation from input\r\n */\r\nfunction saveText() {\r\n if (input.value.trim().length > 0) {\r\n let clientX = parseInt(input.style.left, 10);\r\n let clientY = parseInt(input.style.top, 10);\r\n let svg = findSVGAtPoint(clientX, clientY);\r\n if (!svg) {\r\n return;\r\n }\r\n let height = _textSize;\r\n let { documentId, userId, pageNumber, viewport } = getMetadata(svg);\r\n let scale = 1 / viewport.scale;\r\n let rect = svg.getBoundingClientRect();\r\n let pt = convertToSvgPoint([\r\n clientX - rect.left, \r\n clientY - rect.top + height], svg, viewport);\r\n let annotation = {\r\n type: 'textbox',\r\n size: _textSize * scale,\r\n color: _textColor,\r\n content: input.value.trim(),\r\n x: pt[0],\r\n y: pt[1],\r\n rotation: -viewport.rotation\r\n }\r\n\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation)\r\n .then((annotation) => {\r\n appendChild(svg, annotation);\r\n });\r\n }\r\n \r\n closeInput();\r\n}\r\n\r\n/**\r\n * Close the input\r\n */\r\nfunction closeInput() {\r\n if (input) {\r\n input.removeEventListener('blur', handleInputBlur);\r\n input.removeEventListener('keyup', handleInputKeyup);\r\n document.body.removeChild(input);\r\n input = null;\r\n }\r\n}\r\n\r\n/**\r\n * Set the text attributes\r\n *\r\n * @param {Number} textSize The size of the text\r\n * @param {String} textColor The color of the text\r\n */\r\nexport function setText(textSize = 12, textColor = '000000') {\r\n _textSize = parseInt(textSize, 10);\r\n _textColor = textColor;\r\n}\r\n\r\n\r\n/**\r\n * Enable text behavior\r\n */\r\nexport function enableText() {\r\n if (_enabled) { return; }\r\n\r\n _enabled = true;\r\n document.addEventListener('mouseup', handleDocumentMouseup);\r\n}\r\n\r\n\r\n/**\r\n * Disable text behavior\r\n */\r\nexport function disableText() {\r\n if (!_enabled) { return; }\r\n\r\n _enabled = false;\r\n document.removeEventListener('mouseup', handleDocumentMouseup);\r\n}\r\n\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/text.js\n **/","import PDFJSAnnotate from '../PDFJSAnnotate';\r\nimport config from '../config';\r\nimport renderScreenReaderHints from '../a11y/renderScreenReaderHints';\r\n\r\n// Template for creating a new page\r\nconst PAGE_TEMPLATE = `\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n`;\r\n\r\n/**\r\n * Create a new page to be appended to the DOM.\r\n *\r\n * @param {Number} pageNumber The page number that is being created\r\n * @return {HTMLElement}\r\n */\r\nexport function createPage(pageNumber) {\r\n let temp = document.createElement('div');\r\n temp.innerHTML = PAGE_TEMPLATE;\r\n\r\n let page = temp.children[0];\r\n let canvas = page.querySelector('canvas');\r\n\r\n page.setAttribute('id', `pageContainer${pageNumber}`);\r\n page.setAttribute('data-page-number', pageNumber);\r\n\r\n canvas.mozOpaque = true;\r\n canvas.setAttribute('id', `page${pageNumber}`);\r\n\r\n return page;\r\n}\r\n\r\n/**\r\n * Render a page that has already been created.\r\n *\r\n * @param {Number} pageNumber The page number to be rendered\r\n * @param {Object} renderOptions The options for rendering\r\n * @return {Promise} Settled once rendering has completed\r\n * A settled Promise will be either:\r\n * - fulfilled: [pdfPage, annotations]\r\n * - rejected: Error\r\n */\r\nexport function renderPage(pageNumber, renderOptions) {\r\n let {\r\n documentId,\r\n userId,\r\n pdfDocument,\r\n scale,\r\n rotate\r\n } = renderOptions;\r\n\r\n // Load the page and annotations\r\n return Promise.all([\r\n pdfDocument.getPage(pageNumber),\r\n PDFJSAnnotate.getAnnotations(documentId, userId, pageNumber)\r\n ]).then(([pdfPage, annotations]) => {\r\n let page = document.getElementById(`pageContainer${pageNumber}`);\r\n let svg = page.querySelector(config.annotationClassQuery());\r\n let canvas = page.querySelector('.canvasWrapper canvas');\r\n let canvasContext = canvas.getContext('2d', {alpha: false});\r\n let totalRotation = (rotate + pdfPage.rotate) % 360;\r\n let viewport = pdfPage.getViewport(scale, totalRotation);\r\n let transform = scalePage(pageNumber, viewport, canvasContext);\r\n\r\n // Render the page\r\n return Promise.all([\r\n pdfPage.render({ canvasContext, viewport, transform }),\r\n PDFJSAnnotate.render(svg, viewport, annotations)\r\n ]).then(() => {\r\n // Text content is needed for a11y, but is also necessary for creating\r\n // highlight and strikeout annotations which require selecting text.\r\n return pdfPage.getTextContent({normalizeWhitespace: true}).then((textContent) => {\r\n return new Promise((resolve, reject) => {\r\n // Render text layer for a11y of text content\r\n let textLayer = page.querySelector(config.textClassQuery());\r\n let textLayerFactory = new PDFJS.DefaultTextLayerFactory();\r\n let textLayerBuilder = textLayerFactory.createTextLayerBuilder(textLayer, pageNumber -1, viewport);\r\n textLayerBuilder.setTextContent(textContent);\r\n textLayerBuilder.render();\r\n\r\n // Enable a11y for annotations\r\n // Timeout is needed to wait for `textLayerBuilder.render`\r\n setTimeout(() => {\r\n try {\r\n renderScreenReaderHints(annotations.annotations);\r\n resolve();\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n });\r\n });\r\n }).then(() => {\r\n // Indicate that the page was loaded\r\n page.setAttribute('data-loaded', 'true');\r\n\r\n return [pdfPage, annotations];\r\n });\r\n });\r\n}\r\n\r\n/**\r\n * Scale the elements of a page.\r\n *\r\n * @param {Number} pageNumber The page number to be scaled\r\n * @param {Object} viewport The viewport of the PDF page (see pdfPage.getViewport(scale, rotate))\r\n * @param {Object} context The canvas context that the PDF page is rendered to\r\n * @return {Array} The transform data for rendering the PDF page\r\n */\r\nfunction scalePage(pageNumber, viewport, context) {\r\n let page = document.getElementById(`pageContainer${pageNumber}`);\r\n let canvas = page.querySelector('.canvasWrapper canvas');\r\n let svg = page.querySelector(config.annotationClassQuery());\r\n let wrapper = page.querySelector('.canvasWrapper');\r\n let textLayer = page.querySelector(config.textClassQuery());\r\n let outputScale = getOutputScale(context);\r\n let transform = !outputScale.scaled ? null : [outputScale.sx, 0, 0, outputScale.sy, 0, 0];\r\n let sfx = approximateFraction(outputScale.sx);\r\n let sfy = approximateFraction(outputScale.sy);\r\n\r\n // Adjust width/height for scale\r\n page.style.visibility = '';\r\n canvas.width = roundToDivide(viewport.width * outputScale.sx, sfx[0]);\r\n canvas.height = roundToDivide(viewport.height * outputScale.sy, sfy[0]);\r\n canvas.style.width = roundToDivide(viewport.width, sfx[1]) + 'px';\r\n canvas.style.height = roundToDivide(viewport.height, sfx[1]) + 'px';\r\n svg.setAttribute('width', viewport.width);\r\n svg.setAttribute('height', viewport.height);\r\n svg.style.width = `${viewport.width}px`;\r\n svg.style.height = `${viewport.height}px`;\r\n page.style.width = `${viewport.width}px`;\r\n page.style.height = `${viewport.height}px`;\r\n wrapper.style.width = `${viewport.width}px`;\r\n wrapper.style.height = `${viewport.height}px`;\r\n textLayer.style.width = `${viewport.width}px`;\r\n textLayer.style.height = `${viewport.height}px`;\r\n\r\n return transform;\r\n}\r\n\r\n\r\n/**\r\n * Approximates a float number as a fraction using Farey sequence (max order of 8).\r\n *\r\n * @param {Number} x Positive float number\r\n * @return {Array} Estimated fraction: the first array item is a numerator,\r\n * the second one is a denominator.\r\n */\r\nfunction approximateFraction(x) {\r\n // Fast path for int numbers or their inversions.\r\n if (Math.floor(x) === x) {\r\n return [x, 1];\r\n }\r\n\r\n const xinv = 1 / x;\r\n const limit = 8;\r\n if (xinv > limit) {\r\n return [1, limit];\r\n } else if (Math.floor(xinv) === xinv) {\r\n return [1, xinv];\r\n }\r\n\r\n const x_ = x > 1 ? xinv : x;\r\n \r\n // a/b and c/d are neighbours in Farey sequence.\r\n let a = 0, b = 1, c = 1, d = 1;\r\n \r\n // Limit search to order 8.\r\n while (true) {\r\n // Generating next term in sequence (order of q).\r\n let p = a + c, q = b + d;\r\n if (q > limit) {\r\n break;\r\n }\r\n if (x_ <= p / q) {\r\n c = p; d = q;\r\n } else {\r\n a = p; b = q;\r\n }\r\n }\r\n\r\n // Select closest of neighbours to x.\r\n if (x_ - a / b < c / d - x_) {\r\n return x_ === x ? [a, b] : [b, a];\r\n } else {\r\n return x_ === x ? [c, d] : [d, c];\r\n }\r\n}\r\n\r\nfunction getOutputScale(ctx) {\r\n let devicePixelRatio = window.devicePixelRatio || 1;\r\n let backingStoreRatio = ctx.webkitBackingStorePixelRatio ||\r\n ctx.mozBackingStorePixelRatio ||\r\n ctx.msBackingStorePixelRatio ||\r\n ctx.oBackingStorePixelRatio ||\r\n ctx.backingStorePixelRatio || 1;\r\n let pixelRatio = devicePixelRatio / backingStoreRatio;\r\n return {\r\n sx: pixelRatio,\r\n sy: pixelRatio,\r\n scaled: pixelRatio !== 1\r\n };\r\n}\r\n\r\nfunction roundToDivide(x, div) {\r\n let r = x % div;\r\n return r === 0 ? x : Math.round(x - r + div);\r\n}\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/UI/page.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/pdf-annotate.min.js b/dist/pdf-annotate.min.js index 5d163b4f..fb6aaa8b 100644 --- a/dist/pdf-annotate.min.js +++ b/dist/pdf-annotate.min.js @@ -1,8 +1,8 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PDFAnnotate=t():e.PDFAnnotate=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=r(o);t["default"]=i["default"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=r(o),a=n(20),u=r(a),d=n(22),l=r(d),c=n(32),s=r(c),f=n(27),p=r(f),v=n(21),h=r(v),m=n(6);t["default"]={findAnnotationAtPoint:m.findAnnotationAtPoint,findSVGContainer:m.findSVGContainer,convertToScreenPoint:m.convertToScreenPoint,StoreAdapter:i["default"],LocalStoreAdapter:u["default"],__storeAdapter:new i["default"],getStoreAdapter:function(){return this.__storeAdapter},setStoreAdapter:function(e){this.__storeAdapter=e},UI:s["default"],render:l["default"],getAnnotations:function(e,t){var n;return(n=this.getStoreAdapter()).getAnnotations.apply(n,arguments)},config:p["default"],uuid:h["default"]},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),Object.keys(n).forEach(function(e){"function"==typeof n[e]&&"function"==typeof t[e]&&(t[e]=n[e])})}return i(e,[{key:"__getAnnotations",value:function(e,t){(0,u["default"])("getAnnotations")}},{key:"getAnnotation",value:function(e,t){(0,u["default"])("getAnnotation")}},{key:"__addAnnotation",value:function(e,t,n){(0,u["default"])("addAnnotation")}},{key:"__editAnnotation",value:function(e,t,n){(0,u["default"])("editAnnotation")}},{key:"__deleteAnnotation",value:function(e,t){(0,u["default"])("deleteAnnotation")}},{key:"getComments",value:function(e,t){(0,u["default"])("getComments")}},{key:"__addComment",value:function(e,t,n){(0,u["default"])("addComment")}},{key:"__deleteComment",value:function(e,t){(0,u["default"])("deleteComment")}},{key:"getAnnotations",get:function(){return this.__getAnnotations},set:function(e){this.__getAnnotations=function(t,n){return e.apply(void 0,arguments).then(function(e){return e.annotations&&e.annotations.forEach(function(e){e.documentId=t}),e})}}},{key:"addAnnotation",get:function(){return this.__addAnnotation},set:function(e){this.__addAnnotation=function(t,n,r){return e.apply(void 0,arguments).then(function(e){return(0,d.fireEvent)("annotation:add",t,n,e),e})}}},{key:"editAnnotation",get:function(){return this.__editAnnotation},set:function(e){this.__editAnnotation=function(t,n,r){return e.apply(void 0,arguments).then(function(e){return(0,d.fireEvent)("annotation:edit",t,n,e),e})}}},{key:"deleteAnnotation",get:function(){return this.__deleteAnnotation},set:function(e){this.__deleteAnnotation=function(t,n){return e.apply(void 0,arguments).then(function(e){return e&&(0,d.fireEvent)("annotation:delete",t,n),e})}}},{key:"addComment",get:function(){return this.__addComment},set:function(e){this.__addComment=function(t,n,r){return e.apply(void 0,arguments).then(function(e){return(0,d.fireEvent)("comment:add",t,n,e),e})}}},{key:"deleteComment",get:function(){return this.__deleteComment},set:function(e){this.__deleteComment=function(t,n){return e.apply(void 0,arguments).then(function(e){return e&&(0,d.fireEvent)("comment:delete",t,n),e})}}}]),e}();t["default"]=l,e.exports=t["default"]},function(e,t){"use strict";function n(e){throw new Error(e+" is not implemented")}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){c.emit.apply(c,arguments)}function i(){c.on.apply(c,arguments)}function a(){c.removeListener.apply(c,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.fireEvent=o,t.addEventListener=i,t.removeEventListener=a;var u=n(5),d=r(u),l=n(6),c=new d["default"],s=void 0;document.addEventListener("click",function(e){if((0,l.findSVGAtPoint)(e.clientX,e.clientY)){var t=(0,l.findAnnotationAtPoint)(e.clientX,e.clientY);s&&s!==t&&c.emit("annotation:blur",s),t&&c.emit("annotation:click",t),s=t}})},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,u,d,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:u=Array.prototype.slice.call(arguments,1),n.apply(this,u)}else if(i(n))for(u=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,d=0;d0&&this._events[e].length>o&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,a,u;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(u=a;u-- >0;)if(n[u]===t||n[u].listener&&n[u].listener===t){o=u;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){for(var t=e;(t=t.parentNode)&&t!==document;)if("SVG"===t.nodeName.toUpperCase()&&"true"===t.getAttribute("data-pdf-annotate-container"))return t;return null}function i(e,t){for(var n=document.querySelectorAll('svg[data-pdf-annotate-container="true"]'),r=0,o=n.length;r=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right}function d(e){var t=e.getBoundingClientRect(),n=h(e),r=n.offsetLeft,o=n.offsetTop;return{top:t.top-o,left:t.left-r,right:t.right-r,bottom:t.bottom-o,width:t.width,height:t.height}}function l(e,t){var n={},r=g(e),o=r.viewport;return Object.keys(t).forEach(function(e){n[e]=t[e]*o.scale}),n}function c(e,t,n){var r=[e.x,e.y],o=[e.x+e.width,e.y+e.height];return r=s(r,t,n),o=s(o,t,n),{x:Math.min(r[0],o[0]),y:Math.min(r[1],o[1]),width:Math.abs(o[0]-r[0]),height:Math.abs(o[1]-r[1])}}function s(e,t,n){n=n||g(t).viewport;var r=[1,0,0,1,0,0];r=(0,w.scale)(r,n.scale,n.scale),r=(0,w.rotate)(r,n.rotation);var o=(0,_.getTranslation)(n);return r=(0,w.translate)(r,o.x,o.y),(0,w.applyInverseTransform)(e,r)}function f(e,t,n){n=n||g(t).viewport;var r=[1,0,0,1,0,0];r=(0,w.scale)(r,n.scale,n.scale),r=(0,w.rotate)(r,n.rotation);var o=(0,_.getTranslation)(n);return r=(0,w.translate)(r,o.x,o.y),(0,w.applyTransform)(e,r)}function p(e,t){var n={},r=g(e),o=r.viewport;return Object.keys(t).forEach(function(e){n[e]=t[e]/o.scale}),n}function v(e){for(var t=0,n=0,r=e;(r=r.parentNode)&&r!==document;)t+=r.scrollTop,n+=r.scrollLeft;return{scrollTop:t,scrollLeft:n}}function h(e){for(var t=e;(t=t.parentNode)&&t!==document&&"SVG"!==t.nodeName.toUpperCase(););var n=t.getBoundingClientRect();return{offsetLeft:n.left,offsetTop:n.top}}function m(){A.parentNode||document.head.appendChild(A)}function y(){A.parentNode&&A.parentNode.removeChild(A)}function g(e){return{documentId:e.getAttribute("data-pdf-annotate-document"),pageNumber:parseInt(e.getAttribute("data-pdf-annotate-page"),10),viewport:JSON.parse(e.getAttribute("data-pdf-annotate-viewport"))}}Object.defineProperty(t,"__esModule",{value:!0}),t.BORDER_COLOR=void 0,t.findSVGContainer=o,t.findSVGAtPoint=i,t.findAnnotationAtPoint=a,t.pointIntersectsRect=u,t.getOffsetAnnotationRect=d,t.scaleUp=l,t.convertToSvgRect=c,t.convertToSvgPoint=s,t.convertToScreenPoint=f,t.scaleDown=p,t.getScroll=v,t.getOffset=h,t.disableUserSelect=m,t.enableUserSelect=y,t.getMetadata=g;var b=n(7),x=r(b),_=n(8),w=n(19),A=(t.BORDER_COLOR="#00BFFF",(0,x["default"])({body:{"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}}));A.setAttribute("data-pdf-annotate-user-select","true")},function(e,t){function n(e,t){return e+" {\n"+r(t)+"\n}"}function r(e){return Object.keys(e).map(function(t){return o(t,e[t])}).join("\n")}function o(e,t){return isNaN(t)||0==t||(t+="px"),i(e)+": "+t+";"}function i(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}e.exports=function(e){var t=document.createElement("style"),r=Object.keys(e).map(function(t){return n(t,e[t])}).join("\n");return t.setAttribute("type","text/css"),t.appendChild(document.createTextNode(r)),t}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=void 0,n=void 0;switch(e.rotation%360){case 0:t=n=0;break;case 90:t=0,n=e.width/e.scale*-1;break;case 180:t=e.width/e.scale*-1,n=e.height/e.scale*-1;break;case 270:t=e.height/e.scale*-1,n=0}return{x:t,y:n}}function i(e,t){var n=o(t);if(e.setAttribute("transform","scale("+t.scale+") rotate("+t.rotation+") translate("+n.x+", "+n.y+")"),!E&&"svg"===e.nodeName.toLowerCase()){e.setAttribute("x",parseInt(e.getAttribute("x"),10)*t.scale),e.setAttribute("y",parseInt(e.getAttribute("y"),10)*t.scale);var r=parseInt(e.getAttribute("x",10)),a=parseInt(e.getAttribute("y",10)),u=parseInt(e.getAttribute("width"),10),d=parseInt(e.getAttribute("height"),10),c=e.querySelector("path"),s=c.parentNode;switch([e,s,c,e.querySelector("rect")].forEach(function(e){e.setAttribute("width",parseInt(e.getAttribute("width"),10)*t.scale),e.setAttribute("height",parseInt(e.getAttribute("height"),10)*t.scale)}),i(c,(0,l["default"])({},t,{scale:1})),t.rotation%360){case 90:e.setAttribute("x",t.width-a-u),e.setAttribute("y",r),s.setAttribute("x",1),s.setAttribute("y",0);break;case 180:e.setAttribute("x",t.width-r-u),e.setAttribute("y",t.height-a-d),s.setAttribute("y",2);break;case 270:e.setAttribute("x",a),e.setAttribute("y",t.height-r-d),s.setAttribute("x",-1),s.setAttribute("y",0)}}return e}function a(e,t,n){n||(n=JSON.parse(e.getAttribute("data-pdf-annotate-viewport")));var r=void 0;switch(t.type){case"area":case"highlight":r=(0,y["default"])(t);break;case"circle":case"fillcircle":case"emptycircle":r=(0,_["default"])(t);break;case"strikeout":r=(0,s["default"])(t);break;case"point":r=(0,h["default"])(t);break;case"textbox":r=(0,b["default"])(t);break;case"drawing":r=(0,p["default"])(t);break;case"arrow":r=(0,A["default"])(t)}return r&&(r.setAttribute("data-pdf-annotate-id",t.uuid),r.setAttribute("data-pdf-annotate-type",t.type),r.setAttribute("aria-hidden",!0),e.appendChild(i(r,n))),r}function u(e,t,n){return n||(n=JSON.parse(e.getAttribute("data-pdf-annotate-viewport"))),t&&(t=i(t,n)),t}Object.defineProperty(t,"__esModule",{value:!0}),t.getTranslation=o,t.appendChild=a,t.transformChild=u;var d=n(9),l=r(d),c=n(10),s=r(c),f=n(13),p=r(f),v=n(14),h=r(v),m=n(15),y=r(m),g=n(16),b=r(g),x=n(17),_=r(x),w=n(18),A=r(w),E=/firefox/i.test(navigator.userAgent);t["default"]={getTranslation:o,appendChild:a,transformChild:u}},function(e,t){/* +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PDFAnnotate=t():e.PDFAnnotate=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=r(o);t["default"]=i["default"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=r(o),a=n(20),u=r(a),d=n(22),l=r(d),s=n(32),c=r(s),f=n(27),p=r(f),v=n(21),h=r(v),m=n(6);t["default"]={findAnnotationAtPoint:m.findAnnotationAtPoint,findSVGContainer:m.findSVGContainer,convertToScreenPoint:m.convertToScreenPoint,StoreAdapter:i["default"],LocalStoreAdapter:u["default"],__storeAdapter:new i["default"],getStoreAdapter:function(){return this.__storeAdapter},setStoreAdapter:function(e){this.__storeAdapter=e},UI:c["default"],render:l["default"],getAnnotations:function(e,t,n){var r;return(r=this.getStoreAdapter()).getAnnotations.apply(r,arguments)},config:p["default"],uuid:h["default"]},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),Object.keys(n).forEach(function(e){"function"==typeof n[e]&&"function"==typeof t[e]&&(t[e]=n[e])})}return i(e,[{key:"__getAnnotations",value:function(e,t,n){(0,u["default"])("getAnnotations")}},{key:"getAnnotation",value:function(e,t){(0,u["default"])("getAnnotation")}},{key:"__addAnnotation",value:function(e,t,n,r){(0,u["default"])("addAnnotation")}},{key:"__editAnnotation",value:function(e,t,n){(0,u["default"])("editAnnotation")}},{key:"__deleteAnnotation",value:function(e,t){(0,u["default"])("deleteAnnotation")}},{key:"getComments",value:function(e,t){(0,u["default"])("getComments")}},{key:"__addComment",value:function(e,t,n){(0,u["default"])("addComment")}},{key:"__deleteComment",value:function(e,t){(0,u["default"])("deleteComment")}},{key:"getAnnotations",get:function(){return this.__getAnnotations},set:function(e){this.__getAnnotations=function(t,n,r){return e.apply(void 0,arguments).then(function(e){return e.annotations&&e.annotations.forEach(function(e){e.documentId=t}),e})}}},{key:"addAnnotation",get:function(){return this.__addAnnotation},set:function(e){this.__addAnnotation=function(t,n,r,o){return e.apply(void 0,arguments).then(function(e){return(0,d.fireEvent)("annotation:add",t,n,r,e),e})}}},{key:"editAnnotation",get:function(){return this.__editAnnotation},set:function(e){this.__editAnnotation=function(t,n,r){return e.apply(void 0,arguments).then(function(e){return(0,d.fireEvent)("annotation:edit",t,n,e),e})}}},{key:"deleteAnnotation",get:function(){return this.__deleteAnnotation},set:function(e){this.__deleteAnnotation=function(t,n){return e.apply(void 0,arguments).then(function(e){return e&&(0,d.fireEvent)("annotation:delete",t,n),e})}}},{key:"addComment",get:function(){return this.__addComment},set:function(e){this.__addComment=function(t,n,r){return e.apply(void 0,arguments).then(function(e){return(0,d.fireEvent)("comment:add",t,n,e),e})}}},{key:"deleteComment",get:function(){return this.__deleteComment},set:function(e){this.__deleteComment=function(t,n){return e.apply(void 0,arguments).then(function(e){return e&&(0,d.fireEvent)("comment:delete",t,n),e})}}}]),e}();t["default"]=l,e.exports=t["default"]},function(e,t){"use strict";function n(e){throw new Error(e+" is not implemented")}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){s.emit.apply(s,arguments)}function i(){s.on.apply(s,arguments)}function a(){s.removeListener.apply(s,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.fireEvent=o,t.addEventListener=i,t.removeEventListener=a;var u=n(5),d=r(u),l=n(6),s=new d["default"],c=void 0;document.addEventListener("click",function(e){if((0,l.findSVGAtPoint)(e.clientX,e.clientY)){var t=(0,l.findAnnotationAtPoint)(e.clientX,e.clientY);c&&c!==t&&s.emit("annotation:blur",c),t&&s.emit("annotation:click",t),c=t}})},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,u,d,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var s=new Error('Uncaught, unspecified "error" event. ('+t+")");throw s.context=t,s}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:u=Array.prototype.slice.call(arguments,1),n.apply(this,u)}else if(i(n))for(u=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,d=0;d0&&this._events[e].length>o&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,a,u;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(u=a;u-- >0;)if(n[u]===t||n[u].listener&&n[u].listener===t){o=u;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){for(var t=e;(t=t.parentNode)&&t!==document;)if("SVG"===t.nodeName.toUpperCase()&&"true"===t.getAttribute("data-pdf-annotate-container"))return t;return null}function i(e,t){for(var n=document.querySelectorAll('svg[data-pdf-annotate-container="true"]'),r=0,o=n.length;r=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right}function d(e){var t=e.getBoundingClientRect(),n=h(e),r=n.offsetLeft,o=n.offsetTop;return{top:t.top-o,left:t.left-r,right:t.right-r,bottom:t.bottom-o,width:t.width,height:t.height}}function l(e,t){var n={},r=g(e),o=r.viewport;return Object.keys(t).forEach(function(e){n[e]=t[e]*o.scale}),n}function s(e,t,n){var r=[e.x,e.y],o=[e.x+e.width,e.y+e.height];return r=c(r,t,n),o=c(o,t,n),{x:Math.min(r[0],o[0]),y:Math.min(r[1],o[1]),width:Math.abs(o[0]-r[0]),height:Math.abs(o[1]-r[1])}}function c(e,t,n){n=n||g(t).viewport;var r=[1,0,0,1,0,0];r=(0,w.scale)(r,n.scale,n.scale),r=(0,w.rotate)(r,n.rotation);var o=(0,_.getTranslation)(n);return r=(0,w.translate)(r,o.x,o.y),(0,w.applyInverseTransform)(e,r)}function f(e,t,n){n=n||g(t).viewport;var r=[1,0,0,1,0,0];r=(0,w.scale)(r,n.scale,n.scale),r=(0,w.rotate)(r,n.rotation);var o=(0,_.getTranslation)(n);return r=(0,w.translate)(r,o.x,o.y),(0,w.applyTransform)(e,r)}function p(e,t){var n={},r=g(e),o=r.viewport;return Object.keys(t).forEach(function(e){n[e]=t[e]/o.scale}),n}function v(e){for(var t=0,n=0,r=e;(r=r.parentNode)&&r!==document;)t+=r.scrollTop,n+=r.scrollLeft;return{scrollTop:t,scrollLeft:n}}function h(e){for(var t=e;(t=t.parentNode)&&t!==document&&"SVG"!==t.nodeName.toUpperCase(););var n=t.getBoundingClientRect();return{offsetLeft:n.left,offsetTop:n.top}}function m(){A.parentNode||document.head.appendChild(A)}function y(){A.parentNode&&A.parentNode.removeChild(A)}function g(e){return{documentId:e.getAttribute("data-pdf-annotate-document"),userId:e.getAttribute("data-pdf-annotate-user"),pageNumber:parseInt(e.getAttribute("data-pdf-annotate-page"),10),viewport:JSON.parse(e.getAttribute("data-pdf-annotate-viewport"))}}Object.defineProperty(t,"__esModule",{value:!0}),t.BORDER_COLOR=void 0,t.findSVGContainer=o,t.findSVGAtPoint=i,t.findAnnotationAtPoint=a,t.pointIntersectsRect=u,t.getOffsetAnnotationRect=d,t.scaleUp=l,t.convertToSvgRect=s,t.convertToSvgPoint=c,t.convertToScreenPoint=f,t.scaleDown=p,t.getScroll=v,t.getOffset=h,t.disableUserSelect=m,t.enableUserSelect=y,t.getMetadata=g;var b=n(7),x=r(b),_=n(8),w=n(19),A=(t.BORDER_COLOR="#00BFFF",(0,x["default"])({body:{"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}}));A.setAttribute("data-pdf-annotate-user-select","true")},function(e,t){function n(e,t){return e+" {\n"+r(t)+"\n}"}function r(e){return Object.keys(e).map(function(t){return o(t,e[t])}).join("\n")}function o(e,t){return isNaN(t)||0==t||(t+="px"),i(e)+": "+t+";"}function i(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}e.exports=function(e){var t=document.createElement("style"),r=Object.keys(e).map(function(t){return n(t,e[t])}).join("\n");return t.setAttribute("type","text/css"),t.appendChild(document.createTextNode(r)),t}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=void 0,n=void 0;switch(e.rotation%360){case 0:t=n=0;break;case 90:t=0,n=e.width/e.scale*-1;break;case 180:t=e.width/e.scale*-1,n=e.height/e.scale*-1;break;case 270:t=e.height/e.scale*-1,n=0}return{x:t,y:n}}function i(e,t){var n=o(t);if(e.setAttribute("transform","scale("+t.scale+") rotate("+t.rotation+") translate("+n.x+", "+n.y+")"),!E&&"svg"===e.nodeName.toLowerCase()){e.setAttribute("x",parseInt(e.getAttribute("x"),10)*t.scale),e.setAttribute("y",parseInt(e.getAttribute("y"),10)*t.scale);var r=parseInt(e.getAttribute("x",10)),a=parseInt(e.getAttribute("y",10)),u=parseInt(e.getAttribute("width"),10),d=parseInt(e.getAttribute("height"),10),s=e.querySelector("path"),c=s.parentNode;switch([e,c,s,e.querySelector("rect")].forEach(function(e){e.setAttribute("width",parseInt(e.getAttribute("width"),10)*t.scale),e.setAttribute("height",parseInt(e.getAttribute("height"),10)*t.scale)}),i(s,(0,l["default"])({},t,{scale:1})),t.rotation%360){case 90:e.setAttribute("x",t.width-a-u),e.setAttribute("y",r),c.setAttribute("x",1),c.setAttribute("y",0);break;case 180:e.setAttribute("x",t.width-r-u),e.setAttribute("y",t.height-a-d),c.setAttribute("y",2);break;case 270:e.setAttribute("x",a),e.setAttribute("y",t.height-r-d),c.setAttribute("x",-1),c.setAttribute("y",0)}}return e}function a(e,t,n){n||(n=JSON.parse(e.getAttribute("data-pdf-annotate-viewport")));var r=void 0;switch(t.type){case"area":case"highlight":r=(0,y["default"])(t);break;case"circle":case"fillcircle":case"emptycircle":r=(0,_["default"])(t);break;case"strikeout":r=(0,c["default"])(t);break;case"point":r=(0,h["default"])(t);break;case"textbox":r=(0,b["default"])(t);break;case"drawing":r=(0,p["default"])(t);break;case"arrow":r=(0,A["default"])(t)}return r&&(r.setAttribute("data-pdf-annotate-id",t.uuid),r.setAttribute("data-pdf-annotate-type",t.type),r.setAttribute("aria-hidden",!0),e.appendChild(i(r,n))),r}function u(e,t,n){return n||(n=JSON.parse(e.getAttribute("data-pdf-annotate-viewport"))),t&&(t=i(t,n)),t}Object.defineProperty(t,"__esModule",{value:!0}),t.getTranslation=o,t.appendChild=a,t.transformChild=u;var d=n(9),l=r(d),s=n(10),c=r(s),f=n(13),p=r(f),v=n(14),h=r(v),m=n(15),y=r(m),g=n(16),b=r(g),x=n(17),_=r(x),w=n(18),A=r(w),E=/firefox/i.test(navigator.userAgent);t["default"]={getTranslation:o,appendChild:a,transformChild:u}},function(e,t){/* object-assign (c) Sindre Sorhus @license MIT */ -"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,u,d=n(e),l=1;l-1){var i=u(e);i.splice(o,1),d(e,i)}n(!0)})},getComments:function(e,t){return new Promise(function(n,r){n(u(e).filter(function(e){return"Comment"===e["class"]&&e.annotation===t}))})},addComment:function(e,t,n){return new Promise(function(r,o){var i={"class":"Comment",uuid:(0,s["default"])(),annotation:t,content:n},a=u(e);a.push(i),d(e,a),r(i)})},deleteComment:function(e,t){return new Promise(function(n,r){u(e);for(var o=-1,i=u(e),a=0,l=i.length;a-1&&(i.splice(o,1),d(e,i)),n(!0)})}}))}return a(t,e),t}(p["default"]);t["default"]=v,e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=16*Math.random()|0,n="x"==e?t:3&t|8;return n.toString(16)}function r(){return i.replace(o,n)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var o=/[xy]/g,i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return new Promise(function(r,o){return e.setAttribute("data-pdf-annotate-container",!0),e.setAttribute("data-pdf-annotate-viewport",JSON.stringify(t)),e.removeAttribute("data-pdf-annotate-document"),e.removeAttribute("data-pdf-annotate-page"),n?(e.setAttribute("data-pdf-annotate-document",n.documentId),e.setAttribute("data-pdf-annotate-page",n.pageNumber),Array.isArray(n.annotations)&&0!==n.annotations.length?(n.annotations.forEach(function(n){var r=e.querySelector('[data-pdf-annotate-id="'+n.uuid+'"]');r?(0,a.transformChild)(e,r,t):(0,a.appendChild)(e,n,t)}),void r(e)):r(e)):(e.innerHTML="",r(e))})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=n(1),a=(r(i),n(8)),u=n(23);r(u);e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){e=Array.isArray(e)?e:[],Object.keys(f).forEach(function(t){var n=f[t];e.filter(function(e){return e.type===t}).sort(n).forEach(function(e,t){return(0,l["default"])(e,t+1)})})}function i(e,t){return e.y1&&void 0!==arguments[1]?arguments[1]:0;switch(e.type){case"highlight":case"strikeout":var n=e.rectangles,r=n[0],o=n[n.length-1];(0,c["default"])((0,a["default"])("Begin "+e.type+" annotation "+t,e.uuid),r.x,r.y,e.page,!0),(0,c["default"])((0,a["default"])("End "+e.type+" annotation "+t,e.uuid+"-end"),o.x+o.width,o.y,e.page,!1);break;case"textbox":case"point":var i="textbox"===e.type?" (content: "+e.content+")":"";(0,d["default"])((0,a["default"])(e.type+" annotation "+t+i,e.uuid),e.x,e.y,e.page);break;case"drawing":case"area":var u="undefined"!=typeof e.x?e.x:e.lines[0][0],l="undefined"!=typeof e.y?e.y:e.lines[0][1];(0,d["default"])((0,a["default"])("Unlabeled drawing",e.uuid),u,l,e.page);break;case"circle":case"fillcircle":case"emptycircle":var s="undefined"!=typeof e.cx?e.cx:e.lines[0][0],v="undefined"!=typeof e.cy?e.cy:e.lines[0][1];(0,d["default"])((0,a["default"])("Unlabeled drawing",e.uuid),s,v,e.page)}p.includes(e.type)&&(0,f["default"])(e.documentId,e.uuid)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=n(25),a=r(i),u=n(26),d=r(u),l=n(28),c=r(l),s=n(29),f=r(s),p=["highlight","point","area","circle","emptycircle","fillcircle"];e.exports=t["default"]},function(e,t){"use strict";function n(e,t){var n=document.createElement("div"),r=document.createTextNode(e);return n.appendChild(r),n.setAttribute("id","pdf-annotate-screenreader-"+t),n.style.position="absolute",n.style.left="-10000px",n.style.top="auto",n.style.width="1px",n.style.height="1px",n.style.overflow="hidden",n}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t div")));n=(0,c.scaleUp)(i,{y:n}).y+a.top,t=(0,c.scaleUp)(i,{x:t}).x+a.left;for(var s=0,f=d.length;s"===f[f.length-1])for(;f.length&&(p.unshift(f.pop()),"<"!==p[0]););s.innerHTML=f.join("");var v=(0,l.scaleDown)(d,{width:s.getBoundingClientRect().width}).width;if(c+v<=t)break;p.unshift(f.pop())}return u.innerHTML=f.join("")+e.outerHTML+p.join(""),s.parentNode.removeChild(s),!0}function a(e,t,n){var r=document.querySelector('svg[data-pdf-annotate-page="'+n+'"]'),i=r.getBoundingClientRect();return t=(0,l.scaleUp)(r,{y:t}).y+i.top,e=(0,l.scaleUp)(r,{x:e}).x+i.left,[].concat(o(r.parentNode.querySelectorAll(d["default"].textClassQuery()+" [data-canvas-width]"))).filter(function(n){return(0,l.pointIntersectsRect)(e,t,n.getBoundingClientRect())})[0]}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=n(27),d=r(u),l=n(6);e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){var r=void 0;return r=Array.isArray(n)?Promise.resolve(n):a["default"].getStoreAdapter().getComments(e,t),r.then(function(e){var n=document.getElementById("pdf-annotate-screenreader-"+t);if(n){var r=document.createElement("ol");r.setAttribute("id","pdf-annotate-screenreader-comment-list-"+t),r.setAttribute("aria-label","Comments"),n.appendChild(r),e.forEach(d["default"])}})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=n(1),a=r(i),u=n(30),d=r(u);e.exports=t["default"]},function(e,t){"use strict";function n(e){if(e){var t=document.querySelector("#pdf-annotate-screenreader-"+e.annotation+" ol");if(t){var n=document.createElement("li");n.setAttribute("id","pdf-annotate-screenreader-comment-"+e.uuid),n.appendChild(document.createTextNode(""+e.content)),t.appendChild(n)}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){(0,y.addEventListener)("annotation:add",function(e,t,n){i(e,t,n.type)}),(0,y.addEventListener)("annotation:edit",function(e,t,n){i(e,n.page,n.type)}),(0,y.addEventListener)("annotation:delete",a),(0,y.addEventListener)("comment:add",u),(0,y.addEventListener)("comment:delete",d)}function i(e,t,n){b["default"].getStoreAdapter().getAnnotations(e,t).then(function(e){return e.annotations.filter(function(e){return e.type===n})}).then(function(t){return t.forEach(function(t){a(e,t.uuid)}),t}).then(f["default"])}function a(e,t){l("pdf-annotate-screenreader-"+t),l("pdf-annotate-screenreader-"+t+"-end")}function u(e,t,n){var r=document.querySelector("pdf-annotate-screenreader-comment-list-"+t),o=void 0;o=r?Promise.resolve(!0):(0,m["default"])(e,t,[]).then(function(){return r=document.querySelector("pdf-annotate-screenreader-comment-list-"+t),!0}),o.then(function(){(0,v["default"])(n)})}function d(e,t){l("pdf-annotate-screenreader-comment-"+t)}function l(e){var t=document.getElementById(e);t&&t.parentNode.removeChild(t)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var c=n(24),s=(r(c),n(23)),f=r(s),p=n(30),v=r(p),h=n(29),m=r(h),y=n(4),g=n(1),b=r(g);e.exports=t["default"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(33),i=n(34),a=n(35),u=n(36),d=n(37),l=n(38),c=n(39),s=n(40),f=n(41);t["default"]={addEventListener:r.addEventListener,removeEventListener:r.removeEventListener,fireEvent:r.fireEvent,disableEdit:o.disableEdit,enableEdit:o.enableEdit,disablePen:i.disablePen,enablePen:i.enablePen,setPen:i.setPen,enableEraser:a.enableEraser,disableEraser:a.disableEraser,disablePoint:d.disablePoint,enablePoint:d.enablePoint,disableRect:l.disableRect,enableRect:l.enableRect,disableCircle:c.disableCircle,enableCircle:c.enableCircle,setCircle:c.setCircle,addCircle:c.addCircle,disableArrow:u.disableArrow,enableArrow:u.enableArrow,setArrow:u.setArrow,disableText:s.disableText,enableText:s.enableText,setText:s.setText,createPage:f.createPage,renderPage:f.renderPage},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);ti&&r+L.offsetHeightu&&o+L.offsetWidth-1&&(a="cx",d="cy"),["area","highlight","point","textbox","circle","fillcircle","emptycircle"].indexOf(r)>-1){var l=(0,A.convertToSvgPoint)([k,M],i),c=(0,A.convertToSvgPoint)([L.offsetLeft,L.offsetTop],i),s={x:c[0]-l[0],y:c[1]-l[1]};"textbox"===r&&(n=[n[0].firstChild]),[].concat(o(n)).forEach(function(t,n){var o=parseInt(t.getAttribute(a),10),u=parseInt(t.getAttribute(d),10);if(0!==s.y){u+=s.y;var l=u;"point"===r&&(l=(0,A.scaleUp)(i,{viewY:l}).viewY),t.setAttribute(d,l),e.rectangles&&n1&&(n=(0,g.findSVGAtPoint)(e,t))){var r=(0,g.getMetadata)(n),o=r.documentId,i=r.pageNumber;m["default"].getStoreAdapter().addAnnotation(o,i,{type:"drawing",width:_,color:w,lines:E}).then(function(e){A&&n.removeChild(A),(0,y.appendChild)(n,e)})}}function d(e){x&&s(e.clientX,e.clientY)}function l(e){s(e.changedTouches[0].clientX,e.changedTouches[0].clientY)}function c(e){27===e.keyCode&&(E=null,A.parentNode.removeChild(A),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",a))}function s(e,t){var n=(0,g.findSVGAtPoint)(e,t);if(n){var r=n.getBoundingClientRect(),o=(0,g.convertToSvgPoint)([e-r.left,t-r.top],n);E.push(o),E.length<=1||(A&&n.removeChild(A),A=(0,y.appendChild)(n,{type:"drawing",color:w,width:_,lines:E}))}}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"000000";_=parseInt(e,10),w=t}function p(){b||(b=!0,navigator.userAgent.indexOf("Chrome")!==-1?(document.addEventListener("touchstart",o),document.addEventListener("touchmove",l),document.addEventListener("touchend",i),document.addEventListener("mousedown",o),document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)):(document.addEventListener("pointerdown",o),document.addEventListener("pointermove",d),document.addEventListener("pointerup",a)),document.addEventListener("keyup",c),(0,g.disableUserSelect)())}function v(){b&&(b=!1,navigator.userAgent.indexOf("Chrome")!==-1?(document.removeEventListener("touchstart",o),document.removeEventListener("touchmove",l),document.removeEventListener("touchend",i),document.removeEventListener("mousedown",o),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a)):(document.removeEventListener("pointerdown",o),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",a)),document.removeEventListener("keyup",c),(0,g.enableUserSelect)())}Object.defineProperty(t,"__esModule",{value:!0}),t.setPen=f,t.enablePen=p,t.disablePen=v;var h=n(1),m=r(h),y=n(8),g=n(6),b=!1,x=!1,_=void 0,w=void 0,A=void 0,E=[]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){s=!0}function i(e){s=!1}function a(e){if(s){var t=(0,c.findAnnotationAtPoint)(e.clientX,e.clientY);console.log(t)}}function u(){document.addEventListener("mousemove",a),document.addEventListener("mousedown",o),document.addEventListener("mouseup",i)}function d(){document.removeEventListener("mousemove",a)}Object.defineProperty(t,"__esModule",{value:!0}),t.enableEraser=u,t.disableEraser=d;var l=n(1),c=(r(l),n(6)),s=!1},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=(0,h.findAnnotationAtPoint)(e.clientX,e.clientY);if(null!==t){var n=t.getAttribute("data-pdf-annotate-type");if("circle"===n||"fillcircle"===n||"emptycircle"===n){var r=(0,h.findSVGContainer)(t),o=(0,h.getMetadata)(r),u=o.documentId,d=t.getAttribute("data-pdf-annotate-id");p["default"].getStoreAdapter().getAnnotation(u,d).then(function(e){if(e){b=null,x=[];var t=(0,h.convertToScreenPoint)([e.cx,e.cy],r),n=r.getBoundingClientRect();w=t[0]+n.left,_=t[1]+n.top,document.addEventListener("mousemove",a),document.addEventListener("mouseup",i)}})}}}function i(e){var t=void 0;if(x.length>1&&(t=(0,h.findSVGAtPoint)(e.clientX,e.clientY))){var n=(0,h.getMetadata)(t),r=n.documentId,o=n.pageNumber;p["default"].getStoreAdapter().addAnnotation(r,o,{type:"arrow",width:y,color:g,lines:x}).then(function(e){b&&t.removeChild(b),(0,v.appendChild)(t,e)})}document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",i)}function a(e){var t=0===x.length?w:e.clientX,n=0===x.length?_:e.clientY;d(t,n)}function u(e){27===e.keyCode&&(x=null,b.parentNode.removeChild(b),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",i))}function d(e,t){var n=(0,h.findSVGAtPoint)(e,t);if(n){var r=n.getBoundingClientRect(),o=(0,h.convertToSvgPoint)([e-r.left,t-r.top],n);if(x.length<2)return void x.push(o);x[1]=o,b&&n.removeChild(b),b=(0,v.appendChild)(n,{type:"arrow",color:g,width:y,lines:x})}}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0000FF";y=parseInt(e,10),g=t}function c(){m||(m=!0,document.addEventListener("mousedown",o),document.addEventListener("keyup",u),(0,h.disableUserSelect)())}function s(){m&&(m=!1,document.removeEventListener("mousedown",o),document.removeEventListener("keyup",u),(0,h.enableUserSelect)())}Object.defineProperty(t,"__esModule",{value:!0}),t.setArrow=l,t.enableArrow=c,t.disableArrow=s;var f=n(1),p=r(f),v=n(8),h=n(6),m=!1,y=void 0,g=void 0,b=void 0,x=void 0,_=void 0,w=void 0},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){!m&&(0,v.findSVGAtPoint)(e.clientX,e.clientY)&&(m=document.createElement("input"),m.setAttribute("id","pdf-annotate-point-input"),m.setAttribute("placeholder","Enter comment"),m.style.border="3px solid "+v.BORDER_COLOR,m.style.borderRadius="3px",m.style.position="absolute",m.style.top=e.clientY+"px",m.style.left=e.clientX+"px",m.addEventListener("blur",i),m.addEventListener("keyup",a),document.body.appendChild(m),m.focus())}function i(){u()}function a(e){27===e.keyCode?d():13===e.keyCode&&u()}function u(){if(m.value.trim().length>0){var e=parseInt(m.style.left,10),t=parseInt(m.style.top,10),n=m.value.trim(),r=(0,v.findSVGAtPoint)(e,t);if(!r)return;var o=r.getBoundingClientRect(),i=(0,v.getMetadata)(r),a=i.documentId,u=i.pageNumber,l=Object.assign({type:"point"},(0,v.scaleDown)(r,{x:e-o.left,y:t-o.top}));f["default"].getStoreAdapter().addAnnotation(a,u,l).then(function(e){f["default"].getStoreAdapter().addComment(a,e.uuid,n), -(0,p.appendChild)(r,e)})}d()}function d(){m.removeEventListener("blur",i),m.removeEventListener("keyup",a),document.body.removeChild(m),m=null}function l(){h||(h=!0,document.addEventListener("mouseup",o))}function c(){h&&(h=!1,document.removeEventListener("mouseup",o))}Object.defineProperty(t,"__esModule",{value:!0}),t.enablePoint=l,t.disablePoint=c;var s=n(1),f=r(s),p=n(8),v=n(6),h=!1,m=void 0},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&n[0].width>0&&n[0].height>0)return n}catch(r){}return null}function a(e){var t=void 0;if("area"===x&&(t=(0,g.findSVGAtPoint)(e.clientX,e.clientY))){var n=t.getBoundingClientRect();w=e.clientY,A=e.clientX,_=document.createElement("div"),_.style.position="absolute",_.style.top=w-n.top+"px",_.style.left=A-n.left+"px",_.style.border="3px solid "+g.BORDER_COLOR,_.style.borderRadius="3px",t.parentNode.appendChild(_),document.addEventListener("mousemove",u),(0,g.disableUserSelect)()}}function u(e){var t=_.parentNode.querySelector(m["default"].annotationSvgQuery()),n=t.getBoundingClientRect();A+(e.clientX-A)0&&e.height>0&&e.x>-1&&e.y>-1})},0!==i.rectangles.length){if("area"===e){var u=i.rectangles[0];delete i.rectangles,i.x=u.x,i.y=u.y,i.width=u.width,i.height=u.height}var d=(0,g.getMetadata)(r),l=d.documentId,c=d.pageNumber;v["default"].getStoreAdapter().addAnnotation(l,c,i).then(function(e){(0,y.appendChild)(r,e)})}}}function s(e){x=e,b||(b=!0,document.addEventListener("mouseup",d),document.addEventListener("mousedown",a),document.addEventListener("keyup",l))}function f(){b&&(b=!1,document.removeEventListener("mouseup",d),document.removeEventListener("mousedown",a),document.removeEventListener("keyup",l))}Object.defineProperty(t,"__esModule",{value:!0}),t.enableRect=s,t.disableRect=f;var p=n(1),v=r(p),h=n(27),m=r(h),y=n(8),g=n(6),b=!1,x=void 0,_=void 0,w=void 0,A=void 0},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0000FF";y=parseInt(e,10),g=t}function i(e){var t=(0,v.findSVGAtPoint)(e.clientX,e.clientY);if(t){var n=t.getBoundingClientRect();a(t,m,{x:e.clientX-n.left,y:e.clientY-n.top},y,g)}}function a(e,t,n,r,o){var i=(0,v.convertToSvgPoint)([n.x,n.y],e),a={type:t,color:o,cx:i[0],cy:i[1],r:r},u=(0,v.getMetadata)(e),d=u.documentId,l=u.pageNumber;s["default"].getStoreAdapter().addAnnotation(d,l,a).then(function(t){(0,p.appendChild)(e,t)})}function u(e){m=e,h||(h=!0,document.addEventListener("mouseup",i))}function d(){h&&(h=!1,document.removeEventListener("mouseup",i))}function l(e,t){var n=m;m=e,i(t),m=n}Object.defineProperty(t,"__esModule",{value:!0}),t.setCircle=o,t.enableCircle=u,t.disableCircle=d,t.addCircle=l;var c=n(1),s=r(c),f=n(27),p=(r(f),n(8)),v=n(6),h=!1,m=void 0,y=10,g="0000FF"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){!y&&(0,h.findSVGAtPoint)(e.clientX,e.clientY)&&(y=document.createElement("input"),y.setAttribute("id","pdf-annotate-text-input"),y.setAttribute("placeholder","Enter text"),y.style.border="3px solid "+h.BORDER_COLOR,y.style.borderRadius="3px",y.style.position="absolute",y.style.top=e.clientY+"px",y.style.left=e.clientX+"px",y.style.fontSize=g+"px",y.style.zIndex="41",y.addEventListener("blur",i),y.addEventListener("keyup",a),document.body.appendChild(y),y.focus())}function i(){u()}function a(e){27===e.keyCode?d():13===e.keyCode&&u()}function u(){if(y.value.trim().length>0){var e=parseInt(y.style.left,10),t=parseInt(y.style.top,10),n=(0,h.findSVGAtPoint)(e,t);if(!n)return;var r=g,o=(0,h.getMetadata)(n),i=o.documentId,a=o.pageNumber,u=o.viewport,l=1/u.scale,c=n.getBoundingClientRect(),s=(0,h.convertToSvgPoint)([e-c.left,t-c.top+r],n,u),f={type:"textbox",size:g*l,color:b,content:y.value.trim(),x:s[0],y:s[1],rotation:-u.rotation};p["default"].getStoreAdapter().addAnnotation(i,a,f).then(function(e){(0,v.appendChild)(n,e)})}d()}function d(){y&&(y.removeEventListener("blur",i),y.removeEventListener("keyup",a),document.body.removeChild(y),y=null)}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"000000";g=parseInt(e,10),b=t}function c(){m||(m=!0,document.addEventListener("mouseup",o))}function s(){m&&(m=!1,document.removeEventListener("mouseup",o))}Object.defineProperty(t,"__esModule",{value:!0}),t.setText=l,t.enableText=c,t.disableText=s;var f=n(1),p=r(f),v=n(8),h=n(6),m=!1,y=void 0,g=void 0,b=void 0},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=document.createElement("div");t.innerHTML=y;var n=t.children[0],r=n.querySelector("canvas");return n.setAttribute("id","pageContainer"+e),n.setAttribute("data-page-number",e),r.mozOpaque=!0,r.setAttribute("id","page"+e),n}function i(e,t){var n=t.documentId,r=t.pdfDocument,o=t.scale,i=t.rotate;return Promise.all([r.getPage(e),f["default"].getAnnotations(n,e)]).then(function(t){var n=c(t,2),r=n[0],u=n[1],d=document.getElementById("pageContainer"+e),l=d.querySelector(v["default"].annotationClassQuery()),s=d.querySelector(".canvasWrapper canvas"),p=s.getContext("2d",{alpha:!1}),h=(i+r.rotate)%360,y=r.getViewport(o,h),g=a(e,y,p);return Promise.all([r.render({canvasContext:p,viewport:y,transform:g}),f["default"].render(l,y,u)]).then(function(){return r.getTextContent({normalizeWhitespace:!0}).then(function(t){return new Promise(function(n,r){var o=d.querySelector(v["default"].textClassQuery()),i=new PDFJS.DefaultTextLayerFactory,a=i.createTextLayerBuilder(o,e-1,y);a.setTextContent(t),a.render(),setTimeout(function(){try{(0,m["default"])(u.annotations),n()}catch(e){r(e)}})})})}).then(function(){return d.setAttribute("data-loaded","true"),[r,u]})})}function a(e,t,n){var r=document.getElementById("pageContainer"+e),o=r.querySelector(".canvasWrapper canvas"),i=r.querySelector(v["default"].annotationClassQuery()),a=r.querySelector(".canvasWrapper"),c=r.querySelector(v["default"].textClassQuery()),s=d(n),f=s.scaled?[s.sx,0,0,s.sy,0,0]:null,p=u(s.sx),h=u(s.sy);return r.style.visibility="",o.width=l(t.width*s.sx,p[0]),o.height=l(t.height*s.sy,h[0]),o.style.width=l(t.width,p[1])+"px",o.style.height=l(t.height,p[1])+"px",i.setAttribute("width",t.width),i.setAttribute("height",t.height),i.style.width=t.width+"px",i.style.height=t.height+"px",r.style.width=t.width+"px",r.style.height=t.height+"px",a.style.width=t.width+"px",a.style.height=t.height+"px",c.style.width=t.width+"px",c.style.height=t.height+"px",f}function u(e){if(Math.floor(e)===e)return[e,1];var t=1/e,n=8;if(t>n)return[1,n];if(Math.floor(t)===t)return[1,t];for(var r=e>1?t:e,o=0,i=1,a=1,u=1;;){var d=o+a,l=i+u;if(l>n)break;r<=d/l?(a=d,u=l):(o=d,i=l)}return r-o/i