From d20eb44638f6a210b7daed8d8236463741e555d9 Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Wed, 25 Jun 2025 13:31:06 +0200 Subject: [PATCH] Fix issue with zoom scale : https://trackers.pilotsystems.net/prebarreau/0912 --- pdfannotator/src/render/appendChild.js | 83 ++++++++++--------- .../static/pdfannotator/pdf-annotate.min.js | 8 +- .../pdfannotator/pdf-annotate.min.js.map | 2 +- 3 files changed, 47 insertions(+), 46 deletions(-) diff --git a/pdfannotator/src/render/appendChild.js b/pdfannotator/src/render/appendChild.js index 78fbd80..033ce3f 100644 --- a/pdfannotator/src/render/appendChild.js +++ b/pdfannotator/src/render/appendChild.js @@ -55,47 +55,48 @@ function transform(node, viewport) { node.setAttribute('transform', `scale(${viewport.scale}) rotate(${viewport.rotation}) translate(${trans.x}, ${trans.y})`); // Manually adjust x/y for nested SVG nodes - console.log(node); - if (!isFirefox && node.nodeName.toLowerCase() === 'svg') { - node.setAttribute('x', parseInt(node.getAttribute('x'), 10) * viewport.scale); - node.setAttribute('y', parseInt(node.getAttribute('y'), 10) * viewport.scale); - - let x = parseInt(node.getAttribute('x', 10)); - let y = parseInt(node.getAttribute('y', 10)); - let width = parseInt(node.getAttribute('width'), 10); - let height = parseInt(node.getAttribute('height'), 10); - let path = node.querySelector('path'); - let svg = path.parentNode; - - // Scale width/height - [node, svg, path, node.querySelector('rect')].forEach((n) => { - n.setAttribute('width', parseInt(n.getAttribute('width'), 10) * viewport.scale); - n.setAttribute('height', parseInt(n.getAttribute('height'), 10) * viewport.scale); - }); - - // Transform path but keep scale at 100% since it will be handled natively - transform(path, objectAssign({}, viewport, {scale: 1})); - - switch (viewport.rotation % 360) { - case 90: - node.setAttribute('x', viewport.width - y - width); - node.setAttribute('y', x); - svg.setAttribute('x', 1); - svg.setAttribute('y', 0); - break; - case 180: - node.setAttribute('x', viewport.width - x - width); - node.setAttribute('y', viewport.height - y - height); - svg.setAttribute('y', 2); - break; - case 270: - node.setAttribute('x', y); - node.setAttribute('y', viewport.height - x - height); - svg.setAttribute('x', -1); - svg.setAttribute('y', 0); - break; - } - } + // console.log(node); + // console.log(viewport.scale); + // if (!isFirefox && node.nodeName.toLowerCase() === 'svg') { + // node.setAttribute('x', parseInt(node.getAttribute('x'), 10) * viewport.scale); + // node.setAttribute('y', parseInt(node.getAttribute('y'), 10) * viewport.scale); + + // let x = parseInt(node.getAttribute('x', 10)); + // let y = parseInt(node.getAttribute('y', 10)); + // let width = parseInt(node.getAttribute('width'), 10); + // let height = parseInt(node.getAttribute('height'), 10); + // let path = node.querySelector('path'); + // let svg = path.parentNode; + + // // Scale width/height + // [node, svg, path, node.querySelector('rect')].forEach((n) => { + // n.setAttribute('width', parseInt(n.getAttribute('width'), 10) * viewport.scale); + // n.setAttribute('height', parseInt(n.getAttribute('height'), 10) * viewport.scale); + // }); + + // // Transform path but keep scale at 100% since it will be handled natively + // transform(path, objectAssign({}, viewport, {scale: 1})); + + // switch (viewport.rotation % 360) { + // case 90: + // node.setAttribute('x', viewport.width - y - width); + // node.setAttribute('y', x); + // svg.setAttribute('x', 1); + // svg.setAttribute('y', 0); + // break; + // case 180: + // node.setAttribute('x', viewport.width - x - width); + // node.setAttribute('y', viewport.height - y - height); + // svg.setAttribute('y', 2); + // break; + // case 270: + // node.setAttribute('x', y); + // node.setAttribute('y', viewport.height - x - height); + // svg.setAttribute('x', -1); + // svg.setAttribute('y', 0); + // break; + // } + // } // else{ // Object.keys(node).forEach((key) => { // node[key] = node[key] * viewport.scale; diff --git a/pdfannotator/static/pdfannotator/pdf-annotate.min.js b/pdfannotator/static/pdfannotator/pdf-annotate.min.js index b640a29..7396c8c 100644 --- a/pdfannotator/static/pdfannotator/pdf-annotate.min.js +++ b/pdfannotator/static/pdfannotator/pdf-annotate.min.js @@ -1,14 +1,14 @@ -!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 a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.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}}function a(){pdfjsLib.getDocument(g.documentId).then(function(e){g.pdfDocument=e;var t=document.getElementById("viewer");t.innerHTML="",m=e._pdfInfo.numPages;for(var n=0;n.endOfContent").remove()})})},r=1;r<=m;r++)n(r)})})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var n=[],r=!0,a=!1,u=void 0;try{for(var i,o=e[Symbol.iterator]();!(r=(i=o.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(d){a=!0,u=d}finally{try{!r&&o["return"]&&o["return"]()}finally{if(a)throw u}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=n(1),o=r(i),d=n(37),s=n(39),c=(r(s),n(65)),l=r(c),f=n(38),p=o["default"].UI,h=void 0,g={documentId:d.documentUrl,pdfDocument:null,enhanceTextSelection:!0,scale:parseFloat(localStorage.getItem(d.documentId+"/scale"),10)||1.33};o["default"].setStoreAdapter(new o["default"].CRFPAStoreAdapter);var m=0;a();var v=function(e,t){var n=localStorage.getItem(g.documentId+"/tooltype")||"cursor",r=document.querySelector(".toolbar button.active");if(r)switch(r.classList.remove("active"),n){case"cursor":p.disableEdit();break;case"draw":p.disablePen();break;case"text":p.disableText();break;case"point":p.disablePoint();break;case"area":case"highlight":case"strikeout":p.disableRect()}switch(t&&t.classList.add("active"),n!==e&&localStorage.setItem(g.documentId+"/tooltype",e),n=e,e){case"cursor":p.enableEdit();break;case"draw":p.enablePen();break;case"text":p.enableText();break;case"point":p.enablePoint();break;case"area":case"highlight":case"strikeout":p.enableRect(e)}};o["default"].setActiveToolbarItem=v,d.readonly||(!function(){function e(){t(12,"#EF4437")}function t(e,t){p.setText(e,t)}e()}(),function(){function e(){for(var e=document.querySelector(".toolbar .pen-size"),n=0;n<20;n++)e.appendChild(new Option(n+1,n+1));t(localStorage.getItem(g.documentId+"/pen/size")||1,localStorage.getItem(g.documentId+"/pen/color")||"#000000"),(0,l["default"])(document.querySelector(".pen-color"),a,function(e){t(r,e)})}function t(e,t){var n=!1;if(r!==e&&(n=!0,r=e,localStorage.setItem(g.documentId+"/pen/size",r),document.querySelector(".toolbar .pen-size").value=r),a!==t){n=!0,a=t,localStorage.setItem(g.documentId+"/pen/color",a);var u=document.querySelector(".toolbar .pen-color.color-selected");u&&(u.classList.remove("color-selected"),u.removeAttribute("aria-selected")),u=document.querySelector('.toolbar .pen-color[data-color="'+t+'"]'),u&&(u.classList.add("color-selected"),u.setAttribute("aria-selected",!0))}n&&p.setPen(r,a)}function n(e){t(e.target.value,a)}var r=void 0,a=void 0;document.querySelector(".toolbar .pen-size").addEventListener("change",n),e()}(),function(){function e(e){"BUTTON"===e.target.nodeName&&v(e.target.getAttribute("data-tooltype"),e.target)}var t=localStorage.getItem(g.documentId+"/tooltype")||"cursor";t&&v(t,document.querySelector(".toolbar button[data-tooltype="+t+"]")),document.querySelector(".toolbar").addEventListener("click",e)}()),d.readonly&&p.enableEdit(),function(){function e(e,t){e=parseFloat(e,10),t=parseInt(t,10),g.scale===e&&g.rotate===t||(g.scale=e,g.rotate=t,localStorage.setItem(g.documentId+"/scale",g.scale),localStorage.setItem(g.documentId+"/rotate",g.rotate%360),a())}function t(t){e(t.target.value,g.rotate)}document.querySelector(".toolbar select.scale").value=g.scale,document.querySelector(".toolbar select.scale").addEventListener("change",t)}(),(0,f.renderComments)(d.documentId),t["default"]=o["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 a=n(2),u=r(a),i=n(8),o=r(i),d=n(50),s=r(d),c=n(59),l=r(c);t["default"]={StoreAdapter:u["default"],CRFPAStoreAdapter:o["default"],__storeAdapter:new u["default"],getStoreAdapter:function(){return this.__storeAdapter},setStoreAdapter:function(e){this.__storeAdapter=e},UI:l["default"],render:s["default"],getAnnotations:function(e){var t;return(t=this.getStoreAdapter()).getAnnotations.apply(t,arguments)}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),Object.keys(n).forEach(function(e){"function"==typeof n[e]&&"function"==typeof t[e]&&(t[e]=n[e])})}return u(e,[{key:"__getAnnotations",value:function(e){(0,o["default"])("getAnnotations")}},{key:"getAnnotation",value:function(e,t){(0,o["default"])("getAnnotation")}},{key:"__addAnnotation",value:function(e,t,n){(0,o["default"])("addAnnotation")}},{key:"__editAnnotation",value:function(e,t,n){(0,o["default"])("editAnnotation")}},{key:"__deleteAnnotation",value:function(e,t){(0,o["default"])("deleteAnnotation")}},{key:"getComments",value:function(e,t){(0,o["default"])("getComments")}},{key:"__addComment",value:function(e,t,n){(0,o["default"])("addComment")}},{key:"__updateComment",value:function(e,t,n){(0,o["default"])("addComment")}},{key:"__deleteComment",value:function(e,t){(0,o["default"])("deleteComment")}},{key:"getAnnotations",get:function(){return this.__getAnnotations},set:function(e){this.__getAnnotations=function(t){return e.apply(void 0,arguments).then(function(e){return 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:"updateComment",get:function(){return this.__updateComment},set:function(e){this.__updateComment=function(t,n,r){return e.apply(void 0,arguments).then(function(e){return(0,d.fireEvent)("comment:updated",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 a(){c.emit.apply(c,arguments)}function u(){c.on.apply(c,arguments)}function i(){c.removeListener.apply(c,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.fireEvent=a,t.addEventListener=u,t.removeEventListener=i;var o=n(5),d=r(o),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 a(e){return"number"==typeof e}function u(e){return"object"==typeof e&&null!==e}function i(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(!a(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,a,o,d,s;if(this._events||(this._events={}),"error"===e&&(!this._events.error||u(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],i(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:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(u(n))for(o=Array.prototype.slice.call(arguments,1),s=n.slice(),a=s.length,d=0;d0&&this._events[e].length>a&&(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),a||(a=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var a=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,a,i,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,a=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(u(n)){for(o=i;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=o;break}if(a<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(a,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 a(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 u(e,t){for(var n=document.querySelectorAll('svg[data-pdf-annotate-container="true"]'),r=0,a=n.length;r=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right}function d(e){var t=s(e),n=p(e),r=n.offsetLeft,a=n.offsetTop;return{top:t.top+a,left:t.left+r,right:t.right+r,bottom:t.bottom+a}}function s(e){var t=0,n=0,r=0,a=0,i=e.getBoundingClientRect(),o=16;switch(e.nodeName.toLowerCase()){case"path":var d=void 0,s=void 0,l=void 0,f=void 0;e.getAttribute("d").replace(/Z/,"").split("M").splice(1).forEach(function(e){var t=e.split(" ").map(function(e){return parseInt(e,10)});("undefined"==typeof d||t[0]s)&&(s=t[2]),("undefined"==typeof l||t[1]f)&&(f=t[3])}),t=f-l,n=s-d,r=d,a=l;break;case"line":t=parseInt(e.getAttribute("y2"),10)-parseInt(e.getAttribute("y1"),10),n=parseInt(e.getAttribute("x2"),10)-parseInt(e.getAttribute("x1"),10),r=parseInt(e.getAttribute("x1"),10),a=parseInt(e.getAttribute("y1"),10),0===t&&(t+=o,a-=o/2);break;case"text":t=i.height,n=i.width,r=parseInt(e.getAttribute("x"),10),a=parseInt(e.getAttribute("y"),10)-t;break;case"g":var h=p(e),g=h.offsetLeft,m=h.offsetTop;t=i.height,n=i.width,r=i.left-g,a=i.top-m,"strikeout"===e.getAttribute("data-pdf-annotate-type")&&(t+=o,a-=o/2);break;case"rect":case"svg":t=parseInt(e.getAttribute("height"),10),n=parseInt(e.getAttribute("width"),10),r=parseInt(e.getAttribute("x"),10),a=parseInt(e.getAttribute("y"),10)}var v={top:a,left:r,width:n,height:t,right:r+n,bottom:a+t};return["svg","g"].includes(e.nodeName.toLowerCase())||(v=c(u(i.left,i.top),v)),"svg"==e.nodeName.toLowerCase()&&$.browser.mozilla&&(v=c(u(i.left,i.top),v)),v}function c(e,t){var n={},r=m(e),a=r.viewport;return Object.keys(t).forEach(function(e){n[e]=t[e]*a.scale}),n}function l(e,t){var n={},r=m(e),a=r.viewport;return Object.keys(t).forEach(function(e){n[e]=t[e]/a.scale}),n}function f(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 p(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 h(){x.parentNode||document.head.appendChild(x)}function g(){x.parentNode&&x.parentNode.removeChild(x)}function m(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=a,t.findSVGAtPoint=u,t.findAnnotationAtPoint=i,t.pointIntersectsRect=o,t.getOffsetAnnotationRect=d,t.getAnnotationRect=s,t.scaleUp=c,t.scaleDown=l,t.getScroll=f,t.getOffset=p,t.disableUserSelect=h,t.enableUserSelect=g,t.getMetadata=m;var v=n(7),b=r(v),x=(t.BORDER_COLOR="#00BFFF",(0,b["default"])({body:{"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}}));x.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 a(t,e[t])}).join("\n")}function a(e,t){return isNaN(t)||0==t||(t+="px"),u(e)+": "+t+";"}function u(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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),d=r(o),s=n(36),c=r(s),l=n(2),f=r(l),p=n(37),h=n(38);d["default"].defaults.xsrfCookieName="csrftoken",d["default"].defaults.xsrfHeaderName="X-CSRFToken";var g=function(e){function t(){a(this,t);var e=d["default"].create({baseURL:"/pdfannotator",timeout:6e4,withCredentials:!0,headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*"}});return u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{getAnnotations:function(t){return e.get("/get-annotations/",{params:{fileUuid:p.documentId}}).then(function(e){return e.data})["catch"](function(e){console.log(e),alert("Une erreur est survenue et les annotations n'ont pas pu être téléchargées depuis le serveur.")})},getAnnotation:function(t,n){return e.get("/get-annotation/",{params:{fileUuid:p.documentId,annotationId:n}}).then(function(e){return e.data})},addAnnotation:function(t,n,r){return r["class"]="Annotation",r.page=n,r.uuid=(0,c["default"])(),e.post("/add-annotation/",{fileUuid:p.documentId,page:n,annotation:r}).then(function(e){return r})["catch"](function(e){console.log(e),alert("Une erreur est survenue et votre annotation n'a pas pu être enregistrée.")})},editAnnotation:function(t,n,r){return e.post("/update-annotation/",{fileUuid:p.documentId,annotationId:n,annotation:r}).then(function(e){return"point"===r.type&&(0,h.renderComments)(),e}).then(function(e){return r})["catch"](function(e){console.log(e),alert("Une erreur est survenue et l'annotation n'a pas pu être enregistrée.")})},deleteAnnotation:function(t,n){return e.post("/delete-annotation/",{annotationId:n,fileUuid:p.documentId}).then(function(e){return(0,h.renderComments)(),e}).then(function(e){return!0})["catch"](function(e){console.log(e),alert("Une erreur est survenue et l'annotation n'a pas pu être supprimée.")})},getComments:function(t){return e.get("/get-comments/",{params:{fileUuid:p.documentId}}).then(function(e){return e.data})},addComment:function(t,n,r){return e.post("/add-comment/",{fileUuid:p.documentId,annotationId:n,content:r}).then(function(e){return(0,h.renderComments)(),e}).then(function(e){return r})["catch"](function(e){console.log(e),alert("Une erreur est survenue et votre commentaire n'a pas pu être enregistré.")})},updateComment:function(t,n,r){return e.post("/update-comment/",{fileUuid:p.documentId,annotationId:n,comment:r}).then(function(e){return(0,h.renderComments)(),e}).then(function(e){return r})["catch"](function(e){console.log(e),alert("Une erreur est survenue et votre commentaire n'a pas pu être enregistrée.")})}}))}return i(t,e),t}(f["default"]);t["default"]=g,e.exports=t["default"]},function(e,t,n){e.exports=n(10)},function(e,t,n){"use strict";function r(e){var t=new i(e),n=u(i.prototype.request,t);return a.extend(n,i.prototype,t),a.extend(n,t),n}var a=n(11),u=n(12),i=n(14),o=n(15),d=r(o);d.Axios=i,d.create=function(e){return r(a.merge(o,e))},d.Cancel=n(33),d.CancelToken=n(34),d.isCancel=n(30),d.all=function(e){return Promise.all(e)},d.spread=n(35),e.exports=d,e.exports["default"]=d},function(e,t,n){"use strict";function r(e){return"[object Array]"===_.call(e)}function a(e){return"[object ArrayBuffer]"===_.call(e)}function u(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function o(e){return"string"==typeof e}function d(e){return"number"==typeof e}function s(e){return"undefined"==typeof e}function c(e){return null!==e&&"object"==typeof e}function l(e){return"[object Date]"===_.call(e)}function f(e){return"[object File]"===_.call(e)}function p(e){return"[object Blob]"===_.call(e)}function h(e){return"[object Function]"===_.call(e)}function g(e){return c(e)&&h(e.pipe)}function m(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function v(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function b(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function x(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,a=e.length;n.endOfContent").remove()})})},r=1;r<=g;r++)n(r)})})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var n=[],r=!0,a=!1,u=void 0;try{for(var i,o=e[Symbol.iterator]();!(r=(i=o.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(d){a=!0,u=d}finally{try{!r&&o["return"]&&o["return"]()}finally{if(a)throw u}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=n(1),o=r(i),d=n(37),s=n(39),c=(r(s),n(65)),l=r(c),f=n(38),p=o["default"].UI,h=void 0,m={documentId:d.documentUrl,pdfDocument:null,enhanceTextSelection:!0,scale:parseFloat(localStorage.getItem(d.documentId+"/scale"),10)||1.33};o["default"].setStoreAdapter(new o["default"].CRFPAStoreAdapter);var g=0;a();var v=function(e,t){var n=localStorage.getItem(m.documentId+"/tooltype")||"cursor",r=document.querySelector(".toolbar button.active");if(r)switch(r.classList.remove("active"),n){case"cursor":p.disableEdit();break;case"draw":p.disablePen();break;case"text":p.disableText();break;case"point":p.disablePoint();break;case"area":case"highlight":case"strikeout":p.disableRect()}switch(t&&t.classList.add("active"),n!==e&&localStorage.setItem(m.documentId+"/tooltype",e),n=e,e){case"cursor":p.enableEdit();break;case"draw":p.enablePen();break;case"text":p.enableText();break;case"point":p.enablePoint();break;case"area":case"highlight":case"strikeout":p.enableRect(e)}};o["default"].setActiveToolbarItem=v,d.readonly||(!function(){function e(){t(12,"#EF4437")}function t(e,t){p.setText(e,t)}e()}(),function(){function e(){for(var e=document.querySelector(".toolbar .pen-size"),n=0;n<20;n++)e.appendChild(new Option(n+1,n+1));t(localStorage.getItem(m.documentId+"/pen/size")||1,localStorage.getItem(m.documentId+"/pen/color")||"#000000"),(0,l["default"])(document.querySelector(".pen-color"),a,function(e){t(r,e)})}function t(e,t){var n=!1;if(r!==e&&(n=!0,r=e,localStorage.setItem(m.documentId+"/pen/size",r),document.querySelector(".toolbar .pen-size").value=r),a!==t){n=!0,a=t,localStorage.setItem(m.documentId+"/pen/color",a);var u=document.querySelector(".toolbar .pen-color.color-selected");u&&(u.classList.remove("color-selected"),u.removeAttribute("aria-selected")),u=document.querySelector('.toolbar .pen-color[data-color="'+t+'"]'),u&&(u.classList.add("color-selected"),u.setAttribute("aria-selected",!0))}n&&p.setPen(r,a)}function n(e){t(e.target.value,a)}var r=void 0,a=void 0;document.querySelector(".toolbar .pen-size").addEventListener("change",n),e()}(),function(){function e(e){"BUTTON"===e.target.nodeName&&v(e.target.getAttribute("data-tooltype"),e.target)}var t=localStorage.getItem(m.documentId+"/tooltype")||"cursor";t&&v(t,document.querySelector(".toolbar button[data-tooltype="+t+"]")),document.querySelector(".toolbar").addEventListener("click",e)}()),d.readonly&&p.enableEdit(),function(){function e(e,t){e=parseFloat(e,10),t=parseInt(t,10),m.scale===e&&m.rotate===t||(m.scale=e,m.rotate=t,localStorage.setItem(m.documentId+"/scale",m.scale),localStorage.setItem(m.documentId+"/rotate",m.rotate%360),a())}function t(t){e(t.target.value,m.rotate)}document.querySelector(".toolbar select.scale").value=m.scale,document.querySelector(".toolbar select.scale").addEventListener("change",t)}(),(0,f.renderComments)(d.documentId),t["default"]=o["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 a=n(2),u=r(a),i=n(8),o=r(i),d=n(50),s=r(d),c=n(59),l=r(c);t["default"]={StoreAdapter:u["default"],CRFPAStoreAdapter:o["default"],__storeAdapter:new u["default"],getStoreAdapter:function(){return this.__storeAdapter},setStoreAdapter:function(e){this.__storeAdapter=e},UI:l["default"],render:s["default"],getAnnotations:function(e){var t;return(t=this.getStoreAdapter()).getAnnotations.apply(t,arguments)}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),Object.keys(n).forEach(function(e){"function"==typeof n[e]&&"function"==typeof t[e]&&(t[e]=n[e])})}return u(e,[{key:"__getAnnotations",value:function(e){(0,o["default"])("getAnnotations")}},{key:"getAnnotation",value:function(e,t){(0,o["default"])("getAnnotation")}},{key:"__addAnnotation",value:function(e,t,n){(0,o["default"])("addAnnotation")}},{key:"__editAnnotation",value:function(e,t,n){(0,o["default"])("editAnnotation")}},{key:"__deleteAnnotation",value:function(e,t){(0,o["default"])("deleteAnnotation")}},{key:"getComments",value:function(e,t){(0,o["default"])("getComments")}},{key:"__addComment",value:function(e,t,n){(0,o["default"])("addComment")}},{key:"__updateComment",value:function(e,t,n){(0,o["default"])("addComment")}},{key:"__deleteComment",value:function(e,t){(0,o["default"])("deleteComment")}},{key:"getAnnotations",get:function(){return this.__getAnnotations},set:function(e){this.__getAnnotations=function(t){return e.apply(void 0,arguments).then(function(e){return 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:"updateComment",get:function(){return this.__updateComment},set:function(e){this.__updateComment=function(t,n,r){return e.apply(void 0,arguments).then(function(e){return(0,d.fireEvent)("comment:updated",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 a(){c.emit.apply(c,arguments)}function u(){c.on.apply(c,arguments)}function i(){c.removeListener.apply(c,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.fireEvent=a,t.addEventListener=u,t.removeEventListener=i;var o=n(5),d=r(o),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 a(e){return"number"==typeof e}function u(e){return"object"==typeof e&&null!==e}function i(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(!a(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,a,o,d,s;if(this._events||(this._events={}),"error"===e&&(!this._events.error||u(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],i(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:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(u(n))for(o=Array.prototype.slice.call(arguments,1),s=n.slice(),a=s.length,d=0;d0&&this._events[e].length>a&&(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),a||(a=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var a=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,a,i,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,a=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(u(n)){for(o=i;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=o;break}if(a<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(a,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 a(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 u(e,t){for(var n=document.querySelectorAll('svg[data-pdf-annotate-container="true"]'),r=0,a=n.length;r=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right}function d(e){var t=s(e),n=p(e),r=n.offsetLeft,a=n.offsetTop;return{top:t.top+a,left:t.left+r,right:t.right+r,bottom:t.bottom+a}}function s(e){var t=0,n=0,r=0,a=0,i=e.getBoundingClientRect(),o=16;switch(e.nodeName.toLowerCase()){case"path":var d=void 0,s=void 0,l=void 0,f=void 0;e.getAttribute("d").replace(/Z/,"").split("M").splice(1).forEach(function(e){var t=e.split(" ").map(function(e){return parseInt(e,10)});("undefined"==typeof d||t[0]s)&&(s=t[2]),("undefined"==typeof l||t[1]f)&&(f=t[3])}),t=f-l,n=s-d,r=d,a=l;break;case"line":t=parseInt(e.getAttribute("y2"),10)-parseInt(e.getAttribute("y1"),10),n=parseInt(e.getAttribute("x2"),10)-parseInt(e.getAttribute("x1"),10),r=parseInt(e.getAttribute("x1"),10),a=parseInt(e.getAttribute("y1"),10),0===t&&(t+=o,a-=o/2);break;case"text":t=i.height,n=i.width,r=parseInt(e.getAttribute("x"),10),a=parseInt(e.getAttribute("y"),10)-t;break;case"g":var h=p(e),m=h.offsetLeft,g=h.offsetTop;t=i.height,n=i.width,r=i.left-m,a=i.top-g,"strikeout"===e.getAttribute("data-pdf-annotate-type")&&(t+=o,a-=o/2);break;case"rect":case"svg":t=parseInt(e.getAttribute("height"),10),n=parseInt(e.getAttribute("width"),10),r=parseInt(e.getAttribute("x"),10),a=parseInt(e.getAttribute("y"),10)}var v={top:a,left:r,width:n,height:t,right:r+n,bottom:a+t};return["svg","g"].includes(e.nodeName.toLowerCase())||(v=c(u(i.left,i.top),v)),"svg"==e.nodeName.toLowerCase()&&$.browser.mozilla&&(v=c(u(i.left,i.top),v)),v}function c(e,t){var n={},r=g(e),a=r.viewport;return Object.keys(t).forEach(function(e){n[e]=t[e]*a.scale}),n}function l(e,t){var n={},r=g(e),a=r.viewport;return Object.keys(t).forEach(function(e){n[e]=t[e]/a.scale}),n}function f(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 p(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 h(){x.parentNode||document.head.appendChild(x)}function m(){x.parentNode&&x.parentNode.removeChild(x)}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=a,t.findSVGAtPoint=u,t.findAnnotationAtPoint=i,t.pointIntersectsRect=o,t.getOffsetAnnotationRect=d,t.getAnnotationRect=s,t.scaleUp=c,t.scaleDown=l,t.getScroll=f,t.getOffset=p,t.disableUserSelect=h,t.enableUserSelect=m,t.getMetadata=g;var v=n(7),b=r(v),x=(t.BORDER_COLOR="#00BFFF",(0,b["default"])({body:{"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}}));x.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 a(t,e[t])}).join("\n")}function a(e,t){return isNaN(t)||0==t||(t+="px"),u(e)+": "+t+";"}function u(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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),d=r(o),s=n(36),c=r(s),l=n(2),f=r(l),p=n(37),h=n(38);d["default"].defaults.xsrfCookieName="csrftoken",d["default"].defaults.xsrfHeaderName="X-CSRFToken";var m=function(e){function t(){a(this,t);var e=d["default"].create({baseURL:"/pdfannotator",timeout:6e4,withCredentials:!0,headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*"}});return u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{getAnnotations:function(t){return e.get("/get-annotations/",{params:{fileUuid:p.documentId}}).then(function(e){return e.data})["catch"](function(e){console.log(e),alert("Une erreur est survenue et les annotations n'ont pas pu être téléchargées depuis le serveur.")})},getAnnotation:function(t,n){return e.get("/get-annotation/",{params:{fileUuid:p.documentId,annotationId:n}}).then(function(e){return e.data})},addAnnotation:function(t,n,r){return r["class"]="Annotation",r.page=n,r.uuid=(0,c["default"])(),e.post("/add-annotation/",{fileUuid:p.documentId,page:n,annotation:r}).then(function(e){return r})["catch"](function(e){console.log(e),alert("Une erreur est survenue et votre annotation n'a pas pu être enregistrée.")})},editAnnotation:function(t,n,r){return e.post("/update-annotation/",{fileUuid:p.documentId,annotationId:n,annotation:r}).then(function(e){return"point"===r.type&&(0,h.renderComments)(),e}).then(function(e){return r})["catch"](function(e){console.log(e),alert("Une erreur est survenue et l'annotation n'a pas pu être enregistrée.")})},deleteAnnotation:function(t,n){return e.post("/delete-annotation/",{annotationId:n,fileUuid:p.documentId}).then(function(e){return(0,h.renderComments)(),e}).then(function(e){return!0})["catch"](function(e){console.log(e),alert("Une erreur est survenue et l'annotation n'a pas pu être supprimée.")})},getComments:function(t){return e.get("/get-comments/",{params:{fileUuid:p.documentId}}).then(function(e){return e.data})},addComment:function(t,n,r){return e.post("/add-comment/",{fileUuid:p.documentId,annotationId:n,content:r}).then(function(e){return(0,h.renderComments)(),e}).then(function(e){return r})["catch"](function(e){console.log(e),alert("Une erreur est survenue et votre commentaire n'a pas pu être enregistré.")})},updateComment:function(t,n,r){return e.post("/update-comment/",{fileUuid:p.documentId,annotationId:n,comment:r}).then(function(e){return(0,h.renderComments)(),e}).then(function(e){return r})["catch"](function(e){console.log(e),alert("Une erreur est survenue et votre commentaire n'a pas pu être enregistrée.")})}}))}return i(t,e),t}(f["default"]);t["default"]=m,e.exports=t["default"]},function(e,t,n){e.exports=n(10)},function(e,t,n){"use strict";function r(e){var t=new i(e),n=u(i.prototype.request,t);return a.extend(n,i.prototype,t),a.extend(n,t),n}var a=n(11),u=n(12),i=n(14),o=n(15),d=r(o);d.Axios=i,d.create=function(e){return r(a.merge(o,e))},d.Cancel=n(33),d.CancelToken=n(34),d.isCancel=n(30),d.all=function(e){return Promise.all(e)},d.spread=n(35),e.exports=d,e.exports["default"]=d},function(e,t,n){"use strict";function r(e){return"[object Array]"===A.call(e)}function a(e){return"[object ArrayBuffer]"===A.call(e)}function u(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function o(e){return"string"==typeof e}function d(e){return"number"==typeof e}function s(e){return"undefined"==typeof e}function c(e){return null!==e&&"object"==typeof e}function l(e){return"[object Date]"===A.call(e)}function f(e){return"[object File]"===A.call(e)}function p(e){return"[object Blob]"===A.call(e)}function h(e){return"[object Function]"===A.call(e)}function m(e){return c(e)&&h(e.pipe)}function g(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function v(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function b(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function x(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,a=e.length;n * @license MIT */ -e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new i,response:new i}}var a=n(15),u=n(11),i=n(27),o=n(28);r.prototype.request=function(e){"string"==typeof e&&(e=u.merge({url:arguments[0]},arguments[1])),e=u.merge(a,{method:"get"},this.defaults,e),e.method=e.method.toLowerCase();var t=[o,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},u.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(u.merge(n||{},{method:e,url:t}))}}),u.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(u.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){(function(t){"use strict";function r(e,t){!u.isUndefined(e)&&u.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function a(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(18):"undefined"!=typeof t&&(e=n(18)),e}var u=n(11),i=n(17),o={"Content-Type":"application/x-www-form-urlencoded"},d={adapter:a(),transformRequest:[function(e,t){return i(t,"Content-Type"),u.isFormData(e)||u.isArrayBuffer(e)||u.isBuffer(e)||u.isStream(e)||u.isFile(e)||u.isBlob(e)?e:u.isArrayBufferView(e)?e.buffer:u.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):u.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};d.headers={common:{Accept:"application/json, text/plain, */*"}},u.forEach(["delete","get","head"],function(e){d.headers[e]={}}),u.forEach(["post","put","patch"],function(e){d.headers[e]=u.merge(o)}),e.exports=d}).call(t,n(16))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function a(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function u(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function i(){g&&p&&(g=!1,p.length?h=p.concat(h):m=-1,h.length&&o())}function o(){if(!g){var e=a(i);g=!0;for(var t=h.length;t;){for(p=h,h=[];++m1)for(var n=1;n=0)return;"set-cookie"===t?i[t]=(i[t]?i[t]:[]).concat([n]):i[t]=i[t]?i[t]+", "+n:n}}),i):i}},function(e,t,n){"use strict";var r=n(11);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(a.setAttribute("href",t),t=a.href),a.setAttribute("href",t),{href:a.href,protocol:a.protocol?a.protocol.replace(/:$/,""):"",host:a.host,search:a.search?a.search.replace(/^\?/,""):"",hash:a.hash?a.hash.replace(/^#/,""):"",hostname:a.hostname,port:a.port,pathname:"/"===a.pathname.charAt(0)?a.pathname:"/"+a.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),a=document.createElement("a");return t=e(window.location.href),function(n){var a=r.isString(n)?e(n):n;return a.protocol===t.protocol&&a.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function n(){this.message="String contains an invalid character"}function r(e){for(var t,r,u=String(e),i="",o=0,d=a;u.charAt(0|o)||(d="=",o%1);i+=d.charAt(63&t>>8-o%1*8)){if(r=u.charCodeAt(o+=.75),r>255)throw new n;t=t<<8|r}return i}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.code=5,n.prototype.name="InvalidCharacterError",e.exports=r},function(e,t,n){"use strict";var r=n(11);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,a,u,i){var o=[];o.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),r.isString(a)&&o.push("path="+a),r.isString(u)&&o.push("domain="+u),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var a=n(11);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){a.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var a=n(11),u=n(29),i=n(30),o=n(15),d=n(31),s=n(32);e.exports=function(e){r(e),e.baseURL&&!d(e.url)&&(e.url=s(e.baseURL,e.url)),e.headers=e.headers||{},e.data=u(e.data,e.headers,e.transformRequest),e.headers=a.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),a.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||o.adapter;return t(e).then(function(t){return r(e),t.data=u(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(r(e),t&&t.response&&(t.response.data=u(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(11);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new a(e),t(n.reason))})}var a=n(33);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},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 u.replace(a,n)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var a=/[xy]/g,u="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.documentUrl=document.getElementById("pdf-data").dataset.filepath,t.documentId=document.getElementById("pdf-data").dataset.uuid,t.readonly="True"===document.getElementById("pdf-data").dataset.readonly},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){p["default"].getStoreAdapter().getComments(e).then(function(e){b.html(""),x.hide(),e.forEach(u)})}function u(e){var t=$("
"),n=$('
');if(t.addClass("comment-list-item"),t.attr("uuid",e.annotation),n.html(g["default"].autoLink(g["default"].htmlEscape(e.content).replace(/\n/g,"
"))),n.bind("click",i),!v.readonly){var r=$("");r.bind("click",s),n.append($("
")),n.append(r)}if(t.append(n),!v.readonly){var a=$("");a.text(e.content);var u=$('