From f3518a09d4efd44da98e79941a7e6c45d5b236a5 Mon Sep 17 00:00:00 2001 From: Victor Nazzaro Date: Sun, 23 Sep 2018 23:15:13 -0400 Subject: [PATCH] Reran build-script --- dist/pdf-annotate.js | 41 ++++++++++++++++++++++++------------ dist/pdf-annotate.js.map | 2 +- dist/pdf-annotate.min.js | 6 +++--- dist/pdf-annotate.min.js.map | 2 +- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/dist/pdf-annotate.js b/dist/pdf-annotate.js index bfc66a61..f263314a 100644 --- a/dist/pdf-annotate.js +++ b/dist/pdf-annotate.js @@ -400,10 +400,10 @@ return /******/ (function(modules) { // webpackBootstrap return this.__deleteAnnotation; }, set: function set(fn) { - this.__deleteAnnotation = function deleteAnnotation(documentId, annotationId) { + this.__deleteAnnotation = function deleteAnnotation(documentId, userId, annotationId) { return fn.apply(undefined, arguments).then(function (success) { if (success) { - (0, _event.fireEvent)('annotation:delete', documentId, annotationId); + (0, _event.fireEvent)('annotation:delete', documentId, userId, annotationId); } return success; }); @@ -2214,7 +2214,7 @@ return /******/ (function(modules) { // webpackBootstrap _classCallCheck(this, LocalStoreAdapter); var _this = _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 = getAllAnnotations().filter(function (i) { return i.page === pageNumber && i.class === 'Annotation'; @@ -3590,7 +3590,7 @@ return /******/ (function(modules) { // webpackBootstrap * * @param {Event} e The DOM event to be handled */ - function handleDocumentKeyupChrome(e) { + function handleDocumentPointerupChrome(e) { saveToStorage(e.changedTouches[0].clientX, e.changedTouches[0].clientY); } @@ -3721,7 +3721,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!isFirefox) { document.addEventListener('touchstart', handleDocumentPointerdown); document.addEventListener('touchmove', handleDocumentPointermoveChrome); - document.addEventListener('touchend', handleDocumentKeyupChrome); + document.addEventListener('touchend', handleDocumentPointerupChrome); document.addEventListener('mousedown', handleDocumentPointerdown); document.addEventListener('mousemove', handleDocumentPointermove); document.addEventListener('mouseup', handleDocumentPointerup); @@ -3746,7 +3746,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!isFirefox) { document.removeEventListener('touchstart', handleDocumentPointerdown); document.removeEventListener('touchmove', handleDocumentPointermoveChrome); - document.removeEventListener('touchend', handleDocumentKeyupChrome); + document.removeEventListener('touchend', handleDocumentPointerupChrome); document.removeEventListener('mousedown', handleDocumentPointerdown); document.removeEventListener('mousemove', handleDocumentPointermove); document.removeEventListener('mouseup', handleDocumentPointerup); @@ -3788,17 +3788,24 @@ return /******/ (function(modules) { // webpackBootstrap var _canerase = false; var userId = "user"; - function handleDocumentMouseDown(e) { + function handleDocumentDown(e) { _canerase = true; } - function handleDocumentMouseUp(e) { + function handleDocumentUp(e) { _canerase = false; } + function handleDocumentTouchMove(e) { + erase((0, _utils.findAnnotationAtPoint)(e.changedTouches[0].clientX, e.changedTouches[0].clientY)); + } + function handleDocumentMouseMove(e) { + erase((0, _utils.findAnnotationAtPoint)(e.clientX, e.clientY)); + } + + function erase(target) { if (_canerase) { - var target = (0, _utils.findAnnotationAtPoint)(e.clientX, e.clientY); if (target && target.getAttribute('data-pdf-annotate-userId') == userId) { var _getMetadata = (0, _utils.getMetadata)(target.parentElement), documentId = _getMetadata.documentId; @@ -3809,7 +3816,7 @@ return /******/ (function(modules) { // webpackBootstrap n.parentNode.removeChild(n); }); - _PDFJSAnnotate2.default.getStoreAdapter().deleteAnnotation(documentId, annotationId); + _PDFJSAnnotate2.default.getStoreAdapter().deleteAnnotation(documentId, userId, annotationId); } } } @@ -3817,14 +3824,20 @@ return /******/ (function(modules) { // webpackBootstrap function enableEraser() { userId = _PDFJSAnnotate2.default.getStoreAdapter().userId; document.addEventListener('mousemove', handleDocumentMouseMove); - document.addEventListener('mousedown', handleDocumentMouseDown); - document.addEventListener('mouseup', handleDocumentMouseUp); + document.addEventListener('mousedown', handleDocumentDown); + document.addEventListener('mouseup', handleDocumentUp); + document.addEventListener('touchstart', handleDocumentDown); + document.addEventListener('touchmove', handleDocumentTouchMove); + document.addEventListener('touchend', handleDocumentUp); } function disableEraser() { document.removeEventListener('mousemove', handleDocumentMouseMove); - document.removeEventListener('mousedown', handleDocumentMouseDown); - document.removeEventListener('mouseup', handleDocumentMouseUp); + document.removeEventListener('mousedown', handleDocumentDown); + document.removeEventListener('mouseup', handleDocumentUp); + document.removeEventListener('touchstart', handleDocumentDown); + document.removeEventListener('touchmove', handleDocumentTouchMove); + document.removeEventListener('touchend', handleDocumentUp); } /***/ }, diff --git a/dist/pdf-annotate.js.map b/dist/pdf-annotate.js.map index 657e1663..1a9ae077 100644 --- a/dist/pdf-annotate.js.map +++ b/dist/pdf-annotate.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap ef67e7b570552372175c","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","userId","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","getAllAnnotations","filter","page","class","getAnnotation","findAnnotation","updateAnnotations","index","splice","getComments","_userId","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","preventDefault","handleDocumentKeyupChrome","saveToStorage","changedTouches","handleDocumentPointerup","handleDocumentPointermove","srcElement","classList","contains","savePoint","handleDocumentPointermoveChrome","point","toFixed","penSize","penColor","_canerase","handleDocumentMouseDown","handleDocumentMouseUp","handleDocumentMouseMove","parentElement","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;;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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;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;AAC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BADJ,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,CAAuB7Z,CAAvB,EAA0B4a,GAA1B,EAA+B;AAC7B,OAAI7W,IAAI/D,IAAI4a,GAAZ;AACA,UAAO7W,MAAM,CAAN,GAAU/D,CAAV,GAAc2B,KAAKkZ,KAAL,CAAW7a,IAAI+D,CAAJ,GAAQ6W,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 ef67e7b570552372175c\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, 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 {Number} pageNumber The number of the page the annotations belong to\r\n * @return {Promise}\r\n */\r\n __getAnnotations(documentId, pageNumber) { abstractFunction('getAnnotations'); }\r\n get getAnnotations() { return this.__getAnnotations; }\r\n set getAnnotations(fn) {\r\n this.__getAnnotations = function getAnnotations(documentId, 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, pageNumber, annotation) { abstractFunction('addAnnotation'); }\r\n get addAnnotation() { return this.__addAnnotation; }\r\n set addAnnotation(fn) {\r\n this.__addAnnotation = function addAnnotation(documentId, pageNumber, annotation) {\r\n return fn(...arguments).then((annotation) => {\r\n fireEvent('annotation:add', documentId, 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 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('data-pdf-annotate-userId', annotation.userId);\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(userId = \"user\") {\r\n super({\r\n getAnnotations(documentId, pageNumber) {\r\n return new Promise((resolve, reject) => {\r\n let annotations = getAllAnnotations().filter((i) => {\r\n return i.page === pageNumber && i.class === 'Annotation';\r\n });\r\n\r\n resolve({\r\n documentId,\r\n pageNumber,\r\n annotations\r\n });\r\n });\r\n },\r\n\r\n getAnnotation(documentId, annotationId) {\r\n return Promise.resolve(getAnnotations(documentId, userId)[findAnnotation(documentId, userId, annotationId)]);\r\n },\r\n\r\n addAnnotation(documentId, 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 annotation.userId = userId;\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, 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, 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, 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, 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, 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 this._userId = userId;\r\n }\r\n get userId(){\r\n return this._userId;\r\n }\r\n}\r\n\r\nfunction getAllAnnotations(){\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 getAnnotations(documentId, userId) {\r\n return JSON.parse(localStorage.getItem(`${documentId}/${userId}/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\n * \r\n * @param {String} documentId Document id of the annotation\r\n * @param {String} userId User id of the annotation\r\n * @param {String} annotationId The id of the annotation\r\n * \r\n * This function finds all the annotation made by one user.\r\n * \r\n * @return {int} The index of the annotation in localstorage\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-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, pageNumber, annotation) => {\r\n reorderAnnotationsByType(documentId, pageNumber, annotation.type);\r\n });\r\n addEventListener('annotation:edit', (documentId, annotationId, annotation) => {\r\n reorderAnnotationsByType(documentId, 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 {Number} pageNumber The page number of the annotations\r\n * @param {Strig} type The annotation type\r\n */\r\nfunction reorderAnnotationsByType(documentId, pageNumber, type) {\r\n PDFJSAnnotate.getStoreAdapter().getAnnotations(documentId, 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 } = getMetadata(svg);\r\n \r\n overlay.querySelector('a').style.display = '';\r\n\r\n PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, 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\nconst isFirefox = /firefox/i.test(navigator.userAgent);\r\n\r\n/**\r\n * Handle document.touchdown or document.pointerdown event\r\n */\r\nfunction handleDocumentPointerdown(e) {\r\n e.preventDefault();\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(!e.srcElement.classList.contains('annotationLayer')){\r\n return;\r\n }\r\n if(_candraw){\r\n savePoint(e.clientX, e.clientY);\r\n }\r\n}\r\n\r\nfunction handleDocumentPointermoveChrome(e){\r\n if(!e.srcElement.classList.contains('annotationLayer')){\r\n return;\r\n }\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 point[0] = point[0].toFixed(2);\r\n point[1] = point[1].toFixed(2);\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 (!isFirefox){\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 (!isFirefox){\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 config from '../config';\r\nimport {\r\n findAnnotationAtPoint,\r\n findSVGAtPoint,\r\n getMetadata\r\n} from './utils';\r\n\r\nlet _canerase = false;\r\nlet userId = \"user\";\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 && target.getAttribute('data-pdf-annotate-userId') == userId){\r\n let { documentId } = getMetadata(target.parentElement);\r\n let annotationId = target.getAttribute('data-pdf-annotate-id');\r\n let nodes = document.querySelectorAll(`[data-pdf-annotate-id=\"${annotationId}\"]`);\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 userId = PDFJSAnnotate.getStoreAdapter().userId;\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 document.removeEventListener('mousedown', handleDocumentMouseDown);\r\n document.removeEventListener('mouseup', handleDocumentMouseUp);\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 } = 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, 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, 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, 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, pageNumber } = getMetadata(svg);\r\n\r\n // Add the annotation\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, 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, pageNumber } = getMetadata(svg);\r\n\r\n // Add the annotation\r\n PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, 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 if(!e.srcElement.classList.contains('annotationLayer')){\r\n return;\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, 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, 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 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, 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 +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 59e89cdaf93308c40d35","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","getAllAnnotations","filter","page","class","getAnnotation","findAnnotation","updateAnnotations","index","splice","getComments","_userId","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","preventDefault","handleDocumentPointerupChrome","saveToStorage","changedTouches","handleDocumentPointerup","handleDocumentPointermove","srcElement","classList","contains","savePoint","handleDocumentPointermoveChrome","point","toFixed","penSize","penColor","_canerase","handleDocumentDown","handleDocumentUp","handleDocumentTouchMove","erase","handleDocumentMouseMove","parentElement","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;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACtCA;;;;;;mBAEeA,uB;;;;;;;;;;;;;ACFf;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;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AAR,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;A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B,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,CAAuB9Z,CAAvB,EAA0B6a,GAA1B,EAA+B;AAC7B,OAAI/W,IAAI9D,IAAI6a,GAAZ;AACA,UAAO/W,MAAM,CAAN,GAAU9D,CAAV,GAAc2B,KAAKmZ,KAAL,CAAW9a,IAAI8D,CAAJ,GAAQ+W,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 59e89cdaf93308c40d35\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, userId, annotationId) {\r\n return fn(...arguments).then((success) => {\r\n if (success) {\r\n fireEvent('annotation:delete', documentId, userId, 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('data-pdf-annotate-userId', annotation.userId);\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(userId = \"user\") {\r\n super({\r\n getAnnotations(documentId, userId, pageNumber) {\r\n return new Promise((resolve, reject) => {\r\n let annotations = getAllAnnotations().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, 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 annotation.userId = userId;\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 this._userId = userId;\r\n }\r\n get userId(){\r\n return this._userId;\r\n }\r\n}\r\n\r\nfunction getAllAnnotations(){\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 getAnnotations(documentId, userId) {\r\n return JSON.parse(localStorage.getItem(`${documentId}/${userId}/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\n * \r\n * @param {String} documentId Document id of the annotation\r\n * @param {String} userId User id of the annotation\r\n * @param {String} annotationId The id of the annotation\r\n * \r\n * This function finds all the annotation made by one user.\r\n * \r\n * @return {int} The index of the annotation in localstorage\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\nconst isFirefox = /firefox/i.test(navigator.userAgent);\r\n\r\n/**\r\n * Handle document.touchdown or document.pointerdown event\r\n */\r\nfunction handleDocumentPointerdown(e) {\r\n e.preventDefault();\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 handleDocumentPointerupChrome(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(!e.srcElement.classList.contains('annotationLayer')){\r\n return;\r\n }\r\n if(_candraw){\r\n savePoint(e.clientX, e.clientY);\r\n }\r\n}\r\n\r\nfunction handleDocumentPointermoveChrome(e){\r\n if(!e.srcElement.classList.contains('annotationLayer')){\r\n return;\r\n }\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 point[0] = point[0].toFixed(2);\r\n point[1] = point[1].toFixed(2);\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 (!isFirefox){\r\n document.addEventListener('touchstart', handleDocumentPointerdown);\r\n document.addEventListener('touchmove', handleDocumentPointermoveChrome);\r\n document.addEventListener('touchend', handleDocumentPointerupChrome);\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 (!isFirefox){\r\n document.removeEventListener('touchstart', handleDocumentPointerdown);\r\n document.removeEventListener('touchmove', handleDocumentPointermoveChrome);\r\n document.removeEventListener('touchend', handleDocumentPointerupChrome);\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 config from '../config';\r\nimport {\r\n findAnnotationAtPoint,\r\n findSVGAtPoint,\r\n getMetadata\r\n} from './utils';\r\n\r\nlet _canerase = false;\r\nlet userId = \"user\";\r\n\r\nfunction handleDocumentDown(e){\r\n _canerase = true;\r\n}\r\n\r\nfunction handleDocumentUp(e){\r\n _canerase = false;\r\n}\r\n\r\nfunction handleDocumentTouchMove(e){\r\n erase(findAnnotationAtPoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY));\r\n}\r\n\r\nfunction handleDocumentMouseMove(e){\r\n erase(findAnnotationAtPoint(e.clientX, e.clientY));\r\n}\r\n\r\nfunction erase(target){\r\n if(_canerase){\r\n if(target && target.getAttribute('data-pdf-annotate-userId') == userId){\r\n let { documentId } = getMetadata(target.parentElement);\r\n let annotationId = target.getAttribute('data-pdf-annotate-id');\r\n let nodes = document.querySelectorAll(`[data-pdf-annotate-id=\"${annotationId}\"]`);\r\n [...nodes].forEach((n) => {\r\n n.parentNode.removeChild(n);\r\n });\r\n \r\n PDFJSAnnotate.getStoreAdapter().deleteAnnotation(documentId, userId, annotationId);\r\n }\r\n }\r\n}\r\n\r\nexport function enableEraser(){\r\n userId = PDFJSAnnotate.getStoreAdapter().userId;\r\n document.addEventListener('mousemove', handleDocumentMouseMove);\r\n document.addEventListener('mousedown', handleDocumentDown);\r\n document.addEventListener('mouseup', handleDocumentUp);\r\n document.addEventListener('touchstart', handleDocumentDown);\r\n document.addEventListener('touchmove', handleDocumentTouchMove);\r\n document.addEventListener('touchend', handleDocumentUp);\r\n}\r\n\r\nexport function disableEraser(){\r\n document.removeEventListener('mousemove', handleDocumentMouseMove);\r\n document.removeEventListener('mousedown', handleDocumentDown);\r\n document.removeEventListener('mouseup', handleDocumentUp);\r\n document.removeEventListener('touchstart', handleDocumentDown);\r\n document.removeEventListener('touchmove', handleDocumentTouchMove);\r\n document.removeEventListener('touchend', handleDocumentUp);\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 if(!e.srcElement.classList.contains('annotationLayer')){\r\n return;\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 0c75c178..27e1fe76 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("data-pdf-annotate-userId",t.userId),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),s=r(d),c=n(32),l=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:l["default"],render:s["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,r){return e.apply(void 0,arguments).then(function(e){return e&&(0,d.fireEvent)("annotation:delete",t,n,r),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"]=s,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),s=n(6),c=new d["default"],l=void 0;document.addEventListener("click",function(e){if((0,s.findSVGAtPoint)(e.clientX,e.clientY)){var t=(0,s.findAnnotationAtPoint)(e.clientX,e.clientY);l&&l!==t&&c.emit("annotation:blur",l),t&&c.emit("annotation:click",t),l=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,s;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),s=n.slice(),o=s.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 s(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=l(r,t,n),o=l(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 l(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=s,t.convertToSvgRect=c,t.convertToSvgPoint=l,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"),l=c.parentNode;switch([e,l,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,s["default"])({},t,{scale:1})),t.rotation%360){case 90:e.setAttribute("x",t.width-a-u),e.setAttribute("y",r),l.setAttribute("x",1),l.setAttribute("y",0);break;case 180:e.setAttribute("x",t.width-r-u),e.setAttribute("y",t.height-a-d),l.setAttribute("y",2);break;case 270:e.setAttribute("x",a),e.setAttribute("y",t.height-r-d),l.setAttribute("x",-1),l.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,l["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("data-pdf-annotate-userId",t.userId),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),s=r(d),c=n(10),l=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){/* 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;l0&&void 0!==arguments[0]?arguments[0]:"user";i(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{getAnnotations:function(e,t){return new Promise(function(n,r){var o=d().filter(function(e){return e.page===t&&"Annotation"===e["class"]});n({documentId:e,pageNumber:t,annotations:o})})},getAnnotation:function(t,n){return Promise.resolve(l(t,e)[s(t,e,n)])},addAnnotation:function(t,n,r){return new Promise(function(o,i){r["class"]="Annotation",r.uuid=(0,v["default"])(),r.page=n,r.userId=e;var a=l(t,e);a.push(r),c(t,e,a),o(r)})},editAnnotation:function(t,n,r){return new Promise(function(o,i){var a=l(t,e);a[s(t,e,n)]=r,c(t,e,a),o(r)})},deleteAnnotation:function(t,n){return new Promise(function(r,o){var i=s(t,e,n);if(i>-1){var a=l(t,e);a.splice(i,1),c(t,e,a)}r(!0)})},getComments:function(t,n){return new Promise(function(r,o){r(l(t,e).filter(function(e){return"Comment"===e["class"]&&e.annotation===n}))})},addComment:function(t,n,r){return new Promise(function(o,i){var a={"class":"Comment",uuid:(0,v["default"])(),annotation:n,content:r},u=l(t,e);u.push(a),c(t,e,u),o(a)})},deleteComment:function(t,n){return new Promise(function(r,o){l(t,e);for(var i=-1,a=l(t,e),u=0,d=a.length;u-1&&(a.splice(i,1),c(t,e,a)),r(!0)})}}));return n._userId=e,n}return u(t,e),f(t,[{key:"userId",get:function(){return this._userId}}]),t}(m["default"]);t["default"]=y,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+C.offsetHeightu&&o+C.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)([C.offsetLeft,C.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){e.srcElement.classList.contains("annotationLayer")&&x&&s(e.clientX,e.clientY)}function l(e){e.srcElement.classList.contains("annotationLayer")&&x&&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);o[0]=o[0].toFixed(2),o[1]=o[1].toFixed(2),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,L?(document.addEventListener("pointerdown",o),document.addEventListener("pointermove",d),document.addEventListener("pointerup",a)):(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("keyup",c),(0,g.disableUserSelect)())}function v(){b&&(b=!1,L?(document.removeEventListener("pointerdown",o),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",a)):(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("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=[],L=/firefox/i.test(navigator.userAgent)},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);t1&&(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)&&e.srcElement.classList.contains("annotationLayer")&&(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