@compdfkit_pdf_sdk/webviewer 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +78 -0
  2. package/dist/assets/colorful.c840ddf1.svg +14 -0
  3. package/dist/assets/icon-danger.e75f0c25.svg +4 -0
  4. package/dist/assets/icon-message-error.c91684dd.svg +7 -0
  5. package/dist/assets/icon-message-success.c9ccee05.svg +6 -0
  6. package/dist/assets/index.2fb3cccd.css +1 -0
  7. package/dist/assets/index.53de9f2f.js +2717 -0
  8. package/dist/example/developer_guide_web.pdf +0 -0
  9. package/dist/favicon.ico +0 -0
  10. package/dist/images/curve-guide.gif +0 -0
  11. package/dist/images/loading-icon.gif +0 -0
  12. package/dist/images/stamp/Accepted.png +0 -0
  13. package/dist/images/stamp/Approved.png +0 -0
  14. package/dist/images/stamp/Completed.png +0 -0
  15. package/dist/images/stamp/Confidential.png +0 -0
  16. package/dist/images/stamp/Draft.png +0 -0
  17. package/dist/images/stamp/Final.png +0 -0
  18. package/dist/images/stamp/ForComment.png +0 -0
  19. package/dist/images/stamp/ForPublicRelease.png +0 -0
  20. package/dist/images/stamp/InformationOnly.png +0 -0
  21. package/dist/images/stamp/InitialHere.png +0 -0
  22. package/dist/images/stamp/NotApproved.png +0 -0
  23. package/dist/images/stamp/NotForPublicRelease.png +0 -0
  24. package/dist/images/stamp/PreliminaryResults.png +0 -0
  25. package/dist/images/stamp/PrivateMark1.png +0 -0
  26. package/dist/images/stamp/PrivateMark2.png +0 -0
  27. package/dist/images/stamp/PrivateMark3.png +0 -0
  28. package/dist/images/stamp/Rejected.png +0 -0
  29. package/dist/images/stamp/SignHere.png +0 -0
  30. package/dist/images/stamp/Void.png +0 -0
  31. package/dist/images/stamp/Witness.png +0 -0
  32. package/dist/images/stamp/revised.png +0 -0
  33. package/dist/index.html +23 -0
  34. package/dist/lib/CMYK/CoatedFOGRA39.icc +0 -0
  35. package/dist/lib/ComPDFKit.js +1 -0
  36. package/dist/lib/ComPDFKit.wasm +0 -0
  37. package/dist/lib/DroidSansFallbackFull.ttf +0 -0
  38. package/dist/lib/PDFWorker.js +2 -0
  39. package/dist/lib/pdf.worker.min.js +22 -0
  40. package/package.json +26 -0
  41. package/webviewer.global.js +1 -0
  42. package/webviewer.js +1 -0
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@compdfkit_pdf_sdk/webviewer",
3
+ "version": "2.7.1",
4
+ "description": "",
5
+ "keywords": [
6
+ "PDF SDK",
7
+ "WEB SDK",
8
+ "pdf.js",
9
+ "React",
10
+ "Next.js",
11
+ "Vue",
12
+ "Nuxt.js",
13
+ "Angular",
14
+ "WebViewer",
15
+ "View PDF",
16
+ "Annotate PDF",
17
+ "JavaScript PDF SDK",
18
+ "JS PDF SDK",
19
+ "Edit PDF",
20
+ "Sign PDF",
21
+ "PDF Form"
22
+ ],
23
+ "author": "ComPDFKit",
24
+ "homepage": "https://www.compdf.com/web",
25
+ "main": "webviewer.js"
26
+ }
@@ -0,0 +1 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ComPDFKitViewer=e()}(this,(function(){"use strict";function t(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function e(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function r(){r=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,a=Object.create(o.prototype),c=new T(n||[]);return i(a,"_invoke",{value:j(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",d="suspendedYield",v="executing",y="completed",m={};function w(){}function g(){}function b(){}var E={};l(E,c,(function(){return this}));var L=Object.getPrototypeOf,x=L&&L(L(N([])));x&&x!==n&&o.call(x,c)&&(E=x);var _=b.prototype=w.prototype=Object.create(E);function P(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(n,i,a,c){var s=f(t[n],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(i,i):i()}})}function j(e,r,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=O(c,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:d,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=b,i(_,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,u,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},P(k.prototype),l(k.prototype,s,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(_),l(_,u,"Generator"),l(_,c,(function(){return this})),l(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=o.call(a,"catchLoc"),u=o.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function n(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}var o,i,a,c={init:function(t,e){return new Promise((function(r){e.addEventListener("ready",(function t(){e.removeEventListener("ready",t);var n=e.querySelector("iframe").contentWindow;Promise.resolve().then((function(){r({docViewer:n.instance,Core:n.instances.Core,UI:n.instances.UI})}))})),new u(t,e)}))}},s=new Map,u=function(){return n=function t(e,r){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!s.get(r)){this.docId=0,s.set(r,!0),this.instance=null,this.options=e,this.initialDoc=e.pdfUrl||null,this.element=r,this.options.path=this.options.path||t.config.path;var n=this.options.path.length-1;n>0&&"/"!==this.options.path[n]&&(this.options.path+="/"),this.options.webviewerPath=this.options.path+t.config.webviewerPath,r.addEventListener("ready",(function t(){r.removeEventListener("ready",t)})),this.create()}},o=[{key:"_createEvent",value:function(t,e){var r;try{r=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0})}catch(n){(r=document.createEvent("Event")).initEvent(t,!0,!0),r.detail=e}return r}},{key:"create",value:function(){this.initialDoc?(this.initialDoc=encodeURIComponent(JSON.stringify(this.initialDoc)),this._create()):this._create()}},{key:"_create",value:function(){this.docId++,this._trigger||(this._trigger=function(t,e){var r=this._createEvent(t,e);this.element.dispatchEvent(r)}),this.createViewer()}},{key:"createViewer",value:function(){var e,n,o,i=this,a=this.options.webviewerPath;this.initialDoc?a+="#d=".concat(this.initialDoc):a+="#",a+="&docId=".concat(this.docId),(null===(e=this.options)||void 0===e?void 0:e.css)&&(a+="&css=".concat(encodeURIComponent(this.options.css))),void 0!==this.options.showToolbarControl&&(a+="&header=".concat(this.options.showToolbarControl?"true":"false"));var c=document.createElement("iframe");c.id="webviewer-"+this.docId,c.src=a,c.frameBorder=0,c.width="100%",c.height="100%",c.setAttribute("allowfullscreen",!0),c.setAttribute("webkitallowfullscreen",!0),c.setAttribute("mozallowfullscreen",!0),this.iframe=c,null!==(n=this.options)&&void 0!==n&&n.backgroundColor&&c.setAttribute("data-bgcolor",this.options.backgroundColor),null!==(o=this.options)&&void 0!==o&&o.assetPath&&c.setAttribute("data-assetpath",encodeURIComponent(this.options.assetPath)),this.element.appendChild(c),this.messageHandler=function(){var e,n=(e=r().mark((function t(e){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("documentViewerLoaded"!==e.data.type||e.data.docId!==i.docId){t.next=14;break}return t.prev=1,i.instance=i.iframe.contentWindow.instance,t.next=5,i.instance.initOptions(i.options);case 5:i._trigger("ready"),t.next=10;break;case 8:t.prev=8,t.t0=t.catch(1);case 10:return t.prev=10,window.removeEventListener("message",i.messageHandler),i._documentViewerLoaded(i.iframe),t.finish(10);case 14:case"end":return t.stop()}}),t,null,[[1,8,10,14]])})),function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function c(e){t(a,o,i,c,s,"next",e)}function s(e){t(a,o,i,c,s,"throw",e)}c(void 0)}))});return function(t){return n.apply(this,arguments)}}(),window.addEventListener("message",this.messageHandler)}},{key:"_documentViewerLoaded",value:function(t){this.options.pdfUrl&&t.contentWindow.instances.UI.loadDocument(this.options.pdfUrl)}}],o&&e(n.prototype,o),i&&e(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,i}();return o=u,a={path:"",webviewerPath:"./webviewer/index.html"},(i=n(i="config"))in o?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a,c}));
package/webviewer.js ADDED
@@ -0,0 +1 @@
1
+ function t(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function e(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function r(){r=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,a=Object.create(o.prototype),c=new N(n||[]);return i(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",v="executing",y="completed",m={};function w(){}function g(){}function b(){}var E={};h(E,c,(function(){return this}));var L=Object.getPrototypeOf,x=L&&L(L(S([])));x&&x!==n&&o.call(x,c)&&(E=x);var _=b.prototype=w.prototype=Object.create(E);function P(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(n,i,a,c){var s=f(t[n],t,i);if("throw"!==s.type){var u=s.arg,h=u.value;return h&&"object"==typeof h&&o.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(i,i):i()}})}function O(e,r,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=j(c,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:d,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function S(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=b,i(_,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=h(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,u,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},P(k.prototype),h(k.prototype,s,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(_),h(_,u,"Generator"),h(_,c,(function(){return this})),h(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=S,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=o.call(a,"catchLoc"),u=o.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:S(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function n(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}var o,i,a,c={init:function(t,e){return new Promise((function(r){e.addEventListener("ready",(function t(){e.removeEventListener("ready",t);var n=e.querySelector("iframe").contentWindow;Promise.resolve().then((function(){r({docViewer:n.instance,Core:n.instances.Core,UI:n.instances.UI})}))})),new u(t,e)}))}},s=new Map,u=function(){return n=function t(e,r){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!s.get(r)){this.docId=0,s.set(r,!0),this.instance=null,this.options=e,this.initialDoc=e.pdfUrl||null,this.element=r,this.options.path=this.options.path||t.config.path;var n=this.options.path.length-1;n>0&&"/"!==this.options.path[n]&&(this.options.path+="/"),this.options.webviewerPath=this.options.path+t.config.webviewerPath,r.addEventListener("ready",(function t(){r.removeEventListener("ready",t)})),this.create()}},o=[{key:"_createEvent",value:function(t,e){var r;try{r=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0})}catch(n){(r=document.createEvent("Event")).initEvent(t,!0,!0),r.detail=e}return r}},{key:"create",value:function(){this.initialDoc?(this.initialDoc=encodeURIComponent(JSON.stringify(this.initialDoc)),this._create()):this._create()}},{key:"_create",value:function(){this.docId++,this._trigger||(this._trigger=function(t,e){var r=this._createEvent(t,e);this.element.dispatchEvent(r)}),this.createViewer()}},{key:"createViewer",value:function(){var e,n,o,i=this,a=this.options.webviewerPath;this.initialDoc?a+="#d=".concat(this.initialDoc):a+="#",a+="&docId=".concat(this.docId),(null===(e=this.options)||void 0===e?void 0:e.css)&&(a+="&css=".concat(encodeURIComponent(this.options.css))),void 0!==this.options.showToolbarControl&&(a+="&header=".concat(this.options.showToolbarControl?"true":"false"));var c=document.createElement("iframe");c.id="webviewer-"+this.docId,c.src=a,c.frameBorder=0,c.width="100%",c.height="100%",c.setAttribute("allowfullscreen",!0),c.setAttribute("webkitallowfullscreen",!0),c.setAttribute("mozallowfullscreen",!0),this.iframe=c,null!==(n=this.options)&&void 0!==n&&n.backgroundColor&&c.setAttribute("data-bgcolor",this.options.backgroundColor),null!==(o=this.options)&&void 0!==o&&o.assetPath&&c.setAttribute("data-assetpath",encodeURIComponent(this.options.assetPath)),this.element.appendChild(c),this.messageHandler=function(){var e,n=(e=r().mark((function t(e){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("documentViewerLoaded"!==e.data.type||e.data.docId!==i.docId){t.next=14;break}return t.prev=1,i.instance=i.iframe.contentWindow.instance,t.next=5,i.instance.initOptions(i.options);case 5:i._trigger("ready"),t.next=10;break;case 8:t.prev=8,t.t0=t.catch(1);case 10:return t.prev=10,window.removeEventListener("message",i.messageHandler),i._documentViewerLoaded(i.iframe),t.finish(10);case 14:case"end":return t.stop()}}),t,null,[[1,8,10,14]])})),function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function c(e){t(a,o,i,c,s,"next",e)}function s(e){t(a,o,i,c,s,"throw",e)}c(void 0)}))});return function(t){return n.apply(this,arguments)}}(),window.addEventListener("message",this.messageHandler)}},{key:"_documentViewerLoaded",value:function(t){this.options.pdfUrl&&t.contentWindow.instances.UI.loadDocument(this.options.pdfUrl)}}],o&&e(n.prototype,o),i&&e(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,i}();o=u,a={path:"",webviewerPath:"./webviewer/index.html"},(i=n(i="config"))in o?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a;export{c as default};